Difference between revisions of "SQLCOLUMNS()"
From Lianjapedia
Yvonne.milne (Talk | contribs) m (1 revision: SQL) |
Helen.george (Talk | contribs) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Store column information to a cursor | Store column information to a cursor | ||
− | |||
==Syntax== | ==Syntax== | ||
SQLCOLUMNS(<nStatementHandle>, <cTableName> [, "FOXPRO" | "NATIVE"] [, <cCursorName>]) | SQLCOLUMNS(<nStatementHandle>, <cTableName> [, "FOXPRO" | "NATIVE"] [, <cCursorName>]) | ||
− | |||
==See Also== | ==See Also== | ||
− | + | [[SQLCANCEL()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]], [[SQLTRANSACTION()]] | |
− | + | ||
==Description== | ==Description== | ||
The SQLCOLUMNS() function is used to store column information for a specified data source table to a cursor. | The SQLCOLUMNS() function is used to store column information for a specified data source table to a cursor. | ||
− | The SQLCOLUMNS() function operates on the | + | The SQLCOLUMNS() function operates on the ODBC connection specified by <nStatementHandle>. |
− | + | {| class="wikitable" width="100%" | |
− | {| class="wikitable" | + | !width="30%"|Keywords||width="70%"|Description |
− | !Keywords||Description | + | |
|- | |- | ||
− | |nStatementHandle|| | + | |nStatementHandle||Statement handle to the connection |
|- | |- | ||
|cTableName||The table from which the column information should be returned | |cTableName||The table from which the column information should be returned | ||
|- | |- | ||
− | |"FOXPRO" | "NATIVE"||Used to specify the format for the column information. " | + | |valign="top"|"FOXPRO" | "NATIVE"||Used to specify the format type for the column information. "NATIVE" is ignored, format type is always "FOXPRO". |
|- | |- | ||
|cCursorName||The name of the cursor to use. If cCursorName is not specified, the default name SQLRESULT is used. | |cCursorName||The name of the cursor to use. If cCursorName is not specified, the default name SQLRESULT is used. | ||
Line 30: | Line 26: | ||
|} | |} | ||
+ | ====Cursor Columns:==== | ||
− | + | {| class="wikitable" width="100%" | |
− | + | !width="30%"|Column||width="70%"|Description | |
− | + | ||
− | {| class="wikitable" | + | |
− | !Column||Description | + | |
|- | |- | ||
|Field_name||Column name | |Field_name||Column name | ||
Line 44: | Line 38: | ||
|- | |- | ||
|Field_dec||Number of decimal places | |Field_dec||Number of decimal places | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
|} | |} | ||
Line 85: | Line 44: | ||
====Return values:==== | ====Return values:==== | ||
− | + | {| class="wikitable" width="100%" | |
− | {| class="wikitable" | + | !width="30%"|Return Value||width="70%"|Description |
− | !Return Value|| | + | |
− | + | ||
− | + | ||
|- | |- | ||
− | |.F.|| | + | |.F.||cTableName does not exist |
|- | |- | ||
|1||The table was created successfully | |1||The table was created successfully | ||
Line 102: | Line 58: | ||
|- | |- | ||
|} | |} | ||
− | |||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | nStatHand= | + | nStatHand = sqlconnect("awhr") |
if nStatHand < 1 | if nStatHand < 1 | ||
− | + | messagebox("Cannot make connection", 16, "SQL Connect Error") | |
else | else | ||
− | + | messagebox("Connection made", 48, "SQL Connect Message") | |
− | + | nColEnd = sqlcolumns(nStatHand, "sales.currency") | |
− | + | if nColEnd = 1 | |
− | + | list | |
− | + | else | |
− | + | messagebox("Table of Table Information could not be created") | |
− | + | endif | |
+ | sqldisconnect(nStatHand) | ||
endif | endif | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
− | [[Category: | + | [[Category:ODBC Functions]] |
+ | [[Category:SQL Functions]] |
Latest revision as of 09:56, 4 February 2013
Contents
Purpose
Store column information to a cursor
Syntax
SQLCOLUMNS(<nStatementHandle>, <cTableName> [, "FOXPRO" | "NATIVE"] [, <cCursorName>])
See Also
SQLCANCEL(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES(), SQLTRANSACTION()
Description
The SQLCOLUMNS() function is used to store column information for a specified data source table to a cursor.
The SQLCOLUMNS() function operates on the ODBC connection specified by <nStatementHandle>.
Keywords | Description |
---|---|
nStatementHandle | Statement handle to the connection |
cTableName | The table from which the column information should be returned |
"FOXPRO" | "NATIVE" | Used to specify the format type for the column information. "NATIVE" is ignored, format type is always "FOXPRO". |
cCursorName | The name of the cursor to use. If cCursorName is not specified, the default name SQLRESULT is used. |
Cursor Columns:
Column | Description |
---|---|
Field_name | Column name |
Field_type | Column data type |
Field_len | Column length |
Field_dec | Number of decimal places |
Return values:
Return Value | Description |
---|---|
.F. | cTableName does not exist |
1 | The table was created successfully |
0 | SQLCOLUMNS() still executing |
–1 | Connection error |
–2 | Environment error |
Example
nStatHand = sqlconnect("awhr") if nStatHand < 1 messagebox("Cannot make connection", 16, "SQL Connect Error") else messagebox("Connection made", 48, "SQL Connect Message") nColEnd = sqlcolumns(nStatHand, "sales.currency") if nColEnd = 1 list else messagebox("Table of Table Information could not be created") endif sqldisconnect(nStatHand) endif