当前位置: 首页>>代码示例>>C++>>正文


C++ ECPGdo函数代码示例

本文整理汇总了C++中ECPGdo函数的典型用法代码示例。如果您正苦于以下问题:C++ ECPGdo函数的具体用法?C++ ECPGdo怎么用?C++ ECPGdo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ECPGdo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int 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,代码来源:preproc-strings.c

示例2: main

int 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,代码来源:thread-prep.c

示例3: openit

static 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,代码来源:compat_informix-test_informix.c

示例4: close_cur1

static void
close_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,代码来源:preproc-outofscope.c

示例5: get_record1

static void
get_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,代码来源:preproc-outofscope.c

示例6: open_cur1

static void
open_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,代码来源:preproc-outofscope.c

示例7: main

int
main (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,代码来源:compat_informix-sqlda.c

示例8: main

int 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,代码来源:sql-fetch.c

示例9: main

int 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,代码来源:thread-thread.c

示例10: main

int
main(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,代码来源:sql-execute.c

示例11: main

int
main (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,代码来源:preproc-variable.c

示例12: main

int 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,代码来源:preproc-whenever_do_continue.c

示例13: main

int
main (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,代码来源:sql-sqlda.c

示例14: main

int
main(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,代码来源:connect-test5.c

示例15: main

int
main (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,代码来源:preproc-outofscope.c


注:本文中的ECPGdo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。