diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cf6c775548..5034b3871f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -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. diff --git a/harbour/contrib/hbmysql/tests/test.prg b/harbour/contrib/hbmysql/tests/test.prg index 1d1f67eecd..b4117b8959 100644 --- a/harbour/contrib/hbmysql/tests/test.prg +++ b/harbour/contrib/hbmysql/tests/test.prg @@ -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 diff --git a/harbour/contrib/hbpgsql/tests/simple.prg b/harbour/contrib/hbpgsql/tests/simple.prg index b46f954fc2..9415bca343 100644 --- a/harbour/contrib/hbpgsql/tests/simple.prg +++ b/harbour/contrib/hbpgsql/tests/simple.prg @@ -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 ) diff --git a/harbour/contrib/hbsqlit3/tests/backup.prg b/harbour/contrib/hbsqlit3/tests/backup.prg index 662c376b9f..ec2afc4d56 100644 --- a/harbour/contrib/hbsqlit3/tests/backup.prg +++ b/harbour/contrib/hbsqlit3/tests/backup.prg @@ -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 \ No newline at end of file + RETURN pDb diff --git a/harbour/contrib/hbsqlit3/tests/blob.prg b/harbour/contrib/hbsqlit3/tests/blob.prg index 7d14608fea..c37b3951a8 100644 --- a/harbour/contrib/hbsqlit3/tests/blob.prg +++ b/harbour/contrib/hbsqlit3/tests/blob.prg @@ -131,4 +131,4 @@ PROCEDURE main() wait ENDIF -RETURN \ No newline at end of file + RETURN diff --git a/harbour/contrib/hbsqlit3/tests/hooks.prg b/harbour/contrib/hbsqlit3/tests/hooks.prg index bd83d1419e..a97804b337 100644 --- a/harbour/contrib/hbsqlit3/tests/hooks.prg +++ b/harbour/contrib/hbsqlit3/tests/hooks.prg @@ -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 \ No newline at end of file + + RETURN pDb diff --git a/harbour/contrib/hbsqlit3/tests/metadata.prg b/harbour/contrib/hbsqlit3/tests/metadata.prg index 1d838151be..fce5dcc1fe 100644 --- a/harbour/contrib/hbsqlit3/tests/metadata.prg +++ b/harbour/contrib/hbsqlit3/tests/metadata.prg @@ -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 diff --git a/harbour/contrib/hbsqlit3/tests/pack.prg b/harbour/contrib/hbsqlit3/tests/pack.prg index d8678de02c..15334d297e 100644 --- a/harbour/contrib/hbsqlit3/tests/pack.prg +++ b/harbour/contrib/hbsqlit3/tests/pack.prg @@ -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 \ No newline at end of file + RETURN diff --git a/harbour/contrib/hbsqlit3/tests/sl3_test.prg b/harbour/contrib/hbsqlit3/tests/sl3_test.prg index 4b9da4129b..d7dfac898d 100644 --- a/harbour/contrib/hbsqlit3/tests/sl3_test.prg +++ b/harbour/contrib/hbsqlit3/tests/sl3_test.prg @@ -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