MCPcopy Create free account
hub / github.com/davisking/dlib / query_object

Function query_object

dlib/sqlite/sqlite_tools.h:54–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

execMethod · 0.80
get_num_columnsMethod · 0.80
get_column_as_objectMethod · 0.80
sqlite_errorClass · 0.70
move_nextMethod · 0.45

Tested by

no test coverage detected