2012-06-19 12:21 UTC+0200 Viktor Szakats (harbour syenar.net)
+ contrib/hbsqlit3/tests/pngtest.png
! added missing file for test code
* contrib/hbsqlit3/tests/authoriz.prg
* contrib/hbsqlit3/tests/blob.prg
* formatting
This commit is contained in:
@@ -16,6 +16,14 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-19 12:21 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
+ contrib/hbsqlit3/tests/pngtest.png
|
||||
! added missing file for test code
|
||||
|
||||
* contrib/hbsqlit3/tests/authoriz.prg
|
||||
* contrib/hbsqlit3/tests/blob.prg
|
||||
* formatting
|
||||
|
||||
2012-06-19 08:14 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* harbour/src/common/hbffind.c
|
||||
* ulAttr -> nAttr
|
||||
@@ -31,7 +39,7 @@
|
||||
* contrib/hbqt/qtcore/hbqt_bind.cpp
|
||||
+ Added: static HB_CRITICAL_NEW( s_qtMtx ); and parts.
|
||||
+ Tuned: compilable with or without TSD protocol.
|
||||
To turn on TSD protocol, change
|
||||
To turn on TSD protocol, change
|
||||
__HBQT_WITH_MT_SUPPORT__NO => __HBQT_WITH_MT_SUPPORT__
|
||||
|
||||
2012-06-18 21:12 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
|
||||
@@ -83,7 +83,7 @@ PROCEDURE main()
|
||||
LOCAL cSQLTEXT
|
||||
LOCAL pDb, cb
|
||||
|
||||
IF Empty( pDb := PrepareDB(cFile) )
|
||||
IF Empty( pDb := PrepareDB( cFile ) )
|
||||
ErrorLevel( 1 )
|
||||
RETURN
|
||||
ENDIF
|
||||
@@ -92,25 +92,25 @@ PROCEDURE main()
|
||||
|
||||
QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" )
|
||||
cb := @CallBack() // "CallBack"
|
||||
Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) )
|
||||
QOut( cErrorMsg( sqlite3_exec( pDb, cSQLTEXT, cb ) ) )
|
||||
|
||||
sqlite3_sleep( 3000 )
|
||||
// Authorizer2
|
||||
Qout( cErrorMsg(sqlite3_set_authorizer(pDb, @Authorizer2() /*"Authorizer2"*/)) )
|
||||
QOut( cErrorMsg( sqlite3_set_authorizer( pDb, @Authorizer2() /*"Authorizer2"*/ ) ) )
|
||||
|
||||
QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" )
|
||||
Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb)) )
|
||||
QOut( cErrorMsg( sqlite3_exec( pDb, cSQLTEXT, cb ) ) )
|
||||
|
||||
sqlite3_sleep( 3000 )
|
||||
// Authorizer3
|
||||
Qout( cErrorMsg(sqlite3_set_authorizer(pDb, @Authorizer3() /*"Authorizer3"*/)) )
|
||||
QOut( cErrorMsg( sqlite3_set_authorizer( pDb, @Authorizer3() /*"Authorizer3"*/ ) ) )
|
||||
|
||||
QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" )
|
||||
Qout( cErrorMsg(sqlite3_exec(pDb, cSQLTEXT, cb), .F. ) )
|
||||
QOut( cErrorMsg( sqlite3_exec( pDb, cSQLTEXT, cb ), .F. ) )
|
||||
|
||||
sqlite3_sleep( 3000 )
|
||||
//
|
||||
pDb := Nil // close database
|
||||
pDb := NIL // close database
|
||||
|
||||
RETURN
|
||||
|
||||
@@ -201,8 +201,8 @@ STATIC FUNCTION cErrorMsg( nError, lShortMsg )
|
||||
IF nError == 0
|
||||
cErrorMsg := "SQLITE_OK"
|
||||
ELSE
|
||||
nIndex := AScan( aErrorCodes, {|x| x[1] == nError } )
|
||||
cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg )
|
||||
nIndex := AScan( aErrorCodes, {| x | x[ 1 ] == nError } )
|
||||
cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif( lShortMsg, 2, 3 ) ], cErrorMsg )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
@@ -250,7 +250,7 @@ STATIC FUNCTION PrepareDB( cFile )
|
||||
FOR EACH enum IN hPerson
|
||||
sqlite3_reset( pStmt )
|
||||
sqlite3_bind_text( pStmt, 1, enum:__enumKey() )
|
||||
sqlite3_bind_int( pStmt, 2, enum:__enumValue() )
|
||||
sqlite3_bind_int( pStmt, 2, enum:__enumValue() )
|
||||
sqlite3_bind_text( pStmt, 3, hb_md5( enum:__enumKey() ) )
|
||||
sqlite3_step( pStmt )
|
||||
NEXT
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
|
||||
#define TABLE_SQL "CREATE TABLE image( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT(50), image BLOB )"
|
||||
|
||||
PROCEDURE main()
|
||||
LOCAL lCreateIfNotExist := .t.
|
||||
PROCEDURE Main()
|
||||
LOCAL lCreateIfNotExist := .T.
|
||||
LOCAL db := sqlite3_open( "test.s3db", lCreateIfNotExist )
|
||||
LOCAL stmt
|
||||
LOCAL buff, blob
|
||||
@@ -76,7 +76,7 @@ PROCEDURE main()
|
||||
IF sqlite3_bind_text( stmt, 1, "pngtest.png" ) == SQLITE_OK .AND. ;
|
||||
sqlite3_bind_blob( stmt, 2, @buff ) == SQLITE_OK
|
||||
IF sqlite3_step( stmt ) == SQLITE_DONE
|
||||
?"Save pngtest.png into BLOB"
|
||||
? "Save pngtest.png into BLOB"
|
||||
? "INSERT INTO image( title, image ) VALUES( 'pngtest.png', 'pngtest.png' ) - Done"
|
||||
ENDIF
|
||||
ENDIF
|
||||
@@ -92,7 +92,7 @@ PROCEDURE main()
|
||||
sqlite3_sleep( 3000 )
|
||||
|
||||
blob := sqlite3_blob_open( db, NIL, "image", "image", sqlite3_last_insert_rowid( db ), 0 /* 0 - RO; 1- RW */ )
|
||||
IF !Empty( blob )
|
||||
IF ! Empty( blob )
|
||||
? "Open BLOB image - Ok"
|
||||
|
||||
buff := sqlite3_blob_read( blob )
|
||||
@@ -101,7 +101,7 @@ PROCEDURE main()
|
||||
|
||||
? "The size in bytes of the blob - ", sqlite3_blob_bytes( blob )
|
||||
|
||||
IF ( sqlite3_buff_to_file( "pngtest1.png", @buff ) == SQLITE_OK )
|
||||
IF sqlite3_buff_to_file( "pngtest1.png", @buff ) == SQLITE_OK
|
||||
? "Save BLOB into pngtest1.png - Done"
|
||||
ENDIF
|
||||
|
||||
@@ -112,14 +112,14 @@ PROCEDURE main()
|
||||
ENDIF
|
||||
sqlite3_sleep( 3000 )
|
||||
|
||||
?""
|
||||
?"Save BLOB using sqlite3_column_blob()"
|
||||
? ""
|
||||
? "Save BLOB using sqlite3_column_blob()"
|
||||
stmt := sqlite3_prepare( db, "SELECT image FROM image WHERE id == ?5 ")
|
||||
IF !Empty( stmt )
|
||||
IF ! Empty( stmt )
|
||||
IF sqlite3_bind_int64( stmt, 5, sqlite3_last_insert_rowid( db ) ) == SQLITE_OK
|
||||
IF sqlite3_step( stmt ) == SQLITE_ROW
|
||||
buff := sqlite3_column_blob( stmt, 1 )
|
||||
IF ( sqlite3_buff_to_file( "pngtest2.png", @buff ) == SQLITE_OK )
|
||||
IF sqlite3_buff_to_file( "pngtest2.png", @buff ) == SQLITE_OK
|
||||
? "Save BLOB into pngtest2.png - Done"
|
||||
ENDIF
|
||||
buff := NIL
|
||||
|
||||
BIN
harbour/contrib/hbsqlit3/tests/pngtest.png
Normal file
BIN
harbour/contrib/hbsqlit3/tests/pngtest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Reference in New Issue
Block a user