欢迎投稿

今日深度:

powerbuilder 与sqlite3数据库,

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"


后缀是16的函数为powerbuilder12.5中使用的UTF16编码格式,UTF8格式没有详细测试,powerbuilder9.0中没有详细测试,UTF8ToAnsiString(用于方便9.0的编码转换)

示例代码

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

www.htsjk.Com true http://www.htsjk.com/SQLite/33038.html NewsArticle powerbuilder 与sqlite3数据库, 今天要使用powerbuilder 读取医保日志 ,于是写了一个database.dll文件,用于访问sqlite3数据库。 database.dll这个文件使用万能vc++2005编绎,源码:www.sqlite.org中下载...
相关文章
    暂无相关文章
评论暂时关闭