* contrib/rddsql/sqlbase.c
* contrib/rddsql/sqlmix.c
* contrib/rddsql/tests/test1.prg
* contrib/rddsql/common.mak
- contrib/rddsql/hbsqldd.h
+ contrib/rddsql/hbrddsql.h
* contrib/rddsql/make_b32.bat
* contrib/rddsql/make_vc.bat
* contrib/rddsql/make_gcc.sh
+ contrib/rddsql/sddmy
- contrib/rddsql/mysqldd.c
+ contrib/rddsql/sddmy/mysqldd.c
+ contrib/rddsql/sddmy/Makefile
+ contrib/rddsql/sddmy/make_gcc.sh
+ contrib/rddsql/sddmy/common.mak
+ contrib/rddsql/sddmy/make_b32.bat
+ contrib/rddsql/sddmy/make_vc.bat
* changed structure and names of rddsql libraries. Since it can
support many SQL databases, each backend moved to a separate
library. Otherwise (all backend in the same library) nobody will
be able to compile library without installing packages of ALL
supported SQL databases. Now:
rddsql - RDD for interfacing to SQL database drivers
sddmy - MySQL database driver
sddpg - Postgre SQL database driver
...
; TOFIX: I was unable to manage build files.
contrib/sqlrdd/sddmy/make_b32.bat sets HB_ROOT variable:
set HB_ROOT = ..\..\..
but this variable is lost and contrib/make_b32.mak reassign it:
!ifndef HB_ROOT
HB_ROOT = ..\..
!endif
This breaks building of library. To fix this problem, I've added
a two hacks:
- added additional include path into CFLAGS (see make_b32.bat)
- added "..\" to LIB_PATH (see common.mak)
The same problem is for both make_b32 and make_vc, and for both
sddmy and sddpg libraries.
; TODO: check (and adjust if neccessary) build files for unix
+ contrib/rddsql/sddpg
+ contrib/rddsql/sddpg/pgsqldd.c
+ contrib/rddsql/sddpg/Makefile
+ contrib/rddsql/sddpg/make_gcc.sh
+ contrib/rddsql/sddpg/common.mak
+ contrib/rddsql/sddpg/make_b32.bat
+ contrib/rddsql/sddpg/make_vc.bat
+ added SQL database driver for Postgre SQL
; does anyone have more RDD for Christmas gift? :)
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
#include "dbinfo.ch"
|
|
#include "error.ch"
|
|
|
|
#define DBI_QUERY 1001
|
|
|
|
#define RDDI_CONNECT 1001
|
|
#define RDDI_DISCONNECT 1002
|
|
#define RDDI_EXECUTE 1003
|
|
#define RDDI_ERROR 1004
|
|
#define RDDI_ERRORNO 1005
|
|
#define RDDI_NEWID 1006
|
|
#define RDDI_AFFECTEDROWS 1007
|
|
#define RDDI_QUERY 1008
|
|
|
|
|
|
REQUEST SDDMY, SQLMIX
|
|
|
|
FIELD RESIDENTS
|
|
|
|
PROC main()
|
|
LOCAL hConn
|
|
RDDSETDEFAULT("SQLMIX")
|
|
|
|
AEVAL(RDDLIST(), {|X| QOUT(X)})
|
|
|
|
IF RDDINFO(RDDI_CONNECT, {"MYSQL", "localhost", "test",, "test"}) == 0
|
|
? "Unable connect to the server"
|
|
RETURN
|
|
ENDIF
|
|
|
|
CreateTable()
|
|
|
|
? "Let's browse table (press any key)"
|
|
INKEY(0)
|
|
DBUSEAREA( .T.,, "SELECT * FROM country", "country" )
|
|
Browse()
|
|
|
|
? "Let's browse table ordered by resident count (press any key)"
|
|
INKEY(0)
|
|
INDEX ON RESIDENTS TAG residents TO country
|
|
Browse()
|
|
|
|
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)")
|
|
RETURN
|
|
|
|
PROC RDDSYS(); RETURN
|