From a0d1401dde81dae189b05a170fcbbd9b49dea68d Mon Sep 17 00:00:00 2001 From: Mindaugas Kavaliauskas Date: Mon, 16 Nov 2009 22:03:40 +0000 Subject: [PATCH] 2009-11-17 00:01 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + harbour/contrib/rddsql/sddodbc/tests/test2.prg + added ODBC sample for MySql database --- harbour/ChangeLog | 4 +++ .../contrib/rddsql/sddodbc/tests/test2.prg | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 harbour/contrib/rddsql/sddodbc/tests/test2.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fafd63f292..f7eb10dddf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-17 00:01 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + + harbour/contrib/rddsql/sddodbc/tests/test2.prg + + added ODBC sample for MySql database + 2009-11-16 21:29 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbct/ctnet.c * contrib/hbct/pos1.c diff --git a/harbour/contrib/rddsql/sddodbc/tests/test2.prg b/harbour/contrib/rddsql/sddodbc/tests/test2.prg new file mode 100644 index 0000000000..c76471b51b --- /dev/null +++ b/harbour/contrib/rddsql/sddodbc/tests/test2.prg @@ -0,0 +1,35 @@ +/* + * $Id$ + */ + +#define RDDI_CONNECT 1001 + +REQUEST SQLMIX, SDDODBC + +PROC main() +LOCAL nConnection, nI, aI + + RDDSETDEFAULT( "SQLMIX" ) + SET( 4, "yyyy-mm-dd" ) + nConnection := RDDINFO( RDDI_CONNECT, { "ODBC", "DBQ=Server=192.168.1.99;Driver={MySQL ODBC 5.1 Driver};dsn=;User=test;database=test;" } ) + IF nConnection == 0 + ? "Unable connect to server" + 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() + DO WHILE ! EOF() + aI := ARRAY( FCOUNT() ) + FOR nI := 1 TO FCOUNT() + aI[nI] := FIELDGET( nI ) + NEXT + ? RECNO(), HB_VALTOEXP( aI ) + DBSKIP() + ENDDO + ? "LASTREC:", LASTREC() + DBCLOSEALL() +RETURN