diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0fc8cfcbdf..31b25eb283 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-06-26 15:54 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/sddmy/tests/test1.prg + * contrib/sddoci/tests/test1.prg + * contrib/sddodbc/tests/test1.prg + * contrib/sddodbc/tests/test2.prg + * contrib/sddsqlt3/tests/test1.prg + * formatting + 2012-06-26 11:19 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg % use HBMK_IS_IN() where possible diff --git a/harbour/contrib/sddmy/tests/test1.prg b/harbour/contrib/sddmy/tests/test1.prg index a1348370ae..b555a8bd4d 100644 --- a/harbour/contrib/sddmy/tests/test1.prg +++ b/harbour/contrib/sddmy/tests/test1.prg @@ -13,12 +13,13 @@ ANNOUNCE RDDSYS FIELD RESIDENTS -PROCEDURE main() - RDDSETDEFAULT("SQLMIX") +PROCEDURE Main() - AEVAL(RDDLIST(), {|X| QOUT(X)}) + rddSetDefault( "SQLMIX" ) - IF RDDINFO(RDDI_CONNECT, {"MYSQL", "localhost", "test",, "test"}) == 0 + AEval( rddList(), {| X | QOut( X ) } ) + + IF rddInfo( RDDI_CONNECT, { "MYSQL", "localhost", "test", , "test" } ) == 0 ? "Unable connect to the server" RETURN ENDIF @@ -26,20 +27,23 @@ PROCEDURE main() CreateTable() ? "Let's browse table (press any key)" - INKEY(0) - DBUSEAREA( .T.,, "SELECT * FROM country", "country" ) + Inkey( 0 ) + dbUseArea( .T. , , "SELECT * FROM country", "country" ) Browse() ? "Let's browse table ordered by resident count (press any key)" - INKEY(0) + Inkey( 0 ) INDEX ON RESIDENTS TAG residents TO country Browse() - DBCLOSEALL() + dbCloseAll() + RETURN STATIC PROC CreateTable() - ? RDDINFO(RDDI_EXECUTE, "DROP TABLE country") - ? RDDINFO(RDDI_EXECUTE, "CREATE TABLE country (CODE char(3), NAME char(50), RESIDENTS int(11))") - ? RDDINFO(RDDI_EXECUTE, "INSERT INTO country values ('LTU', 'Lithuania', 3369600), ('USA', 'United States of America', 305397000), ('POR', 'Portugal', 10617600), ('POL', 'Poland', 38115967), ('AUS', 'Australia', 21446187), ('FRA', 'France', 64473140), ('RUS', 'Russia', 141900000)") + + ? rddInfo( RDDI_EXECUTE, "DROP TABLE country" ) + ? rddInfo( RDDI_EXECUTE, "CREATE TABLE country (CODE char(3), NAME char(50), RESIDENTS int(11))" ) + ? rddInfo( RDDI_EXECUTE, "INSERT INTO country values ('LTU', 'Lithuania', 3369600), ('USA', 'United States of America', 305397000), ('POR', 'Portugal', 10617600), ('POL', 'Poland', 38115967), ('AUS', 'Australia', 21446187), ('FRA', 'France', 64473140), ('RUS', 'Russia', 141900000)" ) + RETURN diff --git a/harbour/contrib/sddoci/tests/test1.prg b/harbour/contrib/sddoci/tests/test1.prg index 284d470acf..083d5d48ec 100644 --- a/harbour/contrib/sddoci/tests/test1.prg +++ b/harbour/contrib/sddoci/tests/test1.prg @@ -8,35 +8,36 @@ REQUEST SDDOCI, SQLMIX PROCEDURE Main() + LOCAL tmp - RDDSETDEFAULT( "SQLMIX" ) - SET( _SET_DATEFORMAT, "yyyy-mm-dd" ) + rddSetDefault( "SQLMIX" ) + Set( _SET_DATEFORMAT, "yyyy-mm-dd" ) - AEVAL( rddList(), {| X | QOut( X ) } ) + AEval( rddList(), {| X | QOut( X ) } ) ? "-1-" - ? "Connect:", tmp := RDDINFO( RDDI_CONNECT, { "OCILIB", "ORCL", "scott", "tiger" } ) + ? "Connect:", tmp := rddInfo( RDDI_CONNECT, { "OCILIB", "ORCL", "scott", "tiger" } ) IF tmp == 0 ? "Unable connect to the server" ENDIF ? "-2-" - ? "Use:", DBUSEAREA( .T.,, "select * from emp", "emp" ) + ? "Use:", dbUseArea( .T. , , "select * from emp", "emp" ) ? "-3-" - ? "Alias:", ALIAS() + ? "Alias:", Alias() ? "-4-" - ? "DB struct:", HB_VALTOEXP( DBSTRUCT() ) + ? "DB struct:", hb_ValToExp( dbStruct() ) ? "-5-" FOR tmp := 1 TO FCount() - ? FIELDNAME( tmp ), HB_FIELDTYPE( tmp ), HB_FIELDLEN( tmp ), HB_FIELDDEC( tmp ) + ? FieldName( tmp ), hb_FieldType( tmp ), hb_FieldLen( tmp ), hb_FieldDec( tmp ) NEXT ? "-6-" - INKEY( 0 ) - BROWSE() + Inkey( 0 ) + Browse() - INDEX ON FIELD->SAL TO salary - DBGOTOP() - BROWSE() - DBCLOSEAREA() + INDEX ON FIELD -> SAL TO salary + dbGoTop() + Browse() + dbCloseArea() RETURN diff --git a/harbour/contrib/sddodbc/tests/test1.prg b/harbour/contrib/sddodbc/tests/test1.prg index e72beed5f7..31e900940a 100644 --- a/harbour/contrib/sddodbc/tests/test1.prg +++ b/harbour/contrib/sddodbc/tests/test1.prg @@ -7,18 +7,20 @@ REQUEST SDDODBC, SQLMIX -PROC main() - RDDSETDEFAULT( "SQLMIX" ) - SET( _SET_DATEFORMAT, "yyyy-mm-dd" ) - ? "Connect:", RDDINFO( RDDI_CONNECT, { "ODBC", "DBQ=" + hb_DirBase() + "..\..\hbodbc\tests\test.mdb;Driver={Microsoft Access Driver (*.mdb)}" } ) - ? "Use:", DBUSEAREA( .T.,, "select * from test", "test" ) - ? "Alias:", ALIAS() - ? "DB struct:", HB_VALTOEXP( DBSTRUCT() ) - INKEY( 0 ) - BROWSE() +PROCEDURE Main() - INDEX ON FIELD->SALARY TO salary - DBGOTOP() - BROWSE() - DBCLOSEAREA() -RETURN + rddSetDefault( "SQLMIX" ) + Set( _SET_DATEFORMAT, "yyyy-mm-dd" ) + ? "Connect:", rddInfo( RDDI_CONNECT, { "ODBC", "DBQ=" + hb_DirBase() + "..\..\hbodbc\tests\test.mdb;Driver={Microsoft Access Driver (*.mdb)}" } ) + ? "Use:", dbUseArea( .T. , , "select * from test", "test" ) + ? "Alias:", Alias() + ? "DB struct:", hb_ValToExp( dbStruct() ) + Inkey( 0 ) + Browse() + + INDEX ON FIELD -> SALARY TO salary + dbGoTop() + Browse() + dbCloseArea() + + RETURN diff --git a/harbour/contrib/sddodbc/tests/test2.prg b/harbour/contrib/sddodbc/tests/test2.prg index fb3d8e501a..f47cc63937 100644 --- a/harbour/contrib/sddodbc/tests/test2.prg +++ b/harbour/contrib/sddodbc/tests/test2.prg @@ -7,30 +7,32 @@ REQUEST SQLMIX, SDDODBC -PROC main() -LOCAL nConnection, nI, aI +PROCEDURE Main() - RDDSETDEFAULT( "SQLMIX" ) - SET( _SET_DATEFORMAT, "yyyy-mm-dd" ) - nConnection := RDDINFO( RDDI_CONNECT, { "ODBC", "Server=localhost;Driver={MySQL ODBC 5.1 Driver};dsn=;User=test;database=test;" } ) + LOCAL nConnection, nI, aI + + rddSetDefault( "SQLMIX" ) + Set( _SET_DATEFORMAT, "yyyy-mm-dd" ) + nConnection := rddInfo( RDDI_CONNECT, { "ODBC", "Server=localhost;Driver={MySQL ODBC 5.1 Driver};dsn=;User=test;database=test;" } ) IF nConnection == 0 - ? "Unable connect to server", RDDINFO( RDDI_ERRORNO ), RDDINFO( RDDI_ERROR ) + ? "Unable connect to server", rddInfo( RDDI_ERRORNO ), rddInfo( RDDI_ERROR ) RETURN ENDIF ? nConnection - ? RDDINFO(RDDI_EXECUTE, "DROP TABLE country") - ? RDDINFO(RDDI_EXECUTE, "CREATE TABLE country (CODE char(3), NAME char(50), RESIDENTS int(11))") - ? RDDINFO(RDDI_EXECUTE, "INSERT INTO country values ('LTU', 'Lithuania', 3369600),('USA', 'United States of America', 305397000), ('POR', 'Portugal', 10617600), ('POL', 'Poland', 38115967), ('AUS', 'Australia', 21446187), ('FRA', 'France', 64473140), ('RUS', 'Russia', 141900000)") - ? DBUSEAREA( .T.,, "SELECT * FROM country", "country" ) - ? "LASTREC:", LASTREC() + ? rddInfo( RDDI_EXECUTE, "DROP TABLE country" ) + ? rddInfo( RDDI_EXECUTE, "CREATE TABLE country (CODE char(3), NAME char(50), RESIDENTS int(11))" ) + ? rddInfo( RDDI_EXECUTE, "INSERT INTO country values ('LTU', 'Lithuania', 3369600),('USA', 'United States of America', 305397000), ('POR', 'Portugal', 10617600), ('POL', 'Poland', 38115967), ('AUS', 'Australia', 21446187), ('FRA', 'France', 64473140), ('RUS', 'Russia', 141900000)" ) + ? dbUseArea( .T. , , "SELECT * FROM country", "country" ) + ? "LASTREC:", LastRec() DO WHILE ! EOF() - aI := ARRAY( FCOUNT() ) - FOR nI := 1 TO FCOUNT() - aI[nI] := FIELDGET( nI ) - NEXT - ? RECNO(), HB_VALTOEXP( aI ) - DBSKIP() + aI := Array( FCount() ) + FOR nI := 1 TO FCount() + aI[nI] := FieldGet( nI ) + NEXT + ? RecNo(), hb_ValToExp( aI ) + dbSkip() ENDDO - ? "LASTREC:", LASTREC() - DBCLOSEALL() -RETURN + ? "LASTREC:", LastRec() + dbCloseAll() + + RETURN diff --git a/harbour/contrib/sddsqlt3/tests/test1.prg b/harbour/contrib/sddsqlt3/tests/test1.prg index 09647c0052..bb878fe4be 100644 --- a/harbour/contrib/sddsqlt3/tests/test1.prg +++ b/harbour/contrib/sddsqlt3/tests/test1.prg @@ -8,35 +8,36 @@ REQUEST SDDSQLITE3, SQLMIX PROCEDURE Main() + LOCAL tmp - RDDSETDEFAULT( "SQLMIX" ) - SET( _SET_DATEFORMAT, "yyyy-mm-dd" ) + rddSetDefault( "SQLMIX" ) + Set( _SET_DATEFORMAT, "yyyy-mm-dd" ) - AEVAL( rddList(), {| X | QOut( X ) } ) + AEval( rddList(), {| X | QOut( X ) } ) ? "-1-" - ? "Connect:", tmp := RDDINFO( RDDI_CONNECT, { "SQLITE3", hb_dirBase() + "test.sq3" } ) + ? "Connect:", tmp := rddInfo( RDDI_CONNECT, { "SQLITE3", hb_DirBase() + "test.sq3" } ) IF tmp == 0 ? "Unable connect to the server" ENDIF ? "-2-" - ? "Use:", DBUSEAREA( .T.,, "select * from t1", "t1" ) + ? "Use:", dbUseArea( .T. , , "select * from t1", "t1" ) ? "-3-" - ? "Alias:", ALIAS() + ? "Alias:", Alias() ? "-4-" - ? "DB struct:", HB_VALTOEXP( DBSTRUCT() ) + ? "DB struct:", hb_ValToExp( dbStruct() ) ? "-5-" FOR tmp := 1 TO FCount() - ? FIELDNAME( tmp ), HB_FIELDTYPE( tmp ) + ? FieldName( tmp ), hb_FieldType( tmp ) NEXT ? "-6-" - INKEY( 0 ) - BROWSE() + Inkey( 0 ) + Browse() - INDEX ON FIELD->AGE TO age - DBGOTOP() - BROWSE() - DBCLOSEAREA() + INDEX ON FIELD -> AGE TO age + dbGoTop() + Browse() + dbCloseArea() RETURN