数组定义规范统一

This commit is contained in:
thinkphp
2013-04-01 11:03:19 +08:00
parent 668aca97c8
commit 6f5db51323
33 changed files with 87 additions and 87 deletions

View File

@@ -26,7 +26,7 @@ class Mysql extends Driver{
$this->initConnect(true);
$sql = 'SHOW COLUMNS FROM `'.$tableName.'`';
$result = $this->query($sql);
$info = array();
$info = [];
if($result) {
foreach ($result as $key => $val) {
$info[$val['Field']] = array(
@@ -49,7 +49,7 @@ class Mysql extends Driver{
public function getTables($dbName='') {
$sql = !empty($dbName)?'SHOW TABLES FROM '.$dbName:'SHOW TABLES ';
$result = $this->query($sql);
$info = array();
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}

View File

@@ -69,7 +69,7 @@ class Oracle extends Driver{
."from user_tab_columns a,(select column_name from user_constraints c,user_cons_columns col "
."where c.constraint_name=col.constraint_name and c.constraint_type='P'and c.table_name='".strtoupper($tableName)
."') b where table_name='".strtoupper($tableName)."' and a.column_name=b.column_name(+)");
$info = array();
$info = [];
if($result) {
foreach ($result as $key => $val) {
$info[strtolower($val['column_name'])] = array(
@@ -91,7 +91,7 @@ class Oracle extends Driver{
*/
public function getTables($dbName='') {
$result = $this->query("select table_name from user_tables");
$info = array();
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}

View File

@@ -26,7 +26,7 @@ class Pgsql extends Driver{
*/
public function getFields($tableName) {
$result = $this->query('select fields_name as "Field",fields_type as "Type",fields_not_null as "Null",fields_key_name as "Key",fields_default as "Default",fields_default as "Extra" from table_msg('.$tableName.');');
$info = array();
$info = [];
if($result){
foreach ($result as $key => $val) {
$info[$val['Field']] = array(
@@ -49,7 +49,7 @@ class Pgsql extends Driver{
*/
public function getTables($dbName='') {
$result = $this->query("select tablename as Tables_in_test from pg_tables where schemaname ='public'");
$info = array();
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}

View File

@@ -26,7 +26,7 @@ class Sqlite extends Driver {
*/
public function getFields($tableName) {
$result = $this->query('PRAGMA table_info( '.$tableName.' )');
$info = array();
$info = [];
if($result){
foreach ($result as $key => $val) {
$info[$val['Field']] = array(
@@ -51,7 +51,7 @@ class Sqlite extends Driver {
$result = $this->query("SELECT name FROM sqlite_master WHERE type='table' "
. "UNION ALL SELECT name FROM sqlite_temp_master "
. "WHERE type='table' ORDER BY name");
$info = array();
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}

View File

@@ -34,7 +34,7 @@ class Sqlsrv extends Driver{
AND t.table_schema = c.table_schema
AND t.table_name = c.table_name
WHERE t.table_name = '$tableName'");
$info = array();
$info = [];
if($result) {
foreach ($result as $key => $val) {
$info[$val['column_name']] = array(
@@ -60,7 +60,7 @@ class Sqlsrv extends Driver{
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
");
$info = array();
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
@@ -117,7 +117,7 @@ class Sqlsrv extends Driver{
* @param array $options 表达式
* @return false | integer
*/
public function delete($options=array()) {
public function delete($options=[]) {
$this->model = $options['model'];
$sql = 'DELETE FROM '
.$this->parseTable($options['table'])