Esempio n. 1
0
int INGexec(INGconn *dbconn, const char *query, bool explicit_commit)
{
/* # line 522 "myingres.sc" */

  int sess_id;
  int rowcount;
  int errors;
  char *stmt;
/* # line 527 "myingres.sc" */

   rowcount = -1;
   stmt = bstrdup(query);
/* # line 534 "myingres.sc" */	/* host code */
   /*
    * Switch to the correct default session for this thread.
    */
   sess_id = dbconn->session_id;
/* # line 538 "myingres.sc" */	/* set_sql */
  {
    IILQssSetSqlio(11,(short *)0,1,30,sizeof(sess_id),&sess_id);
  }
/* # line 540 "myingres.sc" */	/* execute */
  {
    IIsqInit(&sqlca);
    IIsqExImmed(stmt);
    IIsyncup((char *)0,0);
    if (sqlca.sqlcode < 0)
      goto bail_out;
  }
/* # line 541 "myingres.sc" */	/* inquire_ingres */
  {
    IILQisInqSqlio((short *)0,1,30,sizeof(rowcount),&rowcount,8);
  }
/* # line 543 "myingres.sc" */	/* host code */
   /*
    * See if the negative rowcount is due to errors.
    */
   if (rowcount < 0) {
/* # line 547 "myingres.sc" */	/* inquire_ingres */
  {
    IILQisInqSqlio((short *)0,1,30,sizeof(errors),&errors,0);
  }
/* # line 549 "myingres.sc" */	/* host code */
      /*
       * If the number of errors is 0 we got a negative rowcount
       * because the statement we executed doesn't give a rowcount back.
       * Lets pretend we have a rowcount of 1 then.
       */
      if (errors == 0) {
         rowcount = 1;
      }
   }
/* # line 561 "myingres.sc" */	/* host code */
bail_out:
   /*
    * If explicit_commit is set we commit our work now.
    */
   if (explicit_commit) {
/* # line 566 "myingres.sc" */	/* commit */
  {
    IIsqInit(&sqlca);
    IIxact(3);
  }
/* # line 567 "myingres.sc" */	/* host code */
   }
   /*
    * Switch to no default session for this thread.
    */
/* # line 572 "myingres.sc" */	/* set_sql */
  {
    IILQssSetSqlio(11,(short *)0,1,30,sizeof(-97),(void *)IILQint(-97));
  }
/* # line 573 "myingres.sc" */	/* host code */
   free(stmt);
   return rowcount;
}
Esempio n. 2
0
void
IIpsqExImmed(char *query)
{
    IIsqExImmed(query);
}