JSON文本文件導入到Sqlite3數據庫(04)

1】Navicat for SQLite ,直接導入,會出現好多問題,即便導入成功,最後一個字常常會是亂碼,這方法放棄編程


2】編程轉換,JSON文本文件中有好多偏僻字,Delphi 裏的UTF8toAnsi函數每每不成功,這方法放棄/由於Delphi自帶的轉換函數遇到其沒法識別的字符串就返回空json

 function DecodeUtf8Str(const S: UTF8String): WideString;
 var lenSrc, lenDst  : Integer;
 begin
   lenSrc  := Length(S);
   if(lenSrc=0)then Exit;
   lenDst  := MultiByteToWideChar(CP_UTF8, 0, Pointer(S), lenSrc, nil, 0);
   SetLength(Result, lenDst);
   MultiByteToWideChar(CP_UTF8, 0, Pointer(S), lenSrc, Pointer(Result), lenDst);
 end;
DecodeUtf8Str解決系統自帶UTF8解碼缺陷

3】JSON文本文件在線轉換成CSV文件,分隔符爲$,而後將結果拷貝到Excel裏,再將Excel文件導入到Navicat for SQLite,完美!ide

UPDATE ciauthor set  name='做者介紹:'||name
insert into atb (id,name,info) 
select ciauthor.value+64051,ciauthor.name,ciauthor.long_desc from ciauthor 

insert into atb (id,name,info) 
select ci.value+65641,ci.rhythmic||'-'||ci.author,ci.content
from ci 

insert into atb (id,name,info) 
select 86691+ROWid, aa.title||'-'||aa.author,aa.paragraphs from aa 

insert into atb (id,name,info) 
select 97748+ROWid, '幽夢影-張潮'||ROWid, aa.content||'---'||aa.comment from aa 
--VACUUM

insert into atb (id,name,info) 
select 98415+ rowID, aax.title||'--'||aax.author
,aax.notes||'--'||aax.paragraphs  from aax

--insert into atb (id,name,info) 
select 99513+ROWid
, Sheet1.title||'--'||Sheet1.author,Sheet1.paragraphs from Sheet1 
用到的SQL
相關文章
相關標籤/搜索