* contrib/gtalleg/tests/hbmk.hbm
* contrib/hbmysql/utils/hbmk.hbm
* contrib/hbmysql/utils/dbf2mysq.prg
* contrib/hbmysql/tests/test.prg
* contrib/hbmysql/tests/hbmk.hbm
* contrib/hbct/tests/tab.prg
* contrib/hbct/tests/tokensep.prg
* contrib/hbct/tests/datetime.prg
* contrib/hbct/tests/hbmk.hbm
* contrib/hbct/tests/token2.prg
* contrib/hbct/tests/charhist.prg
* contrib/xhb/tests/hbmk.hbm
* contrib/hbodbc/tests/hbmk.hbm
* contrib/hbtpathy/tests/hbmk.hbm
* contrib/hbmzip/tests/hbmk.hbm
* contrib/hbsqlit3/tests/hbmk.hbm
* contrib/hbsqlit3/tests/authoriz.prg
* contrib/hbblat/tests/hbmk.hbm
* contrib/hbqt/tests/hbmk.hbm
* contrib/hbfbird/tests/simple.prg
* contrib/hbfbird/tests/test.prg
* contrib/hbfbird/tests/hbmk.hbm
* contrib/hbziparc/tests/hbmk.hbm
* contrib/hbxbp/tests/hbmk.hbm
* contrib/hbnf/tests/ftgete.prg
* contrib/hbnf/tests/hbmk.hbm
* contrib/hbcurl/tests/ftp_uldl.prg
* contrib/hbcurl/tests/hbmk.hbm
* contrib/hbmemio/tests/hbmk.hbm
* contrib/gtqtc/tests/demoqtc.prg
* contrib/gtqtc/tests/hbmk.hbm
* contrib/hbnetio/utils/hbmk.hbm
* contrib/hbnetio/tests/hbmk.hbm
* contrib/rddsql/tests/hbmk.hbm
* contrib/hbhpdf/tests/harupdf.prg
* contrib/hbhpdf/tests/hbmk.hbm
* contrib/rddado/tests/hbmk.hbm
* contrib/gtwvg/tests/hbmk.hbm
* contrib/hbpgsql/tests/async.prg
* contrib/hbpgsql/tests/test.prg
* contrib/hbpgsql/tests/hbmk.hbm
* contrib/hbpgsql/tests/cache.prg
* contrib/hbpgsql/tests/stress.prg
* contrib/hbpgsql/tests/dbf2pg.prg
* contrib/hbclipsm/tests/hbmk.hbm
* contrib/rddads/tests/datad.prg
* contrib/rddads/tests/hbmk.hbm
* contrib/rddads/tests/testmg.prg
* contrib/hbfimage/tests/fitest.prg
* contrib/hbfimage/tests/hbmk.hbm
* contrib/hbgd/tests/tostring.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/animgif.prg
* contrib/hbgd/tests/testdpi.prg
* contrib/hbgd/tests/hbmk.hbm
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/antialia.prg
* contrib/hbgd/tests/bartest.prg
* contrib/hbgd/tests/barms.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbmisc/tests/testhbf.prg
* contrib/hbmisc/tests/hbmk.hbm
* contrib/hbmisc/tests/twirl.prg
* contrib/hbtip/tests/dnldftp.prg
* contrib/hbtip/tests/upld_ftp.prg
* contrib/hbtip/tests/dbtohtml.prg
* contrib/hbtip/tests/hbmk.hbm
* contrib/hbwin/hbwin.h
* contrib/hbwin/hbwin.ch
* contrib/hbwin/tests/testsim.prg
* contrib/hbwin/tests/testole.prg
* contrib/hbwin/tests/testcom2.prg
* contrib/hbwin/win_com.c
* contrib/hbssl/tests/hbmk.hbm
* contrib/hbbtree/tests/hbmk.hbm
! Fixed warnings and errors in test apps.
+ Added -es2 option to test/util default options.
* Renamed few macros in hbwin / win_com implementation:
FCN* -> WIN_COM_FUN_*
WPDBG* -> WIN_COM_DBG_*
; TOFIX: Some errors are left in hbgd/test_out.prg and
gtwvg to be fixed, now the can't be built.
Please do it.
100 lines
2.7 KiB
Plaintext
100 lines
2.7 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
#include "../postgres.ch"
|
|
|
|
Function main()
|
|
Local conn, res, aTemp, x, y, pFile
|
|
Local cDb := 'test'
|
|
Local cUser := 'user'
|
|
Local cPass := 'pass'
|
|
|
|
CLEAR SCREEN
|
|
|
|
conn := PQsetdbLogin( 'localhost', "5432", NIL, NIL, cDb, cUser, cPass)
|
|
? PQdb(conn), PQuser(conn), PQpass(conn), PQhost(conn), PQport(conn), PQtty(conn), PQoptions(conn)
|
|
? PQClose(conn)
|
|
|
|
conn := PQConnect(cDb, 'localhost', cuser, cpass, 5432)
|
|
|
|
? PQstatus(conn), PQerrormessage(conn)
|
|
|
|
if PQstatus(conn) != CONNECTION_OK
|
|
quit
|
|
endif
|
|
|
|
? "Blocking: ", PQisnonblocking(conn), PQsetnonblocking(conn, .t.), PQisnonblocking(conn)
|
|
|
|
pFile := PQcreatetrace( 'trace.log' )
|
|
PQtrace( conn, pFile )
|
|
|
|
? "Verbose: ", PQsetErrorVerbosity(conn, 2)
|
|
|
|
? "Protocol: ", PQprotocolVersion(conn), ;
|
|
" Server Version: ", PQserverVersion(conn), ;
|
|
" Client Encoding: ", PQsetClientEncoding(conn, "ASCII"), ;
|
|
"New encode: ", PQclientEncoding(conn)
|
|
|
|
? PQdb(conn), PQuser(conn), PQpass(conn), PQhost(conn), PQport(conn), PQtty(conn), PQoptions(conn)
|
|
|
|
res := PQexec('drop table products')
|
|
? PQresultStatus(res), PQresultErrorMessage(res)
|
|
PQclear(res)
|
|
|
|
res := PQexec('create table products ( product_no numeric(10), name varchar(20), price numeric(10,2) )')
|
|
? PQresultStatus(res), PQresultErrorMessage(res)
|
|
PQclear(res)
|
|
|
|
res := PQexecParams(conn, 'insert into products(product_no, name, price) values ($1, $2, $3)', {'2', 'bread', '10.95'})
|
|
? "Oid Row: ", PQoidValue(res), PQoidStatus(res)
|
|
|
|
if PQresultStatus(res) != PGRES_COMMAND_OK
|
|
? PQresultStatus(res), PQresultErrorMessage(res)
|
|
endif
|
|
PQclear(res)
|
|
|
|
res := PQexec(conn, 'select price, name, product_no as "produto" from products')
|
|
|
|
if PQresultStatus(res) != PGRES_TUPLES_OK
|
|
? PQresultStatus(res), PQresultErrorMessage(res)
|
|
endif
|
|
|
|
? "Binary: ", PQbinaryTuples(res)
|
|
? "Rows: ", PQntuples(res), "Cols: ", PQnfields(res)
|
|
? PQfname(res, 1), PQftable(res, 1), PQftype(res, 1), PQfnumber(res, "name"), PQfmod(res, 1), PQfsize(res, 1), PQgetisnull(res,1,1)
|
|
|
|
aTemp := PQmetadata(res)
|
|
|
|
for x := 1 to len(aTemp)
|
|
? "Linha 1: "
|
|
for y := 1 to 6
|
|
?? aTemp[x,y], ", "
|
|
next
|
|
next
|
|
|
|
? PQFcount(res)
|
|
|
|
? PQlastrec(res)
|
|
|
|
? PQGetvalue(res,1, 2)
|
|
|
|
? PQclear(res)
|
|
|
|
? "Large Objects, always should be in a transaction..."
|
|
|
|
res := PQexec(conn, 'begin')
|
|
PQclear(res)
|
|
|
|
? (x := lo_Import( conn, 'test.prg' ))
|
|
? lo_Export( conn, x, 'test.new' )
|
|
? lo_Unlink( conn, x )
|
|
|
|
res := PQexec(conn, 'commit')
|
|
PQclear(res)
|
|
|
|
PQuntrace( conn )
|
|
PQclosetrace( pFile )
|
|
PQClose(conn)
|
|
return nil
|