8 #define SOCI_FIREBIRD_SOURCE 31 void skipWhiteSpace(std::string::const_iterator& i, std::string::const_iterator
const &end)
33 std::locale
const loc;
36 if (!std::isspace(*i, loc))
48 getWordUntil(std::string
const &s, std::string::const_iterator &i,
char delim)
50 std::string::const_iterator
const end = s.end();
51 skipWhiteSpace(i, end);
62 std::locale
const loc;
68 if (std::isspace(*i, loc))
70 skipWhiteSpace(i, end);
71 if (i == end || *i != delim)
73 std::ostringstream os;
74 os <<
"Expected '" << delim <<
"' at position " 75 << (i - s.begin() + 1)
76 <<
" in Firebird connection string \"" 90 std::ostringstream os;
91 os <<
"Expected '" << delim
92 <<
"' not found before the end of the string " 93 <<
"in Firebird connection string \"" 110 getPossiblyQuotedWord(std::string
const &s, std::string::const_iterator &i)
112 std::string::const_iterator
const end = s.end();
113 skipWhiteSpace(i, end);
117 if (i != end && *i ==
'"')
123 std::ostringstream os;
124 os <<
"Expected '\"' not found before the end of the string " 125 "in Firebird connection string \"" 142 std::locale
const loc;
143 for (; i != end; ++i)
145 if (std::isspace(*i, loc))
159 std::map<std::string, std::string>
162 std::map<std::string, std::string>
parameters;
164 std::string key, value;
165 for (std::string::const_iterator i = connectString.begin(); ; )
167 key = getWordUntil(connectString, i,
'=');
171 value = getPossiblyQuotedWord(connectString, i);
173 parameters.insert(std::pair<std::string, std::string>(key, value));
180 bool getISCConnectParameter(std::map<std::string, std::string>
const & m, std::string
const & key,
183 std::map <std::string, std::string> :: const_iterator i;
203 , decimals_as_strings_(false)
206 std::map<std::string, std::string>
213 if (getISCConnectParameter(params,
"user", param))
218 if (getISCConnectParameter(params,
"password", param))
223 if (getISCConnectParameter(params,
"role", param))
228 if (getISCConnectParameter(params,
"charset", param))
233 if (getISCConnectParameter(params,
"service", param) ==
false)
235 throw soci_error(
"Service name not specified.");
239 if (isc_attach_database(stat, static_cast<short>(param.size()),
240 const_cast<char*>(param.c_str()), &
dbhp_,
241 static_cast<short>(
dpb_.size()), const_cast<char*>(
dpb_.c_str())))
246 if (getISCConnectParameter(params,
"decimals_as_strings", param))
263 if (isc_start_transaction(stat, &
trhp_, 1, &
dbhp_, 0, NULL))
278 if (
dpb_.size() == 0)
280 dpb_.append(1, static_cast<char>(isc_dpb_version1));
284 dpb_.append(1, static_cast<char>(option));
285 dpb_.append(1, static_cast<char>(value.size()));
295 if (isc_commit_transaction(stat, &
trhp_))
303 #ifndef SOCI_FIREBIRD_NORESTARTTRANSACTION 315 if (isc_rollback_transaction(stat, &
trhp_))
323 #ifndef SOCI_FIREBIRD_NORESTARTTRANSACTION 336 if (isc_commit_transaction(stat, &
trhp_))
344 if (isc_detach_database(stat, &
dbhp_))
353 session & s, std::string
const & sequence,
long & value)
356 s <<
"select next value for " + sequence +
" from rdb$database",
details::into_container< T, details::no_indicator > into(T &t)
bool decimals_as_strings_
virtual firebird_statement_backend * make_statement_backend()
firebird_session_backend(connection_parameters const ¶meters)
std::string const & get_connect_string() const
std::size_t const stat_size
virtual bool get_next_sequence_value(session &s, std::string const &sequence, long &value)
void throw_iscerror(ISC_STATUS *status_vector)
~firebird_session_backend()
std::string connectString
virtual firebird_rowid_backend * make_rowid_backend()
std::vector< ISM::CombinatorialTrainerParameters > parameters
virtual firebird_blob_backend * make_blob_backend()
virtual void setDPBOption(int const option, std::string const &value)