diff options
Diffstat (limited to 'src/pq/test_pq.c')
-rw-r--r-- | src/pq/test_pq.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pq/test_pq.c b/src/pq/test_pq.c index 69c986b6e..a20ff9ddd 100644 --- a/src/pq/test_pq.c +++ b/src/pq/test_pq.c | |||
@@ -554,6 +554,41 @@ main (int argc, | |||
554 | GNUNET_PQ_disconnect (db); | 554 | GNUNET_PQ_disconnect (db); |
555 | return ret; | 555 | return ret; |
556 | } | 556 | } |
557 | |||
558 | /* ensure oid lookup works */ | ||
559 | { | ||
560 | enum GNUNET_GenericReturnValue ret; | ||
561 | Oid oid; | ||
562 | |||
563 | ret = GNUNET_PQ_get_oid_by_name (db, "int8", &oid); | ||
564 | |||
565 | if (GNUNET_OK != ret) | ||
566 | { | ||
567 | fprintf (stderr, | ||
568 | "Cannot lookup oid for int8: %s\n", | ||
569 | PQerrorMessage (db->conn)); | ||
570 | GNUNET_break (0); | ||
571 | GNUNET_PQ_disconnect (db); | ||
572 | return 77; /* signal test was skipped */ | ||
573 | } | ||
574 | |||
575 | PQexec (db->conn, "CREATE TYPE foo AS (foo int, bar int);"); | ||
576 | |||
577 | ret = GNUNET_PQ_get_oid_by_name (db, "foo", &oid); | ||
578 | if (GNUNET_OK != ret) | ||
579 | { | ||
580 | fprintf (stderr, | ||
581 | "Cannot lookup oid for foo: %s\n", | ||
582 | PQerrorMessage (db->conn)); | ||
583 | GNUNET_break (0); | ||
584 | GNUNET_PQ_disconnect (db); | ||
585 | return 77; /* signal test was skipped */ | ||
586 | } | ||
587 | |||
588 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
589 | "got oid %d for type foo\n", oid); | ||
590 | } | ||
591 | |||
557 | GNUNET_SCHEDULER_run (&sched_tests, | 592 | GNUNET_SCHEDULER_run (&sched_tests, |
558 | NULL); | 593 | NULL); |
559 | if (0 != ret) | 594 | if (0 != ret) |