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

Function query_int

dlib/sqlite/sqlite_tools.h:120–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118// ----------------------------------------------------------------------------------------
119
120 inline int query_int (
121 database& db,
122 const std::string& query
123 )
124 {
125 statement st(db, query);
126 st.exec();
127 if (st.move_next() && st.get_num_columns() == 1)
128 {
129 int temp = st.get_column_as_int(0);
130 if (st.move_next())
131 throw sqlite_error("query doesn't result in exactly 1 element");
132 return temp;
133 }
134 else
135 {
136 throw sqlite_error("query doesn't result in exactly 1 element");
137 }
138 }
139
140// ----------------------------------------------------------------------------------------
141

Callers 1

table_existsFunction · 0.85

Calls 5

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

Tested by

no test coverage detected