Esempio n. 1
0
 /**
  * Used for syncing INSERT, UPDATE, DELETE, and other queries that don't return rows.
  * Returns number of affected rows.
  *
  * @param  string 	$sql 		The query to run.
  * @return integer 	The number of rows affected by $sql.
  */
 public function sync($sql)
 {
     // Match all of the database tables in the query using the prefix modifier
     if (preg_match($this->_tables_regex, $sql, $tName)) {
         if ($this->isTableTranslatable($tName[1])) {
             foreach (array_keys($this->_languages) as $language) {
                 if ($language == $this->_lang_primary) {
                     continue;
                 }
                 $query = str_replace($tName[0], $this->_object->nameQuote('#__' . strtolower($language) . '_' . $tName[1]) . $tName[2], $sql);
                 if (parent::execute($query) === false) {
                     $this->setError($this->getErrorMsg());
                     return false;
                 }
             }
         }
     }
     return 0;
 }