dc03kks
dc03kks

Reputation: 221

PowerBuilder create a datastore from sql select and then fetch data

i have a question and i m trying to find a code example to implement in my project. Here is the question, i want in powerbuilder to create a datastore from simple sql select and then to fetch one by one the value stored in the ds. I want this cause at the moment i m using CURSOR which is very slow and has transaction size problems, then i tried ROW_NUMBER which also is very slow. I m using on my application both oracle and sql. (with a lot of data), please if u can provide me an pb example it would be very helpful. thank you guys.

Upvotes: 0

Views: 7617

Answers (1)

Marc Vanhoomissen
Marc Vanhoomissen

Reputation: 395

Here is an example:

datastore lds_data
lds_data = CREATE datastore
lds_data.DataObject = "your datawindow" 
lds_data.SetTransObject (SQLCA)
lds_data.Retrieve()  // Put your parms in the parenthesis
...
DESTROY lds_data // Optionnal - 

And if you want to dynamically build the Datastore from the SQL statement, replace the 3rd line by (ls_err being defined as string variable and will contain possible return error) :

 lds_data.create(sqlca.SyntaxFromSQL('select col, you, want from your_table', 'Style(Type=Form)', ls_err))

Upvotes: 2

Related Questions