ich komme an die PostgreSQL MDIDEMO "Table" mit Phil Ide´s "Wrapper" wie folgt
Code: Alles auswählen
cConnect := "host=localhost dbname="+cDbName+" user="+cUser+" password="+cPwd
oPG := PGSql():new()
if oPG:connect( cConnect )
Code: Alles auswählen
cSQL := "SELECT * FROM %1"
cSQL := StrTran(cSQL,"%1",Lower(cTable))
if oPG:exec(cSQL)
oRes := oPG:result
aFNames := oRes:getFieldnames()
nCols := LEN(aFNames)
Code: Alles auswählen
oRes:goTop() // go top!
//
nRow := 0
nH := FCreate('result2.txt')
while !oRes:eof()
n := 1
cLine := ""
for n := 1 to nCols
cLine += iif( n > 1 , ", " , "")
cLine += oRes:getValue( nRow, n )
next
cLine += CRLF
FWrite( nH, cLine )
oRes:skip()
nRow++
enddo
FClose(nH)
klar könnte man alles in ein Array "schreiben" und das browsen ...
mein "Problem" :
Code: Alles auswählen
for i := 1 to oPGResult:cols
cField := oPGResult:fname(i-1)
IF SUBSTR(cField,1,2) = "__"
ELSE
oBr:addColumn( MakeFieldBlock( oPGResult, cField ), , cField )
ENDIF
next
Function MakeFieldBlock( o, c )
IF IsMemberVar(o,c)
return {|| o:&(c) }
ENDIF
IF IsMethod(o,c)
return {|| o:&c }
ENDIF
return {|| .T. }