Skip to content

SQLColumnMap - cSQLStatement

Returns a column number for a name.

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
sColname String Name of column to map

Syntax

Function SQLColumnMap String sColname Returns Integer

Call Example

Get SQLColumnMap sColname to IntegerVariable

Description

Returns the column number of the column with the passed name. Column numbers are one based. If no column with the passed name exists, 0 (zero) is returned.

Sample

Handle hoSQLMngr
Handle hdbc hstmt
Integer iFetchResult
Integer iColNum

Object oSQLHandler Is A cSQLHandleManager
    Move Self To hoSQLMngr
End_Object

Open Customer
Get SQLFileConnect Of hoSQLMngr Customer.File_number To hdbc
Get SQLOpen Of hdbc To hstmt
Send SQLExecDirect Of hstmt "select * from customer"
Repeat
    Get SQLFetch Of hstmt To iFetchResult
    If (iFetchResult <> 0) Begin
        Get SQLColumnMap Of hstmt "City" To iColNum
        If (iColNum <> 0) ;
            Showln "The city column has number: " iColNum
        Else ;
            Showln "No city columns exists"
    End
Until (iFetchResult = 0)

Send SQLClose Of hstmt
Send SQLDisconnect Of hdbc

Return Value

Returns a column number for a name.