编译提示错误:
In file included from test.c:1:
oraapi.h:27:19: sqlca.h: No such file or directory
oraapi.h:28:19: sqlda.h: No such file or directory
oraapi.h:29:20: sqlcpr.h: No such file or directory
In file included from test.c:1:
oraapi.h:168:21: ora_api.h: No such file or directory
test.c:6:1: warning: no newline at end of file
怎么回事?
/* Convert other type to char type */
if ( selectda->T[i] != 24 )
selectda->T[i] = 1;
} /* end for */
res->select_da = selectda;
res->bind_da = bindda;
return 0;
select_error:
return -1;
}
int ora_fetch_row(ORASQL* con, ORASQL_RES* res, ORASQL_ROW* row)
{
int i, j;
SQLDA* selectda;
SQL_CONTEXT* conn;
conn = (SQL_CONTEXT*)con;
selectda = (res->select_da);
EXEC SQL WHENEVER NOT FOUND GOTO not_found;
EXEC SQL WHENEVER SQLERROR GOTO not_found;
EXEC SQL CONTEXT USE :(*conn);
EXEC SQL FETCH C USING DESCRIPTOR selectda;
/* Define maximal columns or maximal binded variables of table */
#define MAX_ITEMS 40
/* Define maximal length of selected column name or binded variable name */
#define MAX_VNAME_LEN 30
/* Define maximal length of indication variable name */
#define MAX_INAME_LEN 30
/* Define connection handle of Oracle */
typedef void* ORASQL;
/* Define result handle of Oracle */
typedef struct {
SQLDA* select_da;
SQLDA* bind_da;
} ORASQL_RES;
/* Define record handle of Oracle */
typedef struct {
int num;
char field[MAX_ITEMS][512];
} ORASQL_ROW;
/*-
Name:
int ora_connect(ORASQL* con, const char* usr, const char* pwd, const char* sid)
Description:
Connect to Oracle database.
Input Parameters:
usr: user name
pwd: user password
sid: service id
Output Parameters:
con: connection handle
Return Value:
0, otherwise -1 is returned if an error occurred
-*/
int ora_connect(ORASQL* con, const char* usr, const char* pwd, const char* sid);
/*-
Name:
int ora_close(ORASQL* con)
Description:
Close connection to Oracle database.
Input Parameters:
con: connection handle
Output Parameters:
nothing
Return Value:
0, otherwise -1 is returned if an error occurred
-*/
int ora_close(ORASQL* con);
/*-
Name:
int ora_query(ORASQL* con, const char* sqlbuf, ORASQL_RES* res)
Description:
Query Oracle database.
Input Parameters:
con: connection handle
sqlbuf: sql statement
Output Parameters:
res: returned result handle
Return Value:
the number of records affected, otherwise -1 is returned if an error occurred
-*/
int ora_query(ORASQL* con, const char* sqlbuf, ORASQL_RES* res);
/*-
Name:
int ora_fetch_row(ORASQL* con, ORASQL_RES* res, ORASQL_ROW* row)
Description:
Fetch record from result handle.
Input Parameters:
con: connection handle
res: result handle
Output Parameters:
row: record handle
Return Value:
0, otherwise -1 is returned if an error occurred
-*/
int ora_fetch_row(ORASQL* con, ORASQL_RES* res, ORASQL_ROW* row);
/*-
Name:
int ora_free_result(ORASQL* con, ORASQL_RES* res)
Description:
Free result handle.
Input Parameters:
con: connection handle
res: result handle
Output Parameters:
nothing
Return Value:
0, otherwise -1 is returned if an error occurred
-*/
int ora_free_result(ORASQL* con, ORASQL_RES* res);
/* Object support */
struct sqltvn
{
unsigned char *tvnvsn;
unsigned short tvnvsnl;
unsigned char *tvnnm;
unsigned short tvnnml;
unsigned char *tvnsnm;
unsigned short tvnsnml;
};
typedef struct sqltvn sqltvn;
struct sqladts
{
unsigned int adtvsn;
unsigned short adtmode;
unsigned short adtnum;
sqltvn adttvn[1];
};
typedef struct sqladts sqladts;
static struct sqladts sqladt = {
1,1,0,
};
/* Binding to PL/SQL Records */
struct sqltdss
{
unsigned int tdsvsn;
unsigned short tdsnum;
unsigned char *tdsval[1];
};
typedef struct sqltdss sqltdss;
static struct sqltdss sqltds =
{
1,
0,
};
/* File name & Package Name */
struct sqlcxp
{
unsigned short fillen;
char filnam[51];
};
static const struct sqlcxp sqlfpn =
{
50,
"C:\\Documents and Settings\\Administrator\\桌面\\q.txt"
};
static unsigned int sqlctx = 1653460308;
static struct sqlexd {
unsigned int sqlvsn;
unsigned int arrsiz;
unsigned int iters;
unsigned int offset;
unsigned short selerr;
unsigned short sqlety;
unsigned int occurs;
const short *cud;
unsigned char *sqlest;
const char *stmt;
sqladts *sqladtp;
sqltdss *sqltdsp;
void **sqphsv;
unsigned int *sqphsl;
int *sqphss;
void **sqpind;
int *sqpins;
unsigned int *sqparm;
unsigned int **sqparc;
unsigned short *sqpadto;
unsigned short *sqptdso;
unsigned int sqlcmax;
unsigned int sqlcmin;
unsigned int sqlcincr;
unsigned int sqlctimeout;
unsigned int sqlcnowait;
int sqfoff;
unsigned int sqcmod;
unsigned int sqfmod;
void *sqhstv[1];
unsigned int sqhstl[1];
int sqhsts[1];
void *sqindv[1];
int sqinds[1];
unsigned int sqharm[1];
unsigned int *sqharc[1];
unsigned short sqadto[1];
unsigned short sqtdso[1];
} sqlstm = {12,1};