當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JDatabaseDriver::Quote方法代碼示例

本文整理匯總了PHP中JDatabaseDriver::Quote方法的典型用法代碼示例。如果您正苦於以下問題:PHP JDatabaseDriver::Quote方法的具體用法?PHP JDatabaseDriver::Quote怎麽用?PHP JDatabaseDriver::Quote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JDatabaseDriver的用法示例。


在下文中一共展示了JDatabaseDriver::Quote方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 /**
  * Method to provide a shortcut to binding, checking and storing a JTable
  * instance to the database table.  The method will check a row in once the
  * data has been stored and if an ordering filter is present will attempt to
  * reorder the table rows based on the filter.  The ordering filter is an instance
  * property name.  The rows that will be reordered are those whose value matches
  * the JTable instance for the property specified.
  *
  * @param   mixed   $src             An associative array or object to bind to the JTable instance.
  * @param   string  $orderingFilter  Filter for the order updating
  * @param   mixed   $ignore          An optional array or space separated list of properties
  *                                   to ignore while binding.
  *
  * @return  boolean  True on success.
  *
  * @link	http://docs.joomla.org/JTable/save
  * @since   11.1
  */
 public function save($src, $orderingFilter = '', $ignore = '')
 {
     // Attempt to bind the source to the instance.
     if (!$this->bind($src, $ignore)) {
         return false;
     }
     // Run any sanity checks on the instance and verify that it is ready for storage.
     if (!$this->check()) {
         return false;
     }
     // Attempt to store the properties to the database table.
     if (!$this->store()) {
         return false;
     }
     // Attempt to check the row in, just in case it was checked out.
     if (!$this->checkin()) {
         return false;
     }
     // If an ordering filter is set, attempt reorder the rows in the table based on the filter and value.
     if ($orderingFilter) {
         $filterValue = $this->{$orderingFilter};
         $this->reorder($orderingFilter ? $this->_db->quoteName($orderingFilter) . ' = ' . $this->_db->Quote($filterValue) : '');
     }
     // Set the error to empty and return true.
     $this->setError('');
     return true;
 }
開發者ID:ranwaldo,項目名稱:joomla-platform,代碼行數:45,代碼來源:table.php

示例2: postInstallSampleData

 /**
  * method to update the user id of the sample data content to the new rand user id
  *
  * @param   JDatabaseDriver  $db  Database connector object $db*
  *
  * @return  void
  *
  * @since   3.0
  */
 protected function postInstallSampleData($db)
 {
     // Create the ID for the root user
     $userId = self::getUserId();
     // Update all created_by field of the tables with the random user id
     // categories (created_user_id), contact_details, content, newsfeeds, weblinks
     $updates_array = array('categories' => 'created_user_id', 'contact_details' => 'created_by', 'content' => 'created_by', 'newsfeeds' => 'created_by', 'weblinks' => 'created_by');
     foreach ($updates_array as $table => $field) {
         $db->setQuery('UPDATE ' . $db->quoteName('#__' . $table) . ' SET ' . $db->quoteName($field) . ' = ' . $db->Quote($userId));
         $db->execute();
     }
 }
開發者ID:rasiodesign,項目名稱:joomla-cms,代碼行數:21,代碼來源:database.php


注:本文中的JDatabaseDriver::Quote方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。