METHOD PGResult:DataBlock( cFname ) // Jimmy : for PGbrowse Codeblock
LOCAL aFields
LOCAL nPosi := 0
LOCAL xRet := ""
LOCAL aClone
LOCAL PgType
DEFAULT cFname TO ""
IF VALTYPE( cFname ) = "N"
// this IS 0 Zero - based !!!
nPosi := cFname - 1
ELSE
// NOT 0 Zero - based any more
nPosi := PQfnumber( ::resID, cFname )
ENDIF
IF nPosi >= 0
// NOT 0 Zero - based any more
//
xRet := ::getValue( ::curTuple, nPosi )
ENDIF
RETURN xRet
Browse does not work, skipper does not recover the value of the data that should appear in the browse screen.
If possible, perform a test to verify the problem.
patito wrote:Browse does not work, skipper does not recover the value of the data that should appear in the browse screen.
If possible, perform a test to verify the problem.
hm ... i have test it with Phils original CLASS myPGSQLBrowse when wrote last Msg
have you include new Code in CLASS PGResult, not CLASS PGSql, found in PGSQL.PRG ?
what is inside your query0.sql ?
if !oPG:connect( cConnect )
msgbox( "PG- Fallo de Coneccion main:")
return
endif
cSQL := "SELECT * FROM notes ORDER BY notes_id "
if oPG:exec(cSQL)
oHRTimer:stop()
oRes := oPG:result
patito wrote:
This query displays the empty browse screen, without field and data names.
There is no error in the query, one can with debug see the correct answer
oBr:setup(oPGResult)
for i := 1 to oPGResult:cols
cField := oPGResult:fname(i-1)
oBr:addColumn( MakeFieldBlock( oPGResult, cField ), , cField )
next
Function MakeFieldBlock( o, c )
RETURN { || o:DataBlock( c ) }
Please run this example, and you will see that the query is correct, but the browse does not work.
1.- CREATE DATABASE pruebas (example)
2.-
cSql := "CREATE TABLE notes("
cSql += " notes_id serial , "
cSql += " First Varchar(20) not null, "
cSql += " Last Varchar(20), "
cSql += " Street Varchar(30), "
cSql += " City Varchar(30) not null, "
cSql += " State Char(2) , "
cSql += " Zip Char(10), "
cSql += " Hiredate date, "
cSql += " Married Boolean, "
cSql += " Age Integer, "
cSql += " Salary Integer, "
cSql += " Notes Varchar(30), "
cSql += " CONSTRAINT notes_pk PRIMARY KEY(notes_id) ) "