Exemplo n.º 1
0
 /**
  * Execute a query by the current DAO, localizing it along the way (if needed).
  *
  * @param string $query
  *   The SQL query for execution.
  * @param bool $i18nRewrite
  *   Whether to rewrite the query.
  *
  * @return object
  *   the current DAO object after the query execution
  */
 public function query($query, $i18nRewrite = TRUE)
 {
     // rewrite queries that should use $dbLocale-based views for multi-language installs
     global $dbLocale, $_DB_DATAOBJECT;
     $conn =& $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
     $orig_options = $conn->options;
     $this->_setDBOptions($this->_options);
     if ($i18nRewrite and $dbLocale) {
         $query = CRM_Core_I18n_Schema::rewriteQuery($query);
     }
     $ret = parent::query($query);
     $this->_setDBOptions($orig_options);
     return $ret;
 }
Exemplo n.º 2
0
 /**
  * Execute a query by the current DAO, localizing it along the way (if needed).
  *
  * @param string $query        the SQL query for execution
  * @param bool   $i18nRewrite  whether to rewrite the query
  * @return object              the current DAO object after the query execution
  */
 function query($query, $i18nRewrite = true)
 {
     // rewrite queries that should use $dbLocale-based views for multi-language installs
     global $dbLocale;
     if ($i18nRewrite and $dbLocale) {
         require_once 'CRM/Core/I18n/Schema.php';
         $query = CRM_Core_I18n_Schema::rewriteQuery($query);
     }
     return parent::query($query);
 }
Exemplo n.º 3
0
 /**
  * Execute a query by the current DAO, localizing it along the way (if needed).
  *
  * @param string $query
  *   The SQL query for execution.
  * @param bool $i18nRewrite
  *   Whether to rewrite the query.
  *
  * @return object
  *   the current DAO object after the query execution
  */
 public function query($query, $i18nRewrite = TRUE)
 {
     // rewrite queries that should use $dbLocale-based views for multi-language installs
     global $dbLocale;
     if ($i18nRewrite and $dbLocale) {
         $query = CRM_Core_I18n_Schema::rewriteQuery($query);
     }
     return parent::query($query);
 }
/**
 * Help function: if we are multi-lingual, rewrite the
 * given query.
 **/
function sumfields_multilingual_rewrite($query)
{
    global $dbLocale;
    if ($dbLocale) {
        return CRM_Core_I18n_Schema::rewriteQuery($query);
    }
    return $query;
}