Jelajahi Sumber

数据填充时用当前时间更新 created_at updated_at

visuddhinanda 4 tahun lalu
induk
melakukan
2ad17ce3d5

+ 1 - 1
public/app/install/db_insert_bookword_from_csv_cli.php

@@ -87,7 +87,7 @@ for ($from=$_from-1; $from < $_to; $from++) {
     }else{
         // 开始一个事务,关闭自动提交
         $dbh_word_index->beginTransaction();
-        $query = "INSERT INTO "._TABLE_." (book , wordindex , count) VALUES ( ? , ? , ?  )";
+        $query = "INSERT INTO "._TABLE_." (book , wordindex , count , created_at,updated_at) VALUES ( ? , ? , ? , now(),now() )";
         $stmt = $dbh_word_index->prepare($query);
 
         foreach ($bookword as $key => $value) {

+ 1 - 1
public/app/install/db_insert_palitext_cli.php

@@ -127,7 +127,7 @@ for ($from=$_from-1; $from < $to; $from++) {
     // 开始一个事务,关闭自动提交
     $dbh->beginTransaction();
     
-    $query = "INSERT INTO "._TABLE_." ( book , paragraph , level , class , toc , text , html , lenght ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? )";
+    $query = "INSERT INTO "._TABLE_." ( book , paragraph , level , class , toc , text , html , lenght , created_at,updated_at ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? ,now(),now() )";
     $stmt = $dbh->prepare($query);
     foreach ($arrInserString as $oneParam) {
         if ($oneParam[3] < 100) {

+ 1 - 1
public/app/install/db_insert_word_from_csv_cli.php

@@ -69,7 +69,7 @@ for ($from=$_from-1; $from < $_to; $from++) {
     if (($fpoutput = fopen(_DIR_CSV_PALI_CANON_WORD_ . "/{$from}_words.csv", "r")) !== false) {
         // 开始一个事务,关闭自动提交
         $dbh_word_index->beginTransaction();
-        $query = "INSERT INTO "._TABLE_." ( sn , book , paragraph , wordindex , bold ) VALUES (?,?,?,?,?)";
+        $query = "INSERT INTO "._TABLE_." ( sn , book , paragraph , wordindex , bold ,created_at,updated_at ) VALUES (?,?,?,?,?,now(),now())";
         $stmt = $dbh_word_index->prepare($query);
 
         $count = 0;

+ 2 - 2
public/app/install/db_insert_wordindex_from_csv_cli.php

@@ -47,8 +47,8 @@ try{
 
                 // 开始一个事务,关闭自动提交
                 $dbh_word_index->beginTransaction();
-                $query = "INSERT INTO "._TABLE_." (id , word , word_en , count , normal , bold , is_base , len ) 
-				                            VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)";
+                $query = "INSERT INTO "._TABLE_." (id , word , word_en , count , normal , bold , is_base , len , created_at,updated_at ) 
+				                            VALUES ( ?, ?, ?, ?, ?, ?, ?, ? , now(), now())";
 				try{
 					$stmt = $dbh_word_index->prepare($query);
 				}catch(PDOException $e){

+ 1 - 1
public/app/install/db_update_palitext_cli.php

@@ -122,7 +122,7 @@ $paragraph_count = count($title_data);
 
 // 开始一个事务,关闭自动提交
 $PDO->beginTransaction();
-$query = "UPDATE "._TABLE_." SET level = ? , toc = ? , chapter_len = ? , next_chapter = ?, prev_chapter=? , parent= ?  ,  chapter_strlen = ?  WHERE book=? and paragraph=?";
+$query = "UPDATE "._TABLE_." SET level = ? , toc = ? , chapter_len = ? , next_chapter = ?, prev_chapter=? , parent= ?  ,  chapter_strlen = ? , updated_at = now()  WHERE book=? and paragraph=?";
 $stmt = $PDO->prepare($query);
 
 $paragraph_info = array();

+ 1 - 1
public/app/install/db_update_toc_cli.php

@@ -111,7 +111,7 @@ for ($from=$_from-1; $from < $_to; $from++) {
     
     // 开始一个事务,关闭自动提交
     $dbh->beginTransaction();
-    $query = "INSERT INTO \""._TABLE_."\" (book , paragraph, title, title_en , level, type , language , author , share , create_time , update_time  ) VALUES (  ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+    $query = "INSERT INTO \""._TABLE_."\" (book , paragraph, title, title_en , level, type , language , author , share , create_time , update_time,created_at,updated_at  ) VALUES (  ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,now(),now())";
     try{
 	$stmt = $dbh->prepare($query);
 	}catch(PDOException $e){