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


PHP JDatabase::getErrorMsg方法代码示例

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


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

示例1: store

 /**
  * Inserts a new row if id is zero or updates an existing row in the database table
  *
  * Can be overloaded/supplemented by the child class
  *
  * @access public
  * @param boolean If false, null object variables are not updated
  * @return null|string null if successful otherwise returns and error message
  */
 function store($updateNulls = false)
 {
     $k = $this->_tbl_key;
     if ($this->{$k}) {
         $ret = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls);
     } else {
         //loading libraries
         $properties = $this->getProperties();
         //loading resources
         $user =& eFactory::getUser();
         //initializing object properties
         $this->_juser_id = $user->id;
         $this->{$k} = create_guid();
         if (array_key_exists('created_on', $properties)) {
             $this->created_on = date('Y-m-d H:i:s', time());
         }
         if ($ret = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key)) {
             $this->saveRelationship('juser');
         }
     }
     if (!$ret) {
         $this->setError(get_class($this) . '::store failed - ' . $this->_db->getErrorMsg());
         return false;
     } else {
         return true;
     }
 }
开发者ID:Jonathonbyrd,项目名称:Joomla-Listings,代码行数:36,代码来源:table.php

示例2: truncate

 /**
  * Default truncate method
  *
  * can be overloaded/supplemented by the child class
  *
  * @access public
  * @return true if successful otherwise returns and error message
  */
 function truncate()
 {
     $query = 'TRUNCATE ' . $this->_db->quoteName($this->_tbl);
     $this->_db->setQuery($query);
     if ($this->_db->query()) {
         return true;
     } else {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
 }
开发者ID:Lothurm,项目名称:J3.x,代码行数:19,代码来源:JMFPKtable.php

示例3: canDelete

 /**
  * Generic check for whether dependencies exist for this object in the database schema
  *
  * Can be overloaded/supplemented by the child class
  *
  * @param   mixed  $pk     An optional primary key value check the row for.  If not
  * set the instance property value is used.
  * @param   array  $joins  An optional array to compiles standard joins formatted like:
  * [label => 'Label', name => 'table name' , idfield => 'field', joinfield => 'field']
  *
  * @return  boolean  True on success.
  *
  * @deprecated    12.1
  * @link    http://docs.joomla.org/JTable/canDelete
  * @since   11.1
  */
 public function canDelete($pk = null, $joins = null)
 {
     // Deprecation warning.
     JLog::add('JTable::canDelete() is deprecated.', JLog::WARNING, 'deprecated');
     // Initialise variables.
     $k = $this->_tbl_key;
     $pk = is_null($pk) ? $this->{$k} : $pk;
     // If no primary key is given, return false.
     if ($pk === null) {
         return false;
     }
     if (is_array($joins)) {
         // Get a query object.
         $query = $this->_db->getQuery(true);
         // Setup the basic query.
         $query->select($this->_db->quoteName($this->_tbl_key));
         $query->from($this->_db->quoteName($this->_tbl));
         $query->where($this->_db->quoteName($this->_tbl_key) . ' = ' . $this->_db->quote($this->{$k}));
         $query->group($this->_db->quoteName($this->_tbl_key));
         // For each join add the select and join clauses to the query object.
         foreach ($joins as $table) {
             $query->select('COUNT(DISTINCT ' . $table['idfield'] . ') AS ' . $table['idfield']);
             $query->join('LEFT', $table['name'] . ' ON ' . $table['joinfield'] . ' = ' . $k);
         }
         // Get the row object from the query.
         $this->_db->setQuery((string) $query, 0, 1);
         $row = $this->_db->loadObject();
         // Check for a database error.
         if ($this->_db->getErrorNum()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $msg = array();
         $i = 0;
         foreach ($joins as $table) {
             $k = $table['idfield'] . $i;
             if ($row->{$k}) {
                 $msg[] = JText::_($table['label']);
             }
             $i++;
         }
         if (count($msg)) {
             $this->setError("noDeleteRecord" . ": " . implode(', ', $msg));
             return false;
         } else {
             return true;
         }
     }
     return true;
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:66,代码来源:table.php

示例4: jotcache_upgrade

function jotcache_upgrade(JDatabase $db)
{
    $message = '';
    $query = $db->getQuery(true);
    $query->select('COUNT(*)')->from('#__jotcache_exclude')->where('type=1');
    $tplex_count = $db->setQuery($query)->loadResult();
    if ($tplex_count == 0) {
        return false;
    }
    $query->clear('where');
    $query->where('type=4');
    $count = $db->setQuery($query)->loadResult();
    if ($count == 0) {
        $query->clear('select')->clear('where');
        $query->select($db->quoteName('value'))->from($db->quoteName('#__template_styles', 's'))->where('name=s.id')->where('type=1')->order('s.home');
        $defs = $db->setQuery($query)->loadResultArray();
        $positions = array();
        foreach ($defs as $def) {
            $def_array = unserialize($def);
            $positions = array_merge($positions, $def_array);
        }
        $query->clear();
        $query->select('position')->from('#__modules')->where('client_id = 0')->where('published = 1')->where('position <>' . $db->quote(''))->group('position')->order('position');
        $db->setQuery($query);
        $items = $db->loadResultArray();
        $cleaned_positions = array();
        foreach ($items as $item) {
            if (array_key_exists($item, $positions)) {
                $cleaned_positions[$item] = $positions[$item];
            }
        }
        $defs = serialize($cleaned_positions);
        $query->clear();
        $query->insert('#__jotcache_exclude')->columns('name,value,type')->values('1,' . $db->quote($defs) . ',4');
        if ($db->setQuery($query)->query()) {
            $message = "TABLE #__jotcache_exclude has been upgraded. Check JotCache TPL exclude definitions for correct values.";
        } else {
            JError::raiseNotice(100, $db->getErrorMsg());
        }
        return $message;
    }
}
开发者ID:alesconti,项目名称:FF_2015,代码行数:42,代码来源:install.php

示例5: getExistingRecords

 /**
  * get exisiting records sets, optionally filtered by inn list
  *
  * @param string $table table suffix
  * @param array $filter array of inns or numbers
  * @return array of record objects
  */
 private function getExistingRecords($filter = array(), $table = "")
 {
     if ($table && $table == "_oldcert") {
         $fields = "id,number,adding_date";
         $wherefld = "number";
     } else {
         $fields = "id,inn,adding_date";
         $wherefld = "inn";
     }
     $sql = "SELECT {$fields} FROM #__sro{$table} ";
     if (!empty($filter)) {
         $numbers = implode(",", $filter);
         $sql .= " WHERE {$wherefld} IN ({$numbers})";
     }
     $this->_db->setQuery($sql);
     $result = $this->_db->loadObjectList($wherefld);
     if (is_null($result)) {
         $this->setError("Ошибка при загрузке существующих данных:" . $this->_db->getErrorMsg());
         return array();
     }
     return $result;
 }
开发者ID:salatproduction,项目名称:SRO-Registry-Joomla,代码行数:29,代码来源:update.php

示例6: addItem

	public function addItem(){
		
		$this->db->setQuery("
		
			Insert 
			Into 
				#__facileforms_integrator_items
			(
				rule_id,
				element_id,
				reference_column
			)
			Values
			(
				".$this->db->Quote(JRequest::getInt('id',-1)).",
				".$this->db->Quote(JRequest::getInt('element_id',-1)).",
				".$this->db->Quote(JRequest::getVar('reference_column',''))."
			)
		
		");
		$this->db->query();
		echo $this->db->getErrorMsg();
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:23,代码来源:integrator.class.php

示例7: publish

 /**
  * Generic Publish/Unpublish function
  *
  * @access public
  * @param array An array of id numbers
  * @param integer 0 if unpublishing, 1 if publishing
  * @param integer The id of the user performnig the operation
  * @since 1.0.4
  */
 function publish($cid = null, $publish = 1, $user_id = 0)
 {
     JArrayHelper::toInteger($cid);
     $user_id = (int) $user_id;
     $publish = (int) $publish;
     $k = $this->_tbl_key;
     if (count($cid) < 1) {
         if ($this->{$k}) {
             $cid = array($this->{$k});
         } else {
             $this->setError("No items selected.");
             return false;
         }
     }
     $cids = $k . '=' . implode(' OR ' . $k . '=', $cid);
     $query = 'UPDATE ' . $this->_tbl . ' SET published = ' . (int) $publish . ' WHERE (' . $cids . ')';
     $checkin = in_array('checked_out', array_keys($this->getProperties()));
     if ($checkin) {
         $query .= ' AND (checked_out = 0 OR checked_out = ' . (int) $user_id . ')';
     }
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (count($cid) == 1 && $checkin) {
         if ($this->_db->getAffectedRows() == 1) {
             $this->checkin($cid[0]);
             if ($this->{$k} == $cid[0]) {
                 $this->published = $publish;
             }
         }
     }
     $this->setError('');
     return true;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:45,代码来源:table.php

示例8: getErrorMsg

 /**
  * Restituisce l'ultimo messaggio di errore
  * @return string
  */
 public function getErrorMsg()
 {
     return $this->db->getErrorMsg();
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:8,代码来源:ProPayment_Database.php

示例9: addItem

 public function addItem()
 {
     $this->db->setQuery("\n\t\t\n\t\t\tInsert \n\t\t\tInto \n\t\t\t\t#__facileforms_integrator_items\n\t\t\t(\n\t\t\t\trule_id,\n\t\t\t\telement_id,\n\t\t\t\treference_column\n\t\t\t)\n\t\t\tValues\n\t\t\t(\n\t\t\t\t" . $this->db->Quote(JRequest::getInt('id', -1)) . ",\n\t\t\t\t" . $this->db->Quote(JRequest::getInt('element_id', -1)) . ",\n\t\t\t\t" . $this->db->Quote(JRequest::getVar('reference_column', '')) . "\n\t\t\t)\n\t\t\n\t\t");
     $this->db->query();
     echo $this->db->getErrorMsg();
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:6,代码来源:integrator.class.php

示例10: getErrorMsg

 /**
  * Gets error message
  *
  * @deprecated 2.0 (use exceptions instead)
  *
  * @return string The error message for the most recent query
  */
 public function getErrorMsg()
 {
     return stripslashes($this->_db->getErrorMsg());
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:11,代码来源:CmsDatabaseDriver.php


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