7 #if defined(SOCI_HEADERS_BURIED)
8 #include <soci/core/soci.h>
9 #include <soci/backends/mysql/soci-mysql.h>
10 #else // SOCI_HEADERS_BURIED
12 #include <mysql/soci-mysql.h>
13 #endif // SOCI_HEADERS_BURIED
38 ioSelectStatement = (ioSociSession.prepare
39 <<
"select iata_code, name "
40 <<
"from airlines ", soci::into (ioAirline));
43 ioSelectStatement.execute();
45 }
catch (std::exception
const& lException) {
51 void DBManagerForAirlines::
52 prepareSelectOnAirlineCodeStatement (
DBSession_T& ioSociSession,
66 ioSelectStatement = (ioSociSession.prepare
67 <<
"select iata_code, name "
69 <<
"where iata_code = :airline_code ",
70 soci::into (ioAirline), soci::use (iAirlineCode));
73 ioSelectStatement.execute();
75 }
catch (std::exception
const& lException) {
76 throw SQLDatabaseException (lException.what());
84 bool hasStillData =
false;
89 hasStillData = ioStatement.fetch();
91 }
catch (std::exception
const& lException) {
103 ioSociSession.begin();
113 (ioSociSession.prepare
114 <<
"update airlines "
115 <<
"set name = :name "
116 <<
"where iata_code = :iata_code",
117 soci::use (lAirlineName), soci::use (lAirlineCode));
120 lUpdateStatement.execute (
true);
123 ioSociSession.commit();
128 }
catch (std::exception
const& lException) {
137 bool oHasRetrievedAirline =
false;
142 prepareSelectOnAirlineCodeStatement (ioSociSession, lSelectStatement,
143 iAirlineCode, ioAirline);
147 if (hasStillData ==
true) {
148 oHasRetrievedAirline =
true;
158 }
catch (std::exception
const& lException) {
162 return oHasRetrievedAirline;
Handle on the StdAir library context.
const std::string & getAirlineName() const
std::string AirlineCode_T
static void updateAirlineInDB(DBSession_T &, const AirlineStruct &)
soci::session DBSession_T
static bool retrieveAirline(DBSession_T &, const AirlineCode_T &, AirlineStruct &)
static bool iterateOnStatement(DBRequestStatement_T &, AirlineStruct &)
static void prepareSelectStatement(DBSession_T &, DBRequestStatement_T &, AirlineStruct &)
const AirlineCode_T & getAirlineCode() const
soci::statement DBRequestStatement_T