00001 /*00002 * The Software License00003 * =================================================================================00004 * Copyright (c) 2003-.The Terimber Corporation. All rights reserved.00005 * =================================================================================00006 * Redistributions of source code must retain the above copyright notice, 00007 * this list of conditions and the following disclaimer.00008 * Redistributions in binary form must reproduce the above copyright notice, 00009 * this list of conditions and the following disclaimer in the documentation 00010 * and/or other materials provided with the distribution.00011 * The end-user documentation included with the redistribution, if any, 00012 * must include the following acknowledgment:00013 * "This product includes software developed by the Terimber Corporation."00014 * =================================================================================00015 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, 00016 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00017 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00018 * IN NO EVENT SHALL THE TERIMBER CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR 00019 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00020 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00021 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00022 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT00023 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE00024 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.00025 * ================================================================================00026 */00027
00028 #ifndef _terimber_odbcsrv_h_00029 #define _terimber_odbcsrv_h_00030
00031 #include "db/db.h"00032 #include "dbodbc/odbcinc.h"00033
00034 BEGIN_TERIMBER_NAMESPACE00035 #pragma pack(4)00036
00039class odbc_dbserver : publicdbserver_impl00040 {
00041 public:
00043 odbc_dbserver( size_t ident
00044 );
00046 virtual00047 ~odbc_dbserver();
00048
00049 // connection part00050 protected:
00051 // database specific - must be overriden00052 virtualvoidv_connect(bool trusted_connection, constchar* connection_string);
00053 virtualvoidv_disconnect();
00054 virtualvoidv_start_transaction();
00055 virtualvoidv_commit();
00056 virtualvoidv_rollback();
00057 virtualboolv_is_connect_alive();
00058 virtualvoidv_before_execute();
00059 virtualvoidv_after_execute();
00060 virtualvoidv_execute();
00061 virtualvoidv_close();
00062 virtualvoidv_fetch();
00063 virtualvoidv_replace_quote();
00064 virtualvoidv_bind_one_param(size_t index);
00065 virtualvoidv_before_bind_columns();
00066 virtualvoidv_bind_one_column(size_t index);
00067 virtualsize_tv_get_number_columns();
00068 virtualvoidv_convert_one_value(size_t row, size_t col, terimber_db_value& val);
00069 virtualvoidv_get_one_column_info(size_t index);
00070 virtualvoidv_form_sql_string();
00071 virtualvoidv_rebind_one_param(size_t index);
00072 virtualvoidv_interrupt_async();
00073 virtualdbtypesv_native_type_to_client_type(size_t native_type);
00074
00075 private:
00077 static00078 void00079 get_odbc_error( size_t code,
00080 SQLHENV henv,
00081 SQLHDBC hdbc,
00082 SQLHSTMT hstmt
00083 );
00084
00085 private:
00086 SQLHENV _henv;
00087 SQLHDBC _hdbc;
00088 SQLHSTMT _hstmt;
00089bool_bind_cols;
00090 };
00091
00093 // pool support00096class odbc_db_creator : publicdb_creator< odbc_db_creator >
00097 {
00098 public:
00100 static00101 db_entry*
00102 create( constdb_arg& arg
00103 );
00104 };
00105
00106typedefpool< odbc_db_creator >odbc_db_pool_t;
00107
00108 #pragma pack()00109 END_TERIMBER_NAMESPACE00110
00111 #endif // _terimber_odbcsrv_h_00112