Header And Logo

PostgreSQL
| The world's most advanced open source database.

sql-parser.c

Go to the documentation of this file.
00001 /* Processed by ecpg (regression mode) */
00002 /* These include files are added by the preprocessor */
00003 #include <ecpglib.h>
00004 #include <ecpgerrno.h>
00005 #include <sqlca.h>
00006 /* End of automatic include section */
00007 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
00008 
00009 #line 1 "parser.pgc"
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 #include <string.h>
00013 
00014 /* test parser addition that merges two tokens into one */
00015 
00016 #line 1 "regression.h"
00017 
00018 
00019 
00020 
00021 
00022 
00023 #line 6 "parser.pgc"
00024 
00025 
00026 int main() {
00027   /* exec sql begin declare section */
00028        
00029   
00030 #line 10 "parser.pgc"
00031  int item [ 3 ] , ind [ 3 ] , i ;
00032 /* exec sql end declare section */
00033 #line 11 "parser.pgc"
00034 
00035 
00036   ECPGdebug(1, stderr);
00037   { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }
00038 #line 14 "parser.pgc"
00039 
00040 
00041   { ECPGsetcommit(__LINE__, "on", NULL);}
00042 #line 16 "parser.pgc"
00043 
00044   /* exec sql whenever sql_warning  sqlprint ; */
00045 #line 17 "parser.pgc"
00046 
00047   /* exec sql whenever sqlerror  sqlprint ; */
00048 #line 18 "parser.pgc"
00049 
00050 
00051   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( Item1 int , Item2 int )", ECPGt_EOIT, ECPGt_EORT);
00052 #line 20 "parser.pgc"
00053 
00054 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00055 #line 20 "parser.pgc"
00056 
00057 if (sqlca.sqlcode < 0) sqlprint();}
00058 #line 20 "parser.pgc"
00059 
00060 
00061   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into T values ( 1 , null )", ECPGt_EOIT, ECPGt_EORT);
00062 #line 22 "parser.pgc"
00063 
00064 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00065 #line 22 "parser.pgc"
00066 
00067 if (sqlca.sqlcode < 0) sqlprint();}
00068 #line 22 "parser.pgc"
00069 
00070   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into T values ( 1 , 1 )", ECPGt_EOIT, ECPGt_EORT);
00071 #line 23 "parser.pgc"
00072 
00073 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00074 #line 23 "parser.pgc"
00075 
00076 if (sqlca.sqlcode < 0) sqlprint();}
00077 #line 23 "parser.pgc"
00078 
00079   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into T values ( 1 , 2 )", ECPGt_EOIT, ECPGt_EORT);
00080 #line 24 "parser.pgc"
00081 
00082 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00083 #line 24 "parser.pgc"
00084 
00085 if (sqlca.sqlcode < 0) sqlprint();}
00086 #line 24 "parser.pgc"
00087 
00088 
00089   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select Item2 from T order by Item2 nulls last", ECPGt_EOIT, 
00090     ECPGt_int,(item),(long)1,(long)3,sizeof(int), 
00091     ECPGt_int,(ind),(long)1,(long)3,sizeof(int), ECPGt_EORT);
00092 #line 26 "parser.pgc"
00093 
00094 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00095 #line 26 "parser.pgc"
00096 
00097 if (sqlca.sqlcode < 0) sqlprint();}
00098 #line 26 "parser.pgc"
00099 
00100 
00101   for (i=0; i<3; i++)
00102     printf("item[%d] = %d\n", i, ind[i] ? -1 : item[i]);
00103 
00104   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter Item1 type bigint", ECPGt_EOIT, ECPGt_EORT);
00105 #line 31 "parser.pgc"
00106 
00107 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00108 #line 31 "parser.pgc"
00109 
00110 if (sqlca.sqlcode < 0) sqlprint();}
00111 #line 31 "parser.pgc"
00112 
00113   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter table T alter column Item2 set data type smallint", ECPGt_EOIT, ECPGt_EORT);
00114 #line 32 "parser.pgc"
00115 
00116 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00117 #line 32 "parser.pgc"
00118 
00119 if (sqlca.sqlcode < 0) sqlprint();}
00120 #line 32 "parser.pgc"
00121 
00122 
00123   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table T", ECPGt_EOIT, ECPGt_EORT);
00124 #line 34 "parser.pgc"
00125 
00126 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00127 #line 34 "parser.pgc"
00128 
00129 if (sqlca.sqlcode < 0) sqlprint();}
00130 #line 34 "parser.pgc"
00131 
00132 
00133   { ECPGdisconnect(__LINE__, "ALL");
00134 #line 36 "parser.pgc"
00135 
00136 if (sqlca.sqlwarn[0] == 'W') sqlprint();
00137 #line 36 "parser.pgc"
00138 
00139 if (sqlca.sqlcode < 0) sqlprint();}
00140 #line 36 "parser.pgc"
00141 
00142 
00143   return 0;
00144 }