From bb31c97baa8d3fbf638bbcb647d487ce7580f27c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 1 May 2011 19:44:30 +0000 Subject: [PATCH] 2011-05-01 21:41 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbct/tests/datetime.prg * contrib/hbcurl/tests/ftp_uldl.prg * contrib/hbhttpd/tests/webapp.prg * contrib/hbpgsql/tests/simple.prg * contrib/hbpgsql/tests/async.prg * contrib/hbpgsql/tests/hdbctest.prg * contrib/hbpgsql/tests/cache.prg * contrib/hbsqlit3/tests/blob.prg * contrib/hbsqlit3/tests/hdbctest.prg * contrib/hbsqlit3/tests/hooks.prg * contrib/hbsqlit3/tests/authoriz.prg * contrib/hbsqlit3/tests/backup.prg * contrib/hbfbird/tests/simple.prg * contrib/hbfbird/tests/test.prg * contrib/hbfbird/tests/stress.prg * contrib/hbgd/tests/bartest.prg * contrib/hbgd/tests/barms.prg * FUNCTION main() -> PROCEDURE main() ! fixed RETURN in main() to ErrorLevel() call ! fixed <> operator for strings * formatting * deleted some decoration comments --- harbour/ChangeLog | 24 ++++++++ harbour/contrib/hbct/tests/datetime.prg | 6 +- harbour/contrib/hbcurl/tests/ftp_uldl.prg | 10 ++-- harbour/contrib/hbfbird/tests/simple.prg | 4 +- harbour/contrib/hbfbird/tests/stress.prg | 4 +- harbour/contrib/hbfbird/tests/test.prg | 4 +- harbour/contrib/hbgd/tests/barms.prg | 65 ++++++++++---------- harbour/contrib/hbgd/tests/bartest.prg | 66 ++++++++++----------- harbour/contrib/hbhttpd/tests/webapp.prg | 15 ++--- harbour/contrib/hbpgsql/tests/async.prg | 6 +- harbour/contrib/hbpgsql/tests/cache.prg | 6 +- harbour/contrib/hbpgsql/tests/hdbctest.prg | 4 +- harbour/contrib/hbpgsql/tests/simple.prg | 4 +- harbour/contrib/hbsqlit3/tests/authoriz.prg | 66 +++++++++++---------- harbour/contrib/hbsqlit3/tests/backup.prg | 38 ++++++------ harbour/contrib/hbsqlit3/tests/blob.prg | 2 +- harbour/contrib/hbsqlit3/tests/hdbctest.prg | 4 +- harbour/contrib/hbsqlit3/tests/hooks.prg | 45 +++++++------- 18 files changed, 202 insertions(+), 171 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 826c48da13..c42b8929d8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,30 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-01 21:41 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbct/tests/datetime.prg + * contrib/hbcurl/tests/ftp_uldl.prg + * contrib/hbhttpd/tests/webapp.prg + * contrib/hbpgsql/tests/simple.prg + * contrib/hbpgsql/tests/async.prg + * contrib/hbpgsql/tests/hdbctest.prg + * contrib/hbpgsql/tests/cache.prg + * contrib/hbsqlit3/tests/blob.prg + * contrib/hbsqlit3/tests/hdbctest.prg + * contrib/hbsqlit3/tests/hooks.prg + * contrib/hbsqlit3/tests/authoriz.prg + * contrib/hbsqlit3/tests/backup.prg + * contrib/hbfbird/tests/simple.prg + * contrib/hbfbird/tests/test.prg + * contrib/hbfbird/tests/stress.prg + * contrib/hbgd/tests/bartest.prg + * contrib/hbgd/tests/barms.prg + * FUNCTION main() -> PROCEDURE main() + ! fixed RETURN in main() to ErrorLevel() call + ! fixed <> operator for strings + * formatting + * deleted some decoration comments + 2011-05-01 12:06 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/tmenusys.prg * src/rtl/tmenuitm.prg diff --git a/harbour/contrib/hbct/tests/datetime.prg b/harbour/contrib/hbct/tests/datetime.prg index 516dcc05f8..191be9aa20 100644 --- a/harbour/contrib/hbct/tests/datetime.prg +++ b/harbour/contrib/hbct/tests/datetime.prg @@ -62,7 +62,7 @@ *:-------------------------------------------------------------------- -FUNCTION main () +PROCEDURE main () *:-------------------------------------------------------------------- local cScr local nchoice @@ -101,7 +101,7 @@ local farr := { "addmonth ( ddate ) Add a month to ddate ", ; nchoice := achoice ( 5, 7, 20, 65, farr ) //, ,1) if empty ( nchoice ) - return NIL + return endif @ 0, 0 clear to maxrow(), maxcol() @@ -154,7 +154,7 @@ local farr := { "addmonth ( ddate ) Add a month to ddate ", ; restscreen ( 4, 5, 21, 66, cScr) enddo - return NIL + return *:-------------------------------------------------------------------- FUNCTION addmtest() diff --git a/harbour/contrib/hbcurl/tests/ftp_uldl.prg b/harbour/contrib/hbcurl/tests/ftp_uldl.prg index 2bec8a982b..118acd1a35 100644 --- a/harbour/contrib/hbcurl/tests/ftp_uldl.prg +++ b/harbour/contrib/hbcurl/tests/ftp_uldl.prg @@ -15,7 +15,7 @@ #define REMOTE_URL_DEL "ftp://harbour:power@localhost/" + RENAME_FILE_TO #define REMOTE_URL_MEM "ftp://harbour:power@localhost/from_mem.txt" -FUNCTION Main( cDL, cUL ) +PROCEDURE Main( cDL, cUL ) LOCAL curl LOCAL info LOCAL tmp @@ -27,7 +27,7 @@ FUNCTION Main( cDL, cUL ) ? curl_version() ? curl_getdate( "Sun, 1 Jun 2008 02:10:58 +0200" ) - + info := curl_version_info() FOR tmp := 1 TO Len( info ) @@ -156,7 +156,7 @@ FUNCTION Main( cDL, cUL ) ? "DOWNLOAD FILE TO MEM:", curl_easy_perform( curl ) tmp := "test_dlm.bin" - ? "WRITING TO FILE: ", tmp + ? "WRITING TO FILE: ", tmp f := FCreate( tmp, FC_NORMAL ) IF f != F_ERROR FWrite( f, curl_easy_dl_buff_get( curl ) ) @@ -185,7 +185,7 @@ FUNCTION Main( cDL, cUL ) ? "DOWNLOAD DIRLIST TO STRING:", curl_easy_perform( curl ) ? "RESULT 1: " + curl_easy_dl_buff_get( curl ) - ? curl_easy_setopt( curl, HB_CURLOPT_DL_BUFF_GET, @tmp ) + ? curl_easy_setopt( curl, HB_CURLOPT_DL_BUFF_GET, @tmp ) ? "RESULT 2: " + tmp /* Cleanup session */ @@ -196,7 +196,7 @@ FUNCTION Main( cDL, cUL ) curl_global_cleanup() - RETURN NIL + RETURN STATIC FUNCTION CurGet() RETURN { Row(), Col() } diff --git a/harbour/contrib/hbfbird/tests/simple.prg b/harbour/contrib/hbfbird/tests/simple.prg index a5ac1d65c2..1c891e1fd3 100644 --- a/harbour/contrib/hbfbird/tests/simple.prg +++ b/harbour/contrib/hbfbird/tests/simple.prg @@ -4,7 +4,7 @@ #include "simpleio.ch" -FUNCTION Main() +PROCEDURE Main() LOCAL oServer, oQuery, oRow, i, x, aTables, aStruct, aKey LOCAL cServer := "localhost:" @@ -187,4 +187,4 @@ FUNCTION Main() ? "Closing..." - RETURN NIL + RETURN diff --git a/harbour/contrib/hbfbird/tests/stress.prg b/harbour/contrib/hbfbird/tests/stress.prg index 311c768a74..ef092ec55b 100644 --- a/harbour/contrib/hbfbird/tests/stress.prg +++ b/harbour/contrib/hbfbird/tests/stress.prg @@ -6,7 +6,7 @@ #include "simpleio.ch" -FUNCTION Main() +PROCEDURE Main() LOCAL oServer, oQuery, oRow, i, x @@ -137,4 +137,4 @@ FUNCTION Main() ? "Closing..." - RETURN NIL + RETURN diff --git a/harbour/contrib/hbfbird/tests/test.prg b/harbour/contrib/hbfbird/tests/test.prg index 99b51794a9..1c310b4f98 100644 --- a/harbour/contrib/hbfbird/tests/test.prg +++ b/harbour/contrib/hbfbird/tests/test.prg @@ -5,7 +5,7 @@ #include "common.ch" #include "simpleio.ch" -FUNCTION Main() +PROCEDURE Main() LOCAL cServer := "localhost:" LOCAL cDatabase @@ -113,4 +113,4 @@ FUNCTION Main() /* Close connection with rdbms */ ? "Status Close Database: ", tmp := FBClose( db ), FBError( tmp ) - RETURN NIL + RETURN diff --git a/harbour/contrib/hbgd/tests/barms.prg b/harbour/contrib/hbgd/tests/barms.prg index 142b641e5e..d8c72be3f4 100644 --- a/harbour/contrib/hbgd/tests/barms.prg +++ b/harbour/contrib/hbgd/tests/barms.prg @@ -4,30 +4,30 @@ #define IMAGES_OUT "imgs_out" + hb_ps() -Function Main() +PROCEDURE Main() - local bar + LOCAL bar // // Creating some Color (arguments are R, G, B) - local black := {0,0,0} - local white := {255,255,255} + LOCAL black := { 0, 0, 0 } + LOCAL white := { 255, 255, 255 } -// local blue := {0,0,255} -// local yellon := {255,255,128} +// LOCAL blue := { 0, 0, 255 } +// LOCAL yellon := { 255, 255, 128 } -// local red := {255,0,0} +// LOCAL red := { 255, 0, 0 } - local ccode13 := "P48WBQ7BX3M73X8V3WRT7F9JW" - local ccode8 := "P48WBQ7BX3M73X8V3WRT7F9JW" - local ccode128 := "P48WBQ7BX3M73X8V3WRT7F9JW" + LOCAL ccode13 := "P48WBQ7BX3M73X8V3WRT7F9JW" + LOCAL ccode8 := "P48WBQ7BX3M73X8V3WRT7F9JW" + LOCAL ccode128 := "P48WBQ7BX3M73X8V3WRT7F9JW" -// local nlower := 1 , nhight := 50 +// LOCAL nlower := 1 , nhight := 50 /* here is the list of arguments 1- Barcode Type 13,8 and 128 */ - bar := TCode():New(13) + bar := TCode():New( 13 ) /* Here is the list of the arguments 1 - Thickness @@ -36,61 +36,62 @@ Function Main() 4 - Resolution 5 - Text Font (0-5) */ - bar:Configure( 70 , black, white, 2, 1 ) + bar:Configure( 70, black, white, 2, 1 ) /* Here is the list of the arguments 1 - Width 2 - Height 3 - Filename (empty : display on screen) 4 - Background color */ - bar:CreateBar( 205, 105,,white) + bar:CreateBar( 205, 105,, white ) // 1 - code bar - bar:Draw13(ccode13) + bar:Draw13( ccode13 ) // Build image - bar:Finish(2) + bar:Finish( 2 ) // EAN8 - bar:= TCode():New(8) + bar:= TCode():New( 8 ) - bar:Configure( 70 , black, white, 2 , 1 ) + bar:Configure( 70, black, white, 2, 1 ) - bar:CreateBar( 154, 100,,white) + bar:CreateBar( 154, 100,, white ) - bar:Draw8(ccode8) + bar:Draw8( ccode8 ) - bar:Finish(8) + bar:Finish( 8 ) bar:ResizeImage() // EAN128 - bar:= TCode():New(128) + bar:= TCode():New( 128 ) - bar:Configure( 50 , black, white, 2 , 1 ) + bar:Configure( 50, black, white, 2, 1 ) // output image //bar:out_img := "image_out/" - bar:CreateBar( 559, 88, IMAGES_OUT + "Bar128",white) + bar:CreateBar( 559, 88, IMAGES_OUT + "Bar128", white ) // 1- code bar // 2- barcode types A/B/C // A- Alphanumeric characters uppercase // B- Alphanumeric characters upper and lowercase // C- Numeric pairs of integer - bar:Draw128(cCode128,"A") + bar:Draw128( cCode128, "A" ) - bar:Finish(8) + bar:Finish( 8 ) // BRAZIL-FEBRABAN - bar:= TCode():New(25) + bar:= TCode():New( 25 ) - bar:Configure( 25 , black, white, 1 , 1, , .T. ) + bar:Configure( 25, black, white, 1, 1,, .T. ) // output image //bar:out_img := "febraban/" - bar:CreateBar( 560 ,60, IMAGES_OUT + "febraban", white ) - bar:DrawI25("P48WBQ7BX3M73X8V3WRT7F9JW") - bar:Finish(8) -RETURN NIL + bar:CreateBar( 560, 60, IMAGES_OUT + "febraban", white ) + bar:DrawI25( "P48WBQ7BX3M73X8V3WRT7F9JW" ) + bar:Finish( 8 ) + + RETURN diff --git a/harbour/contrib/hbgd/tests/bartest.prg b/harbour/contrib/hbgd/tests/bartest.prg index b94325191b..208511185b 100644 --- a/harbour/contrib/hbgd/tests/bartest.prg +++ b/harbour/contrib/hbgd/tests/bartest.prg @@ -4,31 +4,31 @@ #define IMAGES_OUT "imgs_out" + hb_ps() -Function Main() +PROCEDURE Main() - local bar + LOCAL bar // // Creating some Color (arguments are R, G, B) - local black := {0,0,0} - local white := {255,255,255} + LOCAL black := { 0, 0, 0 } + LOCAL white := { 255, 255, 255 } -// local blue := {0,0,255} -// local yellon := {255,255,128} +// LOCAL blue := { 0, 0, 255 } +// LOCAL yellon := { 255, 255, 128 } -// local red := {255,0,0} +// LOCAL red := { 255, 0, 0 } - local ccode13 := "789136043666" - local ccode8 := "0421000" -// local ccode128 := "00011005100000000" - local ccode128 := "Code 128" + LOCAL ccode13 := "789136043666" + LOCAL ccode8 := "0421000" +// LOCAL ccode128 := "00011005100000000" + LOCAL ccode128 := "Code 128" -// local nlower := 1 , nhight := 50 +// LOCAL nlower := 1 , nhight := 50 /* here is the list of arguments 1- Barcode Type 13,8 and 128 */ - bar := TCode():New(13) + bar := TCode():New( 13 ) /* Here is the list of the arguments 1 - Thickness @@ -37,57 +37,57 @@ Function Main() 4 - Resolution 5 - Text Font (0-5) */ - bar:Configure( 70 , black, white, 2, 1 ) + bar:Configure( 70, black, white, 2, 1 ) /* Here is the list of the arguments 1 - Width 2 - Height 3 - Filename (empty : display on screen) 4 - Background color */ - bar:CreateBar( 205, 105,,white) + bar:CreateBar( 205, 105,, white ) // 1 - code bar - bar:Draw13(ccode13) + bar:Draw13( ccode13 ) // Build image - bar:Finish(2) + bar:Finish( 2 ) // EAN8 - bar:= TCode():New(8) + bar:= TCode():New( 8 ) - bar:Configure( 70 , black, white, 2 , 1 ) + bar:Configure( 70, black, white, 2, 1 ) - bar:CreateBar( 154, 100,,white) + bar:CreateBar( 154, 100,, white ) - bar:Draw8(ccode8) + bar:Draw8( ccode8 ) - bar:Finish(8) + bar:Finish( 8 ) bar:ResizeImage() // EAN128 - bar:= TCode():New(128) + bar:= TCode():New( 128 ) - bar:Configure( 50 , black, white, 2 , 1 ) + bar:Configure( 50, black, white, 2, 1 ) - bar:CreateBar( 300, 400, IMAGES_OUT + "Bar128",white) + bar:CreateBar( 300, 400, IMAGES_OUT + "Bar128", white ) // 1- code bar // 2- barcode types A/B/C // A- Alphanumeric characters uppercase // B- Alphanumeric characters upper and lowercase // C- Numeric pairs of integer - bar:Draw128(cCode128,"B") + bar:Draw128( cCode128, "B" ) - bar:Finish(2) + bar:Finish( 2 ) // BRAZIL-FEBRABAN - bar:= TCode():New(25) + bar:= TCode():New( 25 ) - bar:Configure( 25 , black, white, 1 , 1, , .T. ) + bar:Configure( 25, black, white, 1, 1,, .T. ) - bar:CreateBar( 560 ,60, IMAGES_OUT + "febraban", white ) - bar:DrawI25("104995628545723070285700000008218000") - bar:Finish(8) + bar:CreateBar( 560, 60, IMAGES_OUT + "febraban", white ) + bar:DrawI25( "104995628545723070285700000008218000" ) + bar:Finish( 8 ) -RETURN NIL + RETURN diff --git a/harbour/contrib/hbhttpd/tests/webapp.prg b/harbour/contrib/hbhttpd/tests/webapp.prg index 44e3e04ee3..583d1db732 100644 --- a/harbour/contrib/hbhttpd/tests/webapp.prg +++ b/harbour/contrib/hbhttpd/tests/webapp.prg @@ -6,7 +6,7 @@ REQUEST DBFCDX MEMVAR server, get, post, cookie, session -FUNCTION Main() +PROCEDURE Main() LOCAL oServer @@ -20,12 +20,12 @@ FUNCTION Main() ? "Options:" ? " //help Print help" ? " //stop Stop running server" - RETURN 0 + RETURN ENDIF IF HB_ARGCHECK( "stop" ) HB_MEMOWRIT( ".uhttpd.stop", "" ) - RETURN 0 + RETURN ELSE FErase( ".uhttpd.stop" ) ENDIF @@ -71,7 +71,7 @@ FUNCTION Main() IF ! oLogAccess:Add( "" ) oLogAccess:Close() ? "Access log file open error " + hb_ntos( FError() ) - RETURN 0 + RETURN ENDIF oLogError := UHttpdLog():New( "webapp_error.log" ) @@ -80,7 +80,7 @@ FUNCTION Main() oLogError:Close() oLogAccess:Close() ? "Error log file open error " + hb_ntos( FError() ) - RETURN 0 + RETURN ENDIF oServer := UHttpdNew() @@ -116,13 +116,14 @@ FUNCTION Main() oLogError:Close() oLogAccess:Close() ? "Server error:", oServer:cError - RETURN 1 + ErrorLevel( 1 ) + RETURN ENDIF oLogError:Close() oLogAccess:Close() - RETURN 0 + RETURN STATIC FUNCTION proc_login( cMethod ) diff --git a/harbour/contrib/hbpgsql/tests/async.prg b/harbour/contrib/hbpgsql/tests/async.prg index 79b862163c..511234d41e 100644 --- a/harbour/contrib/hbpgsql/tests/async.prg +++ b/harbour/contrib/hbpgsql/tests/async.prg @@ -8,7 +8,7 @@ #include "inkey.ch" -FUNCTION Main( cServer, cDatabase, cUser, cPass ) +PROCEDURE Main( cServer, cDatabase, cUser, cPass ) LOCAL conn CLEAR SCREEN @@ -21,9 +21,7 @@ FUNCTION Main( cServer, cDatabase, cUser, cPass ) Query( conn, "SELECT codigo, descri FROM fornec limit 100", .F. ) Query( conn, "SELECT pedido, vlrped FROM pedido", .T. ) - conn := NIL - - RETURN NIL + RETURN PROCEDURE Query( conn, cQuery, lCancel ) LOCAL pCancel, cErrMsg := Space( 30 ) diff --git a/harbour/contrib/hbpgsql/tests/cache.prg b/harbour/contrib/hbpgsql/tests/cache.prg index fb7e15dae6..7a567bfe2b 100644 --- a/harbour/contrib/hbpgsql/tests/cache.prg +++ b/harbour/contrib/hbpgsql/tests/cache.prg @@ -19,7 +19,7 @@ STATIC s_oServer STATIC s_aTableTemp := {} STATIC s_aTempDBF := {} -FUNCTION Main( cServer, cDatabase, cUser, cPass ) +PROCEDURE Main( cServer, cDatabase, cUser, cPass ) LOCAL i LOCAL cQuery @@ -65,7 +65,9 @@ FUNCTION Main( cServer, cDatabase, cUser, cPass ) SQLApplyUpdates() ENDIF - RETURN SQLGarbageCollector() + SQLGarbageCollector() + + RETURN /* Put theses functions in a library */ diff --git a/harbour/contrib/hbpgsql/tests/hdbctest.prg b/harbour/contrib/hbpgsql/tests/hdbctest.prg index df66262e59..59198f5c5d 100644 --- a/harbour/contrib/hbpgsql/tests/hdbctest.prg +++ b/harbour/contrib/hbpgsql/tests/hdbctest.prg @@ -4,7 +4,7 @@ #include "common.ch" -FUNCTION Main( cHost, cDatabase, cUser, cPass ) +PROCEDURE Main( cHost, cDatabase, cUser, cPass ) LOCAL oConn, oMeta, oStmt, cSql, n, oRs @@ -197,4 +197,4 @@ FUNCTION Main( cHost, cDatabase, cUser, cPass ) ? "Closing..." - RETURN NIL + RETURN diff --git a/harbour/contrib/hbpgsql/tests/simple.prg b/harbour/contrib/hbpgsql/tests/simple.prg index 4f6e74bb5b..b84eba9063 100644 --- a/harbour/contrib/hbpgsql/tests/simple.prg +++ b/harbour/contrib/hbpgsql/tests/simple.prg @@ -4,7 +4,7 @@ #include "common.ch" -FUNCTION Main( cHost, cDatabase, cUser, cPass ) +PROCEDURE Main( cHost, cDatabase, cUser, cPass ) LOCAL oServer, oQuery, oRow, i, x, aTables, aStruct LOCAL cQuery @@ -165,4 +165,4 @@ FUNCTION Main( cHost, cDatabase, cUser, cPass ) ? "Closing..." - RETURN NIL + RETURN diff --git a/harbour/contrib/hbsqlit3/tests/authoriz.prg b/harbour/contrib/hbsqlit3/tests/authoriz.prg index 6852503723..8cdbff8de6 100644 --- a/harbour/contrib/hbsqlit3/tests/authoriz.prg +++ b/harbour/contrib/hbsqlit3/tests/authoriz.prg @@ -79,12 +79,14 @@ #include "common.ch" #include "hbsqlit3.ch" -FUNCTION main() - LOCAL cFile := ":memory:", cSQLTEXT +PROCEDURE main() + LOCAL cFile := ":memory:" + LOCAL cSQLTEXT LOCAL pDb, cb - // + IF Empty( pDb := PrepareDB(cFile) ) - RETURN 1 + ErrorLevel( 1 ) + RETURN ENDIF // Authorizer1 sqlite3_set_authorizer( pDb, @Authorizer() /*"Authorizer"*/ ) @@ -110,55 +112,55 @@ FUNCTION main() sqlite3_sleep( 3000 ) // pDb := Nil // close database - // -RETURN 0 + + RETURN /** */ FUNCTION Authorizer( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) -LOCAL oldColor := SetColor( "R/N" ) - // - Qout( "=>", StrZero(nAction, 2), cName1, cName2, cDatabaseName, cTriggerOrViewName ) + LOCAL oldColor := SetColor( "R/N" ) + + QOut( "=>", StrZero( nAction, 2 ), cName1, cName2, cDatabaseName, cTriggerOrViewName ) SetColor( oldColor ) - // -RETURN SQLITE_OK + + RETURN SQLITE_OK /** */ FUNCTION Authorizer2( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) -LOCAL oldColor := SetColor( "R/N" ) - // - Qout( "=>", StrZero(nAction, 2), cName1, cName2, cDatabaseName, cTriggerOrViewName ) + LOCAL oldColor := SetColor( "R/N" ) + + QOut( "=>", StrZero( nAction, 2 ), cName1, cName2, cDatabaseName, cTriggerOrViewName ) SetColor( oldColor ) - // -RETURN iif( cName2 == "pasw", SQLITE_IGNORE, SQLITE_OK ) + + RETURN iif( cName2 == "pasw", SQLITE_IGNORE, SQLITE_OK ) /** */ FUNCTION Authorizer3( nAction, cName1, cName2, cDatabaseName, cTriggerOrViewName ) - // + HB_SYMBOL_UNUSED( cName1 ) HB_SYMBOL_UNUSED( cName2 ) HB_SYMBOL_UNUSED( cDatabaseName ) HB_SYMBOL_UNUSED( cTriggerOrViewName ) -RETURN iif( nAction == SQLITE_SELECT, SQLITE_DENY, SQLITE_OK ) + RETURN iif( nAction == SQLITE_SELECT, SQLITE_DENY, SQLITE_OK ) /** */ 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] ) + QOut( Padr( aColName[ nI ], 5 ) , " == ", aValue[ nI ] ) NEXT SetColor( oldColor ) - // -RETURN 0 + + RETURN 0 /** */ @@ -193,7 +195,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 ) @@ -204,8 +206,8 @@ STATIC FUNCTION cErrorMsg( nError, lShortMsg ) cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) ENDIF ENDIF - // -RETURN cErrorMsg + + RETURN cErrorMsg /** */ @@ -219,7 +221,7 @@ STATIC FUNCTION PrepareDB( cFile ) "Andy" => 20, ; "Ivet" => 28 ; }, enum - // + pDb := sqlite3_open( cFile, .T. ) IF Empty( pDb ) QOut( "Can't open/create database : ", cFile ) @@ -228,9 +230,9 @@ STATIC FUNCTION PrepareDB( cFile ) ENDIF cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER, pasw TEXT(32) )" - cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) + cMsg := cErrorMsg( sqlite3_exec( pDb, cSQLTEXT ) ) - IF cMsg <> "SQLITE_OK" + IF !( cMsg == "SQLITE_OK" ) QOut( "Can't create table : person" ) pDb := NIL // close database @@ -256,5 +258,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/backup.prg b/harbour/contrib/hbsqlit3/tests/backup.prg index 01ee6b75c7..c9d490fe7b 100644 --- a/harbour/contrib/hbsqlit3/tests/backup.prg +++ b/harbour/contrib/hbsqlit3/tests/backup.prg @@ -67,16 +67,18 @@ #include "common.ch" #include "hbsqlit3.ch" -FUNCTION main() +PROCEDURE main() LOCAL cFileSource := ":memory:", cFileDest := "backup.db", cSQLTEXT LOCAL pDbSource, pDbDest, pBackup, cb, nDbFlags // IF sqlite3_libversion_number() < 3006011 - RETURN 1 + ErrorLevel( 1 ) + RETURN ENDIF IF Empty( pDbSource := PrepareDB(cFileSource) ) - RETURN 1 + ErrorLevel( 1 ) + RETURN ENDIF nDbFlags := SQLITE_OPEN_CREATE + SQLITE_OPEN_READWRITE + ; @@ -85,8 +87,8 @@ FUNCTION main() IF Empty( pDbDest ) QOut( "Can't open database : ", cFileDest ) - - RETURN 1 + ErrorLevel( 1 ) + RETURN ENDIF sqlite3_trace( pDbDest, .T., "backup.log" ) @@ -95,8 +97,8 @@ FUNCTION main() pBackup := sqlite3_backup_init( pDbDest, "main", pDbSource, "main" ) IF Empty( pBackup ) QOut( "Can't initialize backup" ) - - RETURN 1 + ErrorLevel( 1 ) + RETURN ELSE QOut( "Start backup.." ) ENDIF @@ -113,26 +115,26 @@ FUNCTION main() QOut( "" ) QOut( cSQLTEXT := "SELECT * FROM main.person WHERE age BETWEEN 20 AND 40" ) cb := @CallBack() // "CallBack" - Qout( cErrorMsg(sqlite3_exec(pDbDest, cSQLTEXT, cb)) ) + QOut( cErrorMsg(sqlite3_exec(pDbDest, cSQLTEXT, cb)) ) - pDbDest := Nil // close database + pDbDest := NIL // close database sqlite3_sleep( 3000 ) - // - RETURN 0 + + RETURN /** */ FUNCTION CallBack( nColCount, aValue, aColName ) LOCAL nI LOCAL oldColor := SetColor( "G/N" ) - // + FOR nI := 1 TO nColCount Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) NEXT SetColor( oldColor ) - // + RETURN 0 /** @@ -168,7 +170,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 ) @@ -179,7 +181,7 @@ STATIC FUNCTION cErrorMsg( nError, lShortMsg ) cErrorMsg := iif( nIndex > 0, aErrorCodes[ nIndex ][ iif(lShortMsg,2,3) ], cErrorMsg ) ENDIF ENDIF - // + RETURN cErrorMsg /** @@ -194,7 +196,7 @@ STATIC FUNCTION PrepareDB( cFile ) "Andy" => 20, ; "Ivet" => 28 ; }, enum - // + pDb := sqlite3_open( cFile, .T. ) IF Empty( pDb ) QOut( "Can't open/create database : ", cFile ) @@ -207,7 +209,7 @@ STATIC FUNCTION PrepareDB( cFile ) cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER )" cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) - IF cMsg <> "SQLITE_OK" + IF !( cMsg == "SQLITE_OK" ) QOut( "Can't create table : person" ) pDb := NIL // close database @@ -232,5 +234,5 @@ STATIC FUNCTION PrepareDB( cFile ) sqlite3_clear_bindings( pStmt ) sqlite3_finalize( pStmt ) - // + RETURN pDb diff --git a/harbour/contrib/hbsqlit3/tests/blob.prg b/harbour/contrib/hbsqlit3/tests/blob.prg index c37b3951a8..88c6e3ad9f 100644 --- a/harbour/contrib/hbsqlit3/tests/blob.prg +++ b/harbour/contrib/hbsqlit3/tests/blob.prg @@ -128,7 +128,7 @@ PROCEDURE main() sqlite3_finalize( stmt ) ENDIF ENDIF - wait + WAIT ENDIF RETURN diff --git a/harbour/contrib/hbsqlit3/tests/hdbctest.prg b/harbour/contrib/hbsqlit3/tests/hdbctest.prg index 2dfd7f1f37..8cac62e47d 100644 --- a/harbour/contrib/hbsqlit3/tests/hdbctest.prg +++ b/harbour/contrib/hbsqlit3/tests/hdbctest.prg @@ -4,7 +4,7 @@ #include "common.ch" -FUNCTION Main() +PROCEDURE Main() LOCAL oConn, oMeta, oStmt, cSql, n, oRs @@ -197,4 +197,4 @@ FUNCTION Main() ? "Closing..." - RETURN NIL + RETURN diff --git a/harbour/contrib/hbsqlit3/tests/hooks.prg b/harbour/contrib/hbsqlit3/tests/hooks.prg index dc9b049fa6..312547114c 100644 --- a/harbour/contrib/hbsqlit3/tests/hooks.prg +++ b/harbour/contrib/hbsqlit3/tests/hooks.prg @@ -53,12 +53,13 @@ #include "common.ch" #include "hbsqlit3.ch" -FUNCTION main() +PROCEDURE main() LOCAL cSQLTEXT, cFile := ":memory:" LOCAL pDb, cb := @CallBack() - // - IF Empty( pDb := PrepareDB(cFile) ) - RETURN 1 + + IF Empty( pDb := PrepareDB( cFile ) ) + ErrorLevel( 1 ) + RETURN ENDIF // sqlite3_commit_hook( pDb, "HookCommitY" ) @@ -103,50 +104,50 @@ FUNCTION main() pDb := NIL sqlite3_sleep( 10000 ) - // - RETURN 0 + + RETURN /** */ FUNCTION CallBack( nColCount, aValue, aColName ) LOCAL nI LOCAL oldColor := SetColor( "G/N" ) - // + FOR nI := 1 TO nColCount - Qout( Padr(aColName[nI], 5) , " == ", aValue[nI] ) + QOut( PadR( aColName[ nI ], 5 ) , " == ", aValue[ nI ] ) NEXT SetColor( oldColor ) - // + RETURN 0 /** */ FUNCTION HookCommitY() LOCAL oldColor := SetColor( "R+/N" ) - // - Qout( "!! COMMIT" ) + + QOut( "!! COMMIT" ) SetColor( oldColor ) - // + RETURN 0 FUNCTION HookCommitN() LOCAL oldColor := SetColor( "B+/N" ) - // - Qout( "?? COMMIT or ROLLBACK" ) + + QOut( "?? COMMIT or ROLLBACK" ) SetColor( oldColor ) - // + RETURN 1 // not 0 FUNCTION HookRollback() LOCAL oldColor := SetColor( "R+/N" ) - // - Qout( "!! ROLLBACK" ) + + QOut( "!! ROLLBACK" ) SetColor( oldColor ) - // + RETURN 1 /** @@ -208,7 +209,7 @@ STATIC FUNCTION PrepareDB( cFile ) "Andy" => 20, ; "Ivet" => 28 ; }, enum - // + pDb := sqlite3_open( cFile, .T. ) IF Empty( pDb ) QOut( "Can't open/create database : ", cFile ) @@ -219,7 +220,7 @@ STATIC FUNCTION PrepareDB( cFile ) Qout( cSQLTEXT := "CREATE TABLE person( name TEXT, age INTEGER )" ) cMsg := cErrorMsg( sqlite3_exec(pDb, cSQLTEXT) ) - IF cMsg <> "SQLITE_OK" + IF !( cMsg == "SQLITE_OK" ) QOut( "Can't create table : person" ) pDb := NIL // close database @@ -235,8 +236,8 @@ STATIC FUNCTION PrepareDB( cFile ) RETURN NIL ENDIF - QOut( sqlite3_sql(pStmt) ) - QOut( Replicate("-", Len(cSQLTEXT)) ) + QOut( sqlite3_sql( pStmt ) ) + QOut( Replicate( "-", Len( cSQLTEXT ) ) ) FOR EACH enum IN hPerson sqlite3_reset( pStmt )