模型的时间戳自动写入支持timestamp类型字段

This commit is contained in:
thinkphp
2016-05-12 21:53:54 +08:00
parent 67cebd8ca1
commit c3af0bb1c4
5 changed files with 29 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ class Oracle extends Connection
*/
public function getFields($tableName)
{
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
$sql = "select a.column_name,data_type,DECODE (nullable, 'Y', 0, 1) notnull,data_default, DECODE (A .column_name,b.column_name,1,0) pk from all_tab_columns a,(select column_name from all_constraints c, all_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 (+)";
$pdo = $this->linkID->query($sql);

View File

@@ -43,6 +43,7 @@ class Pgsql extends Connection
*/
public function getFields($tableName)
{
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
$sql = '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 . ');';
$pdo = $this->linkID->query($sql);

View File

@@ -40,6 +40,7 @@ class Sqlite extends Connection
*/
public function getFields($tableName)
{
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
$sql = 'PRAGMA table_info( ' . $tableName . ' )';
$pdo = $this->linkID->query($sql);

View File

@@ -50,6 +50,7 @@ class Sqlsrv extends Connection
*/
public function getFields($tableName)
{
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
$sql = "SELECT column_name, data_type, column_default, is_nullable
FROM information_schema.tables AS t