8 #ifndef SOCI_ODBC_H_INCLUDED 9 #define SOCI_ODBC_H_INCLUDED 13 # ifdef SOCI_ODBC_SOURCE 14 # define SOCI_ODBC_DECL __declspec(dllexport) 16 # define SOCI_ODBC_DECL __declspec(dllimport) 17 # endif // SOCI_ODBC_SOURCE 22 #ifndef SOCI_ODBC_DECL 23 # define SOCI_ODBC_DECL 29 #if defined(_MSC_VER) || defined(__MINGW32__) 62 inline bool use_string_for_bigint()
const;
69 max_bigint_length = 21
82 virtual void define_by_pos(
int &position,
85 virtual void pre_fetch();
86 virtual void post_fetch(
bool gotData,
bool calledFromFetch,
89 virtual void clean_up();
104 data_(NULL), buf_(NULL) {}
106 virtual void define_by_pos(
int &position,
109 virtual void pre_fetch();
110 virtual void post_fetch(
bool gotData,
indicator *ind);
112 virtual void resize(std::size_t sz);
113 virtual std::size_t size();
115 virtual void clean_up();
119 void prepare_indicators(std::size_t size);
136 position_(-1), data_(0), buf_(0), indHolder_(0) {}
138 virtual void bind_by_pos(
int &position,
140 virtual void bind_by_name(std::string
const &name,
143 virtual void pre_use(
indicator const *ind);
144 virtual void post_use(
bool gotData,
indicator *ind);
146 virtual void clean_up();
153 void* prepare_for_bind(SQLLEN &size,
154 SQLSMALLINT &sqlType, SQLSMALLINT &cType);
168 data_(NULL), buf_(NULL) {}
172 void prepare_indicators(std::size_t size);
175 void prepare_for_bind(
void *&data, SQLUINTEGER &size, SQLSMALLINT &sqlType, SQLSMALLINT &cType);
176 void bind_helper(
int &position,
179 virtual void bind_by_pos(
int &position,
181 virtual void bind_by_name(std::string
const &name,
184 virtual void pre_use(
indicator const *ind);
186 virtual std::size_t size();
188 virtual void clean_up();
206 virtual void alloc();
207 virtual void clean_up();
208 virtual void prepare(std::string
const &query,
214 virtual long long get_affected_rows();
215 virtual int get_number_of_rows();
217 virtual std::string rewrite_for_procedure_call(std::string
const &query);
219 virtual int prepare_for_describe();
220 virtual void describe_column(
int colNum,
data_type &dtype,
221 std::string &columnName);
224 std::size_t column_size(
int position);
258 virtual std::size_t get_len();
259 virtual std::size_t read(std::size_t offset,
char *buf,
261 virtual std::size_t write(std::size_t offset,
char const *buf,
262 std::size_t toWrite);
263 virtual std::size_t append(
char const *buf, std::size_t toWrite);
264 virtual void trim(std::size_t newLen);
275 virtual void begin();
276 virtual void commit();
277 virtual void rollback();
279 virtual bool get_next_sequence_value(
session & s,
280 std::string
const & sequence,
long & value);
281 virtual bool get_last_insert_id(
session & s,
282 std::string
const & table,
long & value);
286 void reset_transaction();
321 SQLCHAR message_[SQL_MAX_MESSAGE_LENGTH + 1];
322 SQLCHAR sqlstate_[SQL_SQLSTATE_SIZE + 1];
328 std::string
const & msg)
329 :
soci_error(interpret_odbc_error(htype, hndl, msg))
348 std::ostringstream ss(msg, std::ostringstream::app);
350 const char* socierror = NULL;
352 SQLSMALLINT length, i = 1;
353 switch ( SQLGetDiagRecA(htype, hndl, i, sqlstate_, &sqlcode_,
354 message_, SQL_MAX_MESSAGE_LENGTH + 1,
361 case SQL_INVALID_HANDLE:
362 socierror =
"[SOCI]: Invalid handle.";
366 socierror =
"[SOCI]: SQLGetDiagRec() error.";
369 case SQL_SUCCESS_WITH_INFO:
370 socierror =
"[SOCI]: Error message too long.";
374 socierror =
"[SOCI]: No error.";
378 socierror =
"[SOCI]: Unexpected SQLGetDiagRec() return value.";
385 strcpy(reinterpret_cast<char*>(message_), socierror);
388 strcpy(reinterpret_cast<char*>(sqlstate_),
"01000");
393 ss <<
": " << message_ <<
" (" << sqlstate_ <<
")";
401 if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && rc != SQL_NO_DATA)
419 return statement_.session_.get_database_product()
443 #endif // SOCI_EMPTY_H_INCLUDED
details::exchange_type type_
details::exchange_type type_
SQLCHAR const * odbc_error_message() const
odbc_vector_into_type_backend(odbc_statement_backend &st)
std::size_t const odbc_max_buffer_length
SOCI_ODBC_DECL void register_factory_odbc()
odbc_standard_into_type_backend(odbc_statement_backend &st)
odbc_standard_use_type_backend(odbc_statement_backend &st)
database_product product_
odbc_soci_error(SQLSMALLINT htype, SQLHANDLE hndl, std::string const &msg)
bool is_odbc_error(SQLRETURN rc)
std::vector< SQLLEN > indHolderVec_
details::exchange_type type_
odbc_vector_use_type_backend(odbc_statement_backend &st)
odbc_session_backend & session_
odbc_standard_type_backend_base(odbc_statement_backend &st)
odbc_session_backend & session_
details::exchange_type type_
std::vector< std::string > names_
std::string interpret_odbc_error(SQLSMALLINT htype, SQLHANDLE hndl, std::string const &msg)
SQLINTEGER native_error_code() const
SOCI_ODBC_DECL odbc_backend_factory const odbc
bool use_string_for_bigint() const
SOCI_ODBC_DECL char const * odbc_option_driver_complete
std::string connection_string_
virtual std::string get_backend_name() const
std::vector< SQLLEN > indHolderVec_
std::string get_connection_string() const
SQLCHAR const * odbc_error_code() const
odbc_statement_backend & statement_
SOCI_ODBC_DECL backend_factory const * factory_odbc()
std::vector< ISM::CombinatorialTrainerParameters > parameters
bool hasVectorUseElements_