Files
harbour-core/harbour/contrib/pgsql/tstpgrdd.prg
Przemyslaw Czerpak d35d183f35 2007-03-23 04:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/pack_src.sh
  + harbour/contrib/pgsql/Changelog
  + harbour/contrib/pgsql/Makefile
  + harbour/contrib/pgsql/README
  + harbour/contrib/pgsql/make_b32.bat
  + harbour/contrib/pgsql/makefile.bc
  + harbour/contrib/pgsql/pgrdd.prg
  + harbour/contrib/pgsql/postgres.c
  + harbour/contrib/pgsql/postgres.ch
  + harbour/contrib/pgsql/tpostgre.prg
  + harbour/contrib/pgsql/tstpgrdd.prg
  + harbour/contrib/pgsql/tests/Makefile
  + harbour/contrib/pgsql/tests/async.prg
  + harbour/contrib/pgsql/tests/cache.prg
  + harbour/contrib/pgsql/tests/dbf2pg.prg
  + harbour/contrib/pgsql/tests/simple.prg
  + harbour/contrib/pgsql/tests/stress.prg
  + harbour/contrib/pgsql/tests/test.prg
    + added Postgres SQL library - code borrowed from xHarbour

  * harbour/source/rtl/empty.c
    + added support for HASH items

  * harbour/source/rtl/itemseri.c
    + added SYMBOL items serialization
2007-03-23 03:06:39 +00:00

91 lines
2.0 KiB
Plaintext

/* The aim of this test is to check the same RDD functions and statements against a dbf file
and the same dbf imported into a PostgreSQL database.
Replace <...> with your data and configuration.
*/
procedure main()
local nConn
set deleted on
request DBFCDX
request PGRDD
use <table> index <index> exclusive via "dbfcdx"
set order to 1
test_code( "DBF" )
use
nConn := dbpgconnection( "<host>;<database>;<user>;<password>;<port>;<scheme>" )
/* if you want to update and insert data you need at least a primary key */
use "select <fields,...> from <table> order by <same order as dbf>" alias <table> via "pgrdd" connection nConn
test_code( "SQL" )
use
dbpgclearconnection( nConn )
return
function test_code( cMode )
local xTemp
<table>->( dbgotop() )
? <table>-><field1>, <table>-><field2>, <table>-><field3>
<table>->( dbgobottom() )
? <table>-><field1>, <table>-><field2>, <table>-><field3>
/* goto 100 has different meaning */
<table>->( dbgoto( 100 ) )
? <table>-><field1>, <table>-><field2>, <table>-><field3>
xTemp := <table>-><field3>
replace <table>-><field3> with "*** replaced ***"
? <table>-><field1>, <table>-><field2>, <table>-><field3>
replace <table>-><field3> with xTemp
dbcommit() // the real write is made via dbcommit() so it is needed
? <table>-><field1>, <table>-><field2>, <table>-><field3>
? eof()
dbgobottom()
dbskip()
? eof()
? bof()
dbgotop()
dbskip(-1)
? bof()
dbappend()
replace <table>-><field1> with <"9">
replace <table>-><field2> with <"999999">
replace <table>-><field3> with <"APPENDED">
dbcommit()
// recno() has different meaning, in SQL it is the number of the row and change for every select */
? <table>->( recno() ), <table>-><field1>, <table>-><field2>, <table>-><field3>
wait
cls
BROWSE()
dbgobottom()
replace <table>-><field3> with "REPLACED"
dbcommit()
dbgobottom()
BROWSE()
delete for <table>-><field1> = "9"
return nil