Author | Topic: SqlStatement:query() does not work | |
---|---|---|
Itai Dishon | SqlStatement:query() does not work on Tue, 24 Feb 2015 06:33:15 +0100 Hi, the following code do not return any value in the array passed to it. aRes := {} DbeLoad("pgdbe") DbeSetDefault("pgdbe") cConnStr := "DBE=pgdbe;server=localhost;" cConnStr += "db=mdidemo;uid=postgres;pwd=postgres" oSession := DacSession():New(cConnStr) IF(!oSession:IsConnected()) MsgBox("Connection failed ("+Var2Char(oSession:GetLastMessage())+")") QUIT ENDIF str := "Select * From Customer" oStmt := DacSqlStatement(oSession):fromChar(str) oStmt:build() oStmt:query(USQL_RESULT_ARRAY, @aRes) Result: aRes = {} Note: The data does exist in the workarea but there is no sense of a do while loop to read it to an array if the functionality exist after all we are trying to get rid of all this extra coding with SQL Thank you itai dishon | |
John Lau | Re: SqlStatement:query() does not work on Mon, 05 Nov 2018 04:28:16 +0100 Does anyone know of any progress on this issue? Itai Dishon wrote in message news:2a90c8ae$359f0b64$1ef12b@news.alaska- software.com... >Hi, >the following code do not return any value in the array passed to it. > > aRes := {} > > DbeLoad("pgdbe") > DbeSetDefault("pgdbe") > > cConnStr := "DBE=pgdbe;server=localhost;" > cConnStr += "db=mdidemo;uid=postgres;pwd=postgres" > > oSession := DacSession():New(cConnStr) > IF(!oSession:IsConnected()) > MsgBox("Connection failed ("+Var2Char(oSession:GetLastMessage())+")") > QUIT > ENDIF > > str := "Select * From Customer" > oStmt := DacSqlStatement(oSession):fromChar(str) > oStmt:build() > oStmt:query(USQL_RESULT_ARRAY, @aRes) > >Result: aRes = {} > >Note: The data does exist in the workarea but there is no sense of a do >while loop to read it to an array if the functionality exist after all we >are trying to get rid of all this extra coding with SQL > >Thank you >itai dishon | |
Frank Grossheinrich | Re: SqlStatement:query() does not work on Fri, 09 Nov 2018 18:02:17 +0100 Why so compilcated? PROCEDURE dbeSys() RETURN PROCEDURE Main /* we use the ansi charset by default */ SET CHARSET TO ANSI aRes := {} DbeLoad("pgdbe") DbeSetDefault("pgdbe") cConnStr := "DBE=pgdbe;server=localhost;" cConnStr += "db=mdidemo;uid=postgres;pwd=postgres" oSession := DacSession():New(cConnStr) IF(!oSession:IsConnected()) MsgBox("Connection failed ("+Var2Char(oSession:GetLastMessage())+")") QUIT ENDIF USE customer SELECT * FROM customer INTO ARRAY aRes ? aRes RETURN Frank On 05.11.2018 04:28, John Lau wrote: > Does anyone know of any progress on this issue? > > > > Itai Dishon wrote in message news:2a90c8ae$359f0b64$1ef12b@news.alaska- > software.com... >> Hi, >> the following code do not return any value in the array passed to it. >> >> aRes := {} >> >> DbeLoad("pgdbe") >> DbeSetDefault("pgdbe") >> >> cConnStr := "DBE=pgdbe;server=localhost;" >> cConnStr += "db=mdidemo;uid=postgres;pwd=postgres" >> >> oSession := DacSession():New(cConnStr) >> IF(!oSession:IsConnected()) >> MsgBox("Connection failed ("+Var2Char(oSession:GetLastMessage())+")") >> QUIT >> ENDIF >> >> str := "Select * From Customer" >> oStmt := DacSqlStatement(oSession):fromChar(str) >> oStmt:build() >> oStmt:query(USQL_RESULT_ARRAY, @aRes) >> >> Result: aRes = {} >> >> Note: The data does exist in the workarea but there is no sense of a do >> while loop to read it to an array if the functionality exist after all we >> are trying to get rid of all this extra coding with SQL >> >> Thank you >> itai dishon | |
John Lau | notifications on Mon, 03 Dec 2018 08:36:31 +0100 |