powerbuilder 与sqlite3数据库,
今天要使用powerbuilder 读取医保日志 ,于是写了一个database.dll文件,用于访问sqlite3数据库。
database.dll这个文件使用万能vc++2005编绎,源码:www.sqlite.org中下载3.8.10版本
为了方便pb的使用,将sqlite*指针转化为long类型。
以下是导出的函数声明
function int sqlite3open_v2(string filename,ref long ppDb,int flags,string zVfs) library "database.dll"
function int sqlite3open(string filename,ref long ppDb ) library "database.dll"
function int sqlite3close_v2(long ppDb) library "database.dll"
function int sqlite3close(long ppDb) library "database.dll"
function int sqlite3open16(string filename,ref long db) library "database.dll"
function int sqlite3exec(long db, string sql) library "database.dll"
function string sqlite3errmsg16(long db) library "database.dll"
function string sqlite3errmsg(long db) library "database.dll"
function int sqlite3prepare16(long db,string sql,ref long pStmt) library "database.dll"
function int sqlite3prepare(long db,string sql,ref long pStmt) library "database.dll"
function int sqlite3step(long pStmt) library "database.dll"
function int sqlite3finalize(long pStmt) library "database.dll"
function string sqlite3column_text16(long pStmt,int iCol) library "database.dll"
function string sqlite3column_text(long pStmt,int iCol) library "database.dll"
function string sqlite3column_name16(long pStmt,int iCol) library "database.dll"
function string sqlite3column_name(long pStmt,int iCol) library "database.dll"
function longlong sqlite3last_insert_rowid(long db) library "database.dll"
function int sqlite3changes(long db) library "database.dll"
function int sqlite3data_count(long db) library "database.dll"
function long UTF8ToAnsiString(string lpstring,ref string buff,long nBufflen ) library "database.dll"
示例代码
long ret ,db,record
string value ;
ret = sqlite3open ("e:\\test.db",db)
if(db=0) then
end if
parent.title = string(db)
ret = sqlite3prepare(db,"Select * From table where xh > 1 ",record)
do while(sqlite3step(record) =100)
value = sqlite3column_text(record,5)
loop
string Fieldname;
int iDataCount =0 ;
iDataCount = sqlite3data_count(record)
sqlite3finalize(record);
sqlite3close (db)
我的文件备份下载 database.dll
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。