Returns the index of the column with the specified column name in the result set of a SELECT statement.
| Arguments: |
The arguments are:
| stmt [required] |
The Handle to the oosqlPrepare statement to
be queried. The handle must not be oosqlIsHandleNull and the statement must not
have been oosqlFinalize .
|
| colName [required] |
The name of the column whose index is desired. The name is case-insensitive because SQLite does not allow column
names that differ only by case.
|
|
| Return value: |
Returns the one-based index of the column that matches the specified name, or 0 if there is no match.
|
| Details |
This function does not access any of the SQLite APIs. It is specific to ooSQLite.
|
| Example: |
This example uses theoosqlColumnIndexfunction to get the index of thenamecolumn in thefoodstable:
| dbConn = '' |
| ret = oosqlOpen('ooFoods.rdbx', 'dbConn') |
|
| stmt = '' |
| ret = oosqlPrepare(dbConn, "SELECT * FROM foods", 'stmt') |
| index = oosqlColumnIndex(stmt, 'name') |
|
| do while oosqlStep(stmt) == .ooSQLite~ROW |
| say oosqlColumnText(stmt, index) |
| end |
|
| dbConn~close |
| stmt~finalize
|
|