当前位置: 首页>>代码示例>>PHP>>正文


PHP F3::sql方法代码示例

本文整理汇总了PHP中F3::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::sql方法的具体用法?PHP F3::sql怎么用?PHP F3::sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在F3的用法示例。


在下文中一共展示了F3::sql方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_table_exists

function is_table_exists($table, $db = NULL)
{
    if (is_null($db)) {
        $db = F3::get('DB.name');
    }
    return $db && F3::sql(array("SELECT COUNT(*) AS found " . "FROM information_schema.tables " . "WHERE table_schema='{$db}' " . "AND table_name='{$table}';"));
}
开发者ID:seyyah,项目名称:uzkay,代码行数:7,代码来源:db.php

示例2: normalize_properties_normal

 public function normalize_properties_normal($table, $identifier)
 {
     $all = F3::sql("SELECT * FROM {$table}");
     foreach ($all as $row) {
         $name = $row[$identifier];
         foreach ($row as $key => $column) {
             echo "{$name},{$key},{$column}<br>";
         }
     }
 }
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:10,代码来源:SandboxController.php

示例3: relations

 public function relations()
 {
     // Select magic + class + division
     $division = "\n                SELECT class, division\n                FROM relate_loot_normal\n            ";
     foreach (F3::sql($division) as $row) {
         F3::set('class', F3::get('DB.pdo')->quote($row['class']));
         F3::set('division', F3::get('DB.pdo')->quote($row['division']));
         $query = "\n                    UPDATE loot\n                    SET division = {@division}\n                    WHERE class = {@class}\n                ";
         F3::sql($query);
     }
 }
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:11,代码来源:TestController.php

示例4: kul

<?php

/**
	If our database doesn't exist, create our SQLite schema; we'll do it
	here programmatically; but this can be done outside of our application
**/
F3::sql(array('CREATE TABLE IF NOT EXISTS kul (' . 'tc INT UNSIGNED NOT NULL,' . 'ad CHAR (15),' . 'soyad CHAR (20),' . 'PRIMARY KEY(tc)' . ');'));
开发者ID:seyyah,项目名称:f3kulsqlite,代码行数:7,代码来源:db.php

示例5: sync

 /**
 		Synchronize Axon and table structure
 			@param $_table string
 			@param $_id string
 			@public
 	**/
 public function sync($_table, $_id = 'DB')
 {
     $_db =& F3::$global[$_id];
     // Can't proceed until DSN is set
     if (!$_db || !$_db['dsn']) {
         trigger_error(SQLdb::TEXT_DBConnect);
         return;
     }
     // MySQL schema
     if (preg_match('/^mysql\\:/', $_db['dsn'])) {
         $_cmd = 'SHOW columns FROM ' . $_table . ';';
         $_fields = array('Field', 'Key', 'PRI');
     } elseif (preg_match('/^sqlite[2]*\\:/', $_db['dsn'])) {
         $_cmd = 'PRAGMA table_info(' . $_table . ');';
         $_fields = array('name', 'pk', 1);
     } elseif (preg_match('/^(mssql|sybase|dblib|pgsql)\\:/', $_db['dsn'])) {
         $_cmd = 'SELECT C.column_name AS field,T.constraint_type AS key ' . 'FROM information_schema.columns C ' . 'LEFT OUTER JOIN information_schema.key_column_usage K ' . 'ON C.table_name=K.table_name AND ' . 'C.column_name=K.column_name ' . 'LEFT OUTER JOIN information_schema.table_constraints T ' . 'ON K.table_name=T.table_name AND ' . 'K.constraint_name=T.constraint_name ' . 'WHERE C.table_name="' . $_table . '";';
         $_fields = array('field', 'key', 'PRIMARY KEY');
     } else {
         trigger_error(self::TEXT_AxonEngine);
         return;
     }
     if (method_exists($this, 'beforeSync')) {
         // Execute beforeSync event
         $this->beforeSync();
     }
     $_result = F3::sql($_cmd, $_id, F3::$global['SYNC']);
     if (!$_result) {
         F3::$global['CONTEXT'] = $_table;
         trigger_error(self::TEXT_AxonTable);
         return;
     }
     // Initialize Axon
     $this->db = $_id;
     $this->table = $_table;
     foreach ($_result as $_col) {
         // Populate properties
         $this->fields[$_col[$_fields[0]]] = NULL;
         if ($_col[$_fields[1]] == $_fields[2]) {
             // Save primary key
             $this->keys[$_col[$_fields[0]]] = NULL;
         }
     }
     $this->empty = TRUE;
     if (method_exists($this, 'afterSync')) {
         // Execute afterSync event
         $this->afterSync();
     }
 }
开发者ID:seyyah,项目名称:f3kulmysql,代码行数:55,代码来源:axon.php


注:本文中的F3::sql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。