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


PHP DB::Prepare方法代码示例

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


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

示例1: removeByViewId

 public static function removeByViewId($_view_id)
 {
     $value = array('view_id' => $_view_id);
     $sql = 'DELETE FROM viewZone
             WHERE view_id=:view_id';
     return DB::Prepare($sql, $value, DB::FETCH_TYPE_ROW);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:7,代码来源:viewZone.class.php

示例2: byPlugin

 public static function byPlugin($_plugin)
 {
     $values = array('plugin' => '%' . $_plugin . '%');
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
     FROM jeeNetwork
     WHERE plugin LIKE :plugin';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:8,代码来源:jeeNetwork.class.php

示例3: byId

 public static function byId($_id)
 {
     $values = array('id' => $_id);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
     FROM ' . __CLASS__ . '
     WHERE id=:id';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:8,代码来源:scenarioElement.class.php

示例4: byEqLogic_id

 public static function byEqLogic_id($_eqLogic_id)
 {
     $values = array('eqLogic_id' => $_eqLogic_id);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
             FROM energy
             WHERE eqLogic_id=:eqLogic_id';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:8,代码来源:energy.class.php

示例5: byuserIdAndEntity

 public static function byuserIdAndEntity($_user_id, $_entity)
 {
     $values = array('user_id' => $_user_id, 'entity' => $_entity);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
             FROM `rights`
             WHERE entity=:entity
                 AND user_id=:user_id';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:9,代码来源:rights.class.php

示例6: byviewZoneId

 public static function byviewZoneId($_viewZone_id)
 {
     $value = array('viewZone_id' => $_viewZone_id);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
             FROM viewData
             WHERE viewZone_id=:viewZone_id
             ORDER BY `order`';
     return DB::Prepare($sql, $value, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:9,代码来源:viewData.class.php

示例7: byElement

 public static function byElement($_element_id)
 {
     $values = array('expression' => $_element_id);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
     FROM ' . __CLASS__ . '
     WHERE expression=:expression
     AND `type`= "element"';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:jimibi,项目名称:core,代码行数:9,代码来源:scenarioExpression.class.php

示例8: unbind_user

 public static function unbind_user($_id, $_user_id)
 {
     $sql = 'DELETE FROM `users_interests` WHERE `user_id` = :user_id AND `interest_id` = :id';
     $params = array('id' => $_id, 'user_id' => $_user_id);
     try {
         DB::Prepare($sql, $params);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:Groscheri,项目名称:csrf-seminar,代码行数:11,代码来源:interest.class.php

示例9: byTypeLinkId

 public static function byTypeLinkId($_type, $_link_id = '')
 {
     $values = array('type' => $_type);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
             FROM dataStore
             WHERE type=:type';
     if ($_link_id != '') {
         $values['link_id'] = $_link_id;
         $sql .= ' AND link_id=:link_id';
     }
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:12,代码来源:dataStore.class.php

示例10: searchEvent

 public static function searchEvent($_event)
 {
     if (strpos($_event, '#') !== false) {
         $value = array('event' => '%' . $_event . '%');
     } else {
         $value = array('event' => '%#' . $_event . '#%');
     }
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
             FROM listener
             WHERE `event` LIKE :event';
     return DB::Prepare($sql, $value, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:12,代码来源:listener.class.php

示例11: change_email

 public static function change_email($_id, $_email)
 {
     $email = htmlentities($_email);
     $sql = 'UPDATE `users` SET `email` = :email WHERE `id` = :id';
     $params = array('id' => $_id, 'email' => $email);
     try {
         DB::Prepare($sql, $params);
         $_SESSION['user']['email'] = $email;
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:Groscheri,项目名称:csrf-seminar,代码行数:13,代码来源:user.class.php

示例12: byScenarioElementId

 public static function byScenarioElementId($_scenarioElementId, $_type = '')
 {
     $values = array('scenarioElement_id' => $_scenarioElementId);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '  
             FROM ' . __CLASS__ . ' 
             WHERE scenarioElement_id=:scenarioElement_id ';
     if ($_type != '') {
         $values['type'] = $_type;
         $sql .= ' AND type=:type ';
         return DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
     }
     $sql .= ' ORDER BY `order`';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:14,代码来源:scenarioSubElement.class.php

示例13: byLogicalId

 public static function byLogicalId($_logicalId, $_cat)
 {
     $values = array('logicalId' => $_logicalId, 'cat' => $_cat);
     $sql = 'SELECT id
             FROM eqReal
             WHERE logicalId=:logicalId
                 AND cat=:cat';
     $results = DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL);
     $return = array();
     foreach ($results as $result) {
         $return[] = self::byId($result['id']);
     }
     return $return;
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:14,代码来源:eqReal.class.php

示例14: allUnite

    public static function allUnite()
    {
        $sql = 'SELECT distinct(unite) as unite
		FROM cmd';
        return DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
    }
开发者ID:jimibi,项目名称:core,代码行数:6,代码来源:cmd.class.php

示例15: recognize

 public static function recognize($_query)
 {
     $values = array('query' => $_query);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
 FROM interactQuery
 WHERE LOWER(query)=LOWER(:query)';
     $query = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
     if (is_object($query)) {
         log::add('interact', 'debug', 'Je prend : ' . $query->getQuery());
         return $query;
     }
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . ', MATCH query AGAINST (:query IN NATURAL LANGUAGE MODE) as score
 FROM interactQuery
 GROUP BY id
 HAVING score > 1';
     $queries = DB::Prepare($sql, $values, DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
     if (count($queries) == 0) {
         $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
     FROM interactQuery
     WHERE query=:query';
         $queries = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
         if (is_object($queries)) {
             return $queries;
         }
         $queries = self::all();
     }
     $caracteres = array('À' => 'a', 'Á' => 'a', 'Â' => 'a', 'Ä' => 'a', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ä' => 'a', '@' => 'a', 'È' => 'e', 'É' => 'e', 'Ê' => 'e', 'Ë' => 'e', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', '€' => 'e', 'Ì' => 'i', 'Í' => 'i', 'Î' => 'i', 'Ï' => 'i', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'Ò' => 'o', 'Ó' => 'o', 'Ô' => 'o', 'Ö' => 'o', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'ö' => 'o', 'Ù' => 'u', 'Ú' => 'u', 'Û' => 'u', 'Ü' => 'u', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'µ' => 'u', 'Œ' => 'oe', 'œ' => 'oe', '$' => 's');
     $shortest = 999;
     $closest = null;
     $_query = strtolower(preg_replace('#[^A-Za-z0-9 \\n\\.\'=\\*:]+#', '', strtr($_query, $caracteres)));
     foreach ($queries as $query) {
         $input = strtolower(preg_replace('#[^A-Za-z0-9 \\n\\.\'=\\*:]+#', '', strtr($query->getQuery(), $caracteres)));
         preg_match_all("/#(.*?)#/", $input, $matches);
         foreach ($matches[1] as $match) {
             $input = str_replace('#' . $match . '#', '', $input);
         }
         $lev = levenshtein($input, $_query);
         log::add('interact', 'debug', 'Je compare : ' . $_query . ' avec ' . $input . ' => ' . $lev);
         if ($lev == 0) {
             $shortest = 0;
             $closest = $query;
             break;
         }
         if ($lev <= $shortest || $shortest < 0) {
             $closest = $query;
             $shortest = $lev;
         }
     }
     if (str_word_count($_query) == 1 && config::byKey('interact::confidence1') > 0 && $shortest > config::byKey('interact::confidence1')) {
         log::add('interact', 'debug', 'Correspondance trop éloigné : ' . $shortest);
         return null;
     } else {
         if (str_word_count($_query) == 2 && config::byKey('interact::confidence2') > 0 && $shortest > config::byKey('interact::confidence2')) {
             log::add('interact', 'debug', 'Correspondance trop éloigné : ' . $shortest);
             return null;
         } else {
             if (str_word_count($_query) == 3 && config::byKey('interact::confidence3') > 0 && $shortest > config::byKey('interact::confidence3')) {
                 log::add('interact', 'debug', 'Correspondance trop éloigné : ' . $shortest);
                 return null;
             } else {
                 if (str_word_count($_query) > 3 && config::byKey('interact::confidence') > 0 && $shortest > config::byKey('interact::confidence')) {
                     log::add('interact', 'debug', 'Correspondance trop éloigné : ' . $shortest);
                     return null;
                 }
             }
         }
     }
     return $closest;
 }
开发者ID:saez0pub,项目名称:core,代码行数:69,代码来源:interactQuery.class.php


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