sqldescribeparam.c
来自「这个是内存数据库的客户端」· C语言 代码 · 共 110 行
C
110 行
/* * The contents of this file are subject to the MonetDB Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * The Original Code is the MonetDB Database System. * * The Initial Developer of the Original Code is CWI. * Portions created by CWI are Copyright (C) 1997-2007 CWI. * All Rights Reserved. *//* * This code was created by Peter Harvey (mostly during Christmas 98/99). * This code is LGPL. Please ensure that this message remains in future * distributions and uses of this code (thats about all I get out of it). * - Peter Harvey pharvey@codebydesign.com * * This file has been modified for the MonetDB project. See the file * Copyright in this directory for more information. *//********************************************************************** * SQLDescribeParam() * CLI Compliance: ODBC (Microsoft) * * Note: this function is not supported (yet), it returns an error. * * Author: Martin van Dinther * Date : 30 aug 2002 * **********************************************************************/#include "ODBCGlobal.h"#include "ODBCStmt.h"SQLRETURN SQL_APISQLDescribeParam(SQLHSTMT hStmt, SQLUSMALLINT nParmNumber, SQLSMALLINT *pnDataType, SQLUINTEGER *pnSize, SQLSMALLINT *pnDecDigits, SQLSMALLINT *pnNullable){ ODBCStmt *stmt = (ODBCStmt *) hStmt; ODBCDescRec *rec;#ifdef ODBCDEBUG ODBCLOG("SQLDescribeParam " PTRFMT " %d\n", PTRFMTCAST hStmt, nParmNumber);#endif if (!isValidStmt(stmt)) return SQL_INVALID_HANDLE; clearStmtErrors(stmt); /* check statement cursor state, query should be prepared or executed */ if (stmt->State == INITED || stmt->State >= EXECUTED0) { /* Function sequence error */ addStmtError(stmt, "HY010", NULL, 0); return SQL_ERROR; } if (nParmNumber < 1 || nParmNumber > stmt->ImplRowDescr->sql_desc_count) { /* Invalid descriptor index */ addStmtError(stmt, "07009", NULL, 0); return SQL_ERROR; } rec = &stmt->ImplRowDescr->descRec[nParmNumber]; if (pnDataType) *pnDataType = rec->sql_desc_concise_type; if (pnNullable) *pnNullable = rec->sql_desc_nullable; /* also see SQLDescribeCol */ if (pnSize) *pnSize = ODBCDisplaySize(rec); /* also see SQLDescribeCol */ if (pnDecDigits) { switch (rec->sql_desc_concise_type) { case SQL_DECIMAL: case SQL_NUMERIC: *pnDecDigits = rec->sql_desc_scale; break; case SQL_BIT: case SQL_TINYINT: case SQL_SMALLINT: case SQL_INTEGER: case SQL_BIGINT: *pnDecDigits = 0; break; case SQL_TYPE_TIME: case SQL_TYPE_TIMESTAMP: case SQL_INTERVAL_SECOND: case SQL_INTERVAL_DAY_TO_SECOND: case SQL_INTERVAL_HOUR_TO_SECOND: case SQL_INTERVAL_MINUTE_TO_SECOND: *pnDecDigits = rec->sql_desc_precision; break; } } return SQL_SUCCESS;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?