10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Access a Database with DataStream ObjectsHow You Can Use the SetCols Method to Specify the QueryNote that in addition to using parameter substitution, the preceding querydiffers from previous examples in that it does not specify the columns to beretrieved. Instead it uses the "select *" syntax to retrieve all columns from thecustomer table.After loading the SQL text into the Query attribute, you can use the SetColsmethod to get relevant column information for each column and to initializethe Columns array. The SetCols method also checks the query for syntaxerrors.The SetCols method gets information from the database table and assigns it torelevant attributes in the SQLSelect's Columns array. As an array of typeQueryCol, the Columns attribute contains the following information:AsNameSpecifies the column name used in the select statement to see theretrieved column (for example, select name as EmpName ...); used ingroup by or order by clausesColumnNameSpecifies the name of the database column; required for QueryObjectobjects but not SQLSelect objectsDataTypeSpecifies the data type of the database column; supplied or checked by theSetCols and Open methodsDataTypeLengthSpecifies the length of the data type; supplied or checked by the SetColsand Open methodsDataTypeNullableSet to TRUE if the data type is nullable; supplied or checked by the SetColsand Open methodsTargetsValueSpecifies an array of field mappings for each columnSpecifies the current column value (valid only if a row has been fetched)The attributes that contain data type information are assigned directly byinvoking the SetCols or Open methods. In addition, if it has not already beenfilled in, the AsName attribute is also assigned a value by invoking these twomethods.176 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!