📄 sql.h
字号:
/* * sql.h * * $Id: sql.h,v 1.2 2007/01/09 19:51:04 yas Exp $ * * ODBC defines * * The iODBC driver manager. * * Copyright (C) 1995 by Ke Jin <kejin@empress.com> * Copyright (C) 1996-2006 by OpenLink Software <iodbc@openlinksw.com> * All Rights Reserved. * * This software is released under the terms of either of the following * licenses: * * - GNU Library General Public License (see LICENSE.LGPL) * - The BSD License (see LICENSE.BSD). * * Note that the only valid version of the LGPL license as far as this * project is concerned is the original GNU Library General Public License * Version 2, dated June 1991. * * While not mandated by the BSD license, any patches you make to the * iODBC source code may be contributed back into the iODBC project * at your discretion. Contributions will benefit the Open Source and * Data Access community as a whole. Submissions may be made at: * * http://www.iodbc.org * * * GNU Library Generic Public License Version 2 * ============================================ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; only * Version 2 of the License dated June 1991. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * * The BSD License * =============== * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name of OpenLink Software Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */#ifndef _SQL_H#define _SQL_H/* * Set default specification to ODBC 3.51 */#ifndef ODBCVER#define ODBCVER 0x0351#endif/* * Include Windows style defines and typedefs on Unix */#ifndef _IODBCUNIX_H#include <iodbcunix.h>#endif#ifndef _SQLTYPES_H#include <sqltypes.h>#endif#ifdef __cplusplusextern "C" {#endif/* * Useful Constants */#define SQL_MAX_MESSAGE_LENGTH 512/* * Handle types */#if (ODBCVER >= 0x0300)#define SQL_HANDLE_ENV 1#define SQL_HANDLE_DBC 2#define SQL_HANDLE_STMT 3#define SQL_HANDLE_DESC 4#endif /* ODBCVER >= 0x0300 *//* * Function return codes */#define SQL_SUCCESS 0#define SQL_SUCCESS_WITH_INFO 1#define SQL_STILL_EXECUTING 2#define SQL_ERROR (-1)#define SQL_INVALID_HANDLE (-2)#define SQL_NEED_DATA 99#if (ODBCVER >= 0x0300)#define SQL_NO_DATA 100#endif /* ODBCVER >= 0x0300 *//* * Test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */#define SQL_SUCCEEDED(rc) (((rc) & (~1)) == 0)/* * Special length values */#define SQL_NULL_DATA (-1)#define SQL_DATA_AT_EXEC (-2)/* * Flags for null-terminated strings */#define SQL_NTS (-3)#define SQL_NTSL (-3L)/* * Standard SQL datatypes, using ANSI type numbering */#define SQL_UNKNOWN_TYPE 0#define SQL_CHAR 1#define SQL_NUMERIC 2#define SQL_DECIMAL 3#define SQL_INTEGER 4#define SQL_SMALLINT 5#define SQL_FLOAT 6#define SQL_REAL 7#define SQL_DOUBLE 8#if (ODBCVER >= 0x0300)#define SQL_DATETIME 9#endif /* ODBCVER >= 0x0300 */#define SQL_VARCHAR 12/* * SQLGetTypeInfo request for all data types */#define SQL_ALL_TYPES 0/* * Statement attribute values for date/time data types */#if (ODBCVER >= 0x0300)#define SQL_TYPE_DATE 91#define SQL_TYPE_TIME 92#define SQL_TYPE_TIMESTAMP 93#endif /* ODBCVER >= 0x0300 *//* * Date/Time length constants */#if (ODBCVER >= 0x0300)#define SQL_DATE_LEN 10#define SQL_TIME_LEN 8 /* add P+1 if prec >0 */#define SQL_TIMESTAMP_LEN 19 /* add P+1 if prec >0 */#endif /* ODBCVER >= 0x0300 *//* * NULL status constants */#define SQL_NO_NULLS 0#define SQL_NULLABLE 1#define SQL_NULLABLE_UNKNOWN 2/* * NULL Handles */#define SQL_NULL_HENV 0#define SQL_NULL_HDBC 0#define SQL_NULL_HSTMT 0#if (ODBCVER >= 0x0300)#define SQL_NULL_HDESC 0#endif /* ODBCVER >= 0x0300 *//* * NULL handle for parent argument to SQLAllocHandle when allocating * a SQLHENV */#if (ODBCVER >= 0x0300)#define SQL_NULL_HANDLE 0L#endif /* ODBCVER >= 0x0300 *//* * CLI option values */#if (ODBCVER >= 0x0300)#define SQL_FALSE 0#define SQL_TRUE 1#endif /* ODBCVER >= 0x0300 *//* * Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */#if (ODBCVER >= 0x0300)#define SQL_DEFAULT 99#endif /* ODBCVER >= 0x0300 *//* * SQLDataSources/SQLFetchScroll - FetchOrientation */#define SQL_FETCH_NEXT 1#define SQL_FETCH_FIRST 2/* * SQLFetchScroll - FetchOrientation */#define SQL_FETCH_LAST 3#define SQL_FETCH_PRIOR 4#define SQL_FETCH_ABSOLUTE 5#define SQL_FETCH_RELATIVE 6/* * SQLFreeStmt */#define SQL_CLOSE 0#define SQL_DROP 1#define SQL_UNBIND 2#define SQL_RESET_PARAMS 3/* * SQLGetConnectAttr - connection attributes */#if (ODBCVER >= 0x0300)#define SQL_ATTR_AUTO_IPD 10001#define SQL_ATTR_METADATA_ID 10014#endif /* ODBCVER >= 0x0300 *//* * SQLGetData() code indicating that the application row descriptor * specifies the data type */#if (ODBCVER >= 0x0300)#define SQL_ARD_TYPE (-99)#endif /* ODBCVER >= 0x0300 *//* * SQLGetDescField - identifiers of fields in the SQL descriptor */#if (ODBCVER >= 0x0300)#define SQL_DESC_COUNT 1001#define SQL_DESC_TYPE 1002#define SQL_DESC_LENGTH 1003#define SQL_DESC_OCTET_LENGTH_PTR 1004#define SQL_DESC_PRECISION 1005#define SQL_DESC_SCALE 1006#define SQL_DESC_DATETIME_INTERVAL_CODE 1007#define SQL_DESC_NULLABLE 1008#define SQL_DESC_INDICATOR_PTR 1009#define SQL_DESC_DATA_PTR 1010#define SQL_DESC_NAME 1011#define SQL_DESC_UNNAMED 1012#define SQL_DESC_OCTET_LENGTH 1013#define SQL_DESC_ALLOC_TYPE 1099#endif /* ODBCVER >= 0x0300 *//* * SQLGetDescField - SQL_DESC_ALLOC_TYPE */#if (ODBCVER >= 0x0300)#define SQL_DESC_ALLOC_AUTO 1#define SQL_DESC_ALLOC_USER 2#endif /* ODBCVER >= 0x0300 *//* * SQLGetDescField - SQL_DESC_DATETIME_INTERVAL_CODE */#if (ODBCVER >= 0x0300)#define SQL_CODE_DATE 1#define SQL_CODE_TIME 2#define SQL_CODE_TIMESTAMP 3#endif /* ODBCVER >= 0x0300 *//* * SQLGetDescField - SQL_DESC_UNNAMED */#if (ODBCVER >= 0x0300)#define SQL_NAMED 0#define SQL_UNNAMED 1#endif /* ODBCVER >= 0x0300 *//* * SQLGetDiagField - identifiers of fields in the diagnostics area */#if (ODBCVER >= 0x0300)#define SQL_DIAG_RETURNCODE 1#define SQL_DIAG_NUMBER 2#define SQL_DIAG_ROW_COUNT 3#define SQL_DIAG_SQLSTATE 4#define SQL_DIAG_NATIVE 5#define SQL_DIAG_MESSAGE_TEXT 6#define SQL_DIAG_DYNAMIC_FUNCTION 7#define SQL_DIAG_CLASS_ORIGIN 8#define SQL_DIAG_SUBCLASS_ORIGIN 9#define SQL_DIAG_CONNECTION_NAME 10#define SQL_DIAG_SERVER_NAME 11#define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12#endif /* ODBCVER >= 0x0300 *//* * SQLGetDiagField - SQL_DIAG_DYNAMIC_FUNCTION_CODE */#if (ODBCVER >= 0x0300)#define SQL_DIAG_ALTER_DOMAIN 3#define SQL_DIAG_ALTER_TABLE 4#define SQL_DIAG_CALL 7#define SQL_DIAG_CREATE_ASSERTION 6#define SQL_DIAG_CREATE_CHARACTER_SET 8#define SQL_DIAG_CREATE_COLLATION 10#define SQL_DIAG_CREATE_DOMAIN 23#define SQL_DIAG_CREATE_INDEX (-1)#define SQL_DIAG_CREATE_SCHEMA 64#define SQL_DIAG_CREATE_TABLE 77#define SQL_DIAG_CREATE_TRANSLATION 79#define SQL_DIAG_CREATE_VIEW 84#define SQL_DIAG_DELETE_WHERE 19#define SQL_DIAG_DROP_ASSERTION 24#define SQL_DIAG_DROP_CHARACTER_SET 25#define SQL_DIAG_DROP_COLLATION 26#define SQL_DIAG_DROP_DOMAIN 27#define SQL_DIAG_DROP_INDEX (-2)#define SQL_DIAG_DROP_SCHEMA 31#define SQL_DIAG_DROP_TABLE 32#define SQL_DIAG_DROP_TRANSLATION 33#define SQL_DIAG_DROP_VIEW 36#define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38#define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81#define SQL_DIAG_GRANT 48#define SQL_DIAG_INSERT 50#define SQL_DIAG_REVOKE 59#define SQL_DIAG_SELECT_CURSOR 85#define SQL_DIAG_UNKNOWN_STATEMENT 0#define SQL_DIAG_UPDATE_WHERE 82#endif /* ODBCVER >= 0x0300 *//* * SQLGetEnvAttr - environment attribute */#if (ODBCVER >= 0x0300)#define SQL_ATTR_OUTPUT_NTS 10001#endif /* ODBCVER >= 0x0300 *//*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -