2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Maxim Mamontov <faust@stargazer.dp.ua>
22 * This file contains a realization of a base firebird-storage plugin class
25 * $Date: 2010/01/08 16:00:45 $
34 #include "stg/plugin_creator.h"
35 #include "firebird_store.h"
39 PLUGIN_CREATOR<FIREBIRD_STORE> frsc;
42 extern "C" STORE * GetStore();
43 //-----------------------------------------------------------------------------
46 return frsc.GetPlugin();
48 //-----------------------------------------------------------------------------
49 //-----------------------------------------------------------------------------
50 //-----------------------------------------------------------------------------
51 FIREBIRD_STORE::FIREBIRD_STORE()
52 : version("firebird_store v.1.4"),
54 db_server("localhost"),
55 db_database("/var/stg/stargazer.fdb"),
57 db_password("123456"),
61 til(IBPP::ilConcurrency),
63 logger(GetPluginLogger(GetStgLogger(), "store_firebird"))
65 pthread_mutex_init(&mutex, NULL);
67 //-----------------------------------------------------------------------------
68 FIREBIRD_STORE::~FIREBIRD_STORE()
72 //-----------------------------------------------------------------------------
73 int FIREBIRD_STORE::ParseSettings()
75 std::vector<PARAM_VALUE>::iterator i;
78 for(i = settings.moduleParams.begin(); i != settings.moduleParams.end(); ++i)
81 std::transform(s.begin(), s.end(), s.begin(), ToLower());
84 db_server = *(i->value.begin());
88 db_database = *(i->value.begin());
92 db_user = *(i->value.begin());
96 db_password = *(i->value.begin());
99 // Advanced settings block
101 if (s == "isolationLevel")
103 if (*(i->value.begin()) == "Concurrency")
105 til = IBPP::ilConcurrency;
107 else if (*(i->value.begin()) == "DirtyRead")
109 til = IBPP::ilReadDirty;
111 else if (*(i->value.begin()) == "ReadCommitted")
113 til = IBPP::ilReadCommitted;
115 else if (*(i->value.begin()) == "Consistency")
117 til = IBPP::ilConsistency;
120 if (s == "lockResolution")
122 if (*(i->value.begin()) == "Wait")
126 else if (*(i->value.begin()) == "NoWait")
128 tlr = IBPP::lrNoWait;
135 db = IBPP::DatabaseFactory(db_server, db_database, db_user, db_password, "", "KOI8U", "");
138 catch (IBPP::Exception & ex)
140 strError = "IBPP exception";
141 printfd(__FILE__, ex.what());
147 //-----------------------------------------------------------------------------