- import declarations
- Integer
_embsqlghoSQLHandleMngr - Integer
SQLResult - cSQLStatement : Array
*****************************************************************************
*** Class : cSQLStatement ***
*** Purpose: Statement object for embedded sql ***
*** ***
*** Description: ***
*** An object is created for each statement. These will be children ***
*** of cSQLConnection objects which manage the create and destruction ***
*** of these. ***
*****************************************************************************
Construct_object(Integer Image)
- Integer
phCLIHandle - String
psDriverID - Integer
phStmtConnection - Integer
piLastColumn - Integer
piLastArgument - Integer
piBindFile
StoreHandleInfo(Integer iCLIHandle String sDrvrId Integer iParentHandle)
***
*** Procedure: StoreHandleInfo
*** Purpose : Store basic information about the statement handle.
***
FreeHandle()
***
*** Procedure: FreeHandle
*** Purpose : Free a handle. Since a handle is stored in an
*** cSQLStatement object, we destroy the object.
***
HandleError(Integer ihstmt Integer ihdbc String sDrvrId String sOriginMsg)
***
*** Procedure: HandleError
*** Puprose : Handle an error that has occured while checking properties.
***
- Integer
iErrHandle - Integer
iErrNum - String
sLocationInfo
StmtError(Integer iErrNum String sErrText String sOriginMsg)
***
*** Procedure: StmtError
*** Purpose : Handle general error not related to the properties
***
- Integer
iErrHandle - String
sLocationInfo
SQLIllegalAttribute(String sErrText String sOriginMsg)
***
*** Procedure: SQLIllegalAttribute
*** Purpose : Handle an illegal attribute error
***
- Integer
bReport
- Integer
SQLPrivateColumnIsLegal(Integer ihdbc String sDrvrId Integer ihstmt Integer iCol)
***
*** Function: SQLPrivateColumnIsLegal
*** Purpose : Check if a column number is legal
***
- Integer
bLegal - Integer
iNumColumns
SQLClose()
***
*** Procedure: SQLClose
*** Purpose : Close a statement and free all alllocated resources
***
- Integer
ihdbc - Integer
ihstmt - Integer
iVoid - String
sDrvrId - String
sEmpty
SQLPrepare(String sStatement)
***
*** Procedure: SQLPrepare
*** Purpose : Prepare a statement for execution
***
- Integer
ihdbc - Integer
ihstmt - Integer
iVoid - String
sDrvrId
SQLExecute()
***
*** Procedure: SQLExecute
*** Purpose : Execute a prepared statement
***
- Integer
ihdbc - Integer
ihstmt - Integer
iVoid - String
sDrvrId - String
sEmpty
SQLExecDirect(String sStatement)
***
*** Procedure: SQLExecDirect
*** Purpose : Prepare and execute a statement
***
- Integer
ihdbc - Integer
ihstmt - Integer
iVoid - String
sDrvrId
- Integer
SQLFetch()
***
*** Procedure: SQLFetch
*** Purpose : Fetch the next row
*** Returns : 0 = No more data
*** <>0 = Success
***
- Integer
ihdbc - Integer
ihstmt - Integer
iResult - String
sDrvrId - String
sEmpty
- String
SQLNextColumn()
***
*** Function: SQLNextColumn
*** Purpose : Get the next column
***
- Integer
iCol - String
sResult
- String
SQLColumnValue(Integer iCol)
***
*** Function: SQLColumnValue
*** Purpose : Return the value of a column in a fetched row of a given
*** statement.
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - String
sResult
- String
SQLPrivateColumnValue(Integer iCol Integer ihdbc String sDrvrId Integer ihstmt)
- Integer
iVoid - Integer
iColSize - Integer
iColPrecision - String
sResult - String
sEmpty - Integer
bLegalColumn
SQLBindFile(Integer iFileNum)
***
*** Procedure: SQLBindFile
*** Purpose : Add a file to the files used to place the statement result in.
***
- Integer
ihdbc - Integer
ihstmt - Integer
iVoid - String
sDrvrId - String
sFileType - Integer
bIsOpen
- String
SQLGetData(Integer iCol Integer iLen)
*************************************************************************
*** Function: SQLGetData ***
*** Purpose : Get data of a column. ***
*************************************************************************
- Integer
ihdbc - Integer
ihstmt - Integer
iVoid - Integer
iColSize - Integer
iResult - String
sDrvrId - String
sResult - String
sEmpty - Integer
bLegalColumn
- Integer
SQLColumnMap(String sColname)
***
*** Function: SQLColumnMap
*** Purpose : Map a column name to a number, if the name id not found no
*** error is generated the returned number will be 0 (zero) in
*** that case
***
- Integer
ihdbc - Integer
ihstmt - Integer
iNumColumns - Integer
iColCount - Integer
iColNum - String
sDrvrId - String
sCurColName
- String
SQLStmtAttribute(Integer iAttribId)
***
*** Function: SQLStmtAttribute
*** Purpose : Get a statement attribute
***
- Integer
ihdbc - Integer
ihstmt - String
sResult - String
sDrvrId
- String
SQLPrivateStmtAttribute(Integer iAttribId Integer ihdbc String sDrvrId Integer ihstmt)
- String
sResult - Integer
iLen - Integer
bLegalAttrib
- String
SQLColAttribute(Integer iCol Integer iAttribId)
***
*** Function: SQLColAttribute
*** Purpose : Get a column's attribute
***
- Integer
ihdbc - Integer
ihstmt - String
sResult - String
sDrvrId
- String
SQLPrivateColAttribute(Integer iCol Integer iAttribId Integer ihdbc String sDrvrId Integer ihstmt)
- String
sResult - String
sEmpty - Integer
bIsStringAttribute - Integer
iLen - Integer
iVoid - Integer
bLegalAttrib - Integer
bLegalColumn
SQLSetProcedureName(String sProcName String sSchemaArg)
***
*** Procedure: SQLSetProcedureName
*** Purpsoe : Preapre for calling a stored procedure, pass the procedure name.
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iVoid - String
sSchema - String
sEmpty
SQLSetNextArgument(String sArgument)
***
*** Function: SQLSetNextArgument
*** Purpose : Pass the next argument
***
- Integer
iArgnum
SQLSetArgument(Integer iArgnum String sArgument)
***
*** Procedure: SQLSetArgument
*** Purpose : Set the next argument
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iVoid - String
sEmpty
SQLCall()
***
*** Procedure: SQLCall
*** Purpose : Call a stored procedure
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iVoid - String
sEmpty
- String
SQLGetNextArgument()
***
*** Function: SQLGetNextArgument
*** Purpose : Get the next argument
***
- Integer
iArgnum - String
sResult
- String
SQLGetArgument(Integer iArgnum)
***
*** Function: SQLGetArgument
*** Purpose : Get the specified argument from a procedure
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iVoid - String
sEmpty - String
sArgument - Integer
iLen
- String
SQLReturnValue()
***
*** Function: SQLReturnValue
*** Purpose : Get the reutn value of a stored function
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iVoid - String
sEmpty - String
sRetval - Integer
iLen
- Integer
SQLNextResultSet()
***
*** Function: SQLNextResultSet
*** Purpose : Switch to the next set
*** Returns : 0 = No more result sets
*** <>0 = Switched to next set
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iResult - String
sEmpty
SQLFetchActivatesBuffer(Integer iFileNum Integer bState)
***
*** Procedure: SQLFetchActivatesBuffer
*** Purpose : Setup a file that will be acivated after a succesfull
*** fetch on the statement
***
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - Integer
iResult - Integer
bIsOpen - Integer
iVoid - String
sFileType
- String
SQLGetMessage(Integer iMessageNum)
- Integer
ihdbc - Integer
ihstmt - String
sDrvrId - String
sMessage - Integer
iVoid
- String
RemoveComponentIdentifier(String sDiagMessage)
***
*** Function: RemoveComponentIdentifier
*** Purpose : Remove the component identifier from a diagnostic message
***
- String
DFDateToSQLDate(Date dDFDate)
***
*** Function: DFDateToSQLDate
*** Purpose : Convert a DataFlex date to a SQL Date. Use dummy zero dates.
***
- String
SQLDateToDFDate(String sSQLDate)
***
*** Function: SQLDateToDFDate
*** Purpose : Convert a SQL date to a DataFlex Date. Use dummy zero dates.
***
{ Visibility=Private }
- cSQLConnection : Array
*****************************************************************************
*** Class : cSQLConnection ***
*** Purpose: Connection object for embedded SQL ***
*** ***
*** Description: ***
*** This provides the ability to create a connection for a driver. ***
*** It will contain child statement objects ***
*****************************************************************************
Construct_object(Integer Image)
- Integer
phCLIHandle - String
psDriverID - Integer
piBindFile
StoreHandleInfo(Integer iCLIHandle String sDrvrId Integer iParentHandle)
***
*** Procedure: StoreHandleInfo
*** Purpose : Store basic information about the statement handle.
***
FreeHandle()
***
*** Procedure: FreeHandle
*** Purpose : Destroys handle object and all child statement objects
***
- Integer
SQLConnect(string sDrvrID String sConnect)
***
*** Function: SQLConnect
*** Purpose : Make a connectin to an embedded SQL server
*** Returns : The DataFlex handle to the connection
***
- Integer
ihdbc - String
sEmpty
- Integer
SQLFileConnect(Integer iFileNum)
***
*** Function: SQLFileConnect
*** Purpose : Use a connection of an already open file
***
- Integer
ihdbc - Integer
bIsOpen - String
sDrvrId - String
sEmpty
SQLDisconnect()
***
*** Procedure: SQLDisconnect
*** Purpose : Disconnect from an embedded SQL server and free allocated
*** resources
***
- Integer
ihdbc - Integer
iVoid - String
sDrvrId - String
sEmpty
- Integer
CreateHandle()
***
*** Function: CreateHandle
*** Purpose : Creates a child statement handle
***
- Integer
SQLOpen()
***
*** Function: SQLOpen
*** Prupose : Open a statement for use
***
- Integer
hDFHandle - Integer
ihdbc - Integer
ihstmt - Integer
iVoid - String
sDrvrId - String
sEmpty
- cSQLHandleManager : Array
*****************************************************************************
*** Class : cSQLHandlemanager ***
*** Purpose: Manager for embedded SQL handles. ***
*** ***
*** Description: ***
*** We want to be able to use multiple drivers and multiple ***
*** connections within a driver and multiple statements within a ***
*** connection. To allow this we have palced our own handle logic on ***
*** top of the driver handle logic. This way we can handle the ***
*** situation where two driver handles may be equal. ***
*****************************************************************************
Construct_object(Integer Image)
- String
psDefaultDriver - String
psDefaultConnection
- Integer
CreateHandle()
***
*** Function: CreateHandle
*** Purpose : Allocate memory for the desired type of handle
***
SQLSetConnect(String sDriver String sConnect)
***
*** Procedure: SQLSetConnect
*** Purpose : Store default connection information
***
- integer
SQLConnect(String sDrvrID String sConnect)
***
*** Function: SQLConnect
*** Purpose : Make a connectin to an embedded SQL server
*** Returns : The DataFlex handle to the connection
***
- Integer
hDFHandle - Integer
bOK
- Integer
SQLFileConnect(Integer iFileNum)
***
*** Function: SQLFileConnect
*** Purpose : Make an existing connection available for use with Embedded
*** SQL. The connection is identified by the number opf a file
*** that is open for that connection.
***
- Integer
hDFHandle - Integer
bOK
- SQLSetConnect
*****************************************************************************
*** Command: SQLSetConnect ***
*** Purpose: Setup default connection information for embedded SQL. ***
*** ***
*** Syntax : SQLSetConnect sSDriverId sConnectString ***
*****************************************************************************
- SQLConnect
*****************************************************************************
*** Command: SQLConnect ***
*** Purpose: Connect to a server for embedded SQL usage. ***
*** ***
*** Syntax : SQLConnect To hdbc ***
*** SQLConnect [sDriverId sConnectString] To hdbc ***
*****************************************************************************
- SQLFileConnect
*****************************************************************************
*** Command: SQLFileConnect ***
*** Purpsoe: Return the handle to a connection of an open file. This ***
*** connection is (obviously) already opened. We are just using ***
*** the same connection for Embedded SQL. This allows the ***
*** programmer not to know connection details. ***
*** ***
*** Syntax : SQLFileConnect Filex To hdbc ***
*****************************************************************************
- SQLDisconnect
*****************************************************************************
*** Command: SQLDisconnect ***
*** Purpose: Connect to a server for embedded SQL usage. ***
*** ***
*** Syntax : SQLDisConnect hdbc ***
*****************************************************************************
- SQLOpen
*****************************************************************************
*** Command: SQLOpen ***
*** Purpose: Allocate the memory to stroe statement information. ***
*** ***
*** Syntax : SQLOpen hdbc To hstmt ***
*****************************************************************************
- SQLClose
*****************************************************************************
*** Command: SQLClose ***
*** Purpose: Close a statement and free all associated memory. ***
*** ***
*** Syntax : SQLClose hstmt ***
*****************************************************************************
- SQLPrepare
*****************************************************************************
*** Command: SQLPrepare ***
*** Purpose: Prepare a statement for execution. ***
*** ***
*** Syntax : SQLPrepare hstmt sStatement ***
*****************************************************************************
- SQLExecute
*****************************************************************************
*** Command: SQLExecute ***
*** Purpose: Execute a prepared statement ***
*** ***
*** Syntax : SQLExecute hstmt ***
*****************************************************************************
- SQLExecDirect
*****************************************************************************
*** Command: SQLExecDirect ***
*** Purpose: Prepare and execute a statement. ***
*** ***
*** Syntax : SQLExecDirect hstmt sStatement ***
*****************************************************************************
- SQL$NextFile
*****************************************************************************
*** Command: SQLFileFetch ***
*** Purpose: Get a row from a statement result set. ***
*** ***
*** Syntax : SQLFileFetch hstmt [To File1 [File2 ...]] ***
*****************************************************************************
- SQLFileFetch
- SQLBindFetchFile
*****************************************************************************
*** Command: SQLBindFetchFile ***
*** Purpose: Binds a file number to a statement so it can be used for ***
*** fetching data. Only needed in non fileconnect. Note that ***
*** can be assigned to the connection or the statement handle ***
*** ***
*** Syntax : SQLBindFileForFetch hstmt|hdbc FileName|FileNumber ***
*****************************************************************************
- SQL$NextColumn
*****************************************************************************
*** Command: SQLFetch ***
*** Purpose: Get a row from a statement result set. ***
*** ***
*** Syntax : SQLFetch hstmt [To Var1 [Var2 ...]] ***
*****************************************************************************
- SQLFetch
- SQLGetData
*****************************************************************************
*** Command: SQLGetData ***
*** Purpose: Get a column's data. ***
*** ***
*** Syntax : SQLGetData hstmt iColumnNUmber [Length iLen] To Var ***
*****************************************************************************
- SQLColumnMap
*****************************************************************************
*** Command: SQLColumnMap ***
*** Purpose: Determine the column number based on the column name. ***
*** ***
*** Syntax : SQLColumnMap hstmt sColName To iColNumber ***
*****************************************************************************
- SQLColAttribute
*****************************************************************************
*** Command: SQLColAttribute ***
*** Purpose: Get an attribute of a column in a statements result set. ***
*** ***
*** Syntax : SQLColAttribute hstmt iCol iAttrId To sAttrib ***
*****************************************************************************
- SQLStmtAttribute
*****************************************************************************
*** Command: SQLStmtAttribute ***
*** Purpose: Get an atribute of a statement. ***
*** ***
*** Syntax : SQLStmtAttribute hstmt iAttribId To sAttrib ***
*****************************************************************************
- SQL$SetNextArgument
*****************************************************************************
*** Command: SQLCall ***
*** Purpose: Call a stored procedure. ***
*** ***
*** Syntax : SQLCall hstmt ProcedureName SchemaName [Arg1 ...] [To Var] ***
*** You can pass "" for SchemaName. ***
*****************************************************************************
- SQL$GetNextArgument
- SQLCall
- SQLGetArguments
*****************************************************************************
*** Command: SQLGetArguments ***
*** Purpsoe: Get the arguments of a stored procedure. This command should ***
*** be used when a procedure has multiple result sets. Some ***
*** backends (SQL SErver for example) will return these as the ***
*** last result set. This emans you first process all other ***
*** result sets and then get the arguments and return value. ***
*** ***
*** Syntax : SQLGetArguments hstmt [Arg1...] [To Var] ***
*****************************************************************************
- SQLNextResultSet
*****************************************************************************
*** Command: SQLNextResultSet ***
*** Purpose: Go the the next result set. This command should be used when ***
*** a procedure call results in multiple result sets. Processing ***
*** such procedures can be done by loping through the result ***
*** sets. ***
*** ***
*** Syntax : SQLNextResultSet hstmt ***
*****************************************************************************
- SQLFetchActivatesBuffer
*****************************************************************************
*** Command: SQLFetchActivatesBuffer ***
*** Purpose: Setup fetch behavior for a file. When set to true a ***
*** succesfull fetch of the statement resutl set will ***
*** automatically set the status of the file's bufer to ***
*** DF_FILE_ACTIVE. ***
*** ***
*** Syntax : SQLFetchActivatesBuffer hstmt FileNUmber|FileName sState ***
*****************************************************************************