Commit 69586acd authored by msobczak's avatar msobczak

Name fixes.

parent c0e93b36
...@@ -1069,50 +1069,50 @@ void test11() ...@@ -1069,50 +1069,50 @@ void test11()
// Support for soci Common Tests // Support for soci Common Tests
// //
struct TableCreator1 : public tests::table_creator_base struct table_creator_1 : public tests::table_creator_base
{ {
TableCreator1(session& session) table_creator_1(session & sql)
: tests::table_creator_base(session) : tests::table_creator_base(sql)
{ {
session << "create table soci_test(id integer, val integer, c char, " sql << "create table soci_test(id integer, val integer, c char, "
"str varchar(20), sh smallint, ul decimal(9,0), d double precision, " "str varchar(20), sh smallint, ul decimal(9,0), d double precision, "
"tm timestamp, i1 integer, i2 integer, i3 integer, name varchar(20))"; "tm timestamp, i1 integer, i2 integer, i3 integer, name varchar(20))";
session.commit(); sql.commit();
session.begin(); sql.begin();
} }
}; };
struct TableCreator2 : public tests::table_creator_base struct table_creator_2 : public tests::table_creator_base
{ {
TableCreator2(session& session) table_creator_2(session & sql)
: tests::table_creator_base(session) : tests::table_creator_base(sql)
{ {
session << "create table soci_test(\"num_float\" float, \"num_int\" integer, " sql << "create table soci_test(\"num_float\" float, \"num_int\" integer, "
"\"name\" varchar(20), \"sometime\" timestamp, \"chr\" char)"; "\"name\" varchar(20), \"sometime\" timestamp, \"chr\" char)";
session.commit(); sql.commit();
session.begin(); sql.begin();
} }
}; };
struct TableCreator3 : public tests::table_creator_base struct table_creator_3 : public tests::table_creator_base
{ {
TableCreator3(session& session) table_creator_3(session & sql)
: tests::table_creator_base(session) : tests::table_creator_base(sql)
{ {
// CommonTest uses lower-case column names, // CommonTest uses lower-case column names,
// so we need to enforce such names here. // so we need to enforce such names here.
// That's why column names are enclosed in "" // That's why column names are enclosed in ""
session << "create table soci_test(\"name\" varchar(100) not null, " sql << "create table soci_test(\"name\" varchar(100) not null, "
"\"phone\" varchar(15))"; "\"phone\" varchar(15))";
session.commit(); sql.commit();
session.begin(); sql.begin();
} }
}; };
class TestContext : public tests::test_context_base class test_context : public tests::test_context_base
{ {
public: public:
TestContext(backend_factory const &backEnd, test_context(backend_factory const &backEnd,
std::string const &connectString) std::string const &connectString)
: test_context_base(backEnd, connectString) : test_context_base(backEnd, connectString)
{} {}
...@@ -1169,7 +1169,7 @@ int main(int argc, char** argv) ...@@ -1169,7 +1169,7 @@ int main(int argc, char** argv)
try try
{ {
TestContext tc(backEnd, connectString); test_context tc(backEnd, connectString);
tests::common_tests tests(tc); tests::common_tests tests(tc);
tests.run(); tests.run();
......
...@@ -259,6 +259,6 @@ SOCI_MYSQL_DECL backend_factory const * factory_mysql(); ...@@ -259,6 +259,6 @@ SOCI_MYSQL_DECL backend_factory const * factory_mysql();
} // extern "C" } // extern "C"
} // namespace SOCI } // namespace soci
#endif // SOCI_MYSQL_H_INCLUDED #endif // SOCI_MYSQL_H_INCLUDED
...@@ -419,10 +419,10 @@ void test6() ...@@ -419,10 +419,10 @@ void test6()
// DDL Creation objects for common tests // DDL Creation objects for common tests
struct table_creator_one : public table_creator_base struct table_creator_one : public table_creator_base
{ {
table_creator_one(session& session) table_creator_one(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << "create table soci_test(id integer, val integer, c char, " sql << "create table soci_test(id integer, val integer, c char, "
"str varchar(20), sh int2, ul numeric(20), d float8, " "str varchar(20), sh int2, ul numeric(20), d float8, "
"tm datetime, i1 integer, i2 integer, i3 integer, " "tm datetime, i1 integer, i2 integer, i3 integer, "
"name varchar(20)) type=InnoDB"; "name varchar(20)) type=InnoDB";
...@@ -431,20 +431,20 @@ struct table_creator_one : public table_creator_base ...@@ -431,20 +431,20 @@ struct table_creator_one : public table_creator_base
struct table_creator_two : public table_creator_base struct table_creator_two : public table_creator_base
{ {
table_creator_two(session& session) table_creator_two(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << "create table soci_test(num_float float8, num_int integer," sql << "create table soci_test(num_float float8, num_int integer,"
" name varchar(20), sometime datetime, chr char)"; " name varchar(20), sometime datetime, chr char)";
} }
}; };
struct table_creator_three : public table_creator_base struct table_creator_three : public table_creator_base
{ {
table_creator_three(session& session) table_creator_three(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << "create table soci_test(name varchar(100) not null, " sql << "create table soci_test(name varchar(100) not null, "
"phone varchar(15))"; "phone varchar(15))";
} }
}; };
......
...@@ -310,6 +310,6 @@ SOCI_ODBC_DECL backend_factory const * factory_odbc(); ...@@ -310,6 +310,6 @@ SOCI_ODBC_DECL backend_factory const * factory_odbc();
} // extern "C" } // extern "C"
} // namespace SOCI } // namespace soci
#endif // SOCI_EMPTY_H_INCLUDED #endif // SOCI_EMPTY_H_INCLUDED
...@@ -30,14 +30,6 @@ void odbc_standard_into_type_backend::define_by_pos( ...@@ -30,14 +30,6 @@ void odbc_standard_into_type_backend::define_by_pos(
buf_ = new char[size]; buf_ = new char[size];
data = buf_; data = buf_;
break; break;
case x_cstring:
{
details::cstring_descriptor *desc = static_cast<cstring_descriptor *>(data);
odbcType_ = SQL_C_CHAR;
data = desc->str_;
size = static_cast<SQLINTEGER>(desc->bufSize_);
}
break;
case x_stdstring: case x_stdstring:
odbcType_ = SQL_C_CHAR; odbcType_ = SQL_C_CHAR;
size = 32769; size = 32769;
...@@ -128,18 +120,6 @@ void odbc_standard_into_type_backend::post_fetch( ...@@ -128,18 +120,6 @@ void odbc_standard_into_type_backend::post_fetch(
char *c = static_cast<char*>(data_); char *c = static_cast<char*>(data_);
*c = buf_[0]; *c = buf_[0];
} }
if (type_ == x_cstring)
{
if (ind != NULL)
{
details::cstring_descriptor *desc = static_cast<cstring_descriptor *>(data_);
int size = static_cast<SQLINTEGER>(desc->bufSize_);
if (size < valueLen_)
{
*ind = i_truncated;
}
}
}
if (type_ == x_stdstring) if (type_ == x_stdstring)
{ {
std::string *s = static_cast<std::string *>(data_); std::string *s = static_cast<std::string *>(data_);
......
...@@ -50,16 +50,6 @@ void odbc_standard_use_type_backend::prepare_for_bind( ...@@ -50,16 +50,6 @@ void odbc_standard_use_type_backend::prepare_for_bind(
data = buf_; data = buf_;
indHolder_ = SQL_NTS; indHolder_ = SQL_NTS;
break; break;
case x_cstring:
{
details::cstring_descriptor *desc = static_cast<cstring_descriptor *>(data);
sqlType = SQL_VARCHAR;
cType = SQL_C_CHAR;
data = desc->str_;
size = static_cast<SQLUINTEGER>(desc->bufSize_);
indHolder_ = SQL_NTS;
}
break;
case x_stdstring: case x_stdstring:
{ {
// TODO: No textual value is assigned here! // TODO: No textual value is assigned here!
......
...@@ -14,42 +14,42 @@ ...@@ -14,42 +14,42 @@
#include <ctime> #include <ctime>
#include <cmath> #include <cmath>
using namespace SOCI; using namespace soci;
using namespace SOCI::tests; using namespace soci::tests;
std::string connectString; std::string connectString;
BackEndFactory const &backEnd = odbc; backend_factory const &backEnd = odbc;
// DDL Creation objects for common tests // DDL Creation objects for common tests
struct TableCreator1 : public TableCreatorBase struct table_creator_1 : public table_creator_base
{ {
TableCreator1(Session& session) table_creator_1(session & sql)
: TableCreatorBase(session) : table_creator_base(sql)
{ {
session << "create table soci_test(id integer, val integer, c char, " sql << "create table soci_test(id integer, val integer, c char, "
"str varchar(20), sh integer, ul number, d float, " "str varchar(20), sh integer, ul number, d float, "
"tm timestamp, i1 integer, i2 integer, i3 integer, " "tm timestamp, i1 integer, i2 integer, i3 integer, "
"name varchar(20))"; "name varchar(20))";
} }
}; };
struct TableCreator2 : public TableCreatorBase struct table_creator_2 : public table_creator_base
{ {
TableCreator2(Session& session) table_creator_2(session & sql)
: TableCreatorBase(session) : table_creator_base(sql)
{ {
session << "create table soci_test(num_float float, num_int integer," sql << "create table soci_test(num_float float, num_int integer,"
" name varchar(20), sometime datetime, chr char)"; " name varchar(20), sometime datetime, chr char)";
} }
}; };
struct TableCreator3 : public TableCreatorBase struct table_creator_3 : public table_creator_base
{ {
TableCreator3(Session& session) table_creator_3(session & sql)
: TableCreatorBase(session) : table_creator_base(sql)
{ {
session << "create table soci_test(name varchar(100) not null, " sql << "create table soci_test(name varchar(100) not null, "
"phone varchar(15))"; "phone varchar(15))";
} }
}; };
...@@ -58,26 +58,26 @@ struct TableCreator3 : public TableCreatorBase ...@@ -58,26 +58,26 @@ struct TableCreator3 : public TableCreatorBase
// Support for SOCI Common Tests // Support for SOCI Common Tests
// //
class TestContext : public TestContextBase class test_context : public test_context_base
{ {
public: public:
TestContext(BackEndFactory const &backEnd, test_context(backend_factory const &backEnd,
std::string const &connectString) std::string const &connectString)
: TestContextBase(backEnd, connectString) {} : test_context_base(backEnd, connectString) {}
TableCreatorBase* tableCreator1(Session& s) const table_creator_base * table_creator_1(session& s) const
{ {
return new TableCreator1(s); return new table_creator_1(s);
} }
TableCreatorBase* tableCreator2(Session& s) const table_creator_base * table_creator_2(session& s) const
{ {
return new TableCreator2(s); return new table_creator_2(s);
} }
TableCreatorBase* tableCreator3(Session& s) const table_creator_base * table_creator_3(session& s) const
{ {
return new TableCreator3(s); return new table_creator_3(s);
} }
std::string fromDual (std::string const &sql) const std::string fromDual (std::string const &sql) const
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
return "#" + datdt_string + "#"; return "#" + datdt_string + "#";
} }
std::string toDateTime(std::string const &datdt_string) const std::string to_date_time(std::string const &datdt_string) const
{ {
return "#" + datdt_string + "#"; return "#" + datdt_string + "#";
} }
...@@ -118,16 +118,16 @@ int main(int argc, char** argv) ...@@ -118,16 +118,16 @@ int main(int argc, char** argv)
} }
try try
{ {
TestContext tc(backEnd, connectString); test_context tc(backEnd, connectString);
CommonTests tests(tc); common_tests tests(tc);
tests.run(); tests.run();
} }
catch (SOCI::ODBCSOCIError const & e) catch (soci::odbc_soci_error const & e)
{ {
std::cout << "ODBC Error Code: " << e.odbcErrorCode() << std::endl std::cout << "ODBC Error Code: " << e.odbc_error_code() << std::endl
<< "Native Error Code: " << e.nativeErrorCode() << std::endl << "Native Error Code: " << e.native_error_code() << std::endl
<< "SOCI Message: " << e.what() << std::endl << "SOCI Message: " << e.what() << std::endl
<< "ODBC Message: " << e.odbcErrorMessage() << std::endl; << "ODBC Message: " << e.odbc_error_message() << std::endl;
} }
catch (std::exception const & e) catch (std::exception const & e)
{ {
......
...@@ -22,34 +22,34 @@ backend_factory const &backEnd = odbc; ...@@ -22,34 +22,34 @@ backend_factory const &backEnd = odbc;
// DDL Creation objects for common tests // DDL Creation objects for common tests
struct TableCreator1 : public table_creator_base struct table_creator_one : public table_creator_base
{ {
TableCreator1(session& session) table_creator_one(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << "create table soci_test(id integer, val integer, c char, " sql << "create table soci_test(id integer, val integer, c char, "
"str varchar(20), sh smallint, ul numeric(20), d float, " "str varchar(20), sh smallint, ul numeric(20), d float, "
"tm datetime, i1 integer, i2 integer, i3 integer, " "tm datetime, i1 integer, i2 integer, i3 integer, "
"name varchar(20))"; "name varchar(20))";
} }
}; };
struct TableCreator2 : public table_creator_base struct table_creator_two : public table_creator_base
{ {
TableCreator2(session& session) table_creator_two(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << "create table soci_test(num_float float, num_int integer," sql << "create table soci_test(num_float float, num_int integer,"
" name varchar(20), sometime datetime, chr char)"; " name varchar(20), sometime datetime, chr char)";
} }
}; };
struct TableCreator3 : public table_creator_base struct table_creator_three : public table_creator_base
{ {
TableCreator3(session& session) table_creator_three(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << "create table soci_test(name varchar(100) not null, " sql << "create table soci_test(name varchar(100) not null, "
"phone varchar(15))"; "phone varchar(15))";
} }
}; };
...@@ -58,26 +58,26 @@ struct TableCreator3 : public table_creator_base ...@@ -58,26 +58,26 @@ struct TableCreator3 : public table_creator_base
// Support for SOCI Common Tests // Support for SOCI Common Tests
// //
class TestContext : public test_context_base class test_context : public test_context_base
{ {
public: public:
TestContext(backend_factory const &backEnd, test_context(backend_factory const &backEnd,
std::string const &connectString) std::string const &connectString)
: test_context_base(backEnd, connectString) {} : test_context_base(backEnd, connectString) {}
table_creator_base* table_creator_1(session& s) const table_creator_base* table_creator_1(session& s) const
{ {
return new TableCreator1(s); return new table_creator_one(s);
} }
table_creator_base* table_creator_2(session& s) const table_creator_base* table_creator_2(session& s) const
{ {
return new TableCreator2(s); return new table_creator_two(s);
} }
table_creator_base* table_creator_3(session& s) const table_creator_base* table_creator_3(session& s) const
{ {
return new TableCreator3(s); return new table_creator_three(s);
} }
std::string to_date_time(std::string const &datdt_string) const std::string to_date_time(std::string const &datdt_string) const
...@@ -108,7 +108,7 @@ int main(int argc, char** argv) ...@@ -108,7 +108,7 @@ int main(int argc, char** argv)
} }
try try
{ {
TestContext tc(backEnd, connectString); test_context tc(backEnd, connectString);
common_tests tests(tc); common_tests tests(tc);
tests.run(); tests.run();
std::cout << "\nOK, all tests passed.\n"; std::cout << "\nOK, all tests passed.\n";
......
...@@ -112,7 +112,7 @@ int main(int argc, char** argv) ...@@ -112,7 +112,7 @@ int main(int argc, char** argv)
common_tests tests(tc); common_tests tests(tc);
tests.run(); tests.run();
} }
catch (SOCI::odbc_soci_error const & e) catch (soci::odbc_soci_error const & e)
{ {
std::cout << "ODBC Error Code: " << e.odbc_error_code() << std::endl std::cout << "ODBC Error Code: " << e.odbc_error_code() << std::endl
<< "Native Error Code: " << e.native_error_code() << std::endl << "Native Error Code: " << e.native_error_code() << std::endl
......
...@@ -113,7 +113,7 @@ int main(int argc, char** argv) ...@@ -113,7 +113,7 @@ int main(int argc, char** argv)
common_tests tests(tc); common_tests tests(tc);
tests.run(); tests.run();
} }
catch (SOCI::odbc_soci_error const & e) catch (soci::odbc_soci_error const & e)
{ {
std::cout << "ODBC Error Code: " << e.odbc_error_code() << std::endl std::cout << "ODBC Error Code: " << e.odbc_error_code() << std::endl
<< "Native Error Code: " << e.native_error_code() << std::endl << "Native Error Code: " << e.native_error_code() << std::endl
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "soci-backend.h" #include "soci-backend.h"
#include <sstream> #include <sstream>
namespace SOCI namespace soci
{ {
inline void throw_odbc_error(SQLSMALLINT htype, SQLHANDLE hndl, char const * msg) inline void throw_odbc_error(SQLSMALLINT htype, SQLHANDLE hndl, char const * msg)
......
...@@ -133,9 +133,6 @@ void odbc_vector_into_type_backend::define_by_pos( ...@@ -133,9 +133,6 @@ void odbc_vector_into_type_backend::define_by_pos(
} }
break; break;
case x_cstring: break; // not supported
// (there is no specialization
// of IntoType<vector<char*> >)
case x_statement: break; // not supported case x_statement: break; // not supported
case x_rowid: break; // not supported case x_rowid: break; // not supported
case x_blob: break; // not supported case x_blob: break; // not supported
...@@ -312,7 +309,6 @@ void odbc_vector_into_type_backend::resize(std::size_t sz) ...@@ -312,7 +309,6 @@ void odbc_vector_into_type_backend::resize(std::size_t sz)
} }
break; break;
case x_cstring: break; // not supported
case x_statement: break; // not supported case x_statement: break; // not supported
case x_rowid: break; // not supported case x_rowid: break; // not supported
case x_blob: break; // not supported case x_blob: break; // not supported
...@@ -372,7 +368,6 @@ std::size_t odbc_vector_into_type_backend::size() ...@@ -372,7 +368,6 @@ std::size_t odbc_vector_into_type_backend::size()
} }
break; break;
case x_cstring: break; // not supported
case x_statement: break; // not supported case x_statement: break; // not supported
case x_rowid: break; // not supported case x_rowid: break; // not supported
case x_blob: break; // not supported case x_blob: break; // not supported
......
...@@ -165,7 +165,6 @@ void odbc_vector_use_type_backend::prepare_for_bind(void *&data, SQLUINTEGER &si ...@@ -165,7 +165,6 @@ void odbc_vector_use_type_backend::prepare_for_bind(void *&data, SQLUINTEGER &si
case x_statement: break; // not supported case x_statement: break; // not supported
case x_rowid: break; // not supported case x_rowid: break; // not supported
case x_blob: break; // not supported case x_blob: break; // not supported
case x_cstring: break; // not supported
} }
colSize_ = size; colSize_ = size;
...@@ -366,7 +365,6 @@ std::size_t odbc_vector_use_type_backend::size() ...@@ -366,7 +365,6 @@ std::size_t odbc_vector_use_type_backend::size()
case x_statement: break; // not supported case x_statement: break; // not supported
case x_rowid: break; // not supported case x_rowid: break; // not supported
case x_blob: break; // not supported case x_blob: break; // not supported
case x_cstring: break; // not supported
} }
return sz; return sz;
......
...@@ -152,7 +152,7 @@ oracle_session_backend::~oracle_session_backend() ...@@ -152,7 +152,7 @@ oracle_session_backend::~oracle_session_backend()
void oracle_session_backend::begin() void oracle_session_backend::begin()
{ {
// This code is commented out because it causes one of the transaction // This code is commented out because it causes one of the transaction
// tests in CommonTests::test10() to fail with error 'Invalid handle' // tests in common_tests::test10() to fail with error 'Invalid handle'
// With the code commented out, all tests pass. // With the code commented out, all tests pass.
// sword res = OCITransStart(svchp_, errhp_, 0, OCI_TRANS_NEW); // sword res = OCITransStart(svchp_, errhp_, 0, OCI_TRANS_NEW);
// if (res != OCI_SUCCESS) // if (res != OCI_SUCCESS)
......
...@@ -92,10 +92,10 @@ void test2() ...@@ -92,10 +92,10 @@ void test2()
struct blob_table_creator : public table_creator_base struct blob_table_creator : public table_creator_base
{ {
blob_table_creator(session& session) blob_table_creator(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << sql <<
"create table soci_test (" "create table soci_test ("
" id number(10) not null," " id number(10) not null,"
" img blob" " img blob"
...@@ -157,10 +157,10 @@ void test3() ...@@ -157,10 +157,10 @@ void test3()
struct basic_table_creator : public table_creator_base struct basic_table_creator : public table_creator_base
{ {
basic_table_creator(session& session) basic_table_creator(session & sql)
: table_creator_base(session) : table_creator_base(sql)
{ {
session << sql <<
"create table soci_test (" "create table soci_test ("
" id number(5) not null," " id number(5) not null,"
" name varchar2(100)," " name varchar2(100),"
...@@ -232,10 +232,10 @@ void test5() ...@@ -232,10 +232,10 @@ void test5()
// Stored procedures // Stored procedures
struct procedure_creator : procedure_creator_base struct procedure_creator : procedure_creator_base
{ {
procedure_creator(session& session) procedure_creator(session & sql)
: procedure_creator_base(session) : procedure_creator_base(sql)
{ {
session << sql <<
"create or replace procedure soci_test(output out varchar2," "create or replace procedure soci_test(output out varchar2,"
"input in varchar2) as "