Mercurial > hg > orthanc
comparison Core/SQLite/Statement.h @ 138:f333c0398f6e
some hiding
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Oct 2012 16:53:03 +0200 |
parents | 0e97abc7b950 |
children | 9cd240cfd3a6 |
comparison
equal
deleted
inserted
replaced
137:0e97abc7b950 | 138:f333c0398f6e |
---|---|
41 #include "StatementReference.h" | 41 #include "StatementReference.h" |
42 | 42 |
43 #include <vector> | 43 #include <vector> |
44 #include <stdint.h> | 44 #include <stdint.h> |
45 #include <boost/noncopyable.hpp> | 45 #include <boost/noncopyable.hpp> |
46 #include <gtest/gtest_prod.h> | |
46 | 47 |
47 struct sqlite3_stmt; | 48 struct sqlite3_stmt; |
48 | 49 |
49 | 50 |
50 namespace Orthanc | 51 namespace Orthanc |
65 }; | 66 }; |
66 | 67 |
67 class Statement : public boost::noncopyable | 68 class Statement : public boost::noncopyable |
68 { | 69 { |
69 friend class Connection; | 70 friend class Connection; |
71 FRIEND_TEST(SQLStatementTest, Run); | |
72 FRIEND_TEST(SQLStatementTest, Reset); | |
70 | 73 |
71 private: | 74 private: |
72 StatementReference reference_; | 75 StatementReference reference_; |
73 | 76 |
74 int CheckError(int err) const; | 77 int CheckError(int err) const; |
77 | 80 |
78 struct sqlite3_stmt* GetStatement() const | 81 struct sqlite3_stmt* GetStatement() const |
79 { | 82 { |
80 return reference_.GetWrappedObject(); | 83 return reference_.GetWrappedObject(); |
81 } | 84 } |
85 | |
86 // Resets the statement to its initial condition. This includes any current | |
87 // result row, and also the bound variables if the |clear_bound_vars| is true. | |
88 void Reset(bool clear_bound_vars = true); | |
82 | 89 |
83 public: | 90 public: |
84 Statement(Connection& database, | 91 Statement(Connection& database, |
85 const std::string& sql); | 92 const std::string& sql); |
86 | 93 |
101 } | 108 } |
102 | 109 |
103 bool Run(); | 110 bool Run(); |
104 | 111 |
105 bool Step(); | 112 bool Step(); |
106 | |
107 // Resets the statement to its initial condition. This includes any current | |
108 // result row, and also the bound variables if the |clear_bound_vars| is true. | |
109 void Reset(bool clear_bound_vars = true); | |
110 | 113 |
111 // Diagnostics -------------------------------------------------------------- | 114 // Diagnostics -------------------------------------------------------------- |
112 | 115 |
113 std::string GetOriginalSQLStatement(); | 116 std::string GetOriginalSQLStatement(); |
114 | 117 |