copydesc.c

来自「在Linux/Unix下面访问WINDOWS SQLSERVER 的ODBC驱动」· C语言 代码 · 共 42 行

C
42
字号
#include "common.h"/* Test SQLCopyDesc and SQLAllocHandle(SQL_HANDLE_DESC) */static char software_version[] = "$Id: copydesc.c,v 1.3 2007/04/12 07:49:30 freddy77 Exp $";static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };intmain(int argc, char *argv[]){	SQLHDESC ard, ard2, ard3;	SQLINTEGER id;	SQLLEN ind1, ind2;	char name[64];	Connect();	if (SQLGetStmtAttr(Statement, SQL_ATTR_APP_ROW_DESC, &ard, 0, NULL) != SQL_SUCCESS)		ODBC_REPORT_ERROR("SQLGetStmtAttr");	SQLBindCol(Statement, 1, SQL_C_SLONG, &id, sizeof(SQLINTEGER), &ind1);	SQLBindCol(Statement, 2, SQL_C_CHAR, name, sizeof(name), &ind2);	if (SQLAllocHandle(SQL_HANDLE_DESC, Connection, &ard2) != SQL_SUCCESS)		ODBC_REPORT_ERROR("SQLAllocHandle");	/*	 * this is an additional test to test additional allocation 	 * As of 0.64 for a bug in SQLAllocDesc we only allow to allocate one	 */	if (SQLAllocHandle(SQL_HANDLE_DESC, Connection, &ard3) != SQL_SUCCESS)		ODBC_REPORT_ERROR("SQLAllocHandle");	if (SQLCopyDesc(ard, ard2) != SQL_SUCCESS)		ODBC_REPORT_ERROR("SQLCopyDesc");	Disconnect();	printf("Done.\n");	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?