當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dao::self_columns方法代碼示例

本文整理匯總了PHP中Dao::self_columns方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dao::self_columns方法的具體用法?PHP Dao::self_columns怎麽用?PHP Dao::self_columns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dao的用法示例。


在下文中一共展示了Dao::self_columns方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create_sql

 public function create_sql(Dao $dao)
 {
     $insert = $vars = array();
     $autoid = null;
     foreach ($dao->self_columns() as $column) {
         $insert[] = '`' . $column->column() . '`';
         $vars[] = $this->update_value($dao, $column->name());
         if ($column->auto()) {
             $autoid = $column->name();
         }
     }
     return Dao::daq('insert into `' . $column->table() . '`(' . implode(',', $insert) . ') values (' . implode(',', array_fill(0, count($insert), '?')) . ');', $vars, $autoid);
 }
開發者ID:riaf,項目名稱:rhaco2-repository,代碼行數:13,代碼來源:DbcSqlite.php

示例2: select_sql

 public function select_sql(Dao $dao, Q $query, $paginator)
 {
     $select = $from = $order = array();
     $self_columns = $dao->self_columns();
     foreach ($dao->columns() as $column) {
         $select[] = $column->table_alias() . ".`" . $column->column() . "` " . $column->column_alias();
         $from[$column->table_alias()] = $column->table() . " " . $column->table_alias();
     }
     foreach ($query->order_by() as $q) {
         foreach ($q->arArg1() as $column_str) {
             $order[] = $this->column($column_str, $self_columns)->column_alias() . ($q->type() == Q::ORDER_ASC ? " asc" : " desc");
         }
     }
     list($where_sql, $where_vars) = $this->where_sql($dao, $query, $self_columns, $this->where_cond_columns($dao, $from));
     return (object) array("sql" => "select " . implode(",", $select) . " from " . implode(",", $from) . (empty($where_sql) ? "" : " where " . $where_sql) . (empty($order) ? "" : " order by " . implode(",", $order)) . ($paginator instanceof Paginator ? sprintf(" limit %d,%d ", $paginator->offset(), $paginator->limit()) : ""), "vars" => $where_vars);
 }
開發者ID:hisaboh,項目名稱:w2t,代碼行數:16,代碼來源:DbController.php


注:本文中的Dao::self_columns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。