Procházet zdrojové kódy

Merge branch 'master' of https://github.com/iapt-platform/mint

bhikkhu-kosalla-china před 4 roky
rodič
revize
db3cac018d
1 změnil soubory, kde provedl 12 přidání a 4 odebrání
  1. 12 4
      app/install/db_insert_wordindex_from_csv_cli.php

+ 12 - 4
app/install/db_insert_wordindex_from_csv_cli.php

@@ -40,16 +40,24 @@ try{
 
 
                 // 开始一个事务,关闭自动提交
                 // 开始一个事务,关闭自动提交
                 $dbh_word_index->beginTransaction();
                 $dbh_word_index->beginTransaction();
-                $query = "INSERT INTO "._TABLE_." (id , word , word_en , count , normal , bold , is_base , len ) VALUES (?,?,?,?,?,?,?,?)";
-        
-                $stmt = $dbh_word_index->prepare($query);
+                $query = "INSERT INTO "._TABLE_." (id , word , word_en , count , normal , bold , is_base , len ) 
+				                            VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)";
+				try{
+					$stmt = $dbh_word_index->prepare($query);
+				}catch(PDOException $e){
+					fwrite(STDERR,"error:".$e->getMessage()." At Line: ".$e->getLine().PHP_EOL);
+					exit;
+				}
+                
         
         
                 $count = 0;
                 $count = 0;
                 while (($data = fgetcsv($fpoutput, 0, ',')) !== false) {
                 while (($data = fgetcsv($fpoutput, 0, ',')) !== false) {
 					try{
 					try{
 						$stmt->execute($data);
 						$stmt->execute($data);
 					}catch(PDOException $e){
 					}catch(PDOException $e){
-						fwrite(STDERR,$e->getMessage());
+						fwrite(STDERR,"error:".$e->getMessage()." At Line: ".$e->getLine().PHP_EOL);
+						fwrite(STDERR,"error-data:".implode(",",$data).PHP_EOL);
+						exit;
 					}
 					}
                     
                     
                     $count++;
                     $count++;