test/main.c

changeset 14
59e62e65182c
parent 12
421555fa9ce4
child 23
b26390e77237
--- a/test/main.c	Sun Feb 16 15:14:45 2025 +0100
+++ b/test/main.c	Sun Feb 16 15:50:04 2025 +0100
@@ -157,6 +157,18 @@
     int execResult = dbuConnectionExec(conn, "drop table if exists test_table;");
     printf("exec result: %d\n\n", execResult);
     
+    
+    // single value query
+    DBUQuery *q0 = conn->createQuery(conn, NULL);
+    dbuQuerySetSQL(q0, "select 'hello world';");
+    q0->exec(q0);
+    DBUResult *r0 = q0->getResult(q0);
+    char *str;
+    if(!dbuResultAsValue(r0, &str)) {
+        printf("single query value: %s\n\n", str);
+        free(str);
+    }
+    
     DBUQuery *query = conn->createQuery(conn, NULL);
     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;");
     

mercurial