Client 4—An Interactive Query Processor
Following the pattern set in the previous few chapters, I'll wrap up the discussion of ecpg by developing an interactive query processor. Because of the complexity of using ecpg to handle dynamic queries, I'll take a few shortcuts in this client, and I'll try to point to them as I go.
Let's start by looking at the main() function for the final client application in this chapter:
1 /* client4.pgc */ 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 6 EXEC SQL INCLUDE sql3types; 7 EXEC SQL INCLUDE sqlca; 8 9 EXEC SQL WHENEVER SQLERROR DO print_error(); 10 11 static int is_select_stmt( char * stmt ); 12 static void process_other_stmt( char * stmt_text ); 13 static void process_select_stmt( char * stmt_text ); ...
Get PostgreSQL, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.