Difference between revisions of "SQLCOLUMNS()"

From Lianjapedia
Jump to: navigation, search
m (1 revision: SQL)
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==
[[CREATE CONNECTION]], [[SQLCANCEL()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
+
[[SQLCANCEL()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
 
+
  
 
==Description==
 
==Description==
Line 15: Line 12:
  
 
The SQLCOLUMNS() function operates on the data source specified by <nStatementHandle>.
 
The SQLCOLUMNS() function operates on the data source specified by <nStatementHandle>.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 29: Line 25:
 
|-
 
|-
 
|}
 
|}
 
  
 
"FOXPRO" Cursor Columns:
 
"FOXPRO" Cursor Columns:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 46: Line 40:
 
|-
 
|-
 
|}
 
|}
 
  
 
"NATIVE" Cursor Columns:
 
"NATIVE" Cursor Columns:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 81: Line 73:
 
|-
 
|-
 
|}
 
|}
 
  
 
====Return values:====
 
====Return values:====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 102: Line 92:
 
|-
 
|-
 
|}
 
|}
 
  
 
==Example==
 
==Example==
Line 120: Line 109:
 
</code>
 
</code>
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]
 
[[Category:Remote Data Connectivity Functions]]
 
[[Category:Remote Data Connectivity Functions]]

Revision as of 05:58, 22 March 2012

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()

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 data source specified by <nStatementHandle>.

Keywords Description
nStatementHandle The workarea in which the gateway data source is open
cTableName The table from which the column information should be returned
"NATIVE" Used to specify the format for the column information. "FOXPRO" is the default. "NATIVE" uses the data source format. The cursor column information is shown in the table below. "NATIVE" many include additional columns.
cCursorName The name of the cursor to use. If cCursorName is not specified, the default name SQLRESULT is used.

"FOXPRO" Cursor Columns:

Column Description
Field_name Column name
Field_type Column data type
Field_len Column length
Field_dec Number of decimal places

"NATIVE" Cursor Columns:

Column Description
Table_qualifier Table qualifier id
Table_owner Table owner id
Table_name Table name
Table_type Table type
Column_name Column identifier
Data_type Column data type
Type_name Column data type name
Precision Column precision
Length Data transfer size
Scale Column scale
Radix Base for Numeric type
Nullable Null value support
Remarks Table description

Return values:

Return Value Description
.T. Format is "NATIVE" and cTableName does not exist
.F. Format is "FOXPRO" and cTableName does not exist
1 The table was created successfully
0 SQLCOLUMNS() still executing
–1 Connection error
–2 Environment error

Example

nStatHand=SQLSTRINGCONNECT("mysql@linux1:user1/pass1-database1.tcpip",.T.)
if nStatHand < 1
  dialog box [Could not connect]
else
  nColEnd = SQLCOLUMNS(nStatHand, "accounts", "NATIVE", "tabinfo")
  if nColEnd = 1
    select tabinfo
    browse
  else
    dialog box [Table of Table Information could not be created]
  endif
endif