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


PHP ORM::get_db方法代码示例

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


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

示例1: create

 public function create($table, $ignore_keys = null)
 {
     if ($_POST) {
         $params = $_POST;
         $insert = \ORM::for_table($table)->create();
         \ORM::get_db()->beginTransaction();
         try {
             foreach ($params as $key => $value) {
                 $insert->{$key} = $value;
             }
             $insert->save();
             \ORM::get_db()->commit();
         } catch (Exception $e) {
             \ORM::get_db()->rollBack();
             throw $e;
         }
         $this->view = new Create('done');
     } else {
         $fields = \ORM::for_table($table)->raw_query('DESCRIBE ' . $table)->find_array();
         if ($ignore_keys) {
             foreach ($fields as $key => $field) {
                 if (in_array($field['Field'], $ignore_keys)) {
                     unset($fields[$key]);
                 }
             }
         }
         $data['fields'] = $fields;
         $this->view = new Create('create', $data);
     }
 }
开发者ID:arjunkomath,项目名称:crud,代码行数:30,代码来源:Admin.php

示例2: __construct

 public function __construct()
 {
     self::$debugbar = new StandardDebugBar();
     $pdo = new DebugBar\DataCollector\PDO\TraceablePDO(ORM::get_db());
     self::$debugbar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($pdo));
     Oc_Product::$debug = self::$debugbar;
 }
开发者ID:ayvanov,项目名称:housefitParser,代码行数:7,代码来源:app.php

示例3: escapeLike

function escapeLike($searched)
{
    $db = ORM::get_db();
    dd($db);
    //$searched = $db->real_escape_string($searched);
    //	$searched = $db->escape_string();
    return addcslashes($searched, "%_");
}
开发者ID:agroff,项目名称:FindPuppies,代码行数:8,代码来源:global.php

示例4: run

 public function run()
 {
     include getcwd() . '/bootstrap.php';
     if (preg_match('#^\\p{Lu}#u', $this->config['name']) === 0) {
         echo "Error: parameter name must be camel-case. At a minimum, it must start with a capital letter.\n";
         \Lucid\Task\Container::run('usage', [static::$trigger]);
         exit;
     }
     $this->config['meta'] = new \Lucid\Library\Metabase\Metabase(\ORM::get_db());
     if (is_null($this->config['table']) === true) {
         $this->config['table'] = $this->config['name'];
     }
     $this->config['columns'] = $this->config['meta']->getColumns($this->config['table']);
     $this->config['keys'] = ['name' => $this->config['name'], 'table' => $this->config['table'], 'id_type' => $this->config['columns'][0]['type'], 'id' => $this->config['columns'][0]['name'], 'first_string_col' => null, 'title' => $this->config['name']];
     foreach ($this->config['columns'] as $column) {
         if ($column['type'] == 'string' && is_null($this->config['keys']['first_string_col']) === true) {
             $this->config['keys']['first_string_col'] = $column['name'];
         }
     }
     # we always run all *BuildKeys methods in case a later *BuildFile function relies on a key built by
     # a component not selected for building
     $this->modelBuildKeys();
     $this->viewBuildKeys();
     $this->controllerBuildKeys();
     $this->helperBuildKeys();
     $this->rulesetBuildKeys();
     $this->testBuildKeys();
     $this->dictionaryBuildKeys();
     if ($this->config['no-model'] === false) {
         echo "Building Model...\n";
         $this->modelBuildFiles();
     }
     if ($this->config['no-view'] === false) {
         echo "Building View...\n";
         $this->viewBuildFiles();
     }
     if ($this->config['no-controller'] === false) {
         echo "Building Controller...\n";
         $this->controllerBuildFiles();
     }
     if ($this->config['no-helper'] === false) {
         echo "Building Helper...\n";
         $this->helperBuildFiles();
     }
     if ($this->config['no-ruleset'] === false) {
         echo "Building Ruleset...\n";
         $this->rulesetBuildFiles();
     }
     if ($this->config['no-test'] === false) {
         echo "Building Test...\n";
         $this->testBuildFiles();
     }
     if ($this->config['no-dictionary'] === false) {
         echo "Building Dictionary...\n";
         $this->dictionaryBuildFiles();
     }
     echo "Complete.\n";
 }
开发者ID:dev-lucid,项目名称:lucid,代码行数:58,代码来源:Generate.php

示例5: readSqlFile

 public function readSqlFile($sql_file)
 {
     $sql_content = trim(file_get_contents($sql_file));
     if (!empty($sql_content)) {
         \ORM::get_db()->exec($sql_content);
     } else {
         throw new \Exception("No content for sql file");
     }
 }
开发者ID:nikrou,项目名称:demoBehatTravis,代码行数:9,代码来源:Connection.php

示例6: db_getArrayOfRows

function db_getArrayOfRows($query)
{
    $dbResult = ORM::get_db()->query($query);
    $results = array();
    foreach ($dbResult as $row) {
        $results[] = $row;
    }
    return $results;
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:9,代码来源:db.php

示例7: setUp

 public function setUp()
 {
     // The tests for eager loading requires a real database.
     // Set up SQLite in memory
     ORM::set_db(new PDO('sqlite::memory:'));
     // Create schemas and populate with data
     ORM::get_db()->exec(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'models.sql'));
     // Enable logging
     ORM::configure('logging', true);
 }
开发者ID:arunkapil,项目名称:Granada,代码行数:10,代码来源:EagerTest.php

示例8: create_database

    public function create_database()
    {
        ORM::get_db()->query('CREATE TABLE `book` (
		  `id` integer NOT NULL CONSTRAINT pid PRIMARY KEY AUTOINCREMENT,
		  `title` varchar NOT NULL,
		  `url` varchar NOT NULL,
		  `date` varchar NOT NULL,
		  `pages` integer NOT NULL,
		  `thumb` varchar NOT NULL,
		  `tags` text NOT NULL
		)');
    }
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:12,代码来源:FreeHManga.php

示例9: __construct

 public function __construct(&$core)
 {
     $core->registerMessageHandler('PRIVMSG', "seen", "seenator");
     $core->registerCommand("seen", "seen", "Muestra cuando fue la ultima vez que se vio a un usuario. Sintaxis: seen <nick>");
     try {
         $k = ORM::for_table('seen')->find_one();
     } catch (PDOException $e) {
         $query = "CREATE TABLE 'seen' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'nick' TEXT NOT NULL, 'ts' INTEGER NOT NULL, 'txt' TEXT NOT NULL);";
         $db = ORM::get_db();
         $db->exec($query);
     }
 }
开发者ID:FreuddyHS,项目名称:CoBot-old-and-deprecated,代码行数:12,代码来源:m_seen.php

示例10: __construct

 public function __construct(&$core)
 {
     $core->registerCommand("autodeop", "autodeop", "Activa o desactiva el auto-deop en un canal. Sintaxis: autodeop <on/off> <canal>", 8, CUSTOMPRIV);
     $core->registerMessageHandler('MODE', "autodeop", "deop");
     try {
         $k = ORM::for_table('deopchans')->find_one();
     } catch (PDOException $e) {
         $query = "CREATE TABLE 'deopchans' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'channel' TEXT NOT NULL);";
         $db = ORM::get_db();
         $db->exec($query);
     }
 }
开发者ID:FreuddyHS,项目名称:CoBot-old-and-deprecated,代码行数:12,代码来源:m_autodeop.php

示例11: __construct

 public function __construct(&$core)
 {
     $core->registerCommand("quote", "quote", "Permite gestionar Quotes en el bot. Sintaxis: " . $core->conf['irc']['prefix'] . "quote [add|last|find|del|random] [mensaje de quote|número de quote]");
     $core->registerMessageHandler("307", "quote", "isregistered");
     try {
         $k = ORM::for_table('quotes')->find_one();
     } catch (PDOException $e) {
         $query = "CREATE TABLE 'quotes' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'nick' TEXT NOT NULL,  'quote' TEXT NOT NULL, 'date' datetime default current_timestamp);";
         $db = ORM::get_db();
         $db->exec($query);
     }
 }
开发者ID:FreuddyHS,项目名称:CoBot-old-and-deprecated,代码行数:12,代码来源:m_quotes.php

示例12: create_database

    public function create_database()
    {
        ORM::get_db()->query('CREATE TABLE `hmanga` (
		  `id` integer NOT NULL CONSTRAINT pid PRIMARY KEY AUTOINCREMENT,
		  `url` varchar NOT NULL,
		  `real_id` int NOT NULL,
		  `title` varchar NOT NULL,
		  `date` varchar NOT NULL,
		  `description` text NOT NULL,
		  `pages` integer NOT NULL,
		  `gallery_url` varchar NOT NULL,
		  `tags` text NOT NULL
		)');
    }
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:14,代码来源:HentaiMangaOnline.php

示例13: __construct

 public function __construct(&$core)
 {
     $core->registerMessageHandler('PRIVMSG', "regexakick", "msgs");
     $core->registerMessageHandler('NOTICE', "regexakick", "msgs");
     $core->registerMessageHandler('JOIN', "regexakick", "joinlookup");
     $core->registerCommand("msgakick", "regexakick", "Maneja los akicks por expresiones regulares (por mensajes). Sintaxis: regexakick <add|del|list> <canal> <Expresión regular> (Nota: las expresiones regulares deben incluir el separador.)", 5);
     $core->registerCommand("joinakick", "regexakick", "Maneja los akicks por expresiones regulares (Al entrar al canal, por máscara). Sintaxis: regexakick <add|del|list> <canal> <Expresión regular> (Nota: las expresiones regulares deben incluir el separador. Nota 2: la regex se analiza teniendo en cuenta la máscara del usuario (nick!user@host). )", 5);
     try {
         $k = ORM::for_table('akicks')->find_one();
     } catch (PDOException $e) {
         $query = "CREATE TABLE 'akicks' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'regex' TEXT NOT NULL, 'type' INTEGER NOT NULL, 'channel' TEXT NOT NULL);";
         $db = ORM::get_db();
         $db->exec($query);
     }
 }
开发者ID:FreuddyHS,项目名称:CoBot-old-and-deprecated,代码行数:15,代码来源:m_regexakick.php

示例14: __construct

 public function __construct(&$core)
 {
     $core->registerCommand("chwadd", "wikichan", "Activa funciones wiki en un canal. Sintaxis: chwadd <#canal> <ruta a la API mediawiki>", 5);
     $core->registerCommand("chwrem", "wikichan", "Desctiva funciones wiki en un canal. Sintaxis: chwrem <#canal>", 5);
     $core->registerCommand("info", "wikichan", "Miestra información de un usuario wiki. Sintaxis: info <usuario>");
     $core->registerCommand("preview", "wikichan", "Muestra los primeros 440 caracteres de un articulo. Sintaxis: preview <Nombre del articulo>");
     $core->registerCommand("wikisearch", "wikichan", "Busca un articulo wiki. Sintaxis: wikisearch <Termino de busqueda/>");
     try {
         $k = ORM::for_table('wikichan')->find_one();
     } catch (PDOException $e) {
         $query = "CREATE TABLE 'wikichan' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'chan' TEXT NOT NULL, 'api' TEXT NOT NULL);";
         $db = ORM::get_db();
         $db->exec($query);
     }
 }
开发者ID:FreuddyHS,项目名称:CoBot-old-and-deprecated,代码行数:15,代码来源:m_wikichan.php

示例15: __construct

 public function __construct(&$core)
 {
     try {
         $k = ORM::for_table('chignore2')->find_one();
     } catch (PDOException $e) {
         $query = "CREATE TABLE 'chignore2' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'user' TEXT NOT NULL);";
         $db = ORM::get_db();
         $db->exec($query);
     }
     //$this->timehandlerid = $core->irc->registerTimehandler(20000, $this, "th");
     $core->registerTimeHandler(20000, "whitebotvoy", "th");
     //$core->registerCommand("admin", "whitebotsh", "Avisa a los administradores disponibles.");
     $core->registerCommand("talk", "whitebotvoy", "Habilita o deshabilita el habla del bot. Sintaxis: hablar <si/no>", 5, "whitesh");
     $core->registerCommand("chignore", "whitebotsh", "Ignora un usuario en los cambios recientes. Sintaxis: chignore <usuario>", 5, "whitesh");
     $core->registerCommand("dechignore", "whitebotsh", "Designora un usuario en los cambios recientes. Sintaxis: chignore <usuario>", 5, "whitesh");
 }
开发者ID:White-Master,项目名称:m_whitebot,代码行数:16,代码来源:m_whitebot_voy.php


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