sqlanywhere 0.1.6-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +34 -0
- data/LICENSE +23 -0
- data/README +134 -0
- data/Rakefile +196 -0
- data/ext/Makefile +215 -0
- data/ext/extconf.rb +30 -0
- data/ext/sacapi.h +909 -0
- data/ext/sacapidll.c +182 -0
- data/ext/sacapidll.h +332 -0
- data/ext/sacapidll.o +0 -0
- data/ext/sqlanywhere-i386-mingw32.def +2 -0
- data/ext/sqlanywhere.c +1753 -0
- data/ext/sqlanywhere.o +0 -0
- data/ext/sqlanywhere.so +0 -0
- data/lib/sqlanywhere.so +0 -0
- data/test/sqlanywhere_test.rb +423 -0
- data/test/test.sql +92 -0
- metadata +73 -0
data/ext/sacapidll.c
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
//====================================================
|
2
|
+
//
|
3
|
+
// Copyright 2008-2010 iAnywhere Solutions, Inc.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
//
|
15
|
+
// See the License for the specific language governing permissions and
|
16
|
+
// limitations under the License.
|
17
|
+
//
|
18
|
+
// While not a requirement of the license, if you do modify this file, we
|
19
|
+
// would appreciate hearing about it. Please email
|
20
|
+
// sqlany_interfaces@sybase.com
|
21
|
+
//
|
22
|
+
//====================================================
|
23
|
+
#include <string.h>
|
24
|
+
#include <stdlib.h>
|
25
|
+
#include <stdio.h>
|
26
|
+
|
27
|
+
#if defined( _WIN32 )
|
28
|
+
#include <windows.h>
|
29
|
+
#define DEFAULT_LIBRARY_NAME "dbcapi.dll"
|
30
|
+
#else
|
31
|
+
#include <dlfcn.h>
|
32
|
+
/* assume we are running on a UNIX platform */
|
33
|
+
#if defined( __APPLE__ )
|
34
|
+
#define LIB_EXT "dylib"
|
35
|
+
#else
|
36
|
+
#define LIB_EXT "so"
|
37
|
+
#endif
|
38
|
+
#if defined( _REENTRANT ) || defined( _THREAD_SAFE ) \
|
39
|
+
|| defined( __USE_REENTRANT )
|
40
|
+
/* if building a thread-safe library, we need to load
|
41
|
+
the thread-safe dbcapi library */
|
42
|
+
#define DEFAULT_LIBRARY_NAME "libdbcapi_r." LIB_EXT
|
43
|
+
#else
|
44
|
+
#define DEFAULT_LIBRARY_NAME "libdbcapi." LIB_EXT
|
45
|
+
#endif
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#include "sacapidll.h"
|
49
|
+
|
50
|
+
static
|
51
|
+
void * loadLibrary( const char * name )
|
52
|
+
/*************************************/
|
53
|
+
{
|
54
|
+
void * handle;
|
55
|
+
#if defined( _WIN32 )
|
56
|
+
handle = LoadLibrary( name );
|
57
|
+
#else
|
58
|
+
handle = dlopen( name, RTLD_LAZY );
|
59
|
+
#endif
|
60
|
+
return handle;
|
61
|
+
}
|
62
|
+
|
63
|
+
static
|
64
|
+
void unloadLibrary( void * handle )
|
65
|
+
/**********************************/
|
66
|
+
{
|
67
|
+
#if defined( _WIN32 )
|
68
|
+
FreeLibrary( handle );
|
69
|
+
#else
|
70
|
+
dlclose( handle );
|
71
|
+
#endif
|
72
|
+
}
|
73
|
+
|
74
|
+
static
|
75
|
+
void * findSymbol( void * dll_handle, char * name )
|
76
|
+
/**************************************************/
|
77
|
+
{
|
78
|
+
#if defined( _WIN32 )
|
79
|
+
return GetProcAddress( dll_handle, name );
|
80
|
+
#else
|
81
|
+
return dlsym( dll_handle, name );
|
82
|
+
#endif
|
83
|
+
}
|
84
|
+
|
85
|
+
#define LookupSymbol( api, sym ) \
|
86
|
+
api->sym = (sym ## _func)findSymbol( api->dll_handle, #sym );
|
87
|
+
|
88
|
+
#define LookupSymbolAndCheck( api, sym ) \
|
89
|
+
api->sym = (sym ## _func)findSymbol( api->dll_handle, #sym ); \
|
90
|
+
if( api->sym == NULL ) { \
|
91
|
+
unloadLibrary( api->dll_handle ); \
|
92
|
+
return 0; \
|
93
|
+
}
|
94
|
+
|
95
|
+
int sqlany_initialize_interface( SQLAnywhereInterface * api, const char * path )
|
96
|
+
/*******************************************************************************/
|
97
|
+
{
|
98
|
+
char * env;
|
99
|
+
memset( api, 0, sizeof(*api));
|
100
|
+
|
101
|
+
if( path != NULL ) {
|
102
|
+
api->dll_handle = loadLibrary( path );
|
103
|
+
if( api->dll_handle != NULL ) {
|
104
|
+
goto loaded;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
env = getenv( "SQLANY_API_DLL" );
|
108
|
+
if( env != NULL ) {
|
109
|
+
api->dll_handle = loadLibrary( env );
|
110
|
+
if( api->dll_handle != NULL ) {
|
111
|
+
goto loaded;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
api->dll_handle = loadLibrary( DEFAULT_LIBRARY_NAME );
|
115
|
+
if( api->dll_handle != NULL ) {
|
116
|
+
goto loaded;
|
117
|
+
}
|
118
|
+
return 0;
|
119
|
+
|
120
|
+
loaded:
|
121
|
+
LookupSymbolAndCheck( api, sqlany_init );
|
122
|
+
LookupSymbolAndCheck( api, sqlany_fini );
|
123
|
+
LookupSymbolAndCheck( api, sqlany_new_connection );
|
124
|
+
LookupSymbolAndCheck( api, sqlany_free_connection );
|
125
|
+
LookupSymbolAndCheck( api, sqlany_make_connection );
|
126
|
+
LookupSymbolAndCheck( api, sqlany_connect );
|
127
|
+
LookupSymbolAndCheck( api, sqlany_disconnect );
|
128
|
+
LookupSymbolAndCheck( api, sqlany_execute_immediate );
|
129
|
+
LookupSymbolAndCheck( api, sqlany_prepare );
|
130
|
+
LookupSymbolAndCheck( api, sqlany_free_stmt );
|
131
|
+
LookupSymbolAndCheck( api, sqlany_num_params );
|
132
|
+
LookupSymbolAndCheck( api, sqlany_describe_bind_param );
|
133
|
+
LookupSymbolAndCheck( api, sqlany_bind_param );
|
134
|
+
LookupSymbolAndCheck( api, sqlany_send_param_data );
|
135
|
+
LookupSymbolAndCheck( api, sqlany_reset );
|
136
|
+
LookupSymbolAndCheck( api, sqlany_get_bind_param_info );
|
137
|
+
LookupSymbolAndCheck( api, sqlany_execute );
|
138
|
+
LookupSymbolAndCheck( api, sqlany_execute_direct );
|
139
|
+
LookupSymbolAndCheck( api, sqlany_fetch_absolute );
|
140
|
+
LookupSymbolAndCheck( api, sqlany_fetch_next );
|
141
|
+
LookupSymbolAndCheck( api, sqlany_get_next_result );
|
142
|
+
LookupSymbolAndCheck( api, sqlany_affected_rows );
|
143
|
+
LookupSymbolAndCheck( api, sqlany_num_cols );
|
144
|
+
LookupSymbolAndCheck( api, sqlany_num_rows );
|
145
|
+
LookupSymbolAndCheck( api, sqlany_get_column );
|
146
|
+
LookupSymbolAndCheck( api, sqlany_get_data );
|
147
|
+
LookupSymbolAndCheck( api, sqlany_get_data_info );
|
148
|
+
LookupSymbolAndCheck( api, sqlany_get_column_info );
|
149
|
+
LookupSymbolAndCheck( api, sqlany_commit );
|
150
|
+
LookupSymbolAndCheck( api, sqlany_rollback );
|
151
|
+
LookupSymbolAndCheck( api, sqlany_client_version );
|
152
|
+
LookupSymbolAndCheck( api, sqlany_error );
|
153
|
+
LookupSymbolAndCheck( api, sqlany_sqlstate );
|
154
|
+
LookupSymbolAndCheck( api, sqlany_clear_error );
|
155
|
+
|
156
|
+
#if _SACAPI_VERSION+0 >= 2
|
157
|
+
/* We don't report an error if we don't find the v2 entry points.
|
158
|
+
That allows the calling app to revert to v1 */
|
159
|
+
LookupSymbol( api, sqlany_init_ex );
|
160
|
+
LookupSymbol( api, sqlany_fini_ex );
|
161
|
+
LookupSymbol( api, sqlany_new_connection_ex );
|
162
|
+
LookupSymbol( api, sqlany_make_connection_ex );
|
163
|
+
LookupSymbol( api, sqlany_client_version_ex );
|
164
|
+
LookupSymbolAndCheck( api, sqlany_cancel );
|
165
|
+
#endif
|
166
|
+
|
167
|
+
api->initialized = 1;
|
168
|
+
return 1;
|
169
|
+
}
|
170
|
+
#undef LookupSymbolAndCheck
|
171
|
+
|
172
|
+
void sqlany_finalize_interface( SQLAnywhereInterface * api )
|
173
|
+
/***********************************************************/
|
174
|
+
{
|
175
|
+
if( !api->initialized ) {
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
unloadLibrary( api->dll_handle );
|
179
|
+
memset( api, 0, sizeof(*api));
|
180
|
+
}
|
181
|
+
|
182
|
+
|
data/ext/sacapidll.h
ADDED
@@ -0,0 +1,332 @@
|
|
1
|
+
/* ====================================================
|
2
|
+
*
|
3
|
+
* Copyright 2008-2010 iAnywhere Solutions, Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
*
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*
|
18
|
+
* While not a requirement of the license, if you do modify this file, we
|
19
|
+
* would appreciate hearing about it. Please email
|
20
|
+
* sqlany_interfaces@sybase.com
|
21
|
+
*
|
22
|
+
* ====================================================
|
23
|
+
*/
|
24
|
+
|
25
|
+
#ifndef SACAPIDLL_H
|
26
|
+
#define SACAPIDLL_H
|
27
|
+
|
28
|
+
#include "sacapi.h"
|
29
|
+
|
30
|
+
/** \file sacapidll.h
|
31
|
+
* \brief Header file for stub that can dynamically load the main API DLL.
|
32
|
+
* The user will need to include sacapidll.h in their source files and compile in sacapidll.c
|
33
|
+
*/
|
34
|
+
|
35
|
+
|
36
|
+
#if defined( __cplusplus )
|
37
|
+
extern "C" {
|
38
|
+
#endif
|
39
|
+
typedef sacapi_bool (*sqlany_init_func)( const char * app_name, sacapi_u32 api_version, sacapi_u32 * max_version );
|
40
|
+
typedef void (*sqlany_fini_func)();
|
41
|
+
typedef a_sqlany_connection * (*sqlany_new_connection_func)( );
|
42
|
+
typedef void (*sqlany_free_connection_func)( a_sqlany_connection *sqlany_conn );
|
43
|
+
typedef a_sqlany_connection * (*sqlany_make_connection_func)( void * arg );
|
44
|
+
typedef sacapi_bool (*sqlany_connect_func)( a_sqlany_connection * sqlany_conn, const char * str );
|
45
|
+
typedef sacapi_bool (*sqlany_disconnect_func)( a_sqlany_connection * sqlany_conn );
|
46
|
+
typedef sacapi_bool (*sqlany_execute_immediate_func)( a_sqlany_connection * sqlany_conn, const char * sql );
|
47
|
+
typedef a_sqlany_stmt * (*sqlany_prepare_func)( a_sqlany_connection * sqlany_conn, const char * sql_str );
|
48
|
+
typedef void (*sqlany_free_stmt_func)( a_sqlany_stmt * sqlany_stmt );
|
49
|
+
typedef sacapi_i32 (*sqlany_num_params_func)( a_sqlany_stmt * sqlany_stmt );
|
50
|
+
typedef sacapi_bool (*sqlany_describe_bind_param_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param * params );
|
51
|
+
typedef sacapi_bool (*sqlany_bind_param_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param * params );
|
52
|
+
typedef sacapi_bool (*sqlany_send_param_data_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, char * buffer, size_t size );
|
53
|
+
typedef sacapi_bool (*sqlany_reset_func)( a_sqlany_stmt * sqlany_stmt );
|
54
|
+
typedef sacapi_bool (*sqlany_get_bind_param_info_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 index, a_sqlany_bind_param_info * info );
|
55
|
+
typedef sacapi_bool (*sqlany_execute_func)( a_sqlany_stmt * sqlany_stmt );
|
56
|
+
typedef a_sqlany_stmt * (*sqlany_execute_direct_func)( a_sqlany_connection * sqlany_conn, const char * sql_str );
|
57
|
+
typedef sacapi_bool (*sqlany_fetch_absolute_func)( a_sqlany_stmt * sqlany_result, sacapi_i32 row_num );
|
58
|
+
typedef sacapi_bool (*sqlany_fetch_next_func)( a_sqlany_stmt * sqlany_stmt );
|
59
|
+
typedef sacapi_bool (*sqlany_get_next_result_func)( a_sqlany_stmt * sqlany_stmt );
|
60
|
+
typedef sacapi_i32 (*sqlany_affected_rows_func)( a_sqlany_stmt * sqlany_stmt );
|
61
|
+
typedef sacapi_i32 (*sqlany_num_cols_func)( a_sqlany_stmt * sqlany_stmt );
|
62
|
+
typedef sacapi_i32 (*sqlany_num_rows_func)( a_sqlany_stmt * sqlany_stmt );
|
63
|
+
typedef sacapi_bool (*sqlany_get_column_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_data_value * buffer );
|
64
|
+
typedef sacapi_i32 (*sqlany_get_data_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, size_t offset, void * buffer, size_t size );
|
65
|
+
typedef sacapi_bool (*sqlany_get_data_info_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_data_info * buffer );
|
66
|
+
typedef sacapi_bool (*sqlany_get_column_info_func)( a_sqlany_stmt * sqlany_stmt, sacapi_u32 col_index, a_sqlany_column_info * buffer );
|
67
|
+
typedef sacapi_bool (*sqlany_commit_func)( a_sqlany_connection * sqlany_conn );
|
68
|
+
typedef sacapi_bool (*sqlany_rollback_func)( a_sqlany_connection * sqlany_conn );
|
69
|
+
typedef sacapi_bool (*sqlany_client_version_func)( char * buffer, size_t len );
|
70
|
+
typedef sacapi_i32 (*sqlany_error_func)( a_sqlany_connection * sqlany_conn, char * buffer, size_t size );
|
71
|
+
typedef size_t (*sqlany_sqlstate_func)( a_sqlany_connection * sqlany_conn, char * buffer, size_t size );
|
72
|
+
typedef void (*sqlany_clear_error_func)( a_sqlany_connection * sqlany_conn );
|
73
|
+
#if _SACAPI_VERSION+0 >= 2
|
74
|
+
typedef a_sqlany_interface_context *(*sqlany_init_ex_func)( const char *app_name, sacapi_u32 api_version, sacapi_u32 *max_version );
|
75
|
+
typedef void (*sqlany_fini_ex_func)( a_sqlany_interface_context *context );
|
76
|
+
typedef a_sqlany_connection *(*sqlany_new_connection_ex_func)( a_sqlany_interface_context *context );
|
77
|
+
typedef a_sqlany_connection *(*sqlany_make_connection_ex_func)( a_sqlany_interface_context *context, void *arg );
|
78
|
+
typedef sacapi_bool (*sqlany_client_version_ex_func)( a_sqlany_interface_context *context, char *buffer, size_t len );
|
79
|
+
typedef void (*sqlany_cancel_func)( a_sqlany_connection * sqlany_conn );
|
80
|
+
#endif
|
81
|
+
|
82
|
+
#if defined( __cplusplus )
|
83
|
+
}
|
84
|
+
#endif
|
85
|
+
|
86
|
+
/// @internal
|
87
|
+
#define function( x ) x ## _func x
|
88
|
+
|
89
|
+
/** The SQL Anywhere C API interface structure.
|
90
|
+
*
|
91
|
+
* Only one instance of this structure is required in your application environment. This structure
|
92
|
+
* is initialized by the sqlany_initialize_interface method. It attempts to load the SQL Anywhere C
|
93
|
+
* API DLL or shared object dynamically and looks up all the entry points of the DLL. The fields in
|
94
|
+
* the SQLAnywhereInterface structure is populated to point to the corresponding functions in the DLL.
|
95
|
+
* \sa sqlany_initialize_interface()
|
96
|
+
*/
|
97
|
+
typedef struct SQLAnywhereInterface {
|
98
|
+
/** DLL handle.
|
99
|
+
*/
|
100
|
+
void * dll_handle;
|
101
|
+
|
102
|
+
/** Flag to know if initialized or not.
|
103
|
+
*/
|
104
|
+
int initialized;
|
105
|
+
|
106
|
+
/** Pointer to ::sqlany_init() function.
|
107
|
+
*/
|
108
|
+
function( sqlany_init );
|
109
|
+
|
110
|
+
/** Pointer to ::sqlany_fini() function.
|
111
|
+
*/
|
112
|
+
function( sqlany_fini );
|
113
|
+
|
114
|
+
/** Pointer to ::sqlany_new_connection() function.
|
115
|
+
*/
|
116
|
+
function( sqlany_new_connection );
|
117
|
+
|
118
|
+
/** Pointer to ::sqlany_free_connection() function.
|
119
|
+
*/
|
120
|
+
function( sqlany_free_connection );
|
121
|
+
|
122
|
+
/** Pointer to ::sqlany_make_connection() function.
|
123
|
+
*/
|
124
|
+
function( sqlany_make_connection );
|
125
|
+
|
126
|
+
/** Pointer to ::sqlany_connect() function.
|
127
|
+
*/
|
128
|
+
function( sqlany_connect );
|
129
|
+
|
130
|
+
/** Pointer to ::sqlany_disconnect() function.
|
131
|
+
*/
|
132
|
+
function( sqlany_disconnect );
|
133
|
+
|
134
|
+
/** Pointer to ::sqlany_execute_immediate() function.
|
135
|
+
*/
|
136
|
+
function( sqlany_execute_immediate );
|
137
|
+
|
138
|
+
/** Pointer to ::sqlany_prepare() function.
|
139
|
+
*/
|
140
|
+
function( sqlany_prepare );
|
141
|
+
|
142
|
+
/** Pointer to ::sqlany_free_stmt() function.
|
143
|
+
*/
|
144
|
+
function( sqlany_free_stmt );
|
145
|
+
|
146
|
+
/** Pointer to ::sqlany_num_params() function.
|
147
|
+
*/
|
148
|
+
function( sqlany_num_params );
|
149
|
+
|
150
|
+
/** Pointer to ::sqlany_describe_bind_param() function.
|
151
|
+
*/
|
152
|
+
function( sqlany_describe_bind_param );
|
153
|
+
|
154
|
+
/** Pointer to ::sqlany_bind_param() function.
|
155
|
+
*/
|
156
|
+
function( sqlany_bind_param );
|
157
|
+
|
158
|
+
/** Pointer to ::sqlany_send_param_data() function.
|
159
|
+
*/
|
160
|
+
function( sqlany_send_param_data );
|
161
|
+
|
162
|
+
/** Pointer to ::sqlany_reset() function.
|
163
|
+
*/
|
164
|
+
function( sqlany_reset );
|
165
|
+
|
166
|
+
/** Pointer to ::sqlany_get_bind_param_info() function.
|
167
|
+
*/
|
168
|
+
function( sqlany_get_bind_param_info );
|
169
|
+
|
170
|
+
/** Pointer to ::sqlany_execute() function.
|
171
|
+
*/
|
172
|
+
function( sqlany_execute );
|
173
|
+
|
174
|
+
/** Pointer to ::sqlany_execute_direct() function.
|
175
|
+
*/
|
176
|
+
function( sqlany_execute_direct );
|
177
|
+
|
178
|
+
/** Pointer to ::sqlany_fetch_absolute() function.
|
179
|
+
*/
|
180
|
+
function( sqlany_fetch_absolute );
|
181
|
+
|
182
|
+
/** Pointer to ::sqlany_fetch_next() function.
|
183
|
+
*/
|
184
|
+
function( sqlany_fetch_next );
|
185
|
+
|
186
|
+
/** Pointer to ::sqlany_get_next_result() function.
|
187
|
+
*/
|
188
|
+
function( sqlany_get_next_result );
|
189
|
+
|
190
|
+
/** Pointer to ::sqlany_affected_rows() function.
|
191
|
+
*/
|
192
|
+
function( sqlany_affected_rows );
|
193
|
+
|
194
|
+
/** Pointer to ::sqlany_num_cols() function.
|
195
|
+
*/
|
196
|
+
function( sqlany_num_cols );
|
197
|
+
|
198
|
+
/** Pointer to ::sqlany_num_rows() function.
|
199
|
+
*/
|
200
|
+
function( sqlany_num_rows );
|
201
|
+
|
202
|
+
/** Pointer to ::sqlany_get_column() function.
|
203
|
+
*/
|
204
|
+
function( sqlany_get_column );
|
205
|
+
|
206
|
+
/** Pointer to ::sqlany_get_data() function.
|
207
|
+
*/
|
208
|
+
function( sqlany_get_data );
|
209
|
+
|
210
|
+
/** Pointer to ::sqlany_get_data_info() function.
|
211
|
+
*/
|
212
|
+
function( sqlany_get_data_info );
|
213
|
+
|
214
|
+
/** Pointer to ::sqlany_get_column_info() function.
|
215
|
+
*/
|
216
|
+
function( sqlany_get_column_info );
|
217
|
+
|
218
|
+
/** Pointer to ::sqlany_commit() function.
|
219
|
+
*/
|
220
|
+
function( sqlany_commit );
|
221
|
+
|
222
|
+
/** Pointer to ::sqlany_rollback() function.
|
223
|
+
*/
|
224
|
+
function( sqlany_rollback );
|
225
|
+
|
226
|
+
/** Pointer to ::sqlany_client_version() function.
|
227
|
+
*/
|
228
|
+
function( sqlany_client_version );
|
229
|
+
|
230
|
+
/** Pointer to ::sqlany_error() function.
|
231
|
+
*/
|
232
|
+
function( sqlany_error );
|
233
|
+
|
234
|
+
/** Pointer to ::sqlany_sqlstate() function.
|
235
|
+
*/
|
236
|
+
function( sqlany_sqlstate );
|
237
|
+
|
238
|
+
/** Pointer to ::sqlany_clear_error() function.
|
239
|
+
*/
|
240
|
+
function( sqlany_clear_error );
|
241
|
+
|
242
|
+
#if _SACAPI_VERSION+0 >= 2
|
243
|
+
/** Pointer to ::sqlany_init_ex() function.
|
244
|
+
*/
|
245
|
+
function( sqlany_init_ex );
|
246
|
+
|
247
|
+
/** Pointer to ::sqlany_fini_ex() function.
|
248
|
+
*/
|
249
|
+
function( sqlany_fini_ex );
|
250
|
+
|
251
|
+
/** Pointer to ::sqlany_new_connection_ex() function.
|
252
|
+
*/
|
253
|
+
function( sqlany_new_connection_ex );
|
254
|
+
|
255
|
+
/** Pointer to ::sqlany_make_connection_ex() function.
|
256
|
+
*/
|
257
|
+
function( sqlany_make_connection_ex );
|
258
|
+
|
259
|
+
/** Pointer to ::sqlany_client_version_ex() function.
|
260
|
+
*/
|
261
|
+
function( sqlany_client_version_ex );
|
262
|
+
|
263
|
+
/** Pointer to ::sqlany_cancel() function.
|
264
|
+
*/
|
265
|
+
function( sqlany_cancel );
|
266
|
+
#endif
|
267
|
+
|
268
|
+
} SQLAnywhereInterface;
|
269
|
+
#undef function
|
270
|
+
|
271
|
+
/** Initializes the SQLAnywhereInterface object and loads the DLL dynamically.
|
272
|
+
*
|
273
|
+
* Use the following statement to include the function prototype:
|
274
|
+
*
|
275
|
+
* <pre>
|
276
|
+
* \#include "sacapidll.h"
|
277
|
+
* </pre>
|
278
|
+
*
|
279
|
+
* This function attempts to load the SQL Anywhere C API DLL dynamically and looks up all
|
280
|
+
* the entry points of the DLL. The fields in the SQLAnywhereInterface structure are
|
281
|
+
* populated to point to the corresponding functions in the DLL. If the optional path argument
|
282
|
+
* is NULL, the environment variable SQLANY_DLL_PATH is checked. If the variable is set,
|
283
|
+
* the library attempts to load the DLL specified by the environment variable. If that fails,
|
284
|
+
* the interface attempts to load the DLL directly (this relies on the environment being
|
285
|
+
* setup correctly).
|
286
|
+
*
|
287
|
+
* To view examples of the sqlany_initialize_interface method in use, see the following topics:
|
288
|
+
*
|
289
|
+
* <ul>
|
290
|
+
* <li>\salink{connecting.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-connecting-cpp.html", "programming", "pg-c-api-connecting-cpp"}
|
291
|
+
* <li>\salink{dbcapi_isql.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-dbcapi-isql-cpp.html", "programming", "pg-c-api-dbcapi-isql-cpp"}
|
292
|
+
* <li>\salink{fetching_a_result_set.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-fetching-a-result-set-cpp.html", "programming", "pg-c-api-fetching-a-result-set-cpp"}
|
293
|
+
* <li>\salink{fetching_multiple_from_sp.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-fetching-multiple-from-sp-cpp.html", "programming", "pg-c-api-fetching-multiple-from-sp-cpp"}
|
294
|
+
* <li>\salink{preparing_statements.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-preparing-statements-cpp.html", "programming", "pg-c-api-preparing-statements-cpp"}
|
295
|
+
* <li>\salink{send_retrieve_full_blob.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-send-retrieve-full-blob-cpp.html", "programming", "pg-c-api-send-retrieve-full-blob-cpp"}
|
296
|
+
* <li>\salink{send_retrieve_part_blob.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-send-retrieve-part-blob-cpp.html", "programming", "pg-c-api-send-retrieve-part-blob-cpp"}
|
297
|
+
* </ul>
|
298
|
+
*
|
299
|
+
* \param api An API structure to initialize.
|
300
|
+
* \param optional_path_to_dll An optional argument that specifies a path to the SQL Anywhere C API DLL.
|
301
|
+
* \return 1 on successful initialization, and 0 on failure.
|
302
|
+
*/
|
303
|
+
int sqlany_initialize_interface( SQLAnywhereInterface * api, const char * optional_path_to_dll );
|
304
|
+
|
305
|
+
/** Unloads the C API DLL library and uninitializes the SQLAnywhereInterface structure.
|
306
|
+
*
|
307
|
+
* Use the following statement to include the function prototype:
|
308
|
+
*
|
309
|
+
* <pre>
|
310
|
+
* \#include "sacapidll.h"
|
311
|
+
* </pre>
|
312
|
+
*
|
313
|
+
* Use this method to finalize and free resources associated with the SQL Anywhere C API DLL.
|
314
|
+
*
|
315
|
+
* To view examples of the sqlany_finalize_interface method in use, see the following topics:
|
316
|
+
*
|
317
|
+
* <ul>
|
318
|
+
* <li>\salink{connecting.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-connecting-cpp.html", "programming", "pg-c-api-connecting-cpp"}
|
319
|
+
* <li>\salink{dbcapi_isql.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-dbcapi-isql-cpp.html", "programming", "pg-c-api-dbcapi-isql-cpp"}
|
320
|
+
* <li>\salink{fetching_a_result_set.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-fetching-a-result-set-cpp.html", "programming", "pg-c-api-fetching-a-result-set-cpp"}
|
321
|
+
* <li>\salink{fetching_multiple_from_sp.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-fetching-multiple-from-sp-cpp.html", "programming", "pg-c-api-fetching-multiple-from-sp-cpp"}
|
322
|
+
* <li>\salink{preparing_statements.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-preparing-statements-cpp.html", "programming", "pg-c-api-preparing-statements-cpp"}
|
323
|
+
* <li>\salink{send_retrieve_full_blob.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-send-retrieve-full-blob-cpp.html", "programming", "pg-c-api-send-retrieve-full-blob-cpp"}
|
324
|
+
* <li>\salink{send_retrieve_part_blob.cpp, "http://dcx.sybase.com/1200en/dbprogramming/pg-c-api-send-retrieve-part-blob-cpp.html", "programming", "pg-c-api-send-retrieve-part-blob-cpp"}
|
325
|
+
* </ul>
|
326
|
+
*
|
327
|
+
* \param api An initialized structure to finalize.
|
328
|
+
*/
|
329
|
+
|
330
|
+
void sqlany_finalize_interface( SQLAnywhereInterface * api );
|
331
|
+
|
332
|
+
#endif
|