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


PHP Zend_Db_Adapter_Abstract::quoteInto方法代码示例

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


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

示例1: deleteOther

 public function deleteOther(ActiveSync_Model_SyncState $_syncState)
 {
     // remove all other synckeys
     $where = array($this->_db->quoteInto('device_id = ?', $_syncState->device_id), $this->_db->quoteInto('type = ?', $_syncState->type), $this->_db->quoteInto('counter != ?', $_syncState->counter));
     $this->_db->delete(SQL_TABLE_PREFIX . 'acsync_synckey', $where);
     return true;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:7,代码来源:SyncState.php

示例2: getTableDataDump

 public function getTableDataDump($tableName, $step = 100)
 {
     $sql = '';
     if ($this->_read) {
         $quotedTableName = $this->_read->quoteIdentifier($tableName);
         $colunms = $this->_read->fetchRow('SELECT * FROM ' . $quotedTableName . ' LIMIT 1');
         if ($colunms) {
             $arrSql = array();
             $colunms = array_keys($colunms);
             $quote = $this->_read->getQuoteIdentifierSymbol();
             $sql = 'INSERT INTO ' . $quotedTableName . ' (' . $quote . implode($quote . ', ' . $quote, $colunms) . $quote . ')';
             $sql .= ' VALUES ';
             $startRow = 0;
             $select = $this->_read->select();
             $select->from($tableName)->limit($step, $startRow);
             while ($data = $this->_read->fetchAll($select)) {
                 $dataSql = array();
                 foreach ($data as $row) {
                     $dataSql[] = $this->_read->quoteInto('(?)', $row);
                 }
                 $arrSql[] = $sql . implode(', ', $dataSql) . ';';
                 $startRow += $step;
                 $select->limit($step, $startRow);
             }
             $sql = implode("\n", $arrSql) . "\n";
         }
     }
     return $sql;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:29,代码来源:Db.php

示例3: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute($sourceId = null, $userId = null)
 {
     $now = new \MUtil_Db_Expr_CurrentTimestamp();
     $values = array('gso_last_synch' => $now, 'gso_changed' => $now, 'gso_changed_by' => $userId);
     $where = $this->db->quoteInto('gso_id_source = ?', $sourceId);
     $this->db->update('gems__sources', $values, $where);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:13,代码来源:UpdateSyncDate.php

示例4: isValid

 public function isValid($value, $context = null)
 {
     $result = true;
     $this->_value = $value;
     $where = array();
     $where[] = $this->dbAdapter->quoteInto("(p.url_id = ? OR pt.url_id = ?)", $value);
     if (isset($this->_data['id'])) {
         $where[] = $this->dbAdapter->quoteInto("(p.id <> ?)", $this->_data['id']);
     }
     if (isset($this->_data['type_id'])) {
         $where[] = $this->dbAdapter->quoteInto("(p.type_id = ?)", $this->_data['type_id']);
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT COUNT(p.id) AS doubles\n                FROM cms_page AS p\n                    LEFT JOIN cms_page_tr AS pt ON (p.id = pt.translation_id AND pt.language = '" . $this->_lang . "')\n                WHERE {$where}";
     //echo "\n\n$sql\n\n"; die();
     $resultSet = $this->dbAdapter->fetchAll($sql);
     if (0 == count($resultSet)) {
         return false;
     }
     $row = $resultSet[0];
     $result = $row['doubles'] == 0;
     if (!$result) {
         $this->_error(self::URLID_EXISTS);
     }
     return $result;
 }
开发者ID:bokultis,项目名称:kardiomedika,代码行数:26,代码来源:UrlId.php

示例5: processFilterAndSort

 /**
  * Overrule to implement snippet specific filtering and sorting.
  *
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
 {
     $filter[] = $this->db->quoteInto("gr2t_id_respondent_track IN (\n                    SELECT gr2t2a_id_respondent_track\n                    FROM gems__respondent2track2appointment\n                    WHERE gr2t2a_id_appointment = ?)", $this->request->getParam(\Gems_Model::APPOINTMENT_ID));
     // \MUtil_Model::$verbose = true;
     $model->setFilter($filter);
     $this->processSortOnly($model);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:12,代码来源:TracksForAppointment.php

示例6: generateInserts

 /**
  * Generates an array of SQL insert statements that 
  * will save the current 
  * 
  * @param array $resources 
  * @access public
  * @return string
  */
 public function generateInserts(array $resources)
 {
     $quotedName = $this->_db->quoteIdentifier('name');
     $quotedDescription = $this->_db->quoteIdentifier('description');
     $quotedFlagsTable = $this->_db->quoteIdentifier('flags');
     $insertResourceTemplate = sprintf('INSERT IGNORE INTO %s (%s, %s) VALUES (?, ?);', $quotedFlagsTable, $quotedName, $quotedDescription);
     $selectResourceTemplate = sprintf('SET @flag_id := (SELECT id FROM %s WHERE %s = ?);', $quotedFlagsTable, $quotedName);
     $insertPrivilegeTemplate = '(@flag_id, %s, %s)';
     $inserts = array();
     foreach ($resources as $resource) {
         // ready the insert resource query
         $insertResourceSql = $this->_db->quoteInto($insertResourceTemplate, $resource['name'], NULL, 1);
         $insertResourceSql = $this->_db->quoteInto($insertResourceSql, $resource['description'], NULL, 1);
         // ready the select resource query
         $selectResourceSql = $this->_db->quoteInto($selectResourceTemplate, $resource['name']);
         // ready the insert privilege query
         $insertPrivilegeSql = sprintf('INSERT IGNORE INTO %s (%s, %s, %s) VALUES ', $this->_db->quoteIdentifier('privileges'), $this->_db->quoteIdentifier('flag_id'), $quotedName, $quotedDescription);
         $insertPrivilegeSqlParts = array();
         foreach ($resource['methods'] as $method) {
             $insertPrivilegeSqlParts[] = sprintf($insertPrivilegeTemplate, $this->_db->quote($method['name']), $this->_db->quote($method['description']));
         }
         $inserts[] = $insertResourceSql . PHP_EOL . $selectResourceSql . PHP_EOL . $insertPrivilegeSql . PHP_EOL . "\t" . implode(',' . PHP_EOL . "\t", $insertPrivilegeSqlParts) . ';' . PHP_EOL;
     }
     return $inserts;
 }
开发者ID:omusico,项目名称:logica,代码行数:33,代码来源:FlagFlippers.php

示例7: getSwitch

 /**
  * get switch case expression with multiple cases
  *
  * @param string $field
  * @param array $cases
  *
  * @return Zend_Db_Expr
  */
 public function getSwitch($field, $cases)
 {
     $case = 'CASE ' . $this->_adapter->quoteIdentifier($field) . ' ';
     foreach ($cases as $when => $then) {
         $case .= $this->_adapter->quoteInto(' WHEN ' . $when . ' THEN ?', $then);
     }
     $case .= ' END';
     return new Zend_Db_Expr($case);
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:Oracle.php

示例8: processFilterAndSort

 /**
  * Overrule to implement snippet specific filtering and sorting.
  *
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
 {
     parent::processFilterAndSort($model);
     $appId = $this->request->getParam(\Gems_Model::APPOINTMENT_ID);
     if ($appId) {
         $appKeyPrefix = $this->db->quote(FieldsDefinition::makeKey(FieldMaintenanceModel::APPOINTMENTS_NAME, ''));
         $appSource = $this->db->quote(\Gems_Tracker_Engine_StepEngineAbstract::APPOINTMENT_TABLE);
         $or[] = $this->db->quoteInto("gro_valid_after_source = {$appSource} AND\n                        (gto_id_respondent_track, gro_valid_after_field) IN\n                            (SELECT gr2t2a_id_respondent_track, CONCAT({$appKeyPrefix}, gr2t2a_id_app_field)\n                                FROM gems__respondent2track2appointment\n                                WHERE gr2t2a_id_appointment = ?)", $appId);
         $or[] = $this->db->quoteInto("gro_valid_for_source = {$appSource} AND\n                        (gto_id_respondent_track, gro_valid_for_field) IN\n                            (SELECT gr2t2a_id_respondent_track, CONCAT({$appKeyPrefix}, gr2t2a_id_app_field)\n                                FROM gems__respondent2track2appointment\n                                WHERE gr2t2a_id_appointment = ?)", $appId);
     }
     $model->addFilter(array('(' . implode(') OR (', $or) . ')'));
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:17,代码来源:AppointmentTokensSnippet.php

示例9: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute($lineNr = null, $forRoundOrder = null, $usesRoundRound = null, $roundField = null)
 {
     $batch = $this->getBatch();
     $import = $batch->getVariable('import');
     if (!(isset($import['trackId']) && $import['trackId'])) {
         // Do nothing
         return;
     }
     if (isset($import['roundOrders'][$usesRoundRound]) && $import['roundOrders'][$usesRoundRound]) {
         $this->db->update('gems__rounds', array($roundField => $import['roundOrders'][$usesRoundRound]), $this->db->quoteInto("gro_id_order = ? AND ", $forRoundOrder) . $this->db->quoteInto("gro_id_track = ?", $import['trackId']));
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:18,代码来源:UpdateRoundValidTask.php

示例10: execute

 /**
  * Should handle execution of the task, taking as much (optional) parameters as needed
  *
  * The parameters should be optional and failing to provide them should be handled by
  * the task
  */
 public function execute()
 {
     $role = \Gems_Roles::getInstance();
     $parents = $this->db->fetchPairs("SELECT grl_id_role, grl_parents FROM gems__roles");
     // \MUtil_Echo::track($parents);
     if ($parents) {
         foreach ($parents as $id => $priv) {
             $values['grl_parents'] = implode(',', $role->translateToRoleIds($priv));
             $this->db->update('gems__roles', $values, $this->db->quoteInto('grl_id_role = ?', $id));
         }
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:18,代码来源:UpdateRoleIds.php

示例11: loadFormData

 /**
  * Hook that loads the form data from $_POST or the model
  *
  * Or from whatever other source you specify here.
  */
 protected function loadFormData()
 {
     parent::loadFormData();
     if ($this->request->isPost()) {
         if (!$this->_saveButton || !$this->_saveButton->isChecked()) {
             if (isset($this->formData['grs_ssn']) && $this->formData['grs_ssn']) {
                 $filter = array('grs_ssn' => $this->formData['grs_ssn'], 'gr2o_id_organization' => true);
                 if ($this->formData['gr2o_id_organization']) {
                     $orgId = $this->formData['gr2o_id_organization'];
                 } else {
                     $orgId = $this->model->get('gr2o_id_organization', 'default');
                 }
                 $order = array($this->db->quoteInto("CASE WHEN gr2o_id_organization = ? THEN 1 ELSE 2 END", $orgId) => SORT_ASC);
                 $data = $this->model->loadFirst($filter, $order);
                 if ($data && !isset($this->formData[$this->saveButtonId])) {
                     // \MUtil_Echo::track($this->formData);
                     // \MUtil_Echo::track($data);
                     // Do not use this value
                     unset($data['grs_ssn']);
                     if ($data['gr2o_id_organization'] == $orgId) {
                         // gr2o_patient_nr
                         // gr2o_id_organization
                         $this->addMessage($this->_('Known respondent.'));
                         //*
                         foreach ($data as $name => $value) {
                             if (substr($name, 0, 4) == 'grs_' || substr($name, 0, 5) == 'gr2o_') {
                                 if (array_key_exists($name, $this->formData)) {
                                     $this->formData[$name] = $value;
                                 }
                                 $cname = $this->model->getKeyCopyName($name);
                                 if (array_key_exists($cname, $this->formData)) {
                                     $this->formData[$cname] = $value;
                                 }
                             }
                         }
                         // */
                     } else {
                         $org = $this->loader->getOrganization($data['gr2o_id_organization']);
                         $this->addMessage(sprintf($this->_('Respondent data retrieved from %s.'), $org->getName()));
                         foreach ($data as $name => $value) {
                             if (substr($name, 0, 4) == 'grs_' && array_key_exists($name, $this->formData)) {
                                 $this->formData[$name] = $value;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:55,代码来源:RespondentFormSnippet.php

示例12: authorizeBlock

 /**
  * Checks if the user is allowed to login or is blocked
  *
  * An adapter authorizes and if the end resultis boolean, string or array
  * it is converted into a \Zend_Auth_Result.
  *
  * @return mixed \Zend_Auth_Adapter_Interface|\Zend_Auth_Result|boolean|string|array
  */
 protected function authorizeBlock()
 {
     try {
         $select = $this->db->select();
         $select->from('gems__user_login_attempts', array('UNIX_TIMESTAMP(gula_block_until) - UNIX_TIMESTAMP() AS wait'))->where('gula_block_until is not null')->where('gula_login = ?', $this->getLoginName())->where('gula_id_organization = ?', $this->getCurrentOrganizationId())->limit(1);
         // Not the first login
         if ($block = $this->db->fetchOne($select)) {
             if ($block > 0) {
                 $minutes = intval($block / 60) + 1;
                 // Report all is not well
                 return sprintf($this->plural('Your account is temporarily blocked, please wait a minute.', 'Your account is temporarily blocked, please wait %d minutes.', $minutes), $minutes);
             } else {
                 // Clean the block once it's past
                 $values['gula_failed_logins'] = 0;
                 $values['gula_last_failed'] = null;
                 $values['gula_block_until'] = null;
                 $where = $this->db->quoteInto('gula_login = ? AND ', $this->getLoginName());
                 $where .= $this->db->quoteInto('gula_id_organization = ?', $this->getCurrentOrganizationId());
                 $this->db->update('gems__user_login_attempts', $values, $where);
             }
         }
     } catch (\Zend_Db_Exception $e) {
         // Fall through as this does not work if the database upgrade did not run
         // \MUtil_Echo::r($e);
     }
     return true;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:35,代码来源:User.php

示例13: load

 public function load($object, $customerId)
 {
     $select = $this->_read->select();
     $select->from($this->_customerTable, array('login_at', 'logout_at'))->joinInner($this->_visitorTable, $this->_visitorTable . '.visitor_id=' . $this->_customerTable . '.visitor_id', array('last_visit_at'))->joinInner($this->_visitorInfoTable, $this->_visitorTable . '.visitor_id=' . $this->_visitorInfoTable . '.visitor_id', array('http_referer', 'remote_addr'))->joinInner($this->_urlInfoTable, $this->_urlInfoTable . '.url_id=' . $this->_visitorTable . '.last_url_id', array('url'))->where($this->_read->quoteInto($this->_customerTable . '.customer_id=?', $customerId))->order($this->_customerTable . '.login_at desc')->limit(1);
     $object->setData($this->_read->fetchRow($select));
     return $object;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Mysql4_Customer.php

示例14: renameTableInAppTables

 /**
  * @param $_oldTableName
  * @param $_newTableName
  * @return int
  */
 public function renameTableInAppTables($_oldTableName, $_newTableName)
 {
     $applicationsTables = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'application_tables'));
     $where = array($this->_db->quoteInto($this->_db->quoteIdentifier('name') . ' = ?', $_oldTableName));
     $result = $applicationsTables->update(array('name' => $_newTableName), $where);
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:Abstract.php

示例15: getTag

 /**
  * converts category to tag
  * 
  * @param int $catId
  * @return string tagid
  */
 public function getTag($catId)
 {
     if (!(isset($this->_tagMapCache[$catId]) || array_key_exists($catId, $this->_tagMapCache))) {
         $select = $this->_egwDb->select()->from(array('cats' => 'egw_categories'))->where($this->_egwDb->quoteInto($this->_egwDb->quoteIdentifier('cat_id') . ' = ?', $catId));
         $cat = $this->_egwDb->fetchAll($select, NULL, Zend_Db::FETCH_ASSOC);
         $cat = count($cat) === 1 ? $cat[0] : NULL;
         if (!$cat) {
             $this->_log->DEBUG(__METHOD__ . '::' . __LINE__ . " category {$catId} not found in egw, skipping tag");
             return $this->_tagMapCache[$catId] = NULL;
         }
         $tineDb = Tinebase_Core::getDb();
         $select = $tineDb->select()->from(array('tags' => $tineDb->table_prefix . 'tags'))->where($tineDb->quoteInto($tineDb->quoteIdentifier('name') . ' LIKE ?', $cat['cat_name']));
         $tag = $tineDb->fetchAll($select, NULL, Zend_Db::FETCH_ASSOC);
         $tag = count($tag) > 0 ? $tag[0] : NULL;
         if ($tag) {
             return $this->_tagMapCache[$catId] = $tag['id'];
         }
         // create tag
         $catData = unserialize($cat['cat_data']);
         $tagId = Tinebase_Record_Abstract::generateUID();
         $tagType = $cat['cat_access'] == 'public' ? Tinebase_Model_Tag::TYPE_SHARED : Tinebase_Model_Tag::TYPE_PERSONAL;
         $tagOwner = $tagType == Tinebase_Model_Tag::TYPE_SHARED ? 0 : $this->mapAccountIdEgw2Tine($cat['cat_owner']);
         $this->_log->NOTICE(__METHOD__ . '::' . __LINE__ . " creating new {$tagType} tag '{$cat['cat_name']}'");
         $tineDb->insert($tineDb->table_prefix . 'tags', array('id' => $tagId, 'type' => $tagType, 'owner' => $tagOwner, 'name' => $cat['cat_name'], 'description' => $cat['cat_description'], 'color' => $catData['color'], 'created_by' => $tagOwner ? $tagOwner : Tinebase_Core::getUser()->getId(), 'creation_time' => $cat['last_mod'] ? $this->convertDate($cat['last_mod']) : Tinebase_DateTime::now()));
         $right = new Tinebase_Model_TagRight(array('tag_id' => $tagId, 'account_type' => $tagType == Tinebase_Model_Tag::TYPE_SHARED ? Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE : Tinebase_Acl_Rights::ACCOUNT_TYPE_USER, 'account_id' => $tagOwner, 'view_right' => true, 'use_right' => true));
         Tinebase_Tags::getInstance()->setRights($right);
         Tinebase_Tags::getInstance()->setContexts(array(0), $tagId);
         $this->_tagMapCache[$catId] = $tagId;
     }
     return $this->_tagMapCache[$catId];
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:37,代码来源:Abstract.php


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