本文整理匯總了PHP中JDatabase::getTableColumns方法的典型用法代碼示例。如果您正苦於以下問題:PHP JDatabase::getTableColumns方法的具體用法?PHP JDatabase::getTableColumns怎麽用?PHP JDatabase::getTableColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JDatabase
的用法示例。
在下文中一共展示了JDatabase::getTableColumns方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initializeTables
/**
* Method to initialize the database tables.
*
* @return void
*
* @since 12.1
* @throws RuntimeException
*/
protected function initializeTables()
{
// Check if the tables have been initialized.
if (!$this->initialized) {
// Fetch the column data for each table.
foreach ($this->tables as $alias => $table) {
// Get the table columns.
$columns = $this->db->getTableColumns($table, false);
// Set the table columns.
$this->columns[$alias] = $columns;
}
// Set the initialized flag.
$this->initialized = true;
}
}
示例2: getFields
/**
* Get the columns from database table.
*
* @return mixed An array of the field names, or false if an error occurs.
*
* @since 11.1
*/
public function getFields()
{
static $cache = null;
if ($cache === null) {
// Lookup the fields for this table only once.
$name = $this->_tbl;
$fields = $this->_db->getTableColumns($name, false);
if (empty($fields)) {
$e = new JException(JText::_('JLIB_DATABASE_ERROR_COLUMNS_NOT_FOUND'));
$this->setError($e);
return false;
}
$cache = $fields;
}
return $cache;
}