$iCurrPara){
//echo "new paragraph
";
$iWord=0;
if($i>1){
//echo "上一段结束
";
if(strlen(trim($sent))>0){
$end = $wordlist[$i-1][16];
$arrSent[]=array($book,$iCurrPara,$begin,$end,mb_strlen(trim($sent_real),"UTF-8"),$wordcount,$sent,$sent_html,trim($sent_real),getWordEn($sent_real));
//echo "end={$end}
";
//echo "[{$iCurrPara}-{$begin}-{$end}]({$wordcount})
{$sent}
{$sent_real}
".getWordEn($sent_real)."
";
}
$iCurrPara=$wordlist[$i][3];
$Note_Mark1=0;
$Note_Mark2=0;
$Note_Mark = 0;
$pre=$wordlist[$i-1];
$curr=$wordlist[$i];
if($i0){
$end = $wordlist[$i][16];
$arrSent[]=array($book,$iCurrPara,$begin,$end,mb_strlen(trim($sent_real),"UTF-8"),$wordcount,$sent,$sent_html,trim($sent_real),getWordEn($sent_real));
//echo "end={$end}
";
//echo "[{$iCurrPara}-{$begin}-{$end}]({$wordcount})
{$sent}
{$sent_real}
".getWordEn($sent_real)."
";
$sent="";
$sent_html="";
$sent_real="";
$iSent++;
$begin = $wordlist[$i][16]+1;
$wordcount=0;
}
$iWord++;
}
if(strlen(trim($sent))>0){
$end = $wordlist[count($wordlist)-1][16];
$arrSent[]=array($book,$iCurrPara,$begin,$end,mb_strlen(trim($sent_real),"UTF-8"),$wordcount,$sent,$sent_html,trim($sent_real),getWordEn($sent_real));
//echo "end={$end}
";
//echo "[{$iCurrPara}-{$begin}-{$end}]({$wordcount})
{$sent}
{$sent_real}
".getWordEn($sent_real)."
";
}
}
else{
echo "can not open csv file. filename=".$dirXmlBase.$dirXml.$outputFileNameHead.".csv";
}
// 开始一个事务,关闭自动提交
PDO_Connect("sqlite:$db_file");
$PDO->beginTransaction();
$query="INSERT INTO pali_sent ('id','book','paragraph','begin','end','length','count','text','html','real','real_en') VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
$stmt = $PDO->prepare($query);
foreach($arrSent as $oneParam){
$stmt->execute($oneParam);
}
// 提交更改
$PDO->commit();
if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
$error = PDO_ErrorInfo();
echo "error - $error[2]
";
$log=$log."$from, $FileName, error, $error[2] \r\n";
}
else{
$count=count($arrSent);
echo "updata $count recorders.";
}
$myLogFile = fopen(_DIR_LOG_."insert_sent.log", "a");
fwrite($myLogFile, $log);
fclose($myLogFile);
?>
=$to){
echo "齐活!功德无量!all done!
";
}
else{
echo "";
echo "正在载入:".($from+1)."——".$filelist[$from+1][0];
}
?>