Testing a query

Questions and answers regarding general SQL and backend databases

Testing a query

Postby Odysseus » Mon Jun 21, 2004 8:02 pm

The query:

var maxReturedRows = 25;//usefull to limit number of rows
var query = 'SELECT klant_id FROM klanten WHERE logonname =\''+ globals.gloginName +'\' AND logonpassword =\''+ globals.gloginPassword +'\'' ;
var dataset = databaseManager.getDataSetByQuery('Ready2Learn', query, null, maxReturedRows);

this works; now depending on wether the dataset is empty (null according to docs) I want to load a set of records or not

if(dataset)
{
forms.klanten.controller.loadRecords(dataset)
forms.klanten.controller.show()
}

This way I allways see the controller, so the if is always executed. Why is that since when I found no records dataset was null?

TIA
Odysseus

Citizen of Old Europe
Odysseus
 
Posts: 205
Joined: Wed Sep 10, 2003 9:34 pm
Location: Belgium

Postby Jan Blok » Thu Jun 24, 2004 12:29 pm

There is always a dataset returned (even if there was an error, in which case the error msg can be retrieved), to which point in the manual are you refering?
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby Odysseus » Thu Jun 24, 2004 1:20 pm

Performs custom SQL queries on a database; will return null if the dataset contains no rows; will display an error if the query syntax is incorrect.


Help navigator: getDataSetByQuery

HTH
Odysseus

Citizen of Old Europe
Odysseus
 
Posts: 205
Joined: Wed Sep 10, 2003 9:34 pm
Location: Belgium

Postby mnorman » Mon Jun 28, 2004 11:47 am

Performs custom SQL queries on a database; will return null if the
dataset contains no rows; will display an error if the query syntax is
incorrect..


The description for the function databaseManager.getDataSetByQuery
has been corrected in the next version of the Servoy Developer Edition
Volume 2: Reference Guide as well as in the Servoy online Help Navigator
(F1 Help) and the corresponding pdf file.

The modified text for the getDataSetByQuery function will read:

Performs custom SQL queries on a database; returns an empty dataset
with a SQL database error message if the dataset contains no rows; will
display an error if the query syntax is incorrect.

NOTE: The function dataset.getExceptionMsg() can be used to retrieve a
SQL database error string. For detail on syntax and examples, see the
section below on SQL query functions.

_______________
Marc Norman
Servoy
mnorman
 
Posts: 106
Joined: Wed Sep 24, 2003 8:50 pm
Location: Alturas, CA


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 35 guests