| connection.hxx | | connection.hxx | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| // copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC | | // copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC | |
| // license : GNU GPL v2; see accompanying LICENSE file | | // license : GNU GPL v2; see accompanying LICENSE file | |
| | | | |
| #ifndef ODB_SQLITE_CONNECTION_HXX | | #ifndef ODB_SQLITE_CONNECTION_HXX | |
| #define ODB_SQLITE_CONNECTION_HXX | | #define ODB_SQLITE_CONNECTION_HXX | |
| | | | |
| #include <odb/pre.hxx> | | #include <odb/pre.hxx> | |
| | | | |
| #include <sqlite3.h> | | #include <sqlite3.h> | |
| | | | |
|
| #include <memory> // std::auto_ptr | | | |
| | | | |
| #include <odb/forward.hxx> | | #include <odb/forward.hxx> | |
| #include <odb/connection.hxx> | | #include <odb/connection.hxx> | |
|
| | | | |
| #include <odb/details/mutex.hxx> | | #include <odb/details/mutex.hxx> | |
| #include <odb/details/condition.hxx> | | #include <odb/details/condition.hxx> | |
| #include <odb/details/shared-ptr.hxx> | | #include <odb/details/shared-ptr.hxx> | |
|
| | | #include <odb/details/unique-ptr.hxx> | |
| | | | |
| #include <odb/sqlite/version.hxx> | | #include <odb/sqlite/version.hxx> | |
| #include <odb/sqlite/forward.hxx> | | #include <odb/sqlite/forward.hxx> | |
| #include <odb/sqlite/tracer.hxx> | | #include <odb/sqlite/tracer.hxx> | |
| #include <odb/sqlite/transaction-impl.hxx> | | #include <odb/sqlite/transaction-impl.hxx> | |
| #include <odb/sqlite/auto-handle.hxx> | | #include <odb/sqlite/auto-handle.hxx> | |
| | | | |
| #include <odb/sqlite/details/export.hxx> | | #include <odb/sqlite/details/export.hxx> | |
| | | | |
| namespace odb | | namespace odb | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 134 | |
| // Needed to break the circular connection-database dependency | | // Needed to break the circular connection-database dependency | |
| // (odb::connection has the odb::database member). | | // (odb::connection has the odb::database member). | |
| // | | // | |
| database_type& db_; | | database_type& db_; | |
| | | | |
| auto_handle<sqlite3> handle_; | | auto_handle<sqlite3> handle_; | |
| | | | |
| // Keep statement_cache_ after handle_ so that it is destroyed before | | // Keep statement_cache_ after handle_ so that it is destroyed before | |
| // the connection is closed. | | // the connection is closed. | |
| // | | // | |
|
| std::auto_ptr<statement_cache_type> statement_cache_; | | details::unique_ptr<statement_cache_type> statement_cache_; | |
| | | | |
| // Unlock notification machinery. | | // Unlock notification machinery. | |
| // | | // | |
| private: | | private: | |
| bool unlocked_; | | bool unlocked_; | |
| details::mutex unlock_mutex_; | | details::mutex unlock_mutex_; | |
| details::condition unlock_cond_; | | details::condition unlock_cond_; | |
| | | | |
| friend void | | friend void | |
| connection_unlock_callback (void**, int); | | connection_unlock_callback (void**, int); | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| container-statements.hxx | | container-statements.hxx | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 152 | |
| { | | { | |
| data_id_binding_version_ = v; | | data_id_binding_version_ = v; | |
| } | | } | |
| | | | |
| binding& | | binding& | |
| data_image_binding () | | data_image_binding () | |
| { | | { | |
| return data_image_binding_; | | return data_image_binding_; | |
| } | | } | |
| | | | |
|
| bool* | | | |
| data_image_truncated () | | | |
| { | | | |
| return data_image_truncated_; | | | |
| } | | | |
| | | | |
| binding& | | binding& | |
| select_image_binding () | | select_image_binding () | |
| { | | { | |
| return select_image_binding_; | | return select_image_binding_; | |
| } | | } | |
| | | | |
| bool* | | bool* | |
| select_image_truncated () | | select_image_truncated () | |
| { | | { | |
| return select_image_truncated_; | | return select_image_truncated_; | |
| | | | |
| skipping to change at line 242 | | skipping to change at line 236 | |
| cond_image_type cond_image_; | | cond_image_type cond_image_; | |
| std::size_t cond_image_version_; | | std::size_t cond_image_version_; | |
| std::size_t cond_id_binding_version_; | | std::size_t cond_id_binding_version_; | |
| binding cond_image_binding_; | | binding cond_image_binding_; | |
| | | | |
| data_image_type data_image_; | | data_image_type data_image_; | |
| std::size_t data_image_version_; | | std::size_t data_image_version_; | |
| std::size_t data_id_binding_version_; | | std::size_t data_id_binding_version_; | |
| | | | |
| binding data_image_binding_; | | binding data_image_binding_; | |
|
| bool* data_image_truncated_; | | | |
| | | | |
| // Skips the id from data_image_binding. | | // Skips the id from data_image_binding. | |
| // | | // | |
| binding select_image_binding_; | | binding select_image_binding_; | |
| bool* select_image_truncated_; | | bool* select_image_truncated_; | |
| | | | |
| const char* insert_one_text_; | | const char* insert_one_text_; | |
| const char* select_all_text_; | | const char* select_all_text_; | |
| const char* delete_all_text_; | | const char* delete_all_text_; | |
| | | | |
| | | | |
| skipping to change at line 277 | | skipping to change at line 270 | |
| | | | |
| container_statements_impl (connection_type&); | | container_statements_impl (connection_type&); | |
| | | | |
| private: | | private: | |
| container_statements_impl (const container_statements_impl&); | | container_statements_impl (const container_statements_impl&); | |
| container_statements_impl& operator= (const container_statements_impl
&); | | container_statements_impl& operator= (const container_statements_impl
&); | |
| | | | |
| private: | | private: | |
| bind cond_image_bind_[traits::cond_column_count]; | | bind cond_image_bind_[traits::cond_column_count]; | |
| bind data_image_bind_[traits::data_column_count]; | | bind data_image_bind_[traits::data_column_count]; | |
|
| bool data_image_truncated_array_[traits::data_column_count]; | | bool select_image_truncated_array_[traits::data_column_count- | |
| | | traits::id_column_count]; | |
| }; | | }; | |
| } | | } | |
| } | | } | |
| | | | |
| #include <odb/sqlite/container-statements.txx> | | #include <odb/sqlite/container-statements.txx> | |
| | | | |
| #include <odb/post.hxx> | | #include <odb/post.hxx> | |
| | | | |
| #endif // ODB_SQLITE_CONTAINER_STATEMENTS_HXX | | #endif // ODB_SQLITE_CONTAINER_STATEMENTS_HXX | |
| | | | |
End of changes. 3 change blocks. |
| 8 lines changed or deleted | | 2 lines changed or added | |
|
| container-statements.txx | | container-statements.txx | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| data_image_.version = 0; | | data_image_.version = 0; | |
| data_image_version_ = 0; | | data_image_version_ = 0; | |
| data_id_binding_version_ = 0; | | data_id_binding_version_ = 0; | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
| container_statements_impl<T>:: | | container_statements_impl<T>:: | |
| container_statements_impl (connection_type& conn) | | container_statements_impl (connection_type& conn) | |
| : base (conn) | | : base (conn) | |
| { | | { | |
|
| this->data_image_truncated_ = data_image_truncated_array_; | | this->select_image_truncated_ = select_image_truncated_array_; | |
| this->select_image_truncated_ = data_image_truncated_array_ + | | | |
| traits::id_column_count; | | | |
| | | | |
| this->cond_image_binding_.bind = cond_image_bind_; | | this->cond_image_binding_.bind = cond_image_bind_; | |
| this->cond_image_binding_.count = traits::cond_column_count; | | this->cond_image_binding_.count = traits::cond_column_count; | |
| | | | |
| this->data_image_binding_.bind = data_image_bind_; | | this->data_image_binding_.bind = data_image_bind_; | |
| this->data_image_binding_.count = traits::data_column_count; | | this->data_image_binding_.count = traits::data_column_count; | |
| | | | |
| this->select_image_binding_.bind = data_image_bind_ + | | this->select_image_binding_.bind = data_image_bind_ + | |
| traits::id_column_count; | | traits::id_column_count; | |
| this->select_image_binding_.count = traits::data_column_count - | | this->select_image_binding_.count = traits::data_column_count - | |
| traits::id_column_count; | | traits::id_column_count; | |
| | | | |
| std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_)); | | std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_)); | |
| std::memset (data_image_bind_, 0, sizeof (data_image_bind_)); | | std::memset (data_image_bind_, 0, sizeof (data_image_bind_)); | |
|
| std::memset (data_image_truncated_array_, | | std::memset (select_image_truncated_array_, | |
| 0, | | 0, | |
|
| sizeof (data_image_truncated_array_)); | | sizeof (select_image_truncated_array_)); | |
| | | | |
|
| for (std::size_t i (0); i < traits::data_column_count; ++i) | | for (std::size_t i (0); | |
| data_image_bind_[i].truncated = data_image_truncated_array_ + i; | | i < traits::data_column_count - traits::id_column_count; | |
| | | ++i) | |
| | | data_image_bind_[i + traits::id_column_count].truncated = | |
| | | select_image_truncated_array_ + i; | |
| | | | |
| this->insert_one_text_ = traits::insert_one_statement; | | this->insert_one_text_ = traits::insert_one_statement; | |
| this->select_all_text_ = traits::select_all_statement; | | this->select_all_text_ = traits::select_all_statement; | |
| this->delete_all_text_ = traits::delete_all_statement; | | this->delete_all_text_ = traits::delete_all_statement; | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
End of changes. 4 change blocks. |
| 7 lines changed or deleted | | 8 lines changed or added | |
|
| database.hxx | | database.hxx | |
| | | | |
| skipping to change at line 13 | | skipping to change at line 13 | |
| // license : GNU GPL v2; see accompanying LICENSE file | | // license : GNU GPL v2; see accompanying LICENSE file | |
| | | | |
| #ifndef ODB_SQLITE_DATABASE_HXX | | #ifndef ODB_SQLITE_DATABASE_HXX | |
| #define ODB_SQLITE_DATABASE_HXX | | #define ODB_SQLITE_DATABASE_HXX | |
| | | | |
| #include <odb/pre.hxx> | | #include <odb/pre.hxx> | |
| | | | |
| #include <sqlite3.h> | | #include <sqlite3.h> | |
| | | | |
| #include <string> | | #include <string> | |
|
| #include <memory> // std::auto_ptr | | #include <memory> // std::auto_ptr, std::unique_ptr | |
| #include <iosfwd> // std::ostream | | #include <iosfwd> // std::ostream | |
| | | | |
| #include <odb/database.hxx> | | #include <odb/database.hxx> | |
|
| | | #include <odb/details/unique-ptr.hxx> | |
| | | #include <odb/details/transfer-ptr.hxx> | |
| | | | |
| #include <odb/sqlite/version.hxx> | | #include <odb/sqlite/version.hxx> | |
| #include <odb/sqlite/forward.hxx> | | #include <odb/sqlite/forward.hxx> | |
| #include <odb/sqlite/tracer.hxx> | | #include <odb/sqlite/tracer.hxx> | |
| #include <odb/sqlite/connection.hxx> | | #include <odb/sqlite/connection.hxx> | |
| #include <odb/sqlite/connection-factory.hxx> | | #include <odb/sqlite/connection-factory.hxx> | |
| #include <odb/sqlite/transaction-impl.hxx> | | #include <odb/sqlite/transaction-impl.hxx> | |
| | | | |
| #include <odb/sqlite/details/export.hxx> | | #include <odb/sqlite/details/export.hxx> | |
| | | | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 41 | |
| namespace sqlite | | namespace sqlite | |
| { | | { | |
| class transaction_impl; | | class transaction_impl; | |
| | | | |
| class LIBODB_SQLITE_EXPORT database: public odb::database | | class LIBODB_SQLITE_EXPORT database: public odb::database | |
| { | | { | |
| public: | | public: | |
| database (const std::string& name, | | database (const std::string& name, | |
| int flags = SQLITE_OPEN_READWRITE, | | int flags = SQLITE_OPEN_READWRITE, | |
| bool foreign_keys = true, | | bool foreign_keys = true, | |
|
| std::auto_ptr<connection_factory> = | | details::transfer_ptr<connection_factory> = | |
| std::auto_ptr<connection_factory> (0)); | | details::transfer_ptr<connection_factory> ()); | |
| | | | |
| // Extract the database parameters from the command line. The | | // Extract the database parameters from the command line. The | |
| // following options are recognized: | | // following options are recognized: | |
| // | | // | |
| // --database | | // --database | |
| // --create | | // --create | |
| // --read-only | | // --read-only | |
| // --options-file | | // --options-file | |
| // | | // | |
| // For more information, see the output of the print_usage() function | | // For more information, see the output of the print_usage() function | |
| // below. If erase is true, the above options are removed from the ar
gv | | // below. If erase is true, the above options are removed from the ar
gv | |
| // array and the argc count is updated accordingly. The command line | | // array and the argc count is updated accordingly. The command line | |
| // options override the flags passed as an argument. This constructor | | // options override the flags passed as an argument. This constructor | |
| // may throw the cli_exception exception. | | // may throw the cli_exception exception. | |
| // | | // | |
| database (int& argc, | | database (int& argc, | |
| char* argv[], | | char* argv[], | |
| bool erase = false, | | bool erase = false, | |
| int flags = SQLITE_OPEN_READWRITE, | | int flags = SQLITE_OPEN_READWRITE, | |
| bool foreign_keys = true, | | bool foreign_keys = true, | |
|
| std::auto_ptr<connection_factory> = | | details::transfer_ptr<connection_factory> = | |
| std::auto_ptr<connection_factory> (0)); | | details::transfer_ptr<connection_factory> ()); | |
| | | | |
| static void | | static void | |
| print_usage (std::ostream&); | | print_usage (std::ostream&); | |
| | | | |
| public: | | public: | |
| const std::string& | | const std::string& | |
| name () const | | name () const | |
| { | | { | |
| return name_; | | return name_; | |
| } | | } | |
| | | | |
| skipping to change at line 133 | | skipping to change at line 135 | |
| ~database (); | | ~database (); | |
| | | | |
| protected: | | protected: | |
| virtual odb::connection* | | virtual odb::connection* | |
| connection_ (); | | connection_ (); | |
| | | | |
| private: | | private: | |
| std::string name_; | | std::string name_; | |
| int flags_; | | int flags_; | |
| bool foreign_keys_; | | bool foreign_keys_; | |
|
| std::auto_ptr<connection_factory> factory_; | | details::unique_ptr<connection_factory> factory_; | |
| }; | | }; | |
| } | | } | |
| } | | } | |
| | | | |
| #include <odb/sqlite/database.ixx> | | #include <odb/sqlite/database.ixx> | |
| | | | |
| #include <odb/post.hxx> | | #include <odb/post.hxx> | |
| | | | |
| #endif // ODB_SQLITE_DATABASE_HXX | | #endif // ODB_SQLITE_DATABASE_HXX | |
| | | | |
End of changes. 5 change blocks. |
| 6 lines changed or deleted | | 8 lines changed or added | |
|
| result.hxx | | result.hxx | |
| // file : odb/sqlite/result.hxx | | // file : odb/sqlite/result.hxx | |
| // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC | | // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC | |
| // license : GNU GPL v2; see accompanying LICENSE file | | // license : GNU GPL v2; see accompanying LICENSE file | |
| | | | |
| #ifndef ODB_SQLITE_RESULT_HXX | | #ifndef ODB_SQLITE_RESULT_HXX | |
| #define ODB_SQLITE_RESULT_HXX | | #define ODB_SQLITE_RESULT_HXX | |
| | | | |
| #include <odb/pre.hxx> | | #include <odb/pre.hxx> | |
| | | | |
|
| #include <odb/traits.hxx> | | | |
| #include <odb/result.hxx> | | | |
| | | | |
| #include <odb/details/shared-ptr.hxx> | | #include <odb/details/shared-ptr.hxx> | |
| | | | |
| #include <odb/sqlite/version.hxx> | | #include <odb/sqlite/version.hxx> | |
| #include <odb/sqlite/forward.hxx> // query, query_params | | #include <odb/sqlite/forward.hxx> // query, query_params | |
| #include <odb/sqlite/statement.hxx> | | #include <odb/sqlite/statement.hxx> | |
| | | | |
| #include <odb/sqlite/details/export.hxx> | | #include <odb/sqlite/details/export.hxx> | |
| | | | |
| namespace odb | | namespace odb | |
| { | | { | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 40 | |
| // | | // | |
| details::shared_ptr<query_params> params_; | | details::shared_ptr<query_params> params_; | |
| details::shared_ptr<select_statement> statement_; | | details::shared_ptr<select_statement> statement_; | |
| }; | | }; | |
| } | | } | |
| } | | } | |
| | | | |
| #include <odb/post.hxx> | | #include <odb/post.hxx> | |
| | | | |
| #endif // ODB_SQLITE_RESULT_HXX | | #endif // ODB_SQLITE_RESULT_HXX | |
|
| | | | |
| // Include result specializations so that the user code only needs | | | |
| // to include this header. | | | |
| // | | | |
| | | | |
| #include <odb/sqlite/object-result.hxx> | | | |
| #include <odb/sqlite/view-result.hxx> | | | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 0 lines changed or added | |
|
| statement-cache.hxx | | statement-cache.hxx | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| | | | |
| #ifndef ODB_SQLITE_STATEMENT_CACHE_HXX | | #ifndef ODB_SQLITE_STATEMENT_CACHE_HXX | |
| #define ODB_SQLITE_STATEMENT_CACHE_HXX | | #define ODB_SQLITE_STATEMENT_CACHE_HXX | |
| | | | |
| #include <odb/pre.hxx> | | #include <odb/pre.hxx> | |
| | | | |
| #include <map> | | #include <map> | |
| #include <typeinfo> | | #include <typeinfo> | |
| | | | |
| #include <odb/forward.hxx> | | #include <odb/forward.hxx> | |
|
| | | #include <odb/traits.hxx> | |
| | | | |
| #include <odb/details/shared-ptr.hxx> | | #include <odb/details/shared-ptr.hxx> | |
| #include <odb/details/type-info.hxx> | | #include <odb/details/type-info.hxx> | |
| | | | |
| #include <odb/sqlite/version.hxx> | | #include <odb/sqlite/version.hxx> | |
|
| | | #include <odb/sqlite/forward.hxx> | |
| #include <odb/sqlite/statement.hxx> | | #include <odb/sqlite/statement.hxx> | |
| #include <odb/sqlite/statements-base.hxx> | | #include <odb/sqlite/statements-base.hxx> | |
|
| #include <odb/sqlite/object-statements.hxx> | | | |
| #include <odb/sqlite/view-statements.hxx> | | | |
| | | | |
| #include <odb/sqlite/details/export.hxx> | | #include <odb/sqlite/details/export.hxx> | |
| | | | |
| namespace odb | | namespace odb | |
| { | | { | |
| namespace sqlite | | namespace sqlite | |
| { | | { | |
|
| class connection; | | | |
| | | | |
| class LIBODB_SQLITE_EXPORT statement_cache | | class LIBODB_SQLITE_EXPORT statement_cache | |
| { | | { | |
| public: | | public: | |
| statement_cache (connection&); | | statement_cache (connection&); | |
| | | | |
| generic_statement& | | generic_statement& | |
| begin_statement () const | | begin_statement () const | |
| { | | { | |
| return *begin_; | | return *begin_; | |
| } | | } | |
| | | | |
| skipping to change at line 74 | | skipping to change at line 72 | |
| return *commit_; | | return *commit_; | |
| } | | } | |
| | | | |
| generic_statement& | | generic_statement& | |
| rollback_statement () const | | rollback_statement () const | |
| { | | { | |
| return *rollback_; | | return *rollback_; | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
|
| typename object_statements_selector<T>::type& | | typename object_traits<T>::statements_type& | |
| find_object () | | find_object (); | |
| { | | | |
| typedef typename object_statements_selector<T>::type object_stateme | | | |
| nts; | | | |
| | | | |
| map::iterator i (map_.find (&typeid (T))); | | | |
| | | | |
| if (i != map_.end ()) | | | |
| return static_cast<object_statements&> (*i->second); | | | |
| | | | |
| details::shared_ptr<object_statements> p ( | | | |
| new (details::shared) object_statements (conn_)); | | | |
| | | | |
| map_.insert (map::value_type (&typeid (T), p)); | | | |
| return *p; | | | |
| } | | | |
| | | | |
| template <typename T> | | template <typename T> | |
| view_statements<T>& | | view_statements<T>& | |
|
| find_view () | | find_view (); | |
| { | | | |
| map::iterator i (map_.find (&typeid (T))); | | | |
| | | | |
| if (i != map_.end ()) | | | |
| return static_cast<view_statements<T>&> (*i->second); | | | |
| | | | |
| details::shared_ptr<view_statements<T> > p ( | | | |
| new (details::shared) view_statements<T> (conn_)); | | | |
| | | | |
| map_.insert (map::value_type (&typeid (T), p)); | | | |
| return *p; | | | |
| } | | | |
| | | | |
| private: | | private: | |
| void | | void | |
| begin_immediate_statement_ () const; | | begin_immediate_statement_ () const; | |
| | | | |
| void | | void | |
| begin_exclusive_statement_ () const; | | begin_exclusive_statement_ () const; | |
| | | | |
| private: | | private: | |
| typedef std::map<const std::type_info*, | | typedef std::map<const std::type_info*, | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 104 | |
| mutable details::shared_ptr<generic_statement> begin_immediate_; | | mutable details::shared_ptr<generic_statement> begin_immediate_; | |
| mutable details::shared_ptr<generic_statement> begin_exclusive_; | | mutable details::shared_ptr<generic_statement> begin_exclusive_; | |
| details::shared_ptr<generic_statement> commit_; | | details::shared_ptr<generic_statement> commit_; | |
| details::shared_ptr<generic_statement> rollback_; | | details::shared_ptr<generic_statement> rollback_; | |
| | | | |
| map map_; | | map map_; | |
| }; | | }; | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | #include <odb/sqlite/statement-cache.txx> | |
| | | | |
| #include <odb/post.hxx> | | #include <odb/post.hxx> | |
| | | | |
| #endif // ODB_SQLITE_STATEMENT_CACHE_HXX | | #endif // ODB_SQLITE_STATEMENT_CACHE_HXX | |
| | | | |
End of changes. 7 change blocks. |
| 34 lines changed or deleted | | 7 lines changed or added | |
|
| statement.hxx | | statement.hxx | |
| | | | |
| skipping to change at line 297 | | skipping to change at line 297 | |
| private: | | private: | |
| select_statement (const select_statement&); | | select_statement (const select_statement&); | |
| select_statement& operator= (const select_statement&); | | select_statement& operator= (const select_statement&); | |
| | | | |
| private: | | private: | |
| bool done_; | | bool done_; | |
| binding* param_; | | binding* param_; | |
| binding& result_; | | binding& result_; | |
| }; | | }; | |
| | | | |
|
| | | struct LIBODB_SQLITE_EXPORT auto_result | |
| | | { | |
| | | explicit auto_result (select_statement& s): s_ (s) {} | |
| | | ~auto_result () {s_.free_result ();} | |
| | | | |
| | | private: | |
| | | auto_result (const auto_result&); | |
| | | auto_result& operator= (const auto_result&); | |
| | | | |
| | | private: | |
| | | select_statement& s_; | |
| | | }; | |
| | | | |
| class LIBODB_SQLITE_EXPORT insert_statement: public statement | | class LIBODB_SQLITE_EXPORT insert_statement: public statement | |
| { | | { | |
| public: | | public: | |
| insert_statement (connection& conn, | | insert_statement (connection& conn, | |
| const std::string& text, | | const std::string& text, | |
| binding& param); | | binding& param); | |
| | | | |
| insert_statement (connection& conn, const char* text, binding& param)
; | | insert_statement (connection& conn, const char* text, binding& param)
; | |
| | | | |
| // Return true if successful and false if the row is a duplicate. | | // Return true if successful and false if the row is a duplicate. | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 13 lines changed or added | |
|
| view-result.hxx | | view-result.hxx | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC | | // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC | |
| // license : GNU GPL v2; see accompanying LICENSE file | | // license : GNU GPL v2; see accompanying LICENSE file | |
| | | | |
| #ifndef ODB_SQLITE_VIEW_RESULT_HXX | | #ifndef ODB_SQLITE_VIEW_RESULT_HXX | |
| #define ODB_SQLITE_VIEW_RESULT_HXX | | #define ODB_SQLITE_VIEW_RESULT_HXX | |
| | | | |
| #include <odb/pre.hxx> | | #include <odb/pre.hxx> | |
| | | | |
| #include <cstddef> // std::size_t | | #include <cstddef> // std::size_t | |
| | | | |
|
| | | #include <odb/view-result.hxx> | |
| | | | |
| #include <odb/details/shared-ptr.hxx> | | #include <odb/details/shared-ptr.hxx> | |
| | | | |
| #include <odb/sqlite/version.hxx> | | #include <odb/sqlite/version.hxx> | |
| #include <odb/sqlite/forward.hxx> // query, view_statements | | #include <odb/sqlite/forward.hxx> // query, view_statements | |
|
| #include <odb/sqlite/result.hxx> | | | |
| #include <odb/sqlite/statement.hxx> | | #include <odb/sqlite/statement.hxx> | |
| | | | |
| namespace odb | | namespace odb | |
| { | | { | |
| namespace sqlite | | namespace sqlite | |
| { | | { | |
| template <typename T> | | template <typename T> | |
| class view_result_impl: public odb::view_result_impl<T>, | | class view_result_impl: public odb::view_result_impl<T>, | |
| public result_impl_base | | public result_impl_base | |
| { | | { | |
| public: | | public: | |
| typedef odb::view_result_impl<T> base_type; | | typedef odb::view_result_impl<T> base_type; | |
| | | | |
| typedef typename base_type::view_type view_type; | | typedef typename base_type::view_type view_type; | |
| typedef typename base_type::view_traits view_traits; | | typedef typename base_type::view_traits view_traits; | |
| | | | |
| typedef typename base_type::pointer_type pointer_type; | | typedef typename base_type::pointer_type pointer_type; | |
| typedef typename base_type::pointer_traits pointer_traits; | | typedef typename base_type::pointer_traits pointer_traits; | |
| | | | |
|
| | | typedef view_statements<view_type> statements_type; | |
| | | | |
| virtual | | virtual | |
| ~view_result_impl (); | | ~view_result_impl (); | |
| | | | |
| view_result_impl (const query&, | | view_result_impl (const query&, | |
| details::shared_ptr<select_statement>, | | details::shared_ptr<select_statement>, | |
|
| view_statements<view_type>&); | | statements_type&); | |
| | | | |
| virtual void | | virtual void | |
| load (view_type&); | | load (view_type&); | |
| | | | |
| virtual void | | virtual void | |
| next (); | | next (); | |
| | | | |
| virtual void | | virtual void | |
| cache (); | | cache (); | |
| | | | |
| virtual std::size_t | | virtual std::size_t | |
| size (); | | size (); | |
| | | | |
| using base_type::current; | | using base_type::current; | |
| | | | |
| private: | | private: | |
|
| view_statements<view_type>& statements_; | | statements_type& statements_; | |
| }; | | }; | |
| } | | } | |
| } | | } | |
| | | | |
| #include <odb/sqlite/view-result.txx> | | #include <odb/sqlite/view-result.txx> | |
| | | | |
| #include <odb/post.hxx> | | #include <odb/post.hxx> | |
| | | | |
| #endif // ODB_SQLITE_VIEW_RESULT_HXX | | #endif // ODB_SQLITE_VIEW_RESULT_HXX | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 6 lines changed or added | |
|
| view-result.txx | | view-result.txx | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| #include <odb/sqlite/view-statements.hxx> | | #include <odb/sqlite/view-statements.hxx> | |
| | | | |
| namespace odb | | namespace odb | |
| { | | { | |
| namespace sqlite | | namespace sqlite | |
| { | | { | |
| template <typename T> | | template <typename T> | |
| view_result_impl<T>:: | | view_result_impl<T>:: | |
| ~view_result_impl () | | ~view_result_impl () | |
| { | | { | |
|
| | | if (!this->end_) | |
| | | statement_->free_result (); | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
| view_result_impl<T>:: | | view_result_impl<T>:: | |
| view_result_impl (const query& q, | | view_result_impl (const query& q, | |
| details::shared_ptr<select_statement> statement, | | details::shared_ptr<select_statement> statement, | |
|
| view_statements<view_type>& statements) | | statements_type& statements) | |
| : base_type (statements.connection ().database ()), | | : base_type (statements.connection ().database ()), | |
| result_impl_base (q, statement), | | result_impl_base (q, statement), | |
| statements_ (statements) | | statements_ (statements) | |
| { | | { | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
| void view_result_impl<T>:: | | void view_result_impl<T>:: | |
| load (view_type& view) | | load (view_type& view) | |
| { | | { | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 70 | |
| view_traits::bind (b.bind, im); | | view_traits::bind (b.bind, im); | |
| statements_.image_version (im.version); | | statements_.image_version (im.version); | |
| b.version++; | | b.version++; | |
| statement_->reload (); | | statement_->reload (); | |
| } | | } | |
| } | | } | |
| | | | |
| odb::database& db (this->database ()); | | odb::database& db (this->database ()); | |
| | | | |
| view_traits::callback (db, view, callback_event::pre_load); | | view_traits::callback (db, view, callback_event::pre_load); | |
|
| view_traits::init (view, im, db); | | view_traits::init (view, im, &db); | |
| view_traits::callback (db, view, callback_event::post_load); | | view_traits::callback (db, view, callback_event::post_load); | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
| void view_result_impl<T>:: | | void view_result_impl<T>:: | |
| next () | | next () | |
| { | | { | |
| this->current (pointer_type ()); | | this->current (pointer_type ()); | |
| | | | |
| if (!statement_->next ()) | | if (!statement_->next ()) | |
|
| | | { | |
| | | statement_->free_result (); | |
| this->end_ = true; | | this->end_ = true; | |
|
| | | } | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
| void view_result_impl<T>:: | | void view_result_impl<T>:: | |
| cache () | | cache () | |
| { | | { | |
| } | | } | |
| | | | |
| template <typename T> | | template <typename T> | |
| std::size_t view_result_impl<T>:: | | std::size_t view_result_impl<T>:: | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 7 lines changed or added | |
|