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


PHP CRM_Core_DAO::composeQuery方法代码示例

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


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

示例1: record

 static function record($rg)
 {
     $civicrm_contact = CRM_Utils_Array::value('civicrm_contact', $rg->params, array());
     $civicrm_email = CRM_Utils_Array::value('civicrm_email', $rg->params, array());
     $params = array(1 => array(CRM_Utils_Array::value('first_name', $civicrm_contact, ''), 'String'), 2 => array(CRM_Utils_Array::value('last_name', $civicrm_contact, ''), 'String'), 3 => array(CRM_Utils_Array::value('email', $civicrm_email, ''), 'String'));
     return array("civicrm_contact.{$rg->name}.{$rg->threshold}" => CRM_Core_DAO::composeQuery("\n                SELECT contact.id as id1, {$rg->threshold} as weight\n                FROM civicrm_contact as contact\n                  JOIN civicrm_email as email ON email.contact_id=contact.id\n                WHERE contact_type = 'Individual'\n                  AND first_name = %1\n                  AND last_name = %2\n                  AND email = %3", $params, TRUE));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:7,代码来源:IndividualFuzzy.php

示例2: postProcess

 function postProcess()
 {
     $values = $this->exportValues();
     $table = $values['table'];
     $field = $values['field'];
     // validate table and field
     if (!isset($this->_structure[$table][$field])) {
         CRM_Core_Error::fatal("{$table}.{$field} is not internationalized.");
     }
     $cols = array();
     $params = array(array($values['id'], 'Int'));
     $i = 1;
     foreach ($this->_locales as $locale) {
         $cols[] = "{$field}_{$locale} = %{$i}";
         $params[$i] = array($values["{$field}_{$locale}"], 'String');
         $i++;
     }
     $query = "UPDATE {$table} SET " . implode(', ', $cols) . " WHERE id = %0";
     $dao = new CRM_Core_DAO();
     $query = CRM_Core_DAO::composeQuery($query, $params, TRUE);
     $dao->query($query, FALSE);
     CRM_Utils_System::civiExit();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:23,代码来源:Form.php

示例3: whereClause

 /**
  * @param $where
  * @param $params
  *
  * @return string
  */
 function whereClause(&$where, &$params)
 {
     return CRM_Core_DAO::composeQuery($where, $params, TRUE);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:10,代码来源:Base.php

示例4: testComposeQueryFailure

 function testComposeQueryFailure()
 {
     $cases[] = array('SELECT * FROM whatever WHERE name = %1 AND title = %2 AND year LIKE \'%2012\' ', array(1 => array('Alice', 'String'), 2 => array('Bob', 'String')), 'SELECT * FROM whatever WHERE name = \'Alice\' AND title = \'Bob\' AND year LIKE \'%2012\' ');
     list($inputSql, $inputParams, $expectSql) = $cases[0];
     $actualSql = CRM_Core_DAO::composeQuery($inputSql, $inputParams);
     $this->assertFalse($expectSql == $actualSql);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:7,代码来源:DAOTest.php

示例5: assertDBQuery

 /**
  * Assert that a SQL query returns a given value.
  *
  * The first argument is an expected value. The remaining arguments are passed
  * to CRM_Core_DAO::singleValueQuery
  *
  * Example: $this->assertSql(2, 'select count(*) from foo where foo.bar like "%1"',
  * array(1 => array("Whiz", "String")));
  * @param $expected
  * @param $query
  * @param array $params
  * @param string $message
  */
 public function assertDBQuery($expected, $query, $params = array(), $message = '')
 {
     if ($message) {
         $message .= ': ';
     }
     $actual = CRM_Core_DAO::singleValueQuery($query, $params);
     $this->assertEquals($expected, $actual, sprintf('%sexpected=[%s] actual=[%s] query=[%s]', $message, $expected, $actual, CRM_Core_DAO::composeQuery($query, $params, FALSE)));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:21,代码来源:CiviUnitTestCase.php

示例6: enqueueQuery

 /**
  * Enqueue a query which alters triggers.
  *
  * As this requires a high permission level we funnel the queries through here to
  * facilitate them being taken 'offline'.
  *
  * @param string $triggerSQL
  *   The sql to run to create or drop the triggers.
  * @param array $params
  *   Optional parameters to interpolate into the string.
  */
 public function enqueueQuery($triggerSQL, $params = array())
 {
     if (\Civi::settings()->get('logging_no_trigger_permission')) {
         if (!file_exists($this->getFile())) {
             // Ugh. Need to let user know somehow. This is the first change.
             \CRM_Core_Session::setStatus(ts('The mysql commands you need to run are stored in %1', array(1 => $this->getFile())), '', 'alert', array('expires' => 0));
         }
         $buf = "\n";
         $buf .= "DELIMITER //\n";
         $buf .= \CRM_Core_DAO::composeQuery($triggerSQL, $params) . " //\n";
         $buf .= "DELIMITER ;\n";
         file_put_contents($this->getFile(), $buf, FILE_APPEND);
     } else {
         \CRM_Core_DAO::executeQuery($triggerSQL, $params, TRUE, NULL, FALSE, FALSE);
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:27,代码来源:SqlTriggers.php

示例7: assertDBQuery

 /**
  * Assert that a SQL query returns a given value
  *
  * The first argument is an expected value. The remaining arguments are passed
  * to CRM_Core_DAO::singleValueQuery
  *
  * Example: $this->assertSql(2, 'select count(*) from foo where foo.bar like "%1"',
  * array(1 => array("Whiz", "String")));
  */
 function assertDBQuery($expected, $query, $params = array())
 {
     $actual = CRM_Core_DAO::singleValueQuery($query, $params);
     $this->assertEquals($expected, $actual, sprintf('expected=[%s] actual=[%s] query=[%s]', $expected, $actual, CRM_Core_DAO::composeQuery($query, $params, FALSE)));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:14,代码来源:CiviUnitTestCase.php

示例8: contactIDs

 /**
  * @param int $offset
  * @param int $rowcount
  * @param null $sort
  * @param bool $returnSQL
  *
  * @return string
  */
 public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE)
 {
     $sql = $this->sql('player.id as contact_id', $offset, $rowcount, $sort);
     $this->validateUserSQL($sql);
     if ($returnSQL) {
         return $sql;
     }
     return CRM_Core_DAO::composeQuery($sql, CRM_Core_DAO::$_nullArray);
 }
开发者ID:agloa,项目名称:tournament,代码行数:17,代码来源:Teams.php

示例9: runSqlReturnAffectedRows

 /**
  * There's probably a better way to do this.
  */
 public static function runSqlReturnAffectedRows($sql, $params = array())
 {
     $dao = new CRM_Core_DAO();
     $q = CRM_Core_DAO::composeQuery($sql, $params);
     $result = $dao->query($q);
     if (is_a($result, 'DB_Error')) {
         throw new Exception($result->message . "\n" . $result->userinfo);
     }
     $dao->free();
     return $result;
 }
开发者ID:sunilpawar,项目名称:uk.co.vedaconsulting.mailchimp,代码行数:14,代码来源:Sync.php


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