这篇教程C++ ECPGdo函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ECPGdo函数的典型用法代码示例。如果您正苦于以下问题:C++ ECPGdo函数的具体用法?C++ ECPGdo怎么用?C++ ECPGdo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ECPGdo函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main(void){ ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }#line 13 "strings.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to on", ECPGt_EOIT, ECPGt_EORT);}#line 15 "strings.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select 'abcdef' , N'abcdef' as foo , E'abc//bdef' as /"foo/" , U&'d//0061t//0061' as U&/"foo/" , U&'d!+000061t!+000061' uescape '!' , $foo$abc$def$foo$", ECPGt_EOIT, ECPGt_char,&(s1),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(s2),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(s3),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(s4),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(s5),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(s6),(long)0,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}#line 23 "strings.pgc" printf("%s %s %s %s %s %s/n", s1, s2, s3, s4, s5, s6); { ECPGdisconnect(__LINE__, "CURRENT");}#line 27 "strings.pgc" exit (0);}
开发者ID:50wu,项目名称:gpdb,代码行数:35,
示例2: mainint main (){ int i;#ifdef WIN32 HANDLE threads[THREADS];#else pthread_t threads[THREADS];#endif { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); #line 69 "prep.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 69 "prep.pgc" { ECPGsetcommit(__LINE__, "on", NULL);#line 70 "prep.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 70 "prep.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);#line 71 "prep.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 71 "prep.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);#line 72 "prep.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 72 "prep.pgc" { ECPGdisconnect(__LINE__, "CURRENT");#line 73 "prep.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 73 "prep.pgc"#ifdef WIN32 for (i = 0; i < THREADS; ++i) { unsigned id; threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, (void*)i, 0, &id); } WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE); for (i = 0; i < THREADS; ++i) CloseHandle(threads[i]);#else for (i = 0; i < THREADS; ++i) pthread_create(&threads[i], NULL, fn, (void *) (long) i); for (i = 0; i < THREADS; ++i) pthread_join(threads[i], NULL);#endif return 0;}
开发者ID:HBPSP8Repo,项目名称:NoDB,代码行数:59,
示例3: openitstatic void openit(void){ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare c cursor for select * from test where i <= $1 ", ECPGt_int,&(*( int *)(ECPGget_var( 0))),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 95 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 95 "test_informix.pgc"}
开发者ID:0x0FFF,项目名称:postgres,代码行数:11,
示例4: close_cur1static voidclose_cur1(void){ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur", ECPGt_EOIT, ECPGt_EORT);#line 58 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 58 "outofscope.pgc" if (sqlca.sqlcode != 0) exit(1);}
开发者ID:0x0FFF,项目名称:postgres,代码行数:13,
示例5: get_record1static voidget_record1(void){ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch mycur", ECPGt_EOIT, ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);#line 49 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 49 "outofscope.pgc" if (sqlca.sqlcode != 0 && sqlca.sqlcode != ECPG_NOT_FOUND) exit(1);}
开发者ID:0x0FFF,项目名称:postgres,代码行数:23,
示例6: open_cur1static voidopen_cur1(void){ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT, ECPGt_int,&((*( MYTYPE *)(ECPGget_var( 0)) ).id),(long)1,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).id),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).t),(long)64,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).t),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d1),(long)1,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d1),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_double,&((*( MYTYPE *)(ECPGget_var( 0)) ).d2),(long)1,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).d2),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_char,&((*( MYTYPE *)(ECPGget_var( 0)) ).c),(long)30,(long)1,sizeof( struct mytype ), ECPGt_int,&((*( MYNULLTYPE *)(ECPGget_var( 1)) ).c),(long)1,(long)1,sizeof( struct mynulltype ), ECPGt_EORT);#line 40 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 40 "outofscope.pgc" if (sqlca.sqlcode != 0) exit(1);}
开发者ID:0x0FFF,项目名称:postgres,代码行数:23,
示例7: mainintmain (void){/* exec sql begin declare section */ #line 57 "sqlda.pgc" char * stmt1 = "SELECT * FROM t1" ; #line 58 "sqlda.pgc" char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ; #line 59 "sqlda.pgc" int rec ; #line 60 "sqlda.pgc" int id ;/* exec sql end declare section */#line 61 "sqlda.pgc" char msg[128]; ECPGdebug(1, stderr); strcpy(msg, "connect"); { ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , "regress1", 0); #line 68 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 68 "sqlda.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);#line 71 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 71 "sqlda.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);#line 79 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 79 "sqlda.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' )", ECPGt_EOIT, ECPGt_EORT);#line 85 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 85 "sqlda.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit");#line 88 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 88 "sqlda.pgc" /* SQLDA test for getting all records from a table */ outp_sqlda = NULL; strcpy(msg, "prepare"); { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);#line 95 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 95 "sqlda.pgc" strcpy(msg, "declare"); ECPG_informix_reset_sqlca(); /* declare mycur1 cursor for $1 */#line 98 "sqlda.pgc" strcpy(msg, "open"); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare mycur1 cursor for $1", ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 101 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 101 "sqlda.pgc" /* exec sql whenever not found break ; */#line 103 "sqlda.pgc" rec = 0;//.........这里部分代码省略.........
开发者ID:HBPSP8Repo,项目名称:NoDB,代码行数:101,
示例8: mainint main() { /* exec sql begin declare section */ #line 9 "fetch.pgc" char str [ 25 ] ; #line 10 "fetch.pgc" int i , count = 1 ;/* exec sql end declare section */#line 11 "fetch.pgc" ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }#line 14 "fetch.pgc" /* exec sql whenever sql_warning sqlprint ; */#line 16 "fetch.pgc" /* exec sql whenever sqlerror sqlprint ; */#line 17 "fetch.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table My_Table ( Item1 int , Item2 text )", ECPGt_EOIT, ECPGt_EORT);#line 19 "fetch.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 19 "fetch.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 19 "fetch.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 1 , 'text1' )", ECPGt_EOIT, ECPGt_EORT);#line 21 "fetch.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 21 "fetch.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 21 "fetch.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 2 , 'text2' )", ECPGt_EOIT, ECPGt_EORT);#line 22 "fetch.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 22 "fetch.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 22 "fetch.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 3 , 'text3' )", ECPGt_EOIT, ECPGt_EORT);#line 23 "fetch.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 23 "fetch.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 23 "fetch.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into My_Table values ( 4 , 'text4' )", ECPGt_EOIT, ECPGt_EORT);#line 24 "fetch.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 24 "fetch.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 24 "fetch.pgc" /* declare C cursor for select * from My_Table */#line 26 "fetch.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare C cursor for select * from My_Table", ECPGt_EOIT, ECPGt_EORT);#line 28 "fetch.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 28 "fetch.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 28 "fetch.pgc" /* exec sql whenever not found break ; */#line 30 "fetch.pgc" while (1) { { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 in C", ECPGt_EOIT, ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,(str),(long)25,(long)1,(25)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);#line 32 "fetch.pgc"if (sqlca.sqlcode == ECPG_NOT_FOUND) break;#line 32 "fetch.pgc"//.........这里部分代码省略.........
开发者ID:AXLEproject,项目名称:postgres,代码行数:101,
示例9: mainint main(){#ifndef WIN32 pthread_t *threads;#else HANDLE *threads;#endif int n; /* exec sql begin declare section */ #line 38 "thread.pgc" int l_rows ;/* exec sql end declare section */#line 39 "thread.pgc" /* Do not switch on debug output for regression tests. The threads get executed in * more or less random order */ /* ECPGdebug(1, stderr); */ /* setup test_thread table */ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }#line 46 "thread.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}#line 47 "thread.pgc" /* DROP might fail */ { ECPGtrans(__LINE__, NULL, "commit");}#line 48 "thread.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test_thread ( tstamp timestamp not null default cast ( timeofday ( ) as timestamp ) , thread text not null , iteration integer not null , primary key ( thread , iteration ) )", ECPGt_EOIT, ECPGt_EORT);}#line 53 "thread.pgc" { ECPGtrans(__LINE__, NULL, "commit");}#line 54 "thread.pgc" { ECPGdisconnect(__LINE__, "CURRENT");}#line 55 "thread.pgc" /* create, and start, threads */ threads = calloc(nthreads, sizeof(threads[0])); if( threads == NULL ) { fprintf(stderr, "Cannot alloc memory/n"); return( 1 ); } for( n = 0; n < nthreads; n++ ) {#ifndef WIN32 pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));#else threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL);#endif } /* wait for thread completion */#ifndef WIN32 for( n = 0; n < nthreads; n++ ) { pthread_join(threads[n], NULL); }#else WaitForMultipleObjects(nthreads, threads, TRUE, INFINITE);#endif free(threads); /* and check results */ { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }#line 85 "thread.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT, ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}#line 86 "thread.pgc" { ECPGtrans(__LINE__, NULL, "commit");}#line 87 "thread.pgc" { ECPGdisconnect(__LINE__, "CURRENT");}#line 88 "thread.pgc" if( l_rows == (nthreads * iterations) ) printf("Success./n"); else printf("ERROR: Failure - expecting %d rows, got %d./n", nthreads * iterations, l_rows); return( 0 );}
开发者ID:chrullrich,项目名称:postgres,代码行数:90,
示例10: mainintmain(void){/* exec sql begin declare section */ #line 14 "execute.pgc" int amount [ 8 ] ; #line 15 "execute.pgc" int increment = 100 ; #line 16 "execute.pgc" char name [ 8 ] [ 8 ] ; #line 17 "execute.pgc" char letter [ 8 ] [ 1 ] ; #line 18 "execute.pgc" char command [ 128 ] ;/* exec sql end declare section */#line 19 "execute.pgc" int i,j; ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , "main", 0); #line 24 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 24 "execute.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( name char ( 8 ) , amount int , letter char ( 1 ) )", ECPGt_EOIT, ECPGt_EORT);#line 25 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 25 "execute.pgc" { ECPGtrans(__LINE__, NULL, "commit");#line 26 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 26 "execute.pgc" sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 1, 'f')"); { ECPGdo(__LINE__, 0, 1, NULL, 0, 2, command, ECPGt_EOIT, ECPGt_EORT);#line 29 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 29 "execute.pgc" sprintf(command, "insert into test (name, amount, letter) values ('db: ''r1''', 2, 't')"); { ECPGdo(__LINE__, 0, 1, NULL, 0, 2, command, ECPGt_EOIT, ECPGt_EORT);#line 32 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 32 "execute.pgc" sprintf(command, "insert into test (name, amount, letter) select name, amount+10, letter from test"); { ECPGdo(__LINE__, 0, 1, NULL, 0, 2, command, ECPGt_EOIT, ECPGt_EORT);#line 35 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 35 "execute.pgc" printf("Inserted %ld tuples via execute immediate/n", sqlca.sqlerrd[2]); sprintf(command, "insert into test (name, amount, letter) select name, amount+$1, letter from test"); { ECPGprepare(__LINE__, NULL, 0, "i", command);#line 40 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 40 "execute.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "i", ECPGt_int,&(increment),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 41 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 41 "execute.pgc" printf("Inserted %ld tuples via prepared execute/n", sqlca.sqlerrd[2]); { ECPGtrans(__LINE__, NULL, "commit");#line 45 "execute.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 45 "execute.pgc"//.........这里部分代码省略.........
开发者ID:50wu,项目名称:gpdb,代码行数:101,
示例11: mainintmain (void){ struct birthinfo { #line 23 "variable.pgc" long born ; #line 23 "variable.pgc" short age ; } ;#line 23 "variable.pgc"/* exec sql begin declare section */ #line 27 "variable.pgc" struct personal_struct { #line 25 "variable.pgc" struct varchar_1 { int len; char arr[ BUFFERSIZ ]; } name ; #line 26 "variable.pgc" struct birthinfo birth ; } personal , * p ; #line 30 "variable.pgc" struct personal_indicator { #line 28 "variable.pgc" int ind_name ; #line 29 "variable.pgc" struct birthinfo ind_birth ; } ind_personal , * i ; #line 31 "variable.pgc" ind ind_children ; struct t1 { #line 32 "variable.pgc" struct varchar_2 { int len; char arr[ BUFFERSIZ ]; } name ; } ; struct t2 { #line 32 "variable.pgc" struct varchar_3 { int len; char arr[ BUFFERSIZ ]; } name ; } ;/* exec sql end declare section */#line 33 "variable.pgc" #line 35 "variable.pgc" char * married = NULL ;#line 35 "variable.pgc" #line 36 "variable.pgc" long ind_married ;#line 36 "variable.pgc" #line 37 "variable.pgc" ind children ;#line 37 "variable.pgc" char msg[128]; ECPGdebug(1, stderr); strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); #line 44 "variable.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 44 "variable.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);#line 47 "variable.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 47 "variable.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )", ECPGt_EOIT, ECPGt_EORT);#line 50 "variable.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 50 "variable.pgc" strcpy(msg, "insert");//.........这里部分代码省略.........
开发者ID:zboszor,项目名称:ecpg-readahead,代码行数:101,
示例12: mainint main(void){ /* exec sql begin declare section */ #line 15 "whenever_do_continue.pgc" struct { #line 12 "whenever_do_continue.pgc" char ename [ 12 ] ; #line 13 "whenever_do_continue.pgc" float sal ; #line 14 "whenever_do_continue.pgc" float comm ; } emp ; #line 17 "whenever_do_continue.pgc" char msg [ 128 ] ;/* exec sql end declare section */#line 18 "whenever_do_continue.pgc" ECPGdebug(1, stderr); strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); #line 23 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 23 "whenever_do_continue.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table emp ( ename varchar , sal double precision , comm double precision )", ECPGt_EOIT, ECPGt_EORT);#line 26 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 26 "whenever_do_continue.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'Ram' , 111100 , 21 )", ECPGt_EOIT, ECPGt_EORT);#line 29 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 29 "whenever_do_continue.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'aryan' , 11110 , null )", ECPGt_EOIT, ECPGt_EORT);#line 30 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 30 "whenever_do_continue.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'josh' , 10000 , 10 )", ECPGt_EOIT, ECPGt_EORT);#line 31 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 31 "whenever_do_continue.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into emp values ( 'tom' , 20000 , null )", ECPGt_EOIT, ECPGt_EORT);#line 32 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 32 "whenever_do_continue.pgc" /* declare c cursor for select ename , sal , comm from emp order by ename collate /"C/" asc */#line 34 "whenever_do_continue.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare c cursor for select ename , sal , comm from emp order by ename collate /"C/" asc", ECPGt_EOIT, ECPGt_EORT);#line 36 "whenever_do_continue.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 36 "whenever_do_continue.pgc" /* The 'BREAK' condition to exit the loop. */ /* exec sql whenever not found break ; */#line 39 "whenever_do_continue.pgc" /* The DO CONTINUE makes the loop start at the next iteration when an error occurs.*/ /* exec sql whenever sqlerror continue ; */#line 42 "whenever_do_continue.pgc" while (1) { { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch c", ECPGt_EOIT, ECPGt_char,&(emp.ename),(long)12,(long)1,(12)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, //.........这里部分代码省略.........
开发者ID:AmiGanguli,项目名称:postgres,代码行数:101,
示例13: mainintmain (void){/* exec sql begin declare section */ #line 59 "sqlda.pgc" char * stmt1 = "SELECT * FROM t1" ; #line 60 "sqlda.pgc" char * stmt2 = "SELECT * FROM t1 WHERE id = ?" ; #line 61 "sqlda.pgc" int rec ; #line 62 "sqlda.pgc" int id ;/* exec sql end declare section */#line 63 "sqlda.pgc" char msg[128]; ECPGdebug(1, stderr); strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "regress1", 0); #line 70 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 70 "sqlda.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);#line 73 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 73 "sqlda.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( id integer , t text , d1 numeric , d2 float8 , c char ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);#line 81 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 81 "sqlda.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ) , ( 2 , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' )", ECPGt_EOIT, ECPGt_EORT);#line 87 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 87 "sqlda.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit");#line 90 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 90 "sqlda.pgc" /* SQLDA test for getting all records from a table */ outp_sqlda = NULL; strcpy(msg, "prepare"); { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);#line 97 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 97 "sqlda.pgc" strcpy(msg, "declare"); /* declare mycur1 cursor for $1 */#line 100 "sqlda.pgc" strcpy(msg, "open"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur1 cursor for $1", ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 103 "sqlda.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 103 "sqlda.pgc" /* exec sql whenever not found break ; */#line 105 "sqlda.pgc" rec = 0;//.........这里部分代码省略.........
开发者ID:AmiGanguli,项目名称:postgres,代码行数:101,
示例14: mainintmain(void){ /* exec sql begin declare section */#line 16 "test5.pgc" char db [ 200 ] ;#line 17 "test5.pgc" char id [ 200 ] ;#line 18 "test5.pgc" char * user = "regress_ecpg_user1" ; /* exec sql end declare section */#line 19 "test5.pgc" ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }#line 23 "test5.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user2 encrypted password 'insecure'", ECPGt_EOIT, ECPGt_EORT); }#line 24 "test5.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user1 encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT); }#line 25 "test5.pgc" { ECPGtrans(__LINE__, NULL, "commit"); }#line 26 "test5.pgc" { ECPGdisconnect(__LINE__, "CURRENT"); }#line 27 "test5.pgc" /* <-- "main" not specified */ strcpy(db, "ecpg2_regression"); strcpy(id, "main"); { ECPGconnect(__LINE__, 0, db , NULL, NULL , id, 0); }#line 31 "test5.pgc" { ECPGdisconnect(__LINE__, id); }#line 32 "test5.pgc" { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }#line 34 "test5.pgc" { ECPGdisconnect(__LINE__, "main"); }#line 35 "test5.pgc" { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }#line 37 "test5.pgc" { ECPGdisconnect(__LINE__, "main"); }#line 38 "test5.pgc" { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }#line 40 "test5.pgc" { ECPGdisconnect(__LINE__, "main"); }#line 41 "test5.pgc" { ECPGconnect(__LINE__, 0, "" , "regress_ecpg_user2" , "insecure" , "main", 0); }#line 43 "test5.pgc" {//.........这里部分代码省略.........
开发者ID:sunny256,项目名称:postgres,代码行数:101,
示例15: mainintmain (void){ MYTYPE *myvar; MYNULLTYPE *mynullvar; char msg[128]; ECPGdebug(1, stderr); strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); #line 75 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 75 "outofscope.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);#line 78 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 78 "outofscope.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);#line 81 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 81 "outofscope.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' )", ECPGt_EOIT, ECPGt_EORT);#line 84 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 84 "outofscope.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null )", ECPGt_EOIT, ECPGt_EORT);#line 85 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 85 "outofscope.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' )", ECPGt_EOIT, ECPGt_EORT);#line 86 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 86 "outofscope.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit");#line 89 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 89 "outofscope.pgc" /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE */ get_var1(&myvar, &mynullvar); open_cur1(); /* exec sql whenever not found break ; */#line 96 "outofscope.pgc" while (1) { memset(myvar, 0, sizeof(MYTYPE)); get_record1(); if (sqlca.sqlcode == ECPG_NOT_FOUND) break; printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s/n", myvar->id, mynullvar->id ? " (NULL)" : "", myvar->t, mynullvar->t ? " (NULL)" : "", myvar->d1, mynullvar->d1 ? " (NULL)" : "", myvar->d2, mynullvar->d2 ? " (NULL)" : "", myvar->c, mynullvar->c ? " (NULL)" : ""); } close_cur1(); free(myvar); free(mynullvar); strcpy(msg, "drop"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);#line 118 "outofscope.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 118 "outofscope.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit");//.........这里部分代码省略.........
开发者ID:0x0FFF,项目名称:postgres,代码行数:101,
示例16: mainint main(){ /* exec sql begin declare section */ #line 9 "indicators.pgc" int intvar = 5 ; #line 10 "indicators.pgc" int nullind = - 1 ;/* exec sql end declare section */#line 11 "indicators.pgc" ECPGdebug(1,stderr); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); }#line 15 "indicators.pgc" { ECPGsetcommit(__LINE__, "off", NULL);}#line 16 "indicators.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table indicator_test ( /"id/" int primary key , /"str/" text not null , val int null )", ECPGt_EOIT, ECPGt_EORT);}#line 21 "indicators.pgc" { ECPGtrans(__LINE__, NULL, "commit work");}#line 22 "indicators.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into indicator_test ( id , str , val ) values ( 1 , 'Hello' , 0 )", ECPGt_EOIT, ECPGt_EORT);}#line 24 "indicators.pgc" /* use indicator in insert */ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into indicator_test ( id , str , val ) values ( 2 , 'Hi there' , $1 )", ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}#line 27 "indicators.pgc" nullind = 0; { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into indicator_test ( id , str , val ) values ( 3 , 'Good evening' , $1 )", ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}#line 29 "indicators.pgc" { ECPGtrans(__LINE__, NULL, "commit work");}#line 30 "indicators.pgc" /* use indicators to get information about selects */ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 1", ECPGt_EOIT, ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}#line 33 "indicators.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 2", ECPGt_EOIT, ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}#line 34 "indicators.pgc" printf("intvar: %d, nullind: %d/n", intvar, nullind); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 3", ECPGt_EOIT, ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}#line 36 "indicators.pgc" printf("intvar: %d, nullind: %d/n", intvar, nullind); /* use indicators for update */ intvar = 5; nullind = -1; { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update indicator_test set val = $1 where id = 1", ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EOIT, ECPGt_EORT);}#line 41 "indicators.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select val from indicator_test where id = 1", ECPGt_EOIT, ECPGt_int,&(intvar),(long)1,(long)1,sizeof(int), ECPGt_int,&(nullind),(long)1,(long)1,sizeof(int), ECPGt_EORT);}#line 42 "indicators.pgc" printf("intvar: %d, nullind: %d/n", intvar, nullind); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table indicator_test", ECPGt_EOIT, ECPGt_EORT);}#line 45 "indicators.pgc" { ECPGtrans(__LINE__, NULL, "commit work");}#line 46 "indicators.pgc" { ECPGdisconnect(__LINE__, "CURRENT");}#line 48 "indicators.pgc" return 0;}
开发者ID:42penguins,项目名称:postgres,代码行数:96,
示例17: mainint main(void){ #line 14 "test_informix.pgc" int i = 14 ;#line 14 "test_informix.pgc" #line 15 "test_informix.pgc" decimal j , m , n ;#line 15 "test_informix.pgc" #line 16 "test_informix.pgc" char c [ 10 ] ;#line 16 "test_informix.pgc" ECPGdebug(1, stderr); /* exec sql whenever sqlerror do dosqlprint ( ) ; */#line 19 "test_informix.pgc" { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , NULL, 0); #line 21 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 21 "test_informix.pgc" if (sqlca.sqlcode != 0) exit(1); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table test ( i int primary key , j int , c text )", ECPGt_EOIT, ECPGt_EORT);#line 24 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 24 "test_informix.pgc" /* this INSERT works */ rsetnull(CDECIMALTYPE, (char *)&j); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( 7 , $1 , 'test ' )", ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 28 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 28 "test_informix.pgc" { ECPGtrans(__LINE__, NULL, "commit");#line 29 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 29 "test_informix.pgc" /* this INSERT should fail because i is a unique column */ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( 7 , 12 , 'a' )", ECPGt_EOIT, ECPGt_EORT);#line 32 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 32 "test_informix.pgc" printf("INSERT: %ld=%s/n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");#line 34 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 34 "test_informix.pgc" { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( $1 , 1 , 'a ' )", ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 36 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 36 "test_informix.pgc" { ECPGtrans(__LINE__, NULL, "commit");#line 37 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 37 "test_informix.pgc" /* this will fail (more than one row in subquery) */ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test )", ECPGt_EOIT, ECPGt_EORT);#line 40 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 40 "test_informix.pgc" { ECPGtrans(__LINE__, NULL, "rollback");#line 41 "test_informix.pgc"if (sqlca.sqlcode < 0) dosqlprint ( );}#line 41 "test_informix.pgc"//.........这里部分代码省略.........
开发者ID:0x0FFF,项目名称:postgres,代码行数:101,
示例18: mainint main(){ /* exec sql begin declare section */ typedef struct { #line 30 "array_of_struct.pgc" struct varchar_name_30 { int len; char arr[ 50 ]; } name ; #line 31 "array_of_struct.pgc" int phone ; } customer2 ;#line 32 "array_of_struct.pgc" #line 26 "array_of_struct.pgc" customer custs1 [ 10 ] ; #line 27 "array_of_struct.pgc" cust_ind inds [ 10 ] ; #line 33 "array_of_struct.pgc" customer2 custs2 [ 10 ] ; #line 38 "array_of_struct.pgc" struct customer3 { #line 36 "array_of_struct.pgc" struct varchar_name_36 { int len; char arr[ 50 ]; } name ; #line 37 "array_of_struct.pgc" int phone ; } custs3 [ 10 ] ; #line 43 "array_of_struct.pgc" struct customer4 { #line 41 "array_of_struct.pgc" struct varchar_name_41 { int len; char arr[ 50 ]; } name ; #line 42 "array_of_struct.pgc" int phone ; } custs4 ; #line 44 "array_of_struct.pgc" int r ; #line 45 "array_of_struct.pgc" struct varchar_onlyname_45 { int len; char arr[ 50 ]; } onlyname [2] ;/* exec sql end declare section */#line 46 "array_of_struct.pgc" ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); #line 50 "array_of_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 50 "array_of_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 50 "array_of_struct.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table customers ( c varchar ( 50 ) , p int )", ECPGt_EOIT, ECPGt_EORT);#line 52 "array_of_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 52 "array_of_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 52 "array_of_struct.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into customers values ( 'John Doe' , '12345' )", ECPGt_EOIT, ECPGt_EORT);#line 53 "array_of_struct.pgc"if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();#line 53 "array_of_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 53 "array_of_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}//.........这里部分代码省略.........
开发者ID:50wu,项目名称:gpdb,代码行数:101,
示例19: mainintmain (void){/* exec sql begin declare section */ #line 23 "cursor.pgc" char * stmt1 = "SELECT id, t FROM t1" ; #line 24 "cursor.pgc" char * curname1 = CURNAME ; #line 25 "cursor.pgc" char * curname2 = CURNAME ; #line 26 "cursor.pgc" char * curname3 = CURNAME ; #line 27 "cursor.pgc" struct varchar_1 { int len; char arr[ 50 ]; } curname4 ; #line 28 "cursor.pgc" char * curname5 = CURNAME ; #line 29 "cursor.pgc" int count ; #line 30 "cursor.pgc" int id ; #line 31 "cursor.pgc" char t [ 64 ] ;/* exec sql end declare section */#line 32 "cursor.pgc" char msg[128]; ECPGdebug(1, stderr); strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , "test1", 0); #line 39 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 39 "cursor.pgc" { ECPGconnect(__LINE__, 0, "connectdb" , NULL, NULL , "test2", 0); #line 40 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 40 "cursor.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);#line 43 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 43 "cursor.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);#line 46 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 46 "cursor.pgc" { ECPGdo(__LINE__, 0, 1, "test2", 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT, ECPGt_EORT);#line 47 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 47 "cursor.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT, ECPGt_EORT);#line 50 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 50 "cursor.pgc" { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT, ECPGt_EORT);#line 51 "cursor.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 51 "cursor.pgc" { ECPGdo(__LINE__, 0, 1, "test1", 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT, ECPGt_EORT);#line 52 "cursor.pgc"//.........这里部分代码省略.........
开发者ID:zboszor,项目名称:ecpg-readahead,代码行数:101,
示例20: mainint main() { /* exec sql whenever sql_warning do warn ( ) ; */#line 18 "char_array.pgc" /* exec sql whenever sqlerror stop ; */#line 19 "char_array.pgc" const char *ppppp = "XXXXX"; int loopcount; /* exec sql begin declare section */ #line 24 "char_array.pgc" char shortstr [ 5 ] ; #line 25 "char_array.pgc" char bigstr [ 11 ] ; #line 26 "char_array.pgc" short shstr_ind = 0 ; #line 27 "char_array.pgc" short bigstr_ind = 0 ;/* exec sql end declare section */#line 28 "char_array.pgc" ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 3, "ecpg1_regression" , NULL, NULL , NULL, 0); #line 31 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 31 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 31 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "create table strdbase ( strval varchar ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);#line 33 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 33 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 33 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( '' )", ECPGt_EOIT, ECPGt_EORT);#line 34 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 34 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 34 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'AB' )", ECPGt_EOIT, ECPGt_EORT);#line 35 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 35 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 35 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCD' )", ECPGt_EOIT, ECPGt_EORT);#line 36 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 36 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 36 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDE' )", ECPGt_EOIT, ECPGt_EORT);#line 37 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 37 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 37 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDEF' )", ECPGt_EOIT, ECPGt_EORT);#line 38 "char_array.pgc"if (sqlca.sqlwarn[0] == 'W') warn ( );#line 38 "char_array.pgc"if (sqlca.sqlcode < 0) exit (1);}#line 38 "char_array.pgc" { ECPGdo(__LINE__, 3, 1, NULL, 0, ECPGst_normal, "insert into strdbase values ( 'ABCDEFGHIJ' )", ECPGt_EOIT, ECPGt_EORT);#line 39 "char_array.pgc"//.........这里部分代码省略.........
开发者ID:MasahikoSawada,项目名称:postgresql,代码行数:101,
示例21: mainint main() { /* exec sql begin declare section */ #line 9 "show.pgc" char var [ 25 ] = "public" ;/* exec sql end declare section */#line 10 "show.pgc" ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }#line 13 "show.pgc" /* exec sql whenever sql_warning sqlprint ; */#line 15 "show.pgc" /* exec sql whenever sqlerror sqlprint ; */#line 16 "show.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to $0", ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);#line 18 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 18 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 18 "show.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT, ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);#line 19 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 19 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 19 "show.pgc" printf("Var: Search path: %s/n", var); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);#line 22 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 22 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 22 "show.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT, ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);#line 23 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 23 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 23 "show.pgc" printf("Var: Search path: %s/n", var); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);#line 26 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 26 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 26 "show.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT, ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);#line 27 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 27 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 27 "show.pgc" printf("Var: Standard conforming strings: %s/n", var); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);#line 30 "show.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();#line 30 "show.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 30 "show.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show time zone", ECPGt_EOIT, //.........这里部分代码省略.........
开发者ID:0x0FFF,项目名称:postgres,代码行数:101,
示例22: mainintmain (void){/* exec sql begin declare section */ #line 19 "array.pgc" int i = 1 , j ; #line 20 "array.pgc" int * did = & i ; #line 21 "array.pgc" short a [ 10 ] = { 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 } ; #line 22 "array.pgc" timestamp ts [ 10 ] ; #line 23 "array.pgc" date d [ 10 ] ; #line 24 "array.pgc" interval in [ 10 ] ; #line 25 "array.pgc" numeric n [ 10 ] ; #line 26 "array.pgc" char text [ 25 ] = "klmnopqrst" ; #line 27 "array.pgc" char * t = ( char * ) malloc ( 11 ) ; #line 28 "array.pgc" double f ;/* exec sql end declare section */#line 29 "array.pgc" strcpy(t, "0123456789"); setlocale(LC_ALL, "C"); ECPGdebug(1, stderr); for (j = 0; j < 10; j++) { char str[20]; numeric *value; interval *inter; sprintf(str, "2000-1-1 0%d:00:00", j); ts[j] = PGTYPEStimestamp_from_asc(str, NULL); sprintf(str, "2000-1-1%d/n", j); d[j] = PGTYPESdate_from_asc(str, NULL); sprintf(str, "%d hours", j+10); inter = PGTYPESinterval_from_asc(str, NULL); in[j] = *inter; value = PGTYPESnumeric_new(); PGTYPESnumeric_from_int(j, value); n[j] = *value; } { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); #line 53 "array.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 53 "array.pgc" { ECPGsetcommit(__LINE__, "on", NULL);#line 55 "array.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 55 "array.pgc" { ECPGtrans(__LINE__, NULL, "begin work");#line 57 "array.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 57 "array.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test ( f float , i int , a int [ 10 ] , text char ( 10 ) , ts timestamp [ 10 ] , n numeric [ 10 ] , d date [ 10 ] , inter interval [ 10 ] )", ECPGt_EOIT, ECPGt_EORT);#line 59 "array.pgc"if (sqlca.sqlcode < 0) sqlprint();}#line 59 "array.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into test ( f , i , a , text , ts , n , d , inter ) values ( 404.90 , 3 , '{0,1,2,3,4,5,6,7,8,9}' , 'abcdefghij' , $1 , $2 , $3 , $4 )", ECPGt_timestamp,&(ts),(long)1,(long)10,sizeof(timestamp), //.........这里部分代码省略.........
开发者ID:AmiGanguli,项目名称:postgres,代码行数:101,
示例23: mainintmain(void){/* exec sql begin declare section */ #line 16 "test1.pgc" char db [ 200 ] ; #line 17 "test1.pgc" char pw [ 200 ] ;/* exec sql end declare section */#line 18 "test1.pgc" ECPGdebug(1, stderr); { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }#line 22 "test1.pgc" { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user1 encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}#line 23 "test1.pgc" { ECPGdisconnect(__LINE__, "CURRENT");}#line 24 "test1.pgc" /* <-- "main" not specified */ { ECPGconnect(__LINE__, 0, "[email C++ EC_GROUP_free函数代码示例 C++ ECORE_MAGIC_FAIL函数代码示例
|