Commit d5cf1fd5 authored by msobczak's avatar msobczak

Changed naming convention for enums.

parent cccc862c
......@@ -35,11 +35,11 @@ struct SOCI_EMPTY_DECL empty_standard_into_type_backend : details::standard_into
: statement_(st) {}
virtual void define_by_pos(int &position,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void pre_fetch();
virtual void post_fetch(bool gotData, bool calledFromFetch,
eIndicator *ind);
indicator *ind);
virtual void clean_up();
......@@ -52,10 +52,10 @@ struct SOCI_EMPTY_DECL empty_vector_into_type_backend : details::vector_into_typ
: statement_(st) {}
virtual void define_by_pos(int &position,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void pre_fetch();
virtual void post_fetch(bool gotData, eIndicator *ind);
virtual void post_fetch(bool gotData, indicator *ind);
virtual void resize(std::size_t sz);
virtual std::size_t size();
......@@ -71,12 +71,12 @@ struct SOCI_EMPTY_DECL empty_standard_use_type_backend : details::standard_use_t
: statement_(st) {}
virtual void bind_by_pos(int &position,
void *data, details::eExchangeType type, bool readOnly);
void *data, details::exchange_type type, bool readOnly);
virtual void bind_by_name(std::string const &name,
void *data, details::eExchangeType type, bool readOnly);
void *data, details::exchange_type type, bool readOnly);
virtual void pre_use(eIndicator const *ind);
virtual void post_use(bool gotData, eIndicator *ind);
virtual void pre_use(indicator const *ind);
virtual void post_use(bool gotData, indicator *ind);
virtual void clean_up();
......@@ -89,11 +89,11 @@ struct SOCI_EMPTY_DECL empty_vector_use_type_backend : details::vector_use_type_
: statement_(st) {}
virtual void bind_by_pos(int &position,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void bind_by_name(std::string const &name,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void pre_use(eIndicator const *ind);
virtual void pre_use(indicator const *ind);
virtual std::size_t size();
......@@ -110,17 +110,17 @@ struct SOCI_EMPTY_DECL empty_statement_backend : details::statement_backend
virtual void alloc();
virtual void clean_up();
virtual void prepare(std::string const &query,
details::eStatementType eType);
details::statement_type eType);
virtual execFetchResult execute(int number);
virtual execFetchResult fetch(int number);
virtual exec_fetch_result execute(int number);
virtual exec_fetch_result fetch(int number);
virtual int get_number_of_rows();
virtual std::string rewrite_for_procedure_call(std::string const &query);
virtual int prepare_for_describe();
virtual void describe_column(int colNum, eDataType &dtype,
virtual void describe_column(int colNum, data_type &dtype,
std::string &columnName);
virtual empty_standard_into_type_backend * make_into_type_backend();
......
......@@ -17,7 +17,7 @@ using namespace soci::details;
void empty_standard_into_type_backend::define_by_pos(
int & /* position */, void * /* data */, eExchangeType /* type */)
int & /* position */, void * /* data */, exchange_type /* type */)
{
// ...
}
......@@ -28,7 +28,7 @@ void empty_standard_into_type_backend::pre_fetch()
}
void empty_standard_into_type_backend::post_fetch(
bool /* gotData */, bool /* calledFromFetch */, eIndicator * /* ind */)
bool /* gotData */, bool /* calledFromFetch */, indicator * /* ind */)
{
// ...
}
......
......@@ -18,25 +18,25 @@ using namespace soci::details;
void empty_standard_use_type_backend::bind_by_pos(
int & /* position */, void * /* data */,
eExchangeType /* type */, bool /* readOnly */)
exchange_type /* type */, bool /* readOnly */)
{
// ...
}
void empty_standard_use_type_backend::bind_by_name(
std::string const & /* name */, void * /* data */,
eExchangeType /* type */, bool /* readOnly */)
exchange_type /* type */, bool /* readOnly */)
{
// ...
}
void empty_standard_use_type_backend::pre_use(eIndicator const * /* ind */)
void empty_standard_use_type_backend::pre_use(indicator const * /* ind */)
{
// ...
}
void empty_standard_use_type_backend::post_use(
bool /* gotData */, eIndicator * /* ind */)
bool /* gotData */, indicator * /* ind */)
{
// ...
}
......
......@@ -32,23 +32,23 @@ void empty_statement_backend::clean_up()
}
void empty_statement_backend::prepare(std::string const & /* query */,
eStatementType /* eType */)
statement_type /* eType */)
{
// ...
}
statement_backend::execFetchResult
statement_backend::exec_fetch_result
empty_statement_backend::execute(int /* number */)
{
// ...
return eSuccess;
return ef_success;
}
statement_backend::execFetchResult
statement_backend::exec_fetch_result
empty_statement_backend::fetch(int /* number */)
{
// ...
return eSuccess;
return ef_success;
}
int empty_statement_backend::get_number_of_rows()
......@@ -70,7 +70,7 @@ int empty_statement_backend::prepare_for_describe()
}
void empty_statement_backend::describe_column(int /* colNum */,
eDataType & /* type */, std::string & /* columnName */)
data_type & /* type */, std::string & /* columnName */)
{
// ...
}
......
......@@ -44,7 +44,7 @@ namespace soci
template<> struct type_conversion<Person>
{
typedef values base_type;
static void from_base(values & /* r */, eIndicator /* ind */,
static void from_base(values & /* r */, indicator /* ind */,
Person & /* p */)
{
}
......@@ -66,7 +66,7 @@ void test1()
sql << "insert", use(i);
sql << "select", into(i);
eIndicator ind = eOK;
indicator ind = i_ok;
sql << "insert", use(i, ind);
sql << "select", into(i, ind);
......@@ -74,7 +74,7 @@ void test1()
sql << "insert", use(numbers);
sql << "select", into(numbers);
std::vector<eIndicator> inds(100);
std::vector<indicator> inds(100);
sql << "insert", use(numbers, inds);
sql << "select", into(numbers, inds);
......
......@@ -17,7 +17,7 @@ using namespace soci::details;
void empty_vector_into_type_backend::define_by_pos(
int & /* position */, void * /* data */, eExchangeType /* type */)
int & /* position */, void * /* data */, exchange_type /* type */)
{
// ...
}
......@@ -28,7 +28,7 @@ void empty_vector_into_type_backend::pre_fetch()
}
void empty_vector_into_type_backend::post_fetch(
bool /* gotData */, eIndicator * /* ind */)
bool /* gotData */, indicator * /* ind */)
{
// ...
}
......
......@@ -17,19 +17,19 @@ using namespace soci::details;
void empty_vector_use_type_backend::bind_by_pos(int & /* position */,
void * /* data */, eExchangeType /* type */)
void * /* data */, exchange_type /* type */)
{
// ...
}
void empty_vector_use_type_backend::bind_by_name(
std::string const & /* name */, void * /* data */,
eExchangeType /* type */)
exchange_type /* type */)
{
// ...
}
void empty_vector_use_type_backend::pre_use(eIndicator const * /* ind */)
void empty_vector_use_type_backend::pre_use(indicator const * /* ind */)
{
// ...
}
......
......@@ -63,11 +63,11 @@ struct firebird_standard_into_type_backend : details::standard_into_type_backend
{}
virtual void define_by_pos(int &position,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void pre_fetch();
virtual void post_fetch(bool gotData, bool calledFromFetch,
eIndicator *ind);
indicator *ind);
virtual void clean_up();
......@@ -75,7 +75,7 @@ struct firebird_standard_into_type_backend : details::standard_into_type_backend
virtual void exchangeData();
void *data_;
details::eExchangeType type_;
details::exchange_type type_;
int position_;
char *buf_;
......@@ -89,10 +89,10 @@ struct firebird_vector_into_type_backend : details::vector_into_type_backend
{}
virtual void define_by_pos(int &position,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void pre_fetch();
virtual void post_fetch(bool gotData, eIndicator *ind);
virtual void post_fetch(bool gotData, indicator *ind);
virtual void resize(std::size_t sz);
virtual std::size_t size();
......@@ -103,7 +103,7 @@ struct firebird_vector_into_type_backend : details::vector_into_type_backend
virtual void exchangeData(std::size_t row);
void *data_;
details::eExchangeType type_;
details::exchange_type type_;
int position_;
char *buf_;
......@@ -117,12 +117,12 @@ struct firebird_standard_use_type_backend : details::standard_use_type_backend
{}
virtual void bind_by_pos(int &position,
void *data, details::eExchangeType type, bool readOnly);
void *data, details::exchange_type type, bool readOnly);
virtual void bind_by_name(std::string const &name,
void *data, details::eExchangeType type, bool readOnly);
void *data, details::exchange_type type, bool readOnly);
virtual void pre_use(eIndicator const *ind);
virtual void post_use(bool gotData, eIndicator *ind);
virtual void pre_use(indicator const *ind);
virtual void post_use(bool gotData, indicator *ind);
virtual void clean_up();
......@@ -130,7 +130,7 @@ struct firebird_standard_use_type_backend : details::standard_use_type_backend
virtual void exchangeData();
void *data_;
details::eExchangeType type_;
details::exchange_type type_;
int position_;
char *buf_;
......@@ -144,11 +144,11 @@ struct firebird_vector_use_type_backend : details::vector_use_type_backend
{}
virtual void bind_by_pos(int &position,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void bind_by_name(std::string const &name,
void *data, details::eExchangeType type);
void *data, details::exchange_type type);
virtual void pre_use(eIndicator const *ind);
virtual void pre_use(indicator const *ind);
virtual std::size_t size();
......@@ -158,9 +158,9 @@ struct firebird_vector_use_type_backend : details::vector_use_type_backend
virtual void exchangeData(std::size_t row);
void *data_;
details::eExchangeType type_;
details::exchange_type type_;
int position_;
eIndicator const *inds_;
indicator const *inds_;
char *buf_;
short indISCHolder_;
......@@ -174,17 +174,17 @@ struct firebird_statement_backend : details::statement_backend
virtual void alloc();
virtual void clean_up();
virtual void prepare(std::string const &query,
details::eStatementType eType);
details::statement_type eType);
virtual execFetchResult execute(int number);
virtual execFetchResult fetch(int number);
virtual exec_fetch_result execute(int number);
virtual exec_fetch_result fetch(int number);
virtual int get_number_of_rows();
virtual std::string rewrite_for_procedure_call(std::string const &query);
virtual int prepare_for_describe();
virtual void describe_column(int colNum, eDataType &dtype,
virtual void describe_column(int colNum, data_type &dtype,
std::string &columnName);
virtual firebird_standard_into_type_backend * make_into_type_backend();
......@@ -219,7 +219,7 @@ protected:
BuffersType intoType_;
BuffersType useType_;
std::vector<std::vector<eIndicator> > inds_;
std::vector<std::vector<indicator> > inds_;
std::vector<void*> intos_;
std::vector<void*> uses_;
......
......@@ -15,7 +15,7 @@ using namespace soci::details;
using namespace soci::details::firebird;
void firebird_standard_into_type_backend::define_by_pos(
int & position, void * data, eExchangeType type)
int & position, void * data, exchange_type type)
{
position_ = position-1;
data_ = data;
......@@ -39,7 +39,7 @@ void firebird_standard_into_type_backend::pre_fetch()
}
void firebird_standard_into_type_backend::post_fetch(
bool gotData, bool calledFromFetch, eIndicator * ind)
bool gotData, bool calledFromFetch, indicator * ind)
{
if (calledFromFetch && (gotData == false))
{
......@@ -50,7 +50,7 @@ void firebird_standard_into_type_backend::post_fetch(
if (gotData)
{
if (eNull == statement_.inds_[position_][0] && NULL == ind)
if (i_null == statement_.inds_[position_][0] && NULL == ind)
{
throw soci_error("Null value fetched and no indicator defined.");
}
......@@ -69,28 +69,28 @@ void firebird_standard_into_type_backend::exchangeData()
switch (type_)
{
// simple cases
case eXChar:
case x_char:
*reinterpret_cast<char*>(data_) = getTextParam(var)[0];
break;
case eXShort:
case x_short:
{
short t = from_isc<short>(var);
*reinterpret_cast<short*>(data_) = t;
}
break;
case eXUnsignedLong:
case x_unsigned_long:
{
unsigned long t = from_isc<unsigned long>(var);
*reinterpret_cast<unsigned long*>(data_) = t;
}
break;
case eXInteger:
case x_integer:
{
long long t = from_isc<long long>(var);
*reinterpret_cast<long long *>(data_) = t;
}
break;
case eXDouble:
case x_double:
{
double t = from_isc<double>(var);
*reinterpret_cast<double*>(data_) = t;
......@@ -98,7 +98,7 @@ void firebird_standard_into_type_backend::exchangeData()
break;
// cases that require adjustments and buffer management
case eXCString:
case x_cstring:
{
details::cstring_descriptor *tmp =
static_cast<details::cstring_descriptor*>(data_);
......@@ -109,20 +109,20 @@ void firebird_standard_into_type_backend::exchangeData()
if (stmp.size() >= tmp->bufSize_)
{
statement_.inds_[position_][0] = eTruncated;
statement_.inds_[position_][0] = i_truncated;
}
}
break;
case eXStdString:
case x_stdstring:
*(reinterpret_cast<std::string*>(data_)) = getTextParam(var);
break;
case eXStdTm:
case x_stdtm:
tmDecode(var->sqltype,
buf_, static_cast<std::tm*>(data_));
break;
// cases that require special handling
case eXBLOB:
case x_blob:
{
blob *tmp = reinterpret_cast<blob*>(data_);
......
......@@ -15,7 +15,7 @@ using namespace soci::details;
using namespace soci::details::firebird;
void firebird_standard_use_type_backend::bind_by_pos(
int & position, void * data, eExchangeType type, bool /* readOnly */)
int & position, void * data, exchange_type type, bool /* readOnly */)
{
if (statement_.boundByName_)
{
......@@ -43,7 +43,7 @@ void firebird_standard_use_type_backend::bind_by_pos(
void firebird_standard_use_type_backend::bind_by_name(
std::string const & name, void * data,
eExchangeType type, bool /* readOnly */)
exchange_type type, bool /* readOnly */)
{
if (statement_.boundByPos_)
{
......@@ -75,16 +75,16 @@ void firebird_standard_use_type_backend::bind_by_name(
statement_.boundByName_ = true;
}
void firebird_standard_use_type_backend::pre_use(eIndicator const * ind)
void firebird_standard_use_type_backend::pre_use(indicator const * ind)
{
if (ind)
{
switch (*ind)
{
case eNull:
case i_null:
indISCHolder_ = -1;
break;
case eOK:
case i_ok:
indISCHolder_ = 0;
break;
default:
......@@ -99,27 +99,27 @@ void firebird_standard_use_type_backend::exchangeData()
switch (type_)
{
case eXChar:
case x_char:
setTextParam(static_cast<char*>(data_), 1, buf_, var);
break;
case eXShort:
case x_short:
to_isc<short>(data_, var);
break;
case eXInteger:
case x_integer:
to_isc<int>(data_, var);
break;
case eXUnsignedLong:
case x_unsigned_long:
to_isc<unsigned long>(data_, var);
break;
case eXLongLong:
case x_long_long:
to_isc<long long>(data_, var);
break;
case eXDouble:
case x_double:
to_isc<double>(data_, var);
break;
// cases that require adjustments and buffer management
case eXCString:
case x_cstring:
{
details::cstring_descriptor *tmp
= static_cast<cstring_descriptor*>(data_);
......@@ -133,19 +133,19 @@ void firebird_standard_use_type_backend::exchangeData()
setTextParam(tmp->str_, tmp->bufSize_, buf_, var);
}
break;
case eXStdString:
case x_stdstring:
{
std::string *tmp = static_cast<std::string*>(data_);
setTextParam(tmp->c_str(), tmp->size(), buf_, var);
}
break;
case eXStdTm:
case x_stdtm:
tmEncode(var->sqltype,
static_cast<std::tm*>(data_), buf_);
break;
// cases that require special handling
case eXBLOB:
case x_blob:
{
blob *tmp = static_cast<blob*>(data_);
......@@ -167,7 +167,7 @@ void firebird_standard_use_type_backend::exchangeData()
}
void firebird_standard_use_type_backend::post_use(
bool /* gotData */, eIndicator * /* ind */)
bool /* gotData */, indicator * /* ind */)
{
// TODO: Is it possible to have the bound element being overwritten
// by the database?
......
......@@ -146,7 +146,7 @@ namespace
{
int statementType(isc_stmt_handle stmt)
{
int statement_type;
int stype;
int length;
char type_item[] = {isc_info_sql_stmt_type};
char res_buffer[8];
......@@ -162,14 +162,14 @@ namespace
if (res_buffer[0] == isc_info_sql_stmt_type)
{
length = isc_vax_integer(res_buffer+1, 2);
statement_type = isc_vax_integer(res_buffer+3, length);
stype = isc_vax_integer(res_buffer+3, length);
}
else
{
throw soci_error("Can't determine statement type.");
}
return statement_type;
return stype;
}
}
......@@ -284,7 +284,7 @@ void firebird_statement_backend::rewriteQuery(
}
void firebird_statement_backend::prepare(std::string const & query,
eStatementType /* eType */)
statement_type /* eType */)
{
// clear named parametes
names_.clear();
......@@ -366,7 +366,7 @@ namespace
}
}
statement_backend::execFetchResult
statement_backend::exec_fetch_result
firebird_statement_backend::execute(int number)
{
ISC_STATUS stat[stat_size];
......@@ -447,17 +447,17 @@ firebird_statement_backend::execute(int number)
else
{
// execute(0) was meant to only perform the query
return eSuccess;
return ef_success;
}
}
else
{
// query can't return any data
return eNoData;
return ef_no_data;
}
}
statement_backend::execFetchResult
statement_backend::exec_fetch_result
firebird_statement_backend::fetch(int number)
{
ISC_STATUS stat[stat_size];
......@@ -483,17 +483,17 @@ firebird_statement_backend::fetch(int number)
}
else if (fetch_stat == 100L)
{
return eNoData;
return ef_no_data;
}
else
{
// error
throw_iscerror(stat);
return eNoData; // unreachable, for compiler only
return ef_no_data; // unreachable, for compiler only
}
} // for
return eSuccess;
return ef_success;
}
// here we put data fetched from database into user buffers
......@@ -507,15 +507,15 @@ void firebird_statement_backend::exchangeData(bool gotData, int row)
if (((sqldap_->sqlvar+i)->sqltype & 1) == 0)
{
// there is no indicator for this column
inds_[i][row] = eOK;
inds_[i][row] = i_ok;
}
else if (*((sqldap_->sqlvar+i)->sqlind) == 0)
{
inds_[i][row] = eOK;
inds_[i][row] = i_ok;
}
else if (*((sqldap_->sqlvar+i)->sqlind) == -1)
{
inds_[i][row] = eNull;
inds_[i][row] = i_null;
}
else
{
......@@ -523,7 +523,7 @@ void firebird_statement_backend::exchangeData(bool gotData, int row)
}
// then deal with data
if (inds_[i][row] != eNull)
if (inds_[i][row] != i_null)
{
if (intoType_ == eVector)
{
......@@ -558,7 +558,7 @@ int firebird_statement_backend::prepare_for_describe()
}
void firebird_statement_backend::describe_column(int colNum,
eDataType & type, std::string & columnName)
data_type & type, std::string & columnName)
{
XSQLVAR * var = sqldap_->sqlvar+(colNum-1);
......@@ -568,36 +568,36 @@ void firebird_statement_backend::describe_column(int colNum,
{
case SQL_TEXT:
case SQL_VARYING:
type = eString;
type = dt_string;
break;
case SQL_TYPE_DATE:
case SQL_TYPE_TIME:
case SQL_TIMESTAMP:
type = eDate;
type = dt_date;
break;
case SQL_FLOAT:
case SQL_DOUBLE:
type = eDouble;
type = dt_double;
break;
case SQL_SHORT:
case SQL_LONG:
if (var->sqlscale < 0)
{
type = eDouble;
type = dt_double;
}
else
{
type = eInteger;
type = dt_integer;