rp_data::query



o.query( lcSelect as String ,
lcCursor as String ,
lnResultmode as Integer ,
llEditable as Boolean ,
lLoadFirstRecord as Boolean ,
tcTableList as String ,
tlNoNulls as Boolean
)

Return Value

The number of records retrived

Parameters

lcSelect

Select Statement

Things to be careful of.

Do not use double quotes within the select statement. Use single quotes ONLY

"Single Table Query"

Note that you do not need to include the "FROM" or "INTO" section of the query.
The query object looks after that.

"Multi Table Query"

When carrying out multi table queries you DO need to include the FROM clause
See example below

lcCursor

Cursor name to use to store retrieved data. This cursor is created internally to the Object.
You use this only if you want to carry out further conversions on the returned data set.
For instance using the Convertdata method.

lnResultmode

This determines if the returned data set is converted to a particular format.
For a complete listing of possible formats refer to the Convertdata method

lcEditTable

DO NOT USE THIS. Leave it empty or blank

llLoadFirstRecord

If this is set to True then the query will load the first record of the retrieved data set into the oData property. This is very useful if you are executing queries which you expect only 1 record back from

tcTableList
This parameter is only needed if you are carrying out a multitable query. You need to pass
a comma separated list of the tables involved in the query. If you are using the same table
more than once then you need to pass the alias as well.
For eaxmple "charge, customer, coustomer as customer_a"

tlNoNulls

This is used to remove null values from fields. If you are carrying out a multi table query you should set this to true
as fields which contain null values are not returned over HTTP. It will automatically be set to true in multi
table queries

Example

"Single Table Query"

o.query("Select * where code = '236367'", "tRecords", 31, "", .T.)

The above query would ;
1.	Retrieve records for the select statement
2.	Place the results in the internal cursor called "TRecords"
3.	Place all records in the collection o.oRows
4.	Load the first record retrieved into the o.oData property


"Multi Table Query"

* Set the select statement
lcSelect = "Select customer.Name, charge.* ;
			FROM CUSTOMER INNER JOIN CHARGE ;
			ON CUSTOMER.ACCOUNT == CHARGE.ACCOUNT ;
			WHERE ACCOUNT == '  232322'"

* Set tables involved
lcTables = "charge,customer"
			
o.query(lcSelect,"tRecords", 31, "", .T.,lcTables,.T.)

The above query would ;
1.	Retrieve records for the select statement from all tables
2.	Place the results in the internal cursor called "TRecords"
3.	Place all records in the collection o.oRows
4.	Load the first record retrieved into the o.oData property
5.	Replace all NULL values with blank values (this is default when carrying out multi table queries)
	If you want null values you must use "Local" connections only as over HTTP columns
	containing null values will be removed.

See also:

Class rp_data


Last Updated: 23/11/2005