advertisement
SQLProcedureColumns
SQLProcedureColumns
SQLProcedureColumns returns the list of input and output parameters, as well as the columns that make up the result set for the specified procedures. The driver returns the information as a result set on the specified statement.
SQLProcedureColumnsW() as a Unicode string supports same execution as
SQLProcedureColumns().
Syntax
SQLRETURN SQLProcedureColumns (
SQLHSTMT stmt,
SQLCHAR *cName,
SQLSMALLINT cNameLength,
SQLCHAR *sName,
SQLSMALLINT sNameLength,
SQLCHAR *pName,
SQLSMALLINT pNameLength,
SQLCHAR *colName,
SQLSMALLINT colNameLength );
Arguments
Data Type
SQLHSTMT
SQLCHAR *
SQLSMALLINT
SQLCHAR *
SQLSMALLINT
SQLCHAR *
Argument In/Out stmt cName
Input
Input cNameLength Input sName Input sNameLength Input pName Input
SQLSMALLINT
SQLCHAR *
SQLSMALLINT pNameLength Input colName colName-
Length
Input
Input
Description
Statement handle
Procedure Catalog Name
The character number of *cName
Procedure Schema Name
Length of character string of *sName
Procedure name. Cannot be a NULL pointer. pName must not include the character string search pattern.
Character string of *pName
Column Name
Character string of *colName
Return Values
SQL_SUCCESS
133 ODBC Functions
SQLProcedureColumns
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR
Description
This function is used before a statement is executed to retrieve the procedure parameters and the columns that form the result sets returned by the procedure.
SQLProcedureColumns () returns the results in the standard result set sorted in order by
PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME, and COLUMN_TYPE. The column names will be returned for each procedure in the following order: Name of returned value, each parameter names to call the procedures (or calling order), and column names of the result set returned by the procedure (or column order.)
An application must bind the unique columns which contains the ODBC driver information to the last data of the result set.
Columns Returned by SQLProcedureColumns ()
Name
PROCEDURE_CAT
PROCEDURE _SCHEM
PROCEDURE _NAME
COLUMN_NAME
COLUMN_TYPE
DATA_TYPE
TYPE_NAME
1
2
No.
Data Type
VARCHAR
VARCHAR
3
Description
Returns NULL always
Procedure schema name; NULL if not applicable to the database
Procedure name
4
VARCHAR
(NOT NULL)
VARCHAR
(NOT NULL)
5
6
SMALLINT
(NOT NULL)
Procedure column name. The driver returns an empty string for a procedure column that does not have a name.
Defines the procedure column as a parameter or a result set column:.SQL_PARAM_INOUT: The procedure column is the input parameter.SQL_PARAM_INOUT_OUTPUT: The procedure column is the input/output parameters.SQL_PARAM_OUTPUT: The procedure column is the output parameter.
SQL data type
7
SMALLINT
(NOT NULL)
VARCHAR
(NOT NULL)
Name of the data type corresponding to the database
ODBC Users’ Manual 134
SQLProcedureColumns
Name
COLUMN_SIZE
BUFFER_LENGTH
DECIMAL_DIGITS
NUM_PREC_RADIX
NULLABLE
REMARKS
COLUMN_DEF
SQL_DATA_TYPE
SQL_DATETIME_SUB
CHAR_OCTET_LENGTH
ORDINAL_POSITION
IS_NULLABLE
8
No.
9
10
11
12
13
14
15
16
17
18
19
Data Type Description
INTEGER
INTEGER
SMALLINT
SMALLINT
SMALLINT
(NOT NULL)
VARCHAR
VARCHAR
Column Size. NULL will be returned when the column size is not proper.
The maximum byte storing the data
The NULL will return the data type that cannot apply the decimal points of the string and the decimal points.
In case of the numeric data type 10: For
COLUMN_SIZE and DECIMAL_DIGIT, decimal digits allowable in this string is be given. For example, DECIMAL(12,5) string can return NUM_PREC_RADIX 10,
COLUMN_SIZE 12, and DECIMAL_DIGITS
5.
SQL_NO_NullS when the procedure column does not allow NULL value, or
SQL_Nullable when NULL is allowed.
Description of the procedure column
The default value of the column. If NULL was specified as the default value, this column is the word NULL, not enclosed in quotation marks. If the default value cannot be represented without truncation, this column contains TRUNCATED, with no enclosing single quotation marks. If no default value was specified, this column is NULL.The value of COLUMN_DEF can be used in generating a new column definition, except when it contains the value TRUNCATED
SQL data type SMALLINT
(NOT NULL)
SMALLINT
INTEGER
INTEGER (NOT
NULL)
VARCHAR
The subtype code for datetime and interval data types. For other data types, this column returns a NULL.
Maximum digits of the character string or binary data-type string.
Location of the order of the parameters in the procedure definition (starting with 1)
NO : When the string does not contain the NULL:YES : When the string contain the NULL:
135 ODBC Functions
SQLProcedureColumns
Diagnosis
SQLSTATE
HY000
HY009
Description Comments
General error
Invalid Arguments used (null pointer).
CName is a NULL pointer
Related Functions
SQLBindCol
SQLFetch
SQLProcedures
Example
See: $ALTIBASE_HOME/sample/SQLCLI/demo_meta6.cpp
if (SQLProcedureColumns(stmt,
NULL, 0,
NULL, 0,
"DEMO_META6_PROC", SQL_NTS,
NULL, 0) != SQL_SUCCESS)
{
execute_err(dbc, stmt, "SQLProcedureColumns");
SQLFreeStmt(stmt, SQL_DROP);
return SQL_ERROR;
}
SQLBindCol(stmt, 1, SQL_C_CHAR, szCatalog, STR_LEN,&cbCatalog);
SQLBindCol(stmt, 2, SQL_C_CHAR, szSchema, STR_LEN, &cbSchema);
SQLBindCol(stmt, 3, SQL_C_CHAR, szProcName, STR_LEN,&cbProcName);
SQLBindCol(stmt, 4, SQL_C_CHAR, szColumnName, STR_LEN, &cbColumnName);
SQLBindCol(stmt, 5, SQL_C_SSHORT, &ColumnType, 0, &cbColumnType);
SQLBindCol(stmt, 7, SQL_C_CHAR, szTypeName, STR_LEN, &cbTypeName);
SQLBindCol(stmt, 8, SQL_C_SLONG, &ColumnSize, 0, &cbColumnSize);
SQLBindCol(stmt, 10, SQL_C_SSHORT, &DecimalDigits, 0, &cbDecimalDigits);
SQLBindCol(stmt, 11, SQL_C_SSHORT, &NumPrecRadix, 0, &cbNumPrecRadix);
SQLBindCol(stmt, 18, SQL_C_SLONG, &OrdinalPosition, 0, &cbOrdinalPosition);
ODBC Users’ Manual 136
advertisement
advertisement
Table of contents
- 14 About This Manual
- 14 Target Users
- 14 Software Environment
- 14 Organization
- 15 Convention
- 17 Related Resource
- 17 Online Manual
- 18 Altibase Welcomes Your Opinions!
- 20 Open Database Connectivity
- 20 Backgrounds of the ODBC
- 20 ODBC versus Embedded C/C++ Programming
- 20 Groups of ODBC Functions
- 22 Using the ODBC
- 22 Basic Usages
- 22 Initializing Handles
- 23 Processing of Transactions
- 24 Release Handle
- 24 Managing Diagnosis Messages
- 24 Restriction
- 25 Using ODBC
- 25 Using UNIX ODBC versus Using Windows ODBC
- 27 Basic Programming Steps
- 28 Step 1: Connecting to a Database
- 28 Step 2: Initializing an application Status
- 28 Step 3: Executing an SQL statements
- 29 Step 4a: Fetch the Results
- 29 Step 4b: Fetch the Affected Row Count
- 30 Step 5: Commit/Rollback a Transaction
- 30 Step 6: Disconnect from the Altibase Database
- 31 Summary of ODBC Functions
- 36 SQLAllocConnect
- 36 Syntax
- 36 Arguments
- 36 Return Values
- 36 Description
- 37 Diagnosis
- 37 Related Functions
- 37 Example
- 38 SQLAllocEnv
- 38 Syntax
- 38 Arguments
- 38 Return Values
- 38 Description
- 38 Related Functions
- 39 Example
- 40 SQLAllocHandle
- 40 Syntax
- 40 Arguments
- 40 Return Values
- 41 Description
- 42 Diagnosis
- 42 Related Functions
- 42 Example
- 43 SQLAllocStmt
- 43 Syntax
- 43 Arguments
- 43 Return Values
- 43 Description
- 44 Diagnosis
- 44 Related Functions
- 44 Example
- 45 SQLBindCol
- 45 Syntax
- 45 Arguments
- 46 Return Values
- 46 Description
- 47 Diagnosis
- 47 Related Functions
- 47 Example
- 49 SQLCloseCursor
- 49 Syntax
- 49 Arguments
- 49 Return Value
- 49 Description
- 49 Diagnostics
- 50 Related Function
- 51 SQLBindParameter
- 51 Syntax
- 51 Arguments
- 52 Return Values
- 53 Description
- 56 Example
- 57 Constraints
- 57 Diagnosis
- 57 Related Functions
- 57 Example
- 60 SQLColAttribute
- 60 Syntax
- 60 Arguments
- 61 Return Values
- 61 Description
- 62 Diagnosis
- 63 Related Functions
- 63 Example
- 64 SQLColumns
- 64 Syntax
- 64 Arguments
- 64 Return Values
- 65 Description
- 66 Diagnosis
- 66 Related Functions
- 67 Example
- 68 SQLConnect
- 68 Syntax
- 68 Arguments
- 68 Return Values
- 69 Description
- 69 Diagnosis
- 69 Related Functions
- 70 SQLDescribeCol
- 70 Syntax
- 70 Arguments
- 71 Return Values
- 71 Description
- 71 Diagnosis
- 72 Related Functions
- 72 Example
- 73 SQLDescribeParam
- 73 Syntax
- 73 Arguments
- 73 Return Values
- 74 Description
- 74 Diagnosis
- 74 Related Functions
- 74 Example
- 76 SQLDisconnect
- 76 Syntax
- 76 Arguments
- 76 Return Values
- 76 Description
- 77 Diagnosis
- 77 Related Functions
- 77 Example
- 78 SQLDriverConnect
- 78 Syntax
- 78 Arguments
- 79 Return Values
- 79 Description
- 80 Restriction
- 81 Diagnosis
- 81 Related Functions
- 82 Example
- 83 SQLEndTran
- 83 Syntax
- 83 Arguments
- 83 Return Values
- 83 Description
- 84 Diagnosis
- 84 Related Functions
- 84 Example
- 85 SQLError
- 85 Syntax
- 85 Arguments
- 85 Return Values
- 86 Description
- 86 Example
- 87 SQLExecDirect
- 87 Syntax
- 87 Arguments
- 87 Return Values
- 87 Description
- 88 Diagnosis
- 88 Related Functions
- 88 Example
- 89 SQLExecute
- 89 Syntax
- 89 Arguments
- 89 Return Values
- 89 Description
- 90 Diagnosis
- 90 Related Functions
- 91 Example
- 92 SQLFetch
- 92 Syntax
- 92 Arguments
- 92 Return Values
- 92 Description
- 94 Diagnosis
- 95 Related Functions
- 95 Example
- 96 SQLFetchScroll
- 96 Syntax
- 96 Arguments
- 96 Return Values
- 96 Description
- 97 Diagnosis
- 97 Related Functions
- 97 Example
- 98 SQLForeignKeys
- 98 Syntax
- 98 Arguments
- 99 Return Values
- 99 Description
- 101 Diagnosis
- 101 Related Functions
- 101 Example
- 102 SQLFreeConnect
- 102 Syntax
- 102 Arguments
- 102 Return Values
- 102 Description
- 102 Related Functions
- 102 Example
- 104 SQLFreeEnv
- 104 Syntax
- 104 Arguments
- 104 Return Values
- 104 Description
- 104 Related Functions
- 104 Example
- 105 SQLFreeHandle
- 105 Syntax
- 105 Arguments
- 105 Return Values
- 105 Description
- 106 Diagnosis
- 106 Related Functions
- 106 Example
- 107 SQLFreeStmt
- 107 Syntax
- 107 Arguments
- 107 Return Values
- 107 Description
- 108 Diagnosis
- 108 Related Functions
- 108 Example
- 109 SQLGetConnectAttr
- 109 Syntax
- 109 Arguments
- 109 Return Values
- 110 Description
- 110 Diagnosis
- 111 Related Functions
- 111 Example
- 112 SQLGetData
- 112 Syntax
- 112 Arguments
- 113 Return Values
- 113 Description
- 114 Diagnosis
- 114 Related Functions
- 115 Example
- 116 SQLGetDescField
- 116 Syntax
- 116 Arguments
- 116 Return Value
- 117 Description
- 117 Diagnostics
- 117 Related Function
- 118 SQLGetDescRec
- 118 Syntax
- 118 Arguments
- 118 Return Value
- 119 Description
- 119 Diagnostics
- 119 Related Function
- 120 SQLGetDiagField
- 120 Syntax
- 120 Arguments
- 121 Result Value
- 121 Description
- 121 Related Function
- 122 SQLGetDiagRec
- 122 Syntax
- 122 Argument
- 122 Return Value
- 123 Description
- 123 Related Function
- 124 SQLGetEnvAttr
- 124 Syntax
- 124 Argument
- 124 Return Value
- 124 Description
- 125 Diagnosis
- 125 Related Function
- 126 SQLGetFunctions
- 126 Syntax
- 126 Argument
- 126 Return Value
- 126 Description
- 127 Diagnostics
- 127 Related Function
- 128 SQLGetInfo
- 128 Syntax
- 128 Arguments
- 128 Return Values
- 129 Description
- 129 Diagnosis
- 130 SQLGetPlan
- 130 Syntax
- 130 Arguments
- 130 Returned Values
- 130 Description
- 130 Related Function
- 130 Example
- 131 SQLGetStmtAttr
- 131 Syntax
- 131 Arguments
- 132 Return Values
- 132 Description
- 132 Diagnosis
- 132 Related Functions
- 132 Example
- 133 SQLGetTypeInfo
- 133 Syntax
- 133 Arguments
- 133 Return Values
- 133 Description
- 133 Diagnosis
- 134 Related Functions
- 134 Example
- 136 SQLMoreResult
- 136 Syntax
- 136 Arguments
- 136 Result Values
- 136 Description
- 136 Related Function
- 137 SQLNativeSql
- 137 Syntax
- 137 Argument
- 137 Return Value
- 137 Description
- 138 Diagnosis
- 138 Example
- 139 SQLNumParams
- 139 Syntax
- 139 Arguments
- 139 Return Values
- 139 Description
- 139 Diagnosis
- 139 Related Functions
- 140 Example
- 141 SQLNumResultCols
- 141 Syntax
- 141 Arguments
- 141 Return Values
- 141 Description
- 142 Diagnosis
- 142 Related Functions
- 142 Example
- 143 SQLParamData
- 143 Syntax
- 143 Argument
- 143 Return Value
- 143 Description
- 143 Diagnosis
- 144 Related Function
- 145 SQLPrepare
- 145 Syntax
- 145 Arguments
- 145 Return Values
- 145 Description
- 146 Diagnosis
- 146 Related Functions
- 146 Example
- 148 SQLPrimaryKeys
- 148 Syntax
- 148 Arguments
- 148 Return Values
- 149 Description
- 149 Diagnosis
- 149 Related Functions
- 150 Example
- 151 SQLProcedureColumns
- 151 Syntax
- 151 Arguments
- 151 Return Values
- 152 Description
- 154 Diagnosis
- 154 Related Functions
- 154 Example
- 155 SQLProcedures
- 155 Syntax
- 155 Arguments
- 155 Return Values
- 156 Description
- 157 Diagnosis
- 157 Related Functions
- 157 Example
- 158 SQLPutData
- 158 Syntax
- 158 Argument
- 158 Return Value
- 158 Description
- 158 Diagnosis
- 159 Related Function
- 160 SQLRowCount
- 160 Syntax
- 160 Arguments
- 160 Return Values
- 160 Description
- 161 Diagnosis
- 161 Related Functions
- 161 Example
- 162 SQLSetConnectAttr
- 162 Syntax
- 162 Arguments
- 162 Return Values
- 163 Description
- 163 Diagnosis
- 163 Related Functions
- 164 Example
- 165 SQLSetDescField
- 165 Syntax
- 165 Argument
- 165 Return Value
- 165 Description
- 166 Diagnosis
- 166 Related Function
- 167 SQLSetEnvAttr
- 167 Syntax
- 167 Arguments
- 167 Return Values
- 167 Description
- 168 Diagnosis
- 168 Related Functions
- 169 SQLSetStmtAttr
- 169 Syntax
- 169 Arguments
- 171 Return Values
- 171 Description
- 174 Diagnosis
- 174 Example
- 176 SQLSpecialColumns
- 176 Syntax
- 176 Arguments
- 177 Return Values
- 177 Description
- 178 Diagnosis
- 178 Related Functions
- 178 Example
- 180 SQLStatistics
- 180 Syntax
- 180 Arguments
- 180 Return Values
- 181 Description
- 182 Diagnosis
- 183 Related Functions
- 183 Example
- 184 SQLTablePrivileges
- 184 Syntax
- 184 Arguments
- 184 Return Values
- 185 Description
- 186 Diagnosis
- 186 Related Functions
- 186 Example
- 187 SQLTables
- 187 Syntax
- 187 Arguments
- 187 Return Values
- 188 Description
- 189 Diagnosis
- 189 Related Functions
- 189 Example
- 191 SQLTransact
- 191 Syntax
- 191 Arguments
- 191 Return Values
- 191 Description
- 192 Example
- 194 LOB Data Types
- 195 Function Overview
- 196 SQLBindFileToCol
- 196 Syntax
- 196 Arguments
- 197 Result Values
- 197 Description
- 198 Diagnosis
- 198 Related Functions
- 198 Examples
- 201 SQLBindFileToParam
- 201 Syntax
- 201 Arguments
- 202 Result Values
- 202 Description
- 203 Diagnosis
- 203 Related Functions
- 203 Examples
- 206 SQLGetLobLength
- 206 Syntax
- 206 Arguments
- 206 Result Values
- 206 Description
- 207 Diagnosis
- 207 Related Functions
- 208 Example
- 209 SQLGetLob
- 209 Syntax
- 209 Arguments
- 210 Result Values
- 210 Description
- 210 Diagnosis
- 210 Related Functions
- 211 Example
- 213 SQLPutLob
- 213 Syntax
- 213 Arguments
- 214 Result Values
- 214 Description
- 214 Diagnosis
- 214 Related Functions
- 215 Examples
- 219 SQLFreeLob
- 219 Syntax
- 219 Arguments
- 219 Result Values
- 219 Description
- 220 Diagnosis
- 220 Related Functions
- 220 Example
- 221 Programing Considerations
- 221 Multithreading
- 221 Statement Handles
- 221 Binding Parameters
- 222 Transaction Commit Mode
- 222 Using SQLFreeStmt() function
- 222 Sample of Simple Basic Program
- 228 Sample of Using Metadata
- 235 Example of Procedure test Program
- 239 SQL Data Types
- 240 C Data Types
- 242 Converting SQL Data into C Data Types
- 243 Converting C Data into SQL Data types
- 245 ODBC Error Codes
- 247 Database Connection-related Error Codes
- 248 Network-related Error Codes
- 248 Statement State Transition-related Errors
- 250 SQLAllocHandle
- 250 SQLBindCol
- 250 SQLBindParameter
- 250 SQLColumns, SQLGetTypeInfo, SQLPrimaryKeys, SQLProcedureColumns, SQLProcedures, SQLStatistics, SQLTables
- 251 SQLConnect
- 251 SQLDisconnect
- 251 See SQLDriverConnect: SQLConnect
- 251 SQLExecDirect
- 252 SQLExecute
- 252 SQLFetch
- 252 SQLFreeHandle
- 252 SQLFreeStmt
- 253 SQLGetData
- 253 SQLGetTypeInfo: See SQLColumns.
- 253 SQLNumResultCols
- 253 SQLPrepare
- 253 SQLPrimaryKeys: See SQLColumns.
- 254 SQLProcedureColumns: See SQLColumns.
- 254 SQLProcedures: See SQLColumns.
- 254 SQLSetConnectAttr
- 254 SQLSetEnvAttr
- 254 SQLSetStmtAttr
- 255 SQLStatistics: See SQLColumns.
- 255 SQLTables: See SQLColumns.
- 255 State Transition Tables
- 257 Interface Conformance Levels
- 257 Function Conformance Level
- 261 Data Type
- 261 SQLCHAR, SQLSCHAR
- 261 SQL_BIT, SQL_VARBIT
- 265 SQL_NIBBLE
- 267 SQL_BYTE
- 269 DATE : SQL_TYPE_TIMESTAMP
- 269 LOB
- 273 Other Changes
- 273 SQLCloseCursor
- 274 SQLBindParameter - ColumnSize Argument
- 274 SQLBindParameter – StrLen_or_IndPtr Argument
- 274 SQLPutData(), SQLParamData()
- 276 Limitation on ALTER SESSION statements
- 277 SQLRowCount(), SQLMoreResults() functions
- 278 Unlimited Array Execute, Array Fetch
- 278 Unavailable Properties