FLEAPHP框架的数据库操作

FLEAPHP提供了自动化的crud操作,可以直接调用其save等接口。

 

但是,不可避免的需要一些复杂的sql语句,这时就可以使用 TableDataGateway.php 提供的findBySql接口。

 

比如:

 

        function actionCyTest(){
            ini_set("display_errors", "On");
            error_reporting(E_ALL);
           
            FLEA::loadClass("Table_FishingContent");
            FLEA::loadClass("Helper_GetDomain");
            $this->tbReport =& FLEA::getSingleton("Table_FishingContent");
            var_dump($this->tbReport->findBySql('select * from fishing_content limit 1'));
            exit;
        }

 

 

在默认control里增加了一个这样的函数,通过/index.php?controller=Default&action=cytest访问,即可获取该sql句子的结果。

 

附FLEA/Db/TableDataGateway.php 的方法:

 

    function FLEA_Db_TableDataGateway($params = null)
    function setDBO(& $dbo)
    function & getDBO()
    function & find($conditions, $sort = null, $fields = '*', $queryLinks = true)
    function & findAll($conditions = null, $sort = null, $limit = null, $fields = '*', $queryLinks = true)
        $callback = create_function('& $r, $o, $m', '$r[$m] = null;');
    function assembleRecursionRow($mappingName, & $row, $enabledLinks = null)
    function assembleRecursionRowset($mappingName, & $rowset, $enabledLinks = null)
    function & findByField($field, $value, $sort = null, $fields = '*')
    function & findAllByField($field, $value, $sort = null, $limit = null, $fields = '*')
    function & findAllByPkvs($pkvs, $conditions = null, $sort = null, $limit = null, $fields = '*', $queryLinks = true)
    function & findBySql($sql, $limit = null)
    function findCount($conditions = null, $fields = null)
    function save(& $row, $saveLinks = true, $updateCounter = true)
    function saveRowset(& $rowset, $saveLinks = true)
    function replace(& $row) {
    function replaceRowset(& $rowset)
    function update(& $row, $saveLinks = true)
    function updateRowset(& $rowset, $saveLinks = true)
    function updateByConditions($conditions, & $row)
    function updateField($conditions, $field, $value)
    function incrField($conditions, $field, $incr = 1)
    function decrField($conditions, $field, $decr = 1)
    function create(& $row, $saveLinks = true)
    function createRowset(& $rowset, $saveLinks = true)
    function remove(& $row, $removeLink = true)
    function removeByPkv($pkv, $removeLink = true)
    function removeByConditions($conditions, $removeLink = true)
    function removeByPkvs($pkvs, $removeLink = true)
    function removeAll()
    function removeAllWithLinks()
    function enableLinks($links = null)
    function enableLink($linkName)
    function disableLinks($links = null)
    function disableLink($linkName)
    function clearLinks()
    function relink()
    function & getLink($linkName)
    function & getLinkTable($linkName)
    function existsLink($name)
    function createLink($defines, $type)
    function removeLink($linkName)
    function checkRowData(& $row, $skip = 0) {
    function getLastValidation($info = null) {
    function newInsertId() {
    function execute($sql, $inputarr = false)
    function qinto($sql, $params = null)
    function parseWhere($where, $args = null)
    function _parseWhereArray($where)
    function _parseWhereString($where, $args = null)
    function _parseWhereQfield($matches)
    function qstr($value)
    function qfield($fieldName, $tableName = null)
    function qfields($fieldsName, $tableName = null, $returnArray = false)
    function getWhere($conditions, $queryLinks = true) {
    function flushMeta()
    function _setUpdatedTimeFields(& $row) {
    function _setCreatedTimeFields(& $row) {
    function _prepareMeta($flushCache = false) {
    function _beforeCreate(& $row)
    function _beforeCreateDb(& $row)
    function _afterCreateDb(& $row)
    function _beforeUpdate(& $row)
    function _beforeUpdateDb(& $row)
    function _afterUpdateDb(& $row)
    function _beforeRemove(& $row)
    function _afterRemoveDb($row)
    function _beforeRemoveDbByPkv($pkv)
    function _afterRemoveDbByPkv($pkv)
    function _updateCounterCache(& $row)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值