2010-03-07 19:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbpgsql/tests/simple.prg
    ! Fixed typo.

  * contrib/hbmysql/tests/test.prg
    * Formatting.
    ; TOFIX: Not a standalone test code.

  * contrib/hbsqlit3/tests/blob.prg
  * contrib/hbsqlit3/tests/pack.prg
  * contrib/hbsqlit3/tests/metadata.prg
  * contrib/hbsqlit3/tests/sl3_test.prg
  * contrib/hbsqlit3/tests/hooks.prg
  * contrib/hbsqlit3/tests/backup.prg
    * Indentation.
This commit is contained in:
Viktor Szakats
2010-03-07 18:03:17 +00:00
parent 5687bf4f6d
commit bfff433b33
9 changed files with 95 additions and 81 deletions

View File

@@ -17,6 +17,22 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-03-07 19:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbpgsql/tests/simple.prg
! Fixed typo.
* contrib/hbmysql/tests/test.prg
* Formatting.
; TOFIX: Not a standalone test code.
* contrib/hbsqlit3/tests/blob.prg
* contrib/hbsqlit3/tests/pack.prg
* contrib/hbsqlit3/tests/metadata.prg
* contrib/hbsqlit3/tests/sl3_test.prg
* contrib/hbsqlit3/tests/hooks.prg
* contrib/hbsqlit3/tests/backup.prg
* Indentation.
2010-03-07 18:42 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbpgsql/tests/simple.prg
! Fixed to use ANSI date format in INSERT command.

View File

@@ -52,84 +52,79 @@
#include "dbstruct.ch"
procedure main(cArg)
PROCEDURE Main( cArg )
local oServer, oQuery2, oRow, aStru
local oQuery
LOCAL oServer, oQuery2, oRow, aStru
LOCAL oQuery
SET CENTURY ON
SET EPOCH TO 1960
oServer := TMySQLServer():New("localhost", "root", "")
if oServer:NetErr()
Alert(oServer:Error())
endif
oServer := TMySQLServer():New( "localhost", "root", "" )
IF oServer:NetErr()
Alert( oServer:Error() )
ENDIF
oServer:SelectDB("ims")
// oQuery := oServer:Query("SELECT * from maga limit 10")
oServer:SelectDB( "ims" )
// oQuery := oServer:Query( "SELECT * from maga limit 10" )
// oRow := oQuery:GetRow()
dbUseArea(.T.,, cArg, "wn", .F.)
dbUseArea( .T.,, cArg, "wn", .F. )
if !oServer:DeleteTable("test")
Alert(oServer:Error())
endif
IF !oServer:DeleteTable( "test" )
Alert( oServer:Error() )
ENDIF
aStru := dbStruct()
if oServer:CreateTable("test", aStru)
Alert("test created successfully")
else
Alert(oServer:Error())
endif
IF oServer:CreateTable( "test", aStru )
Alert( "test created successfully" )
ELSE
Alert( oServer:Error() )
ENDIF
oQuery:=oServer:Query("SELECT C111, C116, C134 from maga limit 10")
oQuery:=oServer:Query( "SELECT C111, C116, C134 from maga limit 10" )
// oRow := oQuery:GetRow()
oServer:Destroy()
while !wn->(eof())
DO WHILE !wn->(Eof())
oQuery2 := oServer:Query("SELECT * from test where CODF='" + wn->CODF + "' and CODP='" + wn->CODP + "'")
oQuery2 := oServer:Query( "SELECT * from test where CODF='" + wn->CODF + "' and CODP='" + wn->CODP + "'" )
if oQuery2:LastRec() > 0
IF oQuery2:LastRec() > 0
? "found "
oRow := oQuery2:GetRow()
oRow:FieldPut(oRow:FieldPos("GIACENZA"), oRow:FieldGet(oRow:FieldPos("GIACENZA")) + wn->GIACENZA)
oRow:FieldPut(oRow:FieldPos("ACQGR"), oRow:FieldGet(oRow:FieldPos("ACQGR")) + wn->ACQGR)
oRow:FieldPut(oRow:FieldPos("ACQDI"), oRow:FieldGet(oRow:FieldPos("ACQDI")) + wn->ACQDI)
if !oQuery2:Update(oRow)
Alert(oQuery2:Error())
endif
else
oRow:FieldPut( oRow:FieldPos( "GIACENZA" ), oRow:FieldGet( oRow:FieldPos( "GIACENZA" ) ) + wn->GIACENZA )
oRow:FieldPut( oRow:FieldPos( "ACQGR" ), oRow:FieldGet( oRow:FieldPos( "ACQGR" ) ) + wn->ACQGR )
oRow:FieldPut( oRow:FieldPos( "ACQDI" ), oRow:FieldGet( oRow:FieldPos( "ACQDI" ) ) + wn->ACQDI )
IF ! oQuery2:Update( oRow )
Alert( oQuery2:Error() )
ENDIF
ELSE
? wn->CODF + " " + wn->CODP
oRow := oQuery:GetBlankRow()
oRow:FieldPut(oRow:FieldPos("CODF"), wn->CODF)
oRow:FieldPut(oRow:FieldPos("CODP"), wn->CODP)
oRow:FieldPut(oRow:FieldPos("GIACENZA"), wn->GIACENZA)
oRow:FieldPut(oRow:FieldPos("DATA"), wn->DATA + 365 * 100)
oRow:FieldPut(oRow:FieldPos("ACQGR"), wn->ACQGR)
oRow:FieldPut(oRow:FieldPos("ACQDI"), wn->ACQDI)
oRow:FieldPut( oRow:FieldPos( "CODF" ), wn->CODF )
oRow:FieldPut( oRow:FieldPos( "CODP" ), wn->CODP )
oRow:FieldPut( oRow:FieldPos( "GIACENZA" ), wn->GIACENZA )
oRow:FieldPut( oRow:FieldPos( "DATA" ), wn->DATA + 365 * 100 )
oRow:FieldPut( oRow:FieldPos( "ACQGR" ), wn->ACQGR )
oRow:FieldPut( oRow:FieldPos( "ACQDI" ), wn->ACQDI )
if !oQuery:Append(oRow)
Alert(oQuery:Error())
endif
endif
IF ! oQuery:Append( oRow )
Alert( oQuery:Error() )
ENDIF
ENDIF
wn->(dbSkip())
enddo
ENDDO
wn->(dbCloseArea())
return
RETURN

View File

@@ -9,7 +9,7 @@ FUNCTION Main( cHost, cDatabase, cUser, cPass )
LOCAL cQuery
oServer := TPQServer():New(cHost, cDatabase, cUser, cPass)
oServer := TPQServer():New( cHost, cDatabase, cUser, cPass )
IF oServer:NetErr()
? oServer:ErrorMsg()
@@ -17,7 +17,7 @@ FUNCTION Main( cHost, cDatabase, cUser, cPass )
ENDIF
oServer:SetVerbosity( 2 )
oServer:traceon( "lixo.log" )
oServer:traceon( "simple.log" )
? "Tables..."
@@ -70,8 +70,8 @@ FUNCTION Main( cHost, cDatabase, cUser, cPass )
oServer:StartTransaction()
FOR i := 1 TO 10
cQuery := "INSERT INTO test(code, dept, name, sales, tax, salary, budget, Discount, Creation, Description) "
cQuery += "VALUES( " + Str( i ) + ", 2, "TEST", "y", 5, 3000, 1500.2, 7.5, "2003-12-17", "Short Description about what ? ")"
cQuery := "INSERT INTO test(code, dept, name, sales, tax, salary, budget, Discount, Creation, Description) " +;
"VALUES( " + Str( i ) + ', 2, "TEST", "y", 5, 3000, 1500.2, 7.5, "2003-12-17", "Short Description about what ? ")'
oQuery := oServer:Query( cQuery )

View File

@@ -119,13 +119,13 @@ FUNCTION main()
sqlite3_sleep( 3000 )
//
RETURN 0
RETURN 0
/**
*/
FUNCTION CallBack( nColCount, aValue, aColName )
LOCAL nI
LOCAL oldColor := SetColor( "G/N" )
LOCAL nI
LOCAL oldColor := SetColor( "G/N" )
//
FOR nI := 1 TO nColCount
Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] )
@@ -133,7 +133,7 @@ LOCAL oldColor := SetColor( "G/N" )
SetColor( oldColor )
//
RETURN 0
RETURN 0
/**
*/
@@ -180,7 +180,7 @@ STATIC FUNCTION cErrorMsg( nError, lShortMsg )
ENDIF
ENDIF
//
RETURN cErrorMsg
RETURN cErrorMsg
/**
*/
@@ -233,4 +233,4 @@ STATIC FUNCTION PrepareDB( cFile )
sqlite3_clear_bindings( pStmt )
sqlite3_finalize( pStmt )
//
RETURN pDb
RETURN pDb

View File

@@ -131,4 +131,4 @@ PROCEDURE main()
wait
ENDIF
RETURN
RETURN

View File

@@ -104,13 +104,13 @@ FUNCTION main()
sqlite3_sleep( 10000 )
//
RETURN 0
RETURN 0
/**
*/
FUNCTION CallBack( nColCount, aValue, aColName )
LOCAL nI
LOCAL oldColor := SetColor( "G/N" )
LOCAL nI
LOCAL oldColor := SetColor( "G/N" )
//
FOR nI := 1 TO nColCount
Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] )
@@ -118,36 +118,36 @@ LOCAL oldColor := SetColor( "G/N" )
SetColor( oldColor )
//
RETURN 0
RETURN 0
/**
*/
FUNCTION HookCommitY()
LOCAL oldColor := SetColor( "R+/N" )
LOCAL oldColor := SetColor( "R+/N" )
//
Qout( "!! COMMIT" )
SetColor( oldColor )
//
RETURN 0
RETURN 0
FUNCTION HookCommitN()
LOCAL oldColor := SetColor( "B+/N" )
LOCAL oldColor := SetColor( "B+/N" )
//
Qout( "?? COMMIT or ROLLBACK" )
SetColor( oldColor )
//
RETURN 1 // not 0
RETURN 1 // not 0
FUNCTION HookRollback()
LOCAL oldColor := SetColor( "R+/N" )
LOCAL oldColor := SetColor( "R+/N" )
//
Qout( "!! ROLLBACK" )
SetColor( oldColor )
//
RETURN 1
RETURN 1
/**
*/
@@ -182,7 +182,7 @@ STATIC FUNCTION cErrorMsg( nError, lShortMsg )
{ SQLITE_ROW , "SQLITE_ROW" , "sqlite3_step() has another row ready" }, ;
{ SQLITE_DONE , "SQLITE_DONE" , "sqlite3_step() has finished executing" } ;
}, nIndex, cErrorMsg := "UNKNOWN"
//
DEFAULT lShortMsg TO .T.
IF hb_IsNumeric( nError )
@@ -193,8 +193,8 @@ STATIC FUNCTION cErrorMsg( nError, lShortMsg )
cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg )
ENDIF
ENDIF
//
RETURN cErrorMsg
RETURN cErrorMsg
/**
*/
@@ -247,5 +247,5 @@ STATIC FUNCTION PrepareDB( cFile )
sqlite3_clear_bindings( pStmt )
sqlite3_finalize( pStmt )
//
RETURN pDb
RETURN pDb

View File

@@ -61,7 +61,8 @@ PROCEDURE main()
IF ! Empty( db )
test( db )
ENDIF
RETURN
RETURN
/*
@@ -89,4 +90,5 @@ PROCEDURE test( db )
sqlite3_sleep( 3000 )
ENDIF
RETURN
RETURN

View File

@@ -53,10 +53,9 @@
#include "hbsqlit3.ch"
PROCEDURE main()
LOCAL db := ;
sqlite3_open_v2( "new.s3db", SQLITE_OPEN_READWRITE + SQLITE_OPEN_EXCLUSIVE )
LOCAL db := sqlite3_open_v2( "new.s3db", SQLITE_OPEN_READWRITE + SQLITE_OPEN_EXCLUSIVE )
IF !Empty( db )
IF ! Empty( db )
IF sqlite3_exec( db, "VACUUM" ) == SQLITE_OK
? "PACK - Done"
@@ -64,4 +63,4 @@ LOCAL db := ;
ENDIF
ENDIF
RETURN
RETURN

View File

@@ -66,7 +66,8 @@ PROCEDURE main()
t1()
t2()
RETURN
RETURN
/*
*/
@@ -77,7 +78,8 @@ PROCEDURE t1()
IF ! Empty( db )
sqlite3_exec( db, "DROP TABLE t1" )
ENDIF
RETURN
RETURN
/*
*/
@@ -272,4 +274,4 @@ PROCEDURE t2()
sqlite3_sleep( 3000 )
ENDIF
RETURN
RETURN