瀏覽代碼

Update AUTO_INCREMENT 自动增长的ID

Zhu Jinhui 7 年之前
父節點
當前提交
16d6368646
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/Driver/Base.php

+ 5 - 3
src/Driver/Base.php

@@ -104,10 +104,11 @@ class Base
 	/**
 	 * 获取指定数据表的所有字段
 	 * @param string $table 表名
-	 * @param string $database 数据库名 
+	 * @param string $database 数据库名
+     * @param string $autoIncr 自动增长的序号
 	 * @return array
 	 */
-	public function getTableInfo($table, $database = null)
+	public function getTableInfo($table, $database = null, $autoIncr = null)
 	{
 		if(!$database) $database = $this->currentDB;
 		$sql = "SELECT * from information_schema.COLUMNS where table_name = '".$table."' and table_schema = '".$database."'";
@@ -165,7 +166,7 @@ class Base
 				$data['rules']['default'][$row['COLUMN_NAME']] = $row['COLUMN_DEFAULT'];
 			}
 		}
-		$data['sql'] = $this->getTableSQL($table, $database);
+		$data['sql'] = $this->getTableSQL($table, $database, $autoIncr);
 		return $data;
 	}
 	/**
@@ -244,6 +245,7 @@ class Base
 			throw new \Exception('数据表不存在', __LINE__);
 		}
 		$sql = $row['Create Table'];
+            echo $autoIncr;
 		if($autoIncr === null) {
 			return $sql;
 		}