예제 #1
0
int FC_FUNC_(oraclesim_getvarhead, ORACLESIM_GETVARHEAD)
     (OracleDbConnection **fdbconnid /*, int *var */) {
  OracleDbConnection *dbconnid = *fdbconnid;

  int oidentnr, olt1, ol1, olt2, ol2, opind, op1, op2;

  /* Preparo l'estrazione variabili */
  checkerr(dbconnid, OCIStmtPrepare(dbconnid->stmthp, dbconnid->errhp,
				    (text *) varquery,
				    (ub4) strlen(varquery),
				    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));

  /*
  checkerr(dbconnid, OCIBindByName(dbconnid->stmthp, &dbconnid->bnd1p,
				   dbconnid->errhp, (text *) ":var",
				   -1, (dvoid *) var,
				   (sword) sizeof(*var), SQLT_INT, (dvoid *) NULL,
				   (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0,
				   OCI_DEFAULT));
  */
  
  /* definisco l'uscita */
  vardefine(dbconnid, &oidentnr, &olt1, &ol1, &olt2, &ol2, &opind, &op1, &op2);
  return countrows(dbconnid);
}
예제 #2
0
파일: var.cpp 프로젝트: NicolasLiu/complier
void varblock()
{
	getSym();
	do 
	{
		vardefine();
		if (errorMark)
		{
			errorMark = 0;
		}
		getSym();
	} while (symbol.type == _identifier);
}
예제 #3
0
int FC_FUNC_(oraclesim_getvarvol, ORACLESIM_GETVARVOL)
     (OracleDbConnection **fdbconnid, int *nr, int *vnr, int *oidentnr,
      int *olt1, int *ol1, int *olt2, int *ol2,
      int *opind, int *op1, int *op2, int *imiss) {
  OracleDbConnection *dbconnid = *fdbconnid;
  int i, ret;
  sword status;

  /* definisco l'uscita */
  vardefine(dbconnid, oidentnr, olt1, ol1, olt2, ol2, opind, op1, op2);

  status=checkerr(dbconnid, OCIStmtFetch2(dbconnid->stmthp, dbconnid->errhp,
					  (ub4) *nr, OCI_FETCH_FIRST, (sb4) 0,
					  (ub4) OCI_DEFAULT));
  if (status == OCI_SUCCESS || status == OCI_NO_DATA) {
    if (checkerr(dbconnid, OCIAttrGet(dbconnid->stmthp, OCI_HTYPE_STMT, vnr, 0, 
				      OCI_ATTR_ROW_COUNT, dbconnid->errhp))
	== OCI_SUCCESS) {
      for (i=0; i<*vnr; i++) { /* inserisco i dati mancanti stile libsim */
 	if (olt1[i] == -999) {
	  olt1[i] = *imiss;
	  ol1[i] = *imiss;
	} else {
	  if (ol1[i] == -999) ol1[i] = *imiss;
	}
	if (olt2[i] == 0 || olt2[i] == -999) { /* in Oracle qui c'e` 0 al posto di mancante */
	  olt2[i] = *imiss;
	  ol2[i] = *imiss;
	} else {
	  if (ol2[i] == -999) ol2[i] = *imiss;
	}
	if (opind[i] == -999) opind[i] = *imiss;
	if (op1[i] == -999) op1[i] = *imiss;
	if (op2[i] == -999) op2[i] = *imiss;
      }
    } else {
      *vnr = 0;
    }
    ret = 0;
  } else {
    *vnr = 0;
    ret = 2;
  }
  return ret;
}