1 頁 (共 1 頁)

SQLite3 for [x]Harbour(*mdy:2011.12.15) version 3.7.9

發表於 : 2014-09-23, 12:23
admin
*2011.12.15:

代碼: 選擇全部

       add: support field type about 'DATE' and 'TIMESTAME'. 
       modify: METHOD CreateTable CLASS TSQLiteServer 
                    if have AUTO_INCREMENT field and DEFAULT is miss; 
       modify: Static Func ssTrType(aArr) 
                    fix 'D' and 'T' data type default value; 
       add: sqlite.ch 
       add #define DBS_DEFAULT 6 
               now support 'DEFAULT' at struct
Local   aStruct := {{ 'ID'        ,'N', 05,  0, .T.                      },; 
                    { 'NAME'      ,'C', 50,  0, .T., ['']                },; 
                    { 'YY1'       ,'D',  8,  0, .T.                      },; 
                    { 'YY2'       ,'D',  8,  0, .T., ['']                },; 
                    { 'YY3'       ,'D',  8,  0, .T., [CURRENT_DATE]      },; 
                    { 'ZZ1'       ,'T', 19,  0, .T.                      },; // CURRENT_TIMESTAMP 
                    { 'ZZ2'       ,'T', 19,  0, .T., [CURRENT_DATE]      },; // CURRENT_TIMESTAMP 
                    { 'ZZ3'       ,'T', 19,  0, .T., [CURRENT_TIME]      },; // CURRENT_TIMESTAMP 
                    { 'ZZ4'       ,'T', 19,  0, .T., [CURRENT_TIMESTAMP] }}  // CURRENT_TIMESTAMP 
modify: METHOD GetData() CLASS TSQLiteQryAry, 
            METHOD GetData() CLASS TSQLiteQuery 
            support 'DATE' and 'TIMESTAMP' data type; 
           cSQL := [INSERT INTO ADRES ("NAME", "YY1") VALUES ("MARC", "]+PadL(  Year( Date()), 4, '0' )+'-'+; 
                                                                         PadL( Month( Date()), 2, '0' )+'-'+; 
                                                                         PadL(   Day( Date()), 2, '0' )+[") ] 
*2009.12.29: fix: TSQLiteQryAry:FieldGet(xField)
If you try to read the information,
and the table which no information,
will generate an error hearing.

*2007.10.19: Modify: TSQLiteQryAry():GetData()
*2007.10.16: TSQLiteQryAry:GoBottom() -> ::nCurRow := nNumRows -> TO -> ::nCurRow := ::nNumRows

*2007.10.06: change version to 3.5.1

*2007.07.20: change store query data to 'ARRAY'.
Now can switch store data to 'DBF' or 'ARRAY'.
*2007.06.22: upgrade from 3.3.17 to 3.4.0 -> OK

*2007.06.09: mdy: 2007.06.09: TSQLiteQuery:GetData()
when use 'LEFT JOIN cTable2 b ' ...., SQLITE_COLUMN_NAME() get 'b.xxx', erase the 'b.'
Code:

add: Local cFieldName := NIL
mdy: aField[ DBS_NAME ] := aDbfFld[ DBS_NAME ] := SQLITE_COLUMN_NAME( ::stmt, nI-1 ) // 欄位名稱
to: cFieldName := SQLITE_COLUMN_NAME( ::stmt, nI-1 ) // 欄位名稱
If AT( '.', cFieldName ) > 0 // 去除 LEFT JOIN 所產生的 '.'
aField[ DBS_NAME ] := aDbfFld[ DBS_NAME ] := Substr( cFieldName, AT( '.', cFieldName )+1 ) // 欄位名稱
Else
aField[ DBS_NAME ] := aDbfFld[ DBS_NAME ] := cFieldName // 欄位名稱
EndIf

*2007.05.22: modify
mdy: tsqlite.prg
fix: some bug.
mdy: sqlitec.c
add: SQLITE_COLUMN_INT64()/SQLITE_COLUMN_BLOB()

This is a demo about SQLite3 for xHarbour.

you can download sqlite3.exe from http://www.sqlite.org/sqlite-3_5_1.zip to maintain your sqlite3 db.

sqlite.lib is download from http://www.sqlite.org/sqlite-amalgamation-3_5_1.zip can recompile it.

sqlitec.obj is lower level c for xharbour/harbour
tsqlite.prg is SQLite3 for xHarbour class.
sqlite.ch is define file.
test.prg is demo .prg.

If you have any suggest, please post on the forum.