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_mysqlsrv_h_00029 #define _terimber_mysqlsrv_h_00030
00031 #include "db/db.h"00032 #include "dbmysql/mysqlinc.h"00033
00034 BEGIN_TERIMBER_NAMESPACE00035 #pragma pack(4)00036
00039class mysql_dbserver : publicdbserver_impl00040 {
00041 public:
00043 mysql_dbserver( size_t ident
00044 );
00046 virtual00047 ~mysql_dbserver();
00048
00049 protected:
00051 virtualvoidv_connect(bool trusted_connection, constchar* connection_string);
00052 virtualvoidv_disconnect();
00053 virtualvoidv_start_transaction();
00054 virtualvoidv_commit();
00055 virtualvoidv_rollback();
00056 virtualboolv_is_connect_alive();
00057 virtualvoidv_before_execute();
00058 virtualvoidv_after_execute();
00059 virtualvoidv_before_bind_columns();
00060 virtualvoidv_execute();
00061 virtualvoidv_close();
00062 virtualvoidv_fetch();
00063 virtualvoidv_replace_quote();
00064 virtualvoidv_bind_one_param(size_t index);
00065 virtualvoidv_bind_one_column(size_t index);
00066 virtualsize_tv_get_number_columns();
00067 virtualvoidv_convert_one_value(size_t row, size_t index, terimber_db_value& val);
00068 virtualvoidv_get_one_column_info(size_t index);
00069 virtualvoidv_form_sql_string();
00070 virtualvoidv_rebind_one_param(size_t index);
00071 virtualvoidv_interrupt_async();
00072 virtualdbtypesv_native_type_to_client_type(size_t native_type);
00073
00074
00075 private:
00077 void00078 parse_connection_string(constchar* connection_string,
00079 string_t& user,
00080 string_t& password,
00081 string_t& host,
00082 unsignedshort& port,
00083 string_t& database
00084 );
00085 private:
00086 MYSQL* _desc;
00087 MYSQL_STMT* _stmt;
00088_vector< MYSQL_BIND >_param_binders;
00089_vector< MYSQL_BIND >_column_binders;
00090 };
00091
00092
00094 // pool support00097class mysql_db_creator : publicdb_creator< mysql_db_creator >
00098 {
00099 public:
00101 static00102 db_entry*
00103 create( constdb_arg& arg
00104 );
00105 };
00106
00107typedefpool< mysql_db_creator >mysql_db_pool_t;
00108
00109 #pragma pack()00110 END_TERIMBER_NAMESPACE00111
00112 #endif // _terimber_mysqlsrv_h_00113