Commit 94ff8e83 authored by Davis King's avatar Davis King

Just removed the sqlite namespace and unindended everything.

parent 8d1cf196
...@@ -11,21 +11,19 @@ ...@@ -11,21 +11,19 @@
#include <sqlite3.h> #include <sqlite3.h>
#include "../smart_pointers.h" #include "../smart_pointers.h"
// ---------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
namespace dlib namespace dlib
{ {
namespace sqlite
{
// ------------------------------------------------------------------------------------ // --------------------------------------------------------------------------------------------
struct sqlite_error : public error struct sqlite_error : public error
{ {
sqlite_error(const std::string& message): error(message) {} sqlite_error(const std::string& message): error(message) {}
}; };
// ------------------------------------------------------------------------------------ // --------------------------------------------------------------------------------------------
namespace impl namespace impl
{ {
...@@ -40,7 +38,7 @@ namespace dlib ...@@ -40,7 +38,7 @@ namespace dlib
}; };
} }
// ------------------------------------------------------------------------------------ // --------------------------------------------------------------------------------------------
class database : noncopyable class database : noncopyable
{ {
...@@ -82,7 +80,7 @@ namespace dlib ...@@ -82,7 +80,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(is_open() == true, DLIB_ASSERT(is_open() == true,
"\t std::string sqlite::database::get_database_filename()" "\t std::string database::get_database_filename()"
<< "\n\t The database must be opened before calling this routine." << "\n\t The database must be opened before calling this routine."
<< "\n\t this: " << this << "\n\t this: " << this
); );
...@@ -102,7 +100,7 @@ namespace dlib ...@@ -102,7 +100,7 @@ namespace dlib
shared_ptr<sqlite3> db; shared_ptr<sqlite3> db;
}; };
// ------------------------------------------------------------------------------------ // --------------------------------------------------------------------------------------------
class statement : noncopyable class statement : noncopyable
{ {
...@@ -120,7 +118,7 @@ namespace dlib ...@@ -120,7 +118,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(db_.is_open() == true, DLIB_ASSERT(db_.is_open() == true,
"\t sqlite::statement::statement()" "\t statement::statement()"
<< "\n\t The database must be opened before calling this routine." << "\n\t The database must be opened before calling this routine."
<< "\n\t this: " << this << "\n\t this: " << this
); );
...@@ -160,9 +158,9 @@ namespace dlib ...@@ -160,9 +158,9 @@ namespace dlib
if (step_status == SQLITE_ERROR) if (step_status == SQLITE_ERROR)
throw sqlite_error(sqlite3_errmsg(db.get())); throw sqlite_error(sqlite3_errmsg(db.get()));
else if (step_status == SQLITE_BUSY) else if (step_status == SQLITE_BUSY)
throw sqlite_error("sqlite::statement::exec() failed. SQLITE_BUSY returned"); throw sqlite_error("statement::exec() failed. SQLITE_BUSY returned");
else else
throw sqlite_error("sqlite::statement::exec() failed."); throw sqlite_error("statement::exec() failed.");
} }
} }
...@@ -225,7 +223,7 @@ namespace dlib ...@@ -225,7 +223,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t std::vector<char> sqlite::statement::get_column_as_blob()" "\t std::vector<char> statement::get_column_as_blob()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -245,7 +243,7 @@ namespace dlib ...@@ -245,7 +243,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t void sqlite::statement::get_column_as_object()" "\t void statement::get_column_as_object()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -263,7 +261,7 @@ namespace dlib ...@@ -263,7 +261,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t std::string sqlite::statement::get_column_as_text()" "\t std::string statement::get_column_as_text()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -279,7 +277,7 @@ namespace dlib ...@@ -279,7 +277,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t double sqlite::statement::get_column_as_double()" "\t double statement::get_column_as_double()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -294,7 +292,7 @@ namespace dlib ...@@ -294,7 +292,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t int sqlite::statement::get_column_as_int()" "\t int statement::get_column_as_int()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -309,7 +307,7 @@ namespace dlib ...@@ -309,7 +307,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t int64 sqlite::statement::get_column_as_int64()" "\t int64 statement::get_column_as_int64()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -324,7 +322,7 @@ namespace dlib ...@@ -324,7 +322,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(idx < get_num_columns(), DLIB_ASSERT(idx < get_num_columns(),
"\t std::string sqlite::statement::get_column_name()" "\t std::string statement::get_column_name()"
<< "\n\t Invalid column index." << "\n\t Invalid column index."
<< "\n\t idx: " << idx << "\n\t idx: " << idx
<< "\n\t this: " << this << "\n\t this: " << this
...@@ -353,7 +351,7 @@ namespace dlib ...@@ -353,7 +351,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_blob()" "\t void statement::bind_blob()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -377,7 +375,7 @@ namespace dlib ...@@ -377,7 +375,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_object()" "\t void statement::bind_object()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -403,7 +401,7 @@ namespace dlib ...@@ -403,7 +401,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_double()" "\t void statement::bind_double()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -426,7 +424,7 @@ namespace dlib ...@@ -426,7 +424,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_int()" "\t void statement::bind_int()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -449,7 +447,7 @@ namespace dlib ...@@ -449,7 +447,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_int64()" "\t void statement::bind_int64()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -471,7 +469,7 @@ namespace dlib ...@@ -471,7 +469,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_null()" "\t void statement::bind_null()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -494,7 +492,7 @@ namespace dlib ...@@ -494,7 +492,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(), DLIB_ASSERT(1 <= parameter_id && parameter_id <= get_max_parameter_id(),
"\t void sqlite::statement::bind_text()" "\t void statement::bind_text()"
<< "\n\t Invalid parameter id." << "\n\t Invalid parameter id."
<< "\n\t parameter_id: " << parameter_id << "\n\t parameter_id: " << parameter_id
<< "\n\t get_max_parameter_id(): " << get_max_parameter_id() << "\n\t get_max_parameter_id(): " << get_max_parameter_id()
...@@ -536,7 +534,7 @@ namespace dlib ...@@ -536,7 +534,7 @@ namespace dlib
std::string sql_string; std::string sql_string;
}; };
// ------------------------------------------------------------------------------------ // --------------------------------------------------------------------------------------------
void database:: void database::
exec ( exec (
...@@ -545,7 +543,7 @@ namespace dlib ...@@ -545,7 +543,7 @@ namespace dlib
{ {
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(is_open() == true, DLIB_ASSERT(is_open() == true,
"\t void sqlite::database::exec()" "\t void database::exec()"
<< "\n\t The database must be opened before calling this routine." << "\n\t The database must be opened before calling this routine."
<< "\n\t this: " << this << "\n\t this: " << this
); );
...@@ -553,9 +551,8 @@ namespace dlib ...@@ -553,9 +551,8 @@ namespace dlib
statement(*this, sql_statement).exec(); statement(*this, sql_statement).exec();
} }
// ------------------------------------------------------------------------------------ // --------------------------------------------------------------------------------------------
}
} }
#endif // DLIB_SQLiTE_H_ #endif // DLIB_SQLiTE_H_
......
...@@ -14,10 +14,8 @@ ...@@ -14,10 +14,8 @@
namespace dlib namespace dlib
{ {
namespace sqlite
{
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
struct sqlite_error : public error struct sqlite_error : public error
{ {
...@@ -29,7 +27,7 @@ namespace dlib ...@@ -29,7 +27,7 @@ namespace dlib
!*/ !*/
}; };
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
class database : noncopyable class database : noncopyable
{ {
...@@ -121,7 +119,7 @@ namespace dlib ...@@ -121,7 +119,7 @@ namespace dlib
}; };
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
class statement : noncopyable class statement : noncopyable
{ {
...@@ -435,9 +433,8 @@ namespace dlib ...@@ -435,9 +433,8 @@ namespace dlib
}; };
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
}
} }
#endif // DLIB_SQLiTE_ABSTRACT_H_ #endif // DLIB_SQLiTE_ABSTRACT_H_
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
namespace dlib namespace dlib
{ {
namespace sqlite
{
class transaction : noncopyable class transaction : noncopyable
{ {
...@@ -47,7 +45,7 @@ namespace dlib ...@@ -47,7 +45,7 @@ namespace dlib
}; };
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
template < template <
...@@ -73,7 +71,7 @@ namespace dlib ...@@ -73,7 +71,7 @@ namespace dlib
} }
} }
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
inline std::string query_text ( inline std::string query_text (
database& db, database& db,
...@@ -95,7 +93,7 @@ namespace dlib ...@@ -95,7 +93,7 @@ namespace dlib
} }
} }
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
inline double query_double ( inline double query_double (
database& db, database& db,
...@@ -117,7 +115,7 @@ namespace dlib ...@@ -117,7 +115,7 @@ namespace dlib
} }
} }
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
inline int query_int ( inline int query_int (
database& db, database& db,
...@@ -139,7 +137,7 @@ namespace dlib ...@@ -139,7 +137,7 @@ namespace dlib
} }
} }
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
inline int64 query_int64 ( inline int64 query_int64 (
database& db, database& db,
...@@ -161,7 +159,7 @@ namespace dlib ...@@ -161,7 +159,7 @@ namespace dlib
} }
} }
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
inline const std::vector<char> query_blob ( inline const std::vector<char> query_blob (
database& db, database& db,
...@@ -183,9 +181,8 @@ namespace dlib ...@@ -183,9 +181,8 @@ namespace dlib
} }
} }
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
}
} }
#endif // DLIB_SQLiTE_TOOLS_H_ #endif // DLIB_SQLiTE_TOOLS_H_
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
namespace dlib namespace dlib
{ {
namespace sqlite
{
class transaction : noncopyable class transaction : noncopyable
{ {
...@@ -56,7 +54,7 @@ namespace dlib ...@@ -56,7 +54,7 @@ namespace dlib
}; };
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
template < template <
typename T typename T
...@@ -77,7 +75,7 @@ namespace dlib ...@@ -77,7 +75,7 @@ namespace dlib
!*/ !*/
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
std::string query_text ( std::string query_text (
database& db, database& db,
...@@ -93,7 +91,7 @@ namespace dlib ...@@ -93,7 +91,7 @@ namespace dlib
succeeding. succeeding.
!*/ !*/
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
double query_double ( double query_double (
database& db, database& db,
...@@ -109,7 +107,7 @@ namespace dlib ...@@ -109,7 +107,7 @@ namespace dlib
succeeding. succeeding.
!*/ !*/
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
int query_int ( int query_int (
database& db, database& db,
...@@ -125,7 +123,7 @@ namespace dlib ...@@ -125,7 +123,7 @@ namespace dlib
succeeding. succeeding.
!*/ !*/
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
int64 query_int64 ( int64 query_int64 (
database& db, database& db,
...@@ -141,7 +139,7 @@ namespace dlib ...@@ -141,7 +139,7 @@ namespace dlib
succeeding. succeeding.
!*/ !*/
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
const std::vector<char> query_blob ( const std::vector<char> query_blob (
database& db, database& db,
...@@ -157,9 +155,8 @@ namespace dlib ...@@ -157,9 +155,8 @@ namespace dlib
succeeding. succeeding.
!*/ !*/
// ------------------------------------------------------------------------------------ // ----------------------------------------------------------------------------------------
}
} }
#endif // DLIB_SQLiTE_TOOLS_H_ #endif // DLIB_SQLiTE_TOOLS_H_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment