線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2531
推到 Plurk!
推到 Facebook!

delphi 6 + sqlite3

答題得分者是:t27
jonathan
一般會員


發表:6
回覆:7
積分:7
註冊:2002-03-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2011-11-09 15:15:25 IP:114.32.xxx.xxx 訂閱
 請問若使用 D6 的 adoconnection 去連接 sqlite , 請問provider 應如何選擇?

PS:我目前已開發的系統有連接 oracle , MS sql server , dbase 等 ,
但目前這個案子是連接 sqlite3,這 還是第一次使用

謝謝 !
編輯記錄
jonathan 重新編輯於 2011-11-09 00:35:58, 註解 無‧
aftcast
站務副站長


發表:81
回覆:1485
積分:1763
註冊:2002-11-21

發送簡訊給我
#2 引用回覆 回覆 發表時間:2011-11-09 19:24:18 IP:122.126.xxx.xxx 訂閱
ADO 恐沒辦法。

建議可參考下面的連結

http://www.itwriting.com/blog/?page_id=659
------


蕭沖
--All ideas are worthless unless implemented--

C++ Builder Delphi Taiwan G+ 社群
http://bit.ly/cbtaiwan
rick060
高階會員


發表:2
回覆:112
積分:217
註冊:2009-11-17

發送簡訊給我
#3 引用回覆 回覆 發表時間:2011-11-14 16:54:19 IP:60.250.xxx.xxx 未訂閱
 有沒有考慮自己直接玩弄 API ?


unit Utility_sqlite3;
interface
type
sqlite3_stmt = Pointer;
Psqlite3_stmt = PPointer;
sqlite3 = Pointer;
Psqlite3 = PPointer;
sqlite3_destructor_type = Pointer;
const
SQLITE_OK = 0 ;// Successful result
// beginning-of-error-codes
SQLITE_ERROR = 1 ;// SQL error or missing database
SQLITE_INTERNAL = 2 ;// Internal logic error in SQLite
SQLITE_PERM = 3 ;// Access permission denied
SQLITE_ABORT = 4 ;// Callback routine requested an abort
SQLITE_BUSY = 5 ;// The database file is locked
SQLITE_LOCKED = 6 ;// A table in the database is locked
SQLITE_NOMEM = 7 ;// A malloc() failed
SQLITE_READONLY = 8 ;// Attempt to write a readonly database
SQLITE_INTERRUPT = 9 ;// Operation terminated by sqlite3_interrupt()
SQLITE_IOERR = 10 ;// Some kind of disk I/O error occurred
SQLITE_CORRUPT = 11 ;// The database disk image is malformed
SQLITE_NOTFOUND = 12 ;// Unknown opcode in sqlite3_file_control()
SQLITE_FULL = 13 ;// Insertion failed because database is full
SQLITE_CANTOPEN = 14 ;// Unable to open the database file
SQLITE_PROTOCOL = 15 ;// Database lock protocol error
SQLITE_EMPTY = 16 ;// Database is empty
SQLITE_SCHEMA = 17 ;// The database schema changed
SQLITE_TOOBIG = 18 ;// String or BLOB exceeds size limit
SQLITE_CONSTRAINT = 19 ;// Abort due to constraint violation
SQLITE_MISMATCH = 20 ;// Data type mismatch
SQLITE_MISUSE = 21 ;// Library used incorrectly
SQLITE_NOLFS = 22 ;// Uses OS features not supported on host
SQLITE_AUTH = 23 ;// Authorization denied
SQLITE_FORMAT = 24 ;// Auxiliary database format error
SQLITE_RANGE = 25 ;// 2nd parameter to sqlite3_bind out of range
SQLITE_NOTADB = 26 ;// File opened that is not a database file
SQLITE_ROW = 100 ;// sqlite3_step() has another row ready
SQLITE_DONE = 101 ;// sqlite3_step() has finished executing
SQLITE_STATIC = 0;
SQLITE_TRANSIENT = -1;
//basic Function
function sqlite3_open(const filename : PAnsiChar ; ppDb : Psqlite3) : Integer; stdcall ; external 'sqlite3';
function sqlite3_close(pDb : sqlite3): Integer; stdcall ; external 'sqlite3';
function sqlite3_step( pStmt : sqlite3_stmt): Integer; stdcall ; external 'sqlite3';
function sqlite3_exec( pDb : sqlite3 ; const sql : PAnsiChar ; pCallBack : Cardinal ; pParam : Pointer ; errmsg : PPAnsiChar): Integer; stdcall ; external 'sqlite3';
function sqlite3_errcode(pDb : sqlite3): Integer; stdcall ; external 'sqlite3';
function sqlite3_errmsg(pDb : sqlite3): PAnsiChar ; stdcall ; external 'sqlite3';
function sqlite3_finalize(pStmt : sqlite3_stmt): Integer; stdcall ; external 'sqlite3';
function sqlite3_prepare(pDb : sqlite3;const zSql : PAnsiChar; nByte : Integer ; ppStmt : Psqlite3_stmt ; pzTail : PPAnsiChar): Integer; stdcall ; external 'sqlite3';
procedure sqlite3_free( ptr : Pointer); stdcall ; external 'sqlite3';
//Binding Function
function sqlite3_bind_int(pStmt : sqlite3_stmt; nParamIndex : Integer; nValue : Integer): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_int64(pStmt : sqlite3_stmt; nParamIndex : Integer; nValue : Int64): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_double(pStmt : sqlite3_stmt; nParamIndex : Integer; dlValue : Double): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_null(pStmt : sqlite3_stmt; nParamIndex : Integer): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_zeroblob(pStmt : sqlite3_stmt; nParamIndex : Integer; nValue : Integer): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_text(pStmt : sqlite3_stmt; nParamIndex : Integer; const szValue : PAnsiChar; nLength : Integer; destructorType : Integer): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_text16(pStmt : sqlite3_stmt; nParamIndex : Integer; const szValue : PAnsiChar; nLength : Integer; destructorType : Cardinal): Integer; stdcall ; external 'sqlite3';
function sqlite3_bind_blob(pStmt : sqlite3_stmt; nParamIndex : Integer; const pBuffer : Pointer ; nLength : Integer; destructorType : Cardinal): Integer; stdcall ; external 'sqlite3';
//Fetch Function
function sqlite3_column_blob(pStmt : sqlite3_stmt; iCol : Integer) : Pointer ; stdcall ; external 'sqlite3';
function sqlite3_column_bytes(pStmt : sqlite3_stmt; iCol : Integer): Integer ; stdcall ; external 'sqlite3';
function sqlite3_column_bytes16(pStmt : sqlite3_stmt; iCol : Integer): Integer ; stdcall ; external 'sqlite3';
function sqlite3_column_double(pStmt : sqlite3_stmt; iCol : Integer) : Double; stdcall ; external 'sqlite3';
function sqlite3_column_int(pStmt : sqlite3_stmt; iCol : Integer): Integer ; stdcall ; external 'sqlite3';
function sqlite3_column_int64(pStmt : sqlite3_stmt; iCol : Integer): Int64 ; stdcall ; external 'sqlite3';
function sqlite3_column_text(pStmt : sqlite3_stmt; iCol : Integer):PAnsiChar; stdcall ; external 'sqlite3';
function sqlite3_column_text16(pStmt : sqlite3_stmt; iCol : Integer):pointer; stdcall ; external 'sqlite3';
function sqlite3_column_type(pStmt : sqlite3_stmt; iCol : Integer): Integer ; stdcall ; external 'sqlite3';
// SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
//sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);;
implementation
end.
aftcast
站務副站長


發表:81
回覆:1485
積分:1763
註冊:2002-11-21

發送簡訊給我
#4 引用回覆 回覆 發表時間:2011-11-15 22:23:09 IP:122.126.xxx.xxx 訂閱
 今本版的會員gradnruru和我說,也許可以試odbc的driver,然後配合ado來處理。
可以試看看。

odbc的網站在下面

http://www.ch-werner.de/sqliteodbc/
------


蕭沖
--All ideas are worthless unless implemented--

C++ Builder Delphi Taiwan G+ 社群
http://bit.ly/cbtaiwan
GrandRURU
站務副站長


發表:240
回覆:1680
積分:1874
註冊:2005-06-21

發送簡訊給我
#5 引用回覆 回覆 發表時間:2011-11-17 09:09:22 IP:59.120.xxx.xxx 未訂閱
以下功能使用 Dbexpress 實現,在XE2會有更好的效能

t27
中階會員


發表:34
回覆:95
積分:90
註冊:2002-06-19

發送簡訊給我
#6 引用回覆 回覆 發表時間:2011-11-17 16:25:12 IP:61.224.xxx.xxx 訂閱
 請問Dbexpress 要如何連接sqlite3 ?

GrandRURU
站務副站長


發表:240
回覆:1680
積分:1874
註冊:2005-06-21

發送簡訊給我
#7 引用回覆 回覆 發表時間:2011-11-17 16:48:59 IP:59.120.xxx.xxx 未訂閱
在XE2中裡的Data Explorer內,有個ODBC項目,設定DAC完成後即可使用

===================引 用 t27 文 章===================
請問Dbexpress 要如何連接sqlite3 ?

t27
中階會員


發表:34
回覆:95
積分:90
註冊:2002-06-19

發送簡訊給我
#8 引用回覆 回覆 發表時間:2011-11-20 15:32:07 IP:61.228.xxx.xxx 訂閱
 可參考以下網站資料:
http://source.online.free.fr/
http://www.sqliteexpert.com/


jonathan
一般會員


發表:6
回覆:7
積分:7
註冊:2002-03-28

發送簡訊給我
#9 引用回覆 回覆 發表時間:2011-11-21 14:28:24 IP:114.32.xxx.xxx 訂閱
 謝謝 , 我現使用 http://source.online.free.fr/ 中下載元件測試 ,
目前正在測試中
經我測試 , table 若有中文資料 , 則 SqlitePassDatabase1 fields的值會呈現空白
TsqlPassdataSet元件屬性 database/options/encoding 我只能選擇 UTF8 ,
初步元件測試結果如下:
1. 若我事項先透過 sqliteadmin 產生Table,再編輯Table的中文資料 , 再透過 d6 TsqlPassdataSet 呈現,
則 TsqlPassdataSet 所呈現的中文資料會空白,
2.若使用 D6 TsqlPassdataSet元件編輯 Table的中文資料 ,若再透過 sqliteadmin 工具查看 ,
則中文資料會呈現亂碼
因此我猜測應該與 TsqlPassdataSet元件的 encording 有關
編輯記錄
jonathan 重新編輯於 2011-11-22 23:06:10, 註解 無‧
jonathan 重新編輯於 2011-11-28 20:44:43, 註解 無‧
jonathan 重新編輯於 2011-11-28 20:46:12, 註解 無‧
jonathan 重新編輯於 2011-11-28 20:47:12, 註解 無‧
系統時間:2024-04-19 21:32:44
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!