DBD-ODBC
view release on metacpan or search on metacpan
/*
* Copyright (c) 1997-2001 Jeff Urlwin
* portions Copyright (c) 1997 Thomas K. Wenrich
* portions Copyright (c) 1994,1995,1996 Tim Bunce
* portions Copyright (c) 1997-2001 Jeff Urlwin
* portions Copyright (c) 2001 Dean Arnold
* portions Copyright (c) 2007-2013 Martin J. Evans
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the Perl README file.
*
*/
/* some constants for driver specific types */
#define MS_SQLS_XML_TYPE -152
typedef struct imp_fbh_st imp_fbh_t;
/* This holds global data of the driver itself.
*/
struct imp_drh_st {
dbih_drc_t com; /* MUST be first element in structure */
SQLHENV henv;
int connects; /* connect count */
};
/* Define dbh implementor data structure
This holds everything to describe the database connection.
*/
struct imp_dbh_st {
dbih_dbc_t com; /* MUST be first element in structure */
SQLHENV henv; /* copy from imp_drh for speed */
SQLHDBC hdbc;
char odbc_ver[20]; /* ODBC compat. version for driver */
SQLSMALLINT max_column_name_len;
/* flag to ignore named parameters */
int odbc_ignore_named_placeholders;
/* flag to set default binding type (experimental) */
SQLSMALLINT odbc_default_bind_type;
/* force bound parameters to be this type */
SQLSMALLINT odbc_force_bind_type;
/* flag to see if SQLDescribeParam is supported */
int odbc_sqldescribeparam_supported;
/* flag to see if SQLMoreResults is supported */
int odbc_sqlmoreresults_supported;
/* flag to work around SQLServer bug and defer binding until
last possible moment - execute instead of bind time. Should only
be set for SQL Server currently.
The problem was that SQL Server was not handling binding an undef
then binding the real value. This happened with older SQLServer
2000 drivers on varchars and is still happening with date */
int odbc_defer_binding;
/* force rebinding the output columns after each execute to
resolve some issues where certain stored procs can return
multiple result sets */
int odbc_force_rebind;
SQLINTEGER odbc_query_timeout;
/* point at which start using SQLPutData */
IV odbc_putdata_start;
/* whether built WITH_UNICODE */
int odbc_has_unicode;
/* flag to set asynchronous execution */
int odbc_async_exec;
/* flag for executing SQLExecDirect instead of SQLPrepare and SQLExecute.
Magic happens at SQLExecute() */
int odbc_exec_direct;
/* flag indicating if we should pass SQL_DRIVER_COMPLETE to
SQLDriverConnect */
int odbc_driver_complete;
/* used to disable describing paramters with SQLDescribeParam */
int odbc_describe_parameters;
/* flag to store the type of asynchronous execution the driver supports */
SQLUINTEGER odbc_async_type;
SV *odbc_err_handler; /* contains the error handler coderef */
/* The out connection string after calling SQLDriverConnect */
SV *out_connect_string;
/* default row cache size in rows for statements */
int RowCacheSize;
/* if SQL_COLUMN_DISPLAYS_SIZE or SQL_COLUMN_LENGTH are not defined or
* SQLColAttributes for these attributes fails we fallback on a default
* value. */
SQLLEN odbc_column_display_size;
/* Some databases (like Aster) return all strings UTF-8 encoded.
* If this is set (1), SvUTF8_on() will be called on all strings returned
* from the driver.
*/
int odbc_utf8_on;
/* save the value passed to odbc_SQL_ROWSET_SIZE so we can return
* it without calling SQLGetConnectAttr because some MS driver
* managers (e.g., since MDAC 2.7 and on 64bit Windows) don't allow
* you to retrieve it. Normally, we'd just say stop fetching it but
* until DBI 1.616 DBI itself issues a FETCH if you mention
* odbc_SQL_ROWSET_SIZE in the connect method.*/
SQLULEN rowset_size;
/*
* We need special workarounds for the following drivers. To avoid
* strcmping their names every time we do it once and store the type here
*/
enum {
DT_DONT_CARE,
DT_SQL_SERVER, /* SQLSRV32.DLL */
DT_SQL_SERVER_NATIVE_CLIENT, /* sqlncli10.dll | SQLNCLI.DLL */
DT_MS_ACCESS_JET, /* odbcjt32.dll */
DT_MS_ACCESS_ACE, /* ACEODBC.DLL */
DT_ES_OOB, /* Easysoft OOB */
DT_FIREBIRD, /* Firebird OdbcFb */
DT_FREETDS /* freeTDS libtdsodbc.so */
} driver_type;
char odbc_driver_name[80];
char odbc_driver_version[20];
char odbc_dbms_name[80];
char odbc_dbms_version[80];
int odbc_batch_size; /* rows in a batch operation */
int odbc_array_operations; /* enable/disable inbuilt execute_for_fetch etc */
/*int (*taf_callback_fn)(SQLHANDLE connection, int type, int event);*/
SV *odbc_taf_callback;
/* If the driver does not support SQLDescribeParam or SQLDescribeParam
fails we fall back on a default type. However, some databases need
that type to be different depending on the length of the column.
( run in 0.606 second using v1.01-cache-2.11-cpan-39bf76dae61 )