| 52 | typename T |
| 53 | > |
| 54 | void query_object ( |
| 55 | database& db, |
| 56 | const std::string& query, |
| 57 | T& item |
| 58 | ) |
| 59 | { |
| 60 | statement st(db, query); |
| 61 | st.exec(); |
| 62 | if (st.move_next() && st.get_num_columns() == 1) |
| 63 | { |
| 64 | st.get_column_as_object(0,item); |
| 65 | if (st.move_next()) |
| 66 | throw sqlite_error("query doesn't result in exactly 1 element"); |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | throw sqlite_error("query doesn't result in exactly 1 element"); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // ---------------------------------------------------------------------------------------- |
| 75 |
nothing calls this directly
no test coverage detected