* contrib/hbwin/hbole.ch
! missing svn props
* contrib/hbwin/hbsim.ch
* contrib/hbfoxpro/hbfoxpro.ch
* contrib/hbmysql/mysql.ch
! added missing self-guards
This was a requirement, but now it really must
be done, if a header wants to be put in headers=
directive in a .hbc file for auto-inclusion.
* contrib/hbmysql/tests/dbf2mysq.prg
! missing #require directive
* contrib/hbblat/hbblat.hbc
* contrib/hbblink/hbblink.hbc
* contrib/hbbz2/hbbz2.hbc
* contrib/hbcairo/hbcairo.hbc
* contrib/hbcurl/hbcurl.hbc
* contrib/hbexpat/hbexpat.hbc
* contrib/hbfimage/hbfimage.hbc
* contrib/hbfoxpro/hbfoxpro.hbc
* contrib/hbgd/hbgd.hbc
* contrib/hbhpdf/hbhpdf.hbc
* contrib/hblzf/hblzf.hbc
* contrib/hbmagic/hbmagic.hbc
* contrib/hbmlzo/hbmlzo.hbc
* contrib/hbmxml/hbmxml.hbc
* contrib/hbmysql/hbmysql.hbc
* contrib/hbmzip/hbmzip.hbc
* contrib/hbnetio/hbnetio.hbc
* contrib/hbpgsql/hbpgsql.hbc
* contrib/hbsqlit3/hbsqlit3.hbc
* contrib/hbssl/hbssl.hbc
* contrib/hbtpathy/hbtpathy.hbc
* contrib/hbxdiff/hbxdiff.hbc
* contrib/hbzebra/hbzebra.hbc
* contrib/rddsql/rddsql.hbc
+ added .ch headers to .hbc files for
autoload.
; For some contribs it still has to do
for several reasons, f.e. .ch file overrides
standard features so they must stay optional,
or they must be optional for other reasons,
or they have multiple headers and I didn't
decide yet which one of those should be
standard.
* contrib/hbexpat/tests/test.prg
* contrib/hbexpat/tests/tohash.prg
* contrib/hbfimage/tests/fitest.prg
* contrib/hbgd/tests/animgif.prg
* contrib/hbgd/tests/antialia.prg
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbgd/tests/testdpi.prg
* contrib/hbgd/tests/tostring.prg
* contrib/hbgd/tests/tpoly.prg
* contrib/hbhpdf/tests/harupdf.prg
* contrib/hblzf/tests/test.prg
* contrib/hbmlzo/tests/test.prg
* contrib/hbpgsql/tests/cache.prg
* contrib/hbpgsql/tests/stress.prg
* contrib/hbpgsql/tests/test.prg
* contrib/hbsqlit3/tests/authoriz.prg
* contrib/hbsqlit3/tests/backup.prg
* contrib/hbsqlit3/tests/blob.prg
* contrib/hbsqlit3/tests/hooks.prg
* contrib/hbsqlit3/tests/metadata.prg
* contrib/hbsqlit3/tests/pack.prg
* contrib/hbsqlit3/tests/sl3_test.prg
* contrib/hbssl/tests/bio.prg
* contrib/hbssl/tests/crypt.prg
* contrib/hbssl/tests/digest.prg
* contrib/hbssl/tests/encode.prg
* contrib/hbssl/tests/pem.prg
* contrib/hbssl/tests/test.prg
* contrib/hbxdiff/tests/test.prg
* contrib/hbxdiff/tests/test2.prg
* contrib/hbxdiff/tests/test3.prg
* contrib/hbzebra/tests/testcair.prg
* contrib/hbzebra/tests/testhpdf.prg
* contrib/hbzebra/tests/testwin.prg
* 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
% no longer use #include to include standard
package headers. Rely on autoload triggered
by .hbc file or #require directive.
94 lines
2.6 KiB
Plaintext
94 lines
2.6 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
#require "hbpgsql"
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL conn, res, aTemp, x, y, pFile
|
|
LOCAL cDb := "test"
|
|
LOCAL cUser := "user"
|
|
LOCAL cPass := "pass"
|
|
|
|
CLS
|
|
|
|
conn := PQsetdbLogin( "localhost", "5432", NIL, NIL, cDb, cUser, cPass )
|
|
? PQdb( conn ), PQuser( conn ), PQpass( conn ), PQhost( conn ), PQport( conn ), PQtty( conn ), PQoptions( conn )
|
|
|
|
conn := PQconnectdb( "dbname = " + cDb + " host = localhost user = " + cUser + " password = " + cPass + " port = 5432" )
|
|
|
|
? PQstatus( conn ), PQerrorMessage( conn )
|
|
|
|
IF PQstatus( conn ) != CONNECTION_OK
|
|
QUIT
|
|
ENDIF
|
|
|
|
? "Blocking: ", PQisnonblocking( conn ), PQsetnonblocking( conn, .T. ), PQisnonblocking( conn )
|
|
|
|
pFile := PQtracecreate( "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( conn, "drop table products" )
|
|
? PQresultStatus( res ), PQresultErrorMessage( res )
|
|
res := NIL
|
|
|
|
res := PQexec( conn, "create table products ( product_no numeric(10), name varchar(20), price numeric(10,2) )" )
|
|
? PQresultStatus( res ), PQresultErrorMessage( 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
|
|
|
|
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 )
|
|
|
|
? "Large Objects, always should be in a transaction..."
|
|
|
|
PQexec( conn, "begin" )
|
|
|
|
? ( x := lo_import( conn, __FILE__ ) )
|
|
? lo_export( conn, x, "test.new" )
|
|
? lo_unlink( conn, x )
|
|
|
|
PQexec( conn, "commit" )
|
|
|
|
PQuntrace( conn )
|
|
|
|
RETURN
|