All Categories  Class Hierarchy  This Category  Previous  Next  Indexes

Miscellaneous Class CATDMUSRSelect

CATDMUSRSelect
 


public class CATDMUSRSelect

Basic service to perform queries against the database

Usage Note:
Add library LV003DBA as prereq for link


Constructor and Destructor Index


o CATDMUSRSelect(CATUnicodeString&,int*,int)
o ~CATDMUSRSelect()

Method Index


o GetSelectCount(int*)
Returns the number of fetched rows using only the where clause.
o GetSelectResult(CATDMListResultLine*,int*)
Returns the result of the query.
o NextRows(CATDMListResultLine*,int*,int,int*)
Returns nbfechRows of MaxRows
o ResetParameters()
Remove all input Parameters
o RunSelect(int*)
Prepare and Run the Query for retriving Rows by chunks with NextRows sample :

int ier; int Max=50; in Nb=50;CATDMListResultLine lines;
CATDMUSRSelect usrSel("SELECT * FROM VPMENV.
o SetParameter(int,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&)
Set parameter value
o SetParameter(int,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&,double&)
Set parameter value
o SetParameter(int,CATUnicodeString&,CATUnicodeString&,CATUnicodeString&,int&)
Set parameter value

Constructor and Destructor


o CATDMUSRSelect
public CATDMUSRSelect( const CATUnicodeString& i_select_order,
int* o_ier,
const int i_nbfetchmax=-1)
Parameters:
i_select_order
ORDER HAVE TO BE IN UPPER CASE for instance: "SELECT * FROM VPMENV.PART_LIST WHERE S_PART_NUMBER LIKE 'a%';". Note that CATDMUSRSelect::GetSelectResult cuts trailing blanks. The application programmer therefore cannot trust in the length of a fixed length attribute if trailing blanks may occur. Especially a subsequent call to CATUnicodeString::SubString may return wrong results. To simulate standard SQL behaviour every application should use the SQL RPAD construct every time he uses CATDMUSRSelect::GetSelectResult. Sample: The statement "SELECT S_TYPE_REP FROM VPMENV.CATIA_MODEL;" should be replace by "SELECT RPAD (S_TYPE_REP, LENGTH(S_TYPE_REP)) FROM VPMENV.CATIA_MODEL;"
o_ier
Return code
i_nbfetchmax
if i_nbfetchmax < 0 fetch without limit
else use this value as limitation during fetch
o ~CATDMUSRSelect
public ~CATDMUSRSelect()

Methods


o GetSelectCount
public virtual int GetSelectCount(int* o_ier)
Returns the number of fetched rows using only the where clause.
o GetSelectResult
public virtual void GetSelectResult(CATDMListResultLine* o_result,
int* o_ier)
Returns the result of the query.
o NextRows
public virtual void NextRows(CATDMListResultLine* o_result,
int* o_ier,
const int MaxRows,
int* nbfechRows)
Returns nbfechRows of MaxRows
Parameters:
o_result
results lines
o_ier
return code
MaxRows
Max Rows to be read
nbfechRows
number of rows read 0 if end of fetch
o ResetParameters
public virtual void ResetParameters()
Remove all input Parameters
o RunSelect
public virtual void RunSelect(int* o_ier)
Prepare and Run the Query for retriving Rows by chunks with NextRows sample :

int ier; int Max=50; in Nb=50;CATDMListResultLine lines;
CATDMUSRSelect usrSel("SELECT * FROM VPMENV.PART_LIST WHERE S_PART_NUMBER LIKE 'a%';",&ier);
if ( ier ) usrSel.RunSelect(&ier);
while ( Nb && ! ier)
{
usrSel > NextRows(lines,&ier,Max,&Nb);
for ( int i = 1; i ≤ Nb ; i++)
{
// do something
}
}
o SetParameter
public virtual int SetParameter( const int iPos,
const CATUnicodeString& iOwner,
const CATUnicodeString& iTable,
const CATUnicodeString& iColumn,
const CATUnicodeString& iValue)
Set parameter value
Parameters:
iPos
parameter marker position thru 1 to N
iOwner
owner name
iTable
table name
iColumn
column name
iValue
input parameter value parameter is translate to appropiate database type retrieve by index "iOwner.iTabel.iColumn"
Returns:
parameter marker position
o SetParameter
public virtual int SetParameter( const int iPos,
const CATUnicodeString& iOwner,
const CATUnicodeString& iTable,
const CATUnicodeString& iColumn,
const double& iValue)
Set parameter value
Parameters:
iPos
parameter marker position thru 1 to N
iOwner
owner name
iTable
table name
iColumn
column name
iValue
input parameter value parameter is translate to appropiate database type retrieve by index "iOwner.iTabel.iColumn"
Returns:
parameter marker position
o SetParameter
public virtual int SetParameter( const int iPos,
const CATUnicodeString& iOwner,
const CATUnicodeString& iTable,
const CATUnicodeString& iColumn,
const int& iValue)
Set parameter value
Parameters:
iPos
parameter marker position thru 1 to N
iOwner
owner name
iTable
table name
iColumn
column name
iValue
input parameter value parameter is translate to appropiate database type retrieve by index "iOwner.iTabel.iColumn"
Returns:
parameter marker position

This object is included in the file: CATDMUSRSelect.h
If needed, your Imakefile.mk should include the module: LV003DBA

Copyright © 2003, Dassault Systèmes. All rights reserved.