diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-03-26 15:33:06 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-03-26 15:33:06 -0400 |
commit | 0e6355329f241a3e3c8b38cb4146fda4470e6ed0 (patch) | |
tree | df5853ba6df148e8eeb0082d090dfbcd9f94f651 /generator/database.cpp | |
parent | 09acb46a9c32257b0003eb152d32c15b43b95dfe (diff) | |
download | cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.tar.gz cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.tar.bz2 cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.zip |
Whitespace changes
Diffstat (limited to 'generator/database.cpp')
-rw-r--r-- | generator/database.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/generator/database.cpp b/generator/database.cpp index f326f46..b46a0d1 100644 --- a/generator/database.cpp +++ b/generator/database.cpp | |||
@@ -73,19 +73,19 @@ namespace cadence { | |||
73 | { | 73 | { |
74 | sqlite3_close_v2(ppdb_); | 74 | sqlite3_close_v2(ppdb_); |
75 | } | 75 | } |
76 | 76 | ||
77 | void database::runQuery(std::string query) | 77 | void database::runQuery(std::string query) |
78 | { | 78 | { |
79 | // This can only happen when doing bad things with move semantics. | 79 | // This can only happen when doing bad things with move semantics. |
80 | assert(ppdb_ != nullptr); | 80 | assert(ppdb_ != nullptr); |
81 | 81 | ||
82 | sqlite3_stmt* ppstmt; | 82 | sqlite3_stmt* ppstmt; |
83 | 83 | ||
84 | if (sqlite3_prepare_v2(ppdb_, query.c_str(), query.length(), &ppstmt, NULL) != SQLITE_OK) | 84 | if (sqlite3_prepare_v2(ppdb_, query.c_str(), query.length(), &ppstmt, NULL) != SQLITE_OK) |
85 | { | 85 | { |
86 | throw sqlite3_error("Error writing to database", sqlite3_errmsg(ppdb_)); | 86 | throw sqlite3_error("Error writing to database", sqlite3_errmsg(ppdb_)); |
87 | } | 87 | } |
88 | 88 | ||
89 | int result = sqlite3_step(ppstmt); | 89 | int result = sqlite3_step(ppstmt); |
90 | sqlite3_finalize(ppstmt); | 90 | sqlite3_finalize(ppstmt); |
91 | 91 | ||
@@ -99,10 +99,10 @@ namespace cadence { | |||
99 | { | 99 | { |
100 | // This can only happen when doing bad things with move semantics. | 100 | // This can only happen when doing bad things with move semantics. |
101 | assert(ppdb_ != nullptr); | 101 | assert(ppdb_ != nullptr); |
102 | 102 | ||
103 | // This shouldn't happen. | 103 | // This shouldn't happen. |
104 | assert(!fields.empty()); | 104 | assert(!fields.empty()); |
105 | 105 | ||
106 | std::list<std::string> fieldNames; | 106 | std::list<std::string> fieldNames; |
107 | std::list<std::string> qs; | 107 | std::list<std::string> qs; |
108 | for (field& f : fields) | 108 | for (field& f : fields) |
@@ -110,7 +110,7 @@ namespace cadence { | |||
110 | fieldNames.push_back(f.getName()); | 110 | fieldNames.push_back(f.getName()); |
111 | qs.push_back("?"); | 111 | qs.push_back("?"); |
112 | } | 112 | } |
113 | 113 | ||
114 | std::ostringstream query; | 114 | std::ostringstream query; |
115 | query << "INSERT INTO "; | 115 | query << "INSERT INTO "; |
116 | query << table; | 116 | query << table; |
@@ -119,7 +119,7 @@ namespace cadence { | |||
119 | query << ") VALUES ("; | 119 | query << ") VALUES ("; |
120 | query << implode(std::begin(qs), std::end(qs), ", "); | 120 | query << implode(std::begin(qs), std::end(qs), ", "); |
121 | query << ")"; | 121 | query << ")"; |
122 | 122 | ||
123 | std::string query_str = query.str(); | 123 | std::string query_str = query.str(); |
124 | 124 | ||
125 | sqlite3_stmt* ppstmt; | 125 | sqlite3_stmt* ppstmt; |