本文整理匯總了PHP中PHPWS_DB::getTableColumns方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHPWS_DB::getTableColumns方法的具體用法?PHP PHPWS_DB::getTableColumns怎麽用?PHP PHPWS_DB::getTableColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::getTableColumns方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _buildBackupTable
public function _buildBackupTable($table)
{
$db = new PHPWS_DB($table);
$result = $db->getTableColumns(TRUE);
foreach ($result as $col) {
if ($col['name'] == 'id') {
continue;
}
$allColumns[] = $col;
}
$columns = PHPWS_DB::parseColumns($allColumns);
$columns[] = 'backup_id int NOT NULL';
$columns[] = 'backup_order smallint NOT NULL';
$sql = 'CREATE TABLE ' . Backup::getBackupTableName($table) . ' (' . implode(', ', $columns) . ')';
return PHPWS_DB::query($sql);
}
示例2: setPermissions
public static function setPermissions($group_id, $module, $level, $subpermissions = NULL)
{
if (empty($group_id) || !is_numeric($group_id)) {
return false;
}
$tableName = Users_Permission::getPermissionTableName($module);
if (!PHPWS_DB::isTable($tableName)) {
return;
}
$db = new PHPWS_DB($tableName);
$db->addWhere('group_id', (int) $group_id);
$db->delete();
$db->resetWhere();
$db->addValue('group_id', (int) $group_id);
$columns = $db->getTableColumns();
$db->addValue('permission_level', (int) $level);
if ($level == NO_PERMISSION) {
unset($subpermissions);
Users_Permission::clearItemPermissions($module, $group_id);
}
if (isset($subpermissions)) {
foreach ($columns as $colName) {
if ($colName == 'permission_level' || $colName == 'group_id') {
continue;
}
if (isset($subpermissions[$colName]) && (int) $subpermissions[$colName] == 1) {
$db->addValue($colName, 1);
} else {
$db->addValue($colName, 0);
}
}
}
return $db->insert();
}