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


PHP dibi::insert方法代码示例

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


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

示例1: translate

 /**
  * translates string with key $msg_id
  *
  * @param string $msg_id
  * @param int $count NOT USED YET, only for ITranslator needs
  * @return string translated string
  */
 public function translate($msg_id, $count = NULL)
 {
     if ($msg_id == "") {
         return NULL;
     }
     ///**************
     if (!isset($this->dictionary[$msg_id])) {
         dibi::insert(self::TABLE, array('msg_id' => $msg_id))->execute();
         $this->dictionary[$msg_id] = $msg_id;
         CacheTools::invalidate('dictionary');
     }
     /**	applying parameters **/
     $args = func_get_args();
     $argsCount = count($args);
     $requiredArgsCount = preg_match_all($this->paramsRegexp, $this->dictionary[$msg_id], $matches);
     if ($requiredArgsCount > $argsCount - 1) {
         throw new InvalidArgumentException("Insufficient number of arguments in translate function. Provided string '{$msg_id}'");
     }
     //        if ($argsCount > 1) {
     //	volane z Rules.php, aby sa mi to nesexovalo s '%label' a tym percentom a nemusel ho zdvojovat
     if ($argsCount > 1 && !is_null($args[1])) {
         //	vola sa to aj s parametrami z Rules.php napr. pre MIN_LENGTH a pod., treba zdvojit percento
         $msg_id = str_replace(array('%label', '%name', '%value'), array('%%label', '%%name', '%%value'), $this->dictionary[$msg_id]);
         //		dump($args);
         array_shift($args);
         //		dump($args);
         return vsprintf($msg_id, $args);
     } else {
         return $this->dictionary[$msg_id];
     }
     /**	applying parameters END **/
 }
开发者ID:radypala,项目名称:maga-website,代码行数:39,代码来源:DBTranslator.php

示例2: __set

 public function __set($name, $value)
 {
     if (!array_key_exists($name, $this->vars)) {
         dibi::insert("configs", array('name' => $name, 'value' => $value))->execute();
         return $this->vars[$name] = $value;
     } else {
         if ($this->vars[$name] == $value) {
             return $value;
         }
         dibi::update("configs", array('value' => $value))->where('name=%s', $name)->execute();
         return $this->vars[$name] = $value;
     }
 }
开发者ID:killsaw,项目名称:Mescal,代码行数:13,代码来源:ConfigSet.php

示例3: updateUserRoles

 /**
  * update user roles [delete & insert]
  *
  * @param int User id
  * @param int Role id
  */
 public function updateUserRoles($userId, $roles)
 {
     try {
         dibi::begin();
         dibi::delete(self::ACL_USERS_2_ROLES_TABLE)->where('user_id = %i', $userId)->execute();
         foreach ($roles as $role) {
             dibi::insert(self::ACL_USERS_2_ROLES_TABLE, array('user_id' => $userId, 'role_id' => $role))->execute();
         }
         dibi::commit();
     } catch (DibiDriverException $e) {
         dibi::rollback();
         throw $e;
     }
 }
开发者ID:radypala,项目名称:maga-website,代码行数:20,代码来源:RolesModel.php

示例4: insertIntoDatabase

 function insertIntoDatabase($id, $name, $region)
 {
     $codename = strtolower(preg_replace('/\\s+/', '', $name));
     // player name
     $row = array("codename" => $codename, "id" => $id, "region" => $region, "last_updated" => NULL);
     $table = "group";
     dibi::insert($table, $row)->on('DUPLICATE KEY UPDATE %a ', $row)->execute();
 }
开发者ID:roesel,项目名称:lolcomp,代码行数:8,代码来源:group.class.php

示例5: insert

 public static function insert($data, $log_type)
 {
     return dibi::insert(self::getTable($log_type), $data)->execute();
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:4,代码来源:Logs.php

示例6: date_default_timezone_set

<h1>Using Fluent Syntax | dibi</h1>

<?php 
require_once 'Nette/Debug.php';
require_once '../dibi/dibi.php';
date_default_timezone_set('Europe/Prague');
dibi::connect(array('driver' => 'sqlite', 'database' => 'data/sample.sdb'));
$id = 10;
$record = array('title' => 'Super product', 'price' => 318, 'active' => TRUE);
// SELECT ...
dibi::select('product_id')->as('id')->select('title')->from('products')->innerJoin('orders')->using('(product_id)')->innerJoin('customers USING (customer_id)')->orderBy('title')->test();
// -> SELECT [product_id] AS [id] , [title] FROM [products] INNER JOIN [orders]
//    USING (product_id) INNER JOIN customers USING (customer_id) ORDER BY [title]
// SELECT ...
echo dibi::select('title')->as('id')->from('products')->fetchSingle();
// -> Chair (as result of query: SELECT [title] AS [id] FROM [products])
// INSERT ...
dibi::insert('products', $record)->setFlag('IGNORE')->test();
// -> INSERT IGNORE INTO [products] ([title], [price], [active]) VALUES ('Super product', 318, 1)
// UPDATE ...
dibi::update('products', $record)->where('product_id = %d', $id)->test();
// -> UPDATE [products] SET [title]='Super product', [price]=318, [active]=1 WHERE product_id = 10
// DELETE ...
dibi::delete('products')->where('product_id = %d', $id)->test();
// -> DELETE FROM [products] WHERE product_id = 10
// custom commands
dibi::command()->update('products')->where('product_id = %d', $id)->set($record)->test();
// -> UPDATE [products] SET [title]='Super product', [price]=318, [active]=1 WHERE product_id = 10
dibi::command()->truncate('products')->test();
// -> TRUNCATE [products]
开发者ID:kravco,项目名称:dibi,代码行数:30,代码来源:using-fluent-syntax.php

示例7: insert

 public function insert(array $data)
 {
     return dibi::insert(':graweb:news', $data)->execute(dibi::IDENTIFIER);
 }
开发者ID:svoby,项目名称:graweb2010,代码行数:4,代码来源:News.php

示例8: insert

 /**
  * basic insert
  *
  * @param array $data
  * @return int insertedId()
  */
 public function insert(array $data)
 {
     return dibi::insert(static::TABLE, $data)->execute(dibi::IDENTIFIER);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:10,代码来源:BaseModel.php

示例9: insert

 static function insert($values)
 {
     $user_value['name'] = @$values['name'];
     $user_value['surname'] = @$values['surname'];
     //		$user_value['email'] = $values['email'];
     $user_value['login'] = $values['login'];
     $user_value['activate'] = $values['activate'];
     $user_value['password'] = self::getHash($values['password']);
     $user_value['fbuid'] = @$values['fbuid'];
     $user_value['google_id'] = @$values['google_id'];
     $user_value['newsletter'] = @$values['newsletter'];
     $user_value['discount'] = @$values['discount'];
     unset($values['name'], $values['surname'], $values['login'], $values['password'], $values['activate'], $values['fbuid'], $values['newsletter'], $values['discount']);
     dibi::begin();
     dibi::insert(TABLE_USERS, $user_value)->execute();
     $values['user_id'] = dibi::insertId();
     dibi::insert(TABLE_USERS_INFO, $values)->execute();
     dibi::commit();
     return $values['user_id'];
 }
开发者ID:oaki,项目名称:demoshop,代码行数:20,代码来源:UserModel.php

示例10: allowTemporaryLogin

 public function allowTemporaryLogin($userId, $email, $expirationTime = '+1 hour')
 {
     $token = Basic::randomizer(80);
     dibi::insert(self::TEMPORARY_LOGIN_TABLE, array('users_id' => $userId, 'email' => $email, 'token' => $token, 'expire' => dibi::datetime(strtotime($expirationTime))))->execute();
     return $token;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:6,代码来源:UsersModel.php

示例11: logAccess

 public function logAccess()
 {
     return dibi::insert('analytics', array('ua' => $this->ua, 'ip' => $this->ip, 'sid' => $this->sid, 'referer' => $this->referer, 'page' => $this->page))->execute();
 }
开发者ID:killsaw,项目名称:Mescal,代码行数:4,代码来源:Analytics.php

示例12: addToDatabase

 function addToDatabase($name, $value)
 {
     dibi::insert($name, $value)->on('DUPLICATE KEY UPDATE %a ', $value)->execute();
 }
开发者ID:roesel,项目名称:lolcomp,代码行数:4,代码来源:player.class.php


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