powerbuilder 與sqlite3資料庫

2021-07-04 06:42:31 字數 2555 閱讀 9715

今天要使用powerbuilder 讀取醫保日誌 ,於是寫了乙個database.dll檔案,用於訪問sqlite3資料庫。

為了方便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)

powerbuilder日期函式

pb系統函式 之 日期時間函式day 功能得到日期型資料中的號數 1到31之間的整數值 語法day date 引數date 要得到號數的日期值返回值 integer。函式執行成功時返回號數 1到31之間的整數值 如果date引數的值為null,則day 函式返回null。dayname 功能得到指定...

PowerBuilder常用技巧

1 怎樣對分組裡的行加上序號,要求每個組裡行的序號從1開始!datawindow物件,用計算域 做分組組號 cumulativesum if 分組列名 1 分組列名 0 0,1 for all 做組內編號 getrow first getrow for group 1 1 2 去掉分組資料視窗的分頁...

mysql profiling的使用與sql分析

mysql在5.0.3版本之後新增了profiling來進行效能分析 首先進入資料庫 show profiles mysql預設是關閉的,也就是off 需要設定成1開啟,也就是on,注意設定以後退出視窗之後會還原,要永久生效貌似需要重啟mysql才行 檢視是否開啟 開啟 set profiling ...