| 154 DBUConnection *conn = dbuSQLiteConnectionFromDB(db, true); |
154 DBUConnection *conn = dbuSQLiteConnectionFromDB(db, true); |
| 155 |
155 |
| 156 // test dbuConnectionExec |
156 // test dbuConnectionExec |
| 157 int execResult = dbuConnectionExec(conn, "drop table if exists test_table;"); |
157 int execResult = dbuConnectionExec(conn, "drop table if exists test_table;"); |
| 158 printf("exec result: %d\n\n", execResult); |
158 printf("exec result: %d\n\n", execResult); |
| |
159 |
| |
160 |
| |
161 // single value query |
| |
162 DBUQuery *q0 = conn->createQuery(conn, NULL); |
| |
163 dbuQuerySetSQL(q0, "select 'hello world';"); |
| |
164 q0->exec(q0); |
| |
165 DBUResult *r0 = q0->getResult(q0); |
| |
166 char *str; |
| |
167 if(!dbuResultAsValue(r0, &str)) { |
| |
168 printf("single query value: %s\n\n", str); |
| |
169 free(str); |
| |
170 } |
| 159 |
171 |
| 160 DBUQuery *query = conn->createQuery(conn, NULL); |
172 DBUQuery *query = conn->createQuery(conn, NULL); |
| 161 dbuQuerySetSQL(query, "select p.*, a.address_id as [__address__address_id], a.street, a.zip, a.city from Person p inner join Address a on p.address_id = a.address_id;"); |
173 dbuQuerySetSQL(query, "select p.*, a.address_id as [__address__address_id], a.street, a.zip, a.city from Person p inner join Address a on p.address_id = a.address_id;"); |
| 162 |
174 |
| 163 DBUQuery *roleQuery = conn->createQuery(conn, NULL); |
175 DBUQuery *roleQuery = conn->createQuery(conn, NULL); |