分类: C/C++
2008-11-18 00:45:40
含义 |
Informix,ESQL/C |
Oracle,PROC |
插入时列数不匹配 |
-236 |
(待查) |
字段不存在 |
-217 |
(待查) |
含义 |
Informix,ESQL/C |
Oracle,PROC |
找到数据 |
0 |
0 |
找不到数据 |
100 |
1403 |
插入时重复 |
-239 |
-1 |
找到记录不唯一 |
(待查) |
(待查) |
范围超限 |
(待查) |
1480 |
找到值为NULL |
(待查) |
-1405 |
其他(待续) |
|
|
Informix,ESQL/C |
Oracle,PROC |
"$select " |
"EXEC SQL select " |
"$insert " |
"EXEC SQL insert " |
"$update " |
"EXEC SQL update " |
"$delete " |
"EXEC SQL delete " |
"$prepare " |
"EXEC SQL prepare " |
"$declare " |
"EXEC SQL declare " |
"$open " |
"EXEC SQL open " |
"$fetch " |
"EXEC SQL fetch " |
"$close " |
"EXEC SQL close " |
"$free " |
"EXEC SQL free "或"free_cursor(); //" |
"$begin work" |
"EXEC SQL begin work"或"begin_work()" |
"$commit work" |
"EXEC SQL commit work" |
"$rollback work" |
"EXEC SQL rollback"或"rollback_work()" |
"$database " |
"EXEC SQL database "或"open_database()" |
"$close database " |
"EXEC SQL database "或"close_database()" |
/*
*文件:db_ifx.ec
*描述:用于处理INFORMIX数据库
*/
EXEC SQL include sqlca;
/*打开数据库*/
int open_database(void)
{
EXEC SQL database devp_jxnc;
if(sqlca.sqlcode){
printf("open_database error:%d\n", sqlca.sqlcode);
return -1;
} else{
return 0;
}
}
/*关闭数据库*/
void close_database(void)
{
EXEC SQL close database;
}
/*开始事务*/
int begin_work(void)
{
EXEC SQL begin work;
if(sqlca.sqlcode){
printf("begin_work error:%d\n", sqlca.sqlcode);
return -1;
} else{
return 0;
}
}
/*回滚事务*/
int rollback_work(void)
{
EXEC SQL rollback work;
if(sqlca.sqlcode){
printf("rollback_work error:%d\n", sqlca.sqlcode);
return -1;
} else{
return 0;
}
}
/*释放游标*/
void free_cursor(void)
{
return;
}
|
/*
*文件:db_ora.ec
*描述:用于处理ORACLE数据库
*/
EXEC SQL include sqlca;
/*打开数据库*/
int open_database(void)
{
EXEC SQL BEGIN DECLARE SECTION;
char username[50];
char password[50];
EXEC SQL END DECLARE SECTION;
memset(username, 0, sizeof(username));
memset(password, 0, sizeof(password));
strcpy(username, "posp");
strcpy(password, "posp");
EXEC SQL connect :username identified by :password;
if(sqlca.sqlcode){
printf("open_database error:%d\n", sqlca.sqlcode);
return -1;
} else{
return 0;
}
}
/*关闭数据库*/
void close_database(void)
{
return;
}
/*开始事务*/
int begin_work(void)
{
return 0;
}
/*回滚事务*/
int rollback_work(void)
{
EXEC SQL rollback;
if(sqlca.sqlcode){
printf("rollback_work error:%d\n", sqlca.sqlcode);
return -1;
} else{
return 0;
}
}
/*释放游标*/
void free_cursor(void)
{
return;
}
|
#Makefile for informxi/oracle
#no tuxedo env
#1.定义公共make变量
APPDIR=$(HOME)
DB_HOME=$(INFORMIXDIR)
BIN_DIR=$(APPDIR)/bin
#2.定义informix/oracle数据库相关的make变量
#2.1 informix下的make变量设置
INCL_DB=$(DB_HOME)/incl/esql
DB_OBJ=db_ifx.o
DBLIB=$(INFORMIXDIR)/lib/esql/checkapi.o -L$(INFORMIXDIR)/lib/esql -L$(INFORMIXDIR)/lib -lixsql -lixasf -lixgen -lixos -lixgls -lnsl_s -lcrypt_i -lsocket -lm -lsuds -lx
ECC=esql
CFLAGS_1=-DDB_IS_INFORMIX
CFLAGS_2=
#informix.设置.end
#2.2 oracle下的make变量设置
#INCL_DB=$(DB_HOME)/precomp/lib
#DB_OBJ=db_ora.o
#DBLIB=-L$(ORACLE_HOME)/lib -lm -lclntsh
#PROC=proc userid=posp/posp sqlcheck=full char_map=string def_sqlcode=yes
#CFLAGS_1=-q64 -qcpluscmt -DDB_IS_ORACLE
#CFLAGS_2=-q64
#oracle.设置.end
#3.CC变量及include
CC=cc
INCL_APP=$(APPDIR)/incl
INCL_TUXEDO=$(TUXDIR)/include
INCL_FLAG=-I$(INCL_APP) -I$(INCL_DB)
INCL_FLAG2=include=$(INCL_APP) include=$(INCL_DB)
#4.应用依赖的OBJ设置
clean:
rm -f *.o
TESTAPP=mylib.o #等等
testapp:testapp.o $(LIB_TESTAPP) $(DB_OBJ)
$(CC) $(CFLAGS_2) -o $@ $? \
$(DBLIB)
mv $@ $(BIN_DIR)
.SUFFIXES:.c
.SUFFIXES:.ec
.ec.o:
$(ECC) $(INCL_FLAG) $(CFLAGS_1) -c -o $*.o $*.ec
rm -f $*.c
.c.o:
$(CC) $(INCL_FLAG) $(CFLAGS_1) -c -o $*.o $*.c
|
#Makefile for informxi/oracle
#no tuxedo env
#1.定义公共make变量
APPDIR=$(HOME)
DB_HOME=$(ORACLE_HOME)
BIN_DIR=$(APPDIR)/bin
#2.定义informix/oracle数据库相关的make变量
#2.1 informix下的make变量设置
#INCL_DB=$(DB_HOME)/incl/esql
#DB_OBJ=db_ifx.o
#DBLIB=$(INFORMIXDIR)/lib/esql/checkapi.o -L$(INFORMIXDIR)/lib/esql -L$(INFORMIXDIR)/lib -lixsql -lixasf -lixgen -lixos -lixgls -lnsl_s -lcrypt_i -lsocket -lm -lsuds -lx
#ECC=esql
#CFLAGS_1=-DDB_IS_INFORMIX
#CFLAGS_2=
#informix.设置.end
#2.2 oracle下的make变量设置
INCL_DB=$(DB_HOME)/precomp/public
DB_OBJ=db_ora.o
DBLIB=-L$(ORACLE_HOME)/lib -lm -lclntsh
PROC=proc userid=posp/posp sqlcheck=full char_map=string def_sqlcode=yes
CFLAGS_1=-q64 -qcpluscmt -DDB_IS_ORACLE
CFLAGS_2=-q64
#oracle.设置.end
#3.CC变量及include
CC=cc
INCL_APP=$(APPDIR)/incl
INCL_TUXEDO=$(TUXDIR)/include
INCL_FLAG=-I$(INCL_APP) -I$(INCL_DB)
INCL_FLAG2=include=$(INCL_APP) include=$(INCL_DB)
#4.应用所依赖的OBJ设置等
clean:
rm -f *.o
TESTAPP=mylib.o #等等
testapp:testapp.o $(LIB_TESTAPP) $(DB_OBJ)
$(CC) $(CFLAGS_2) -o $@ $? \
$(DBLIB)
mv $@ $(BIN_DIR)
.SUFFIXES:.c
.SUFFIXES:.ec
.ec.o:
$(PROC) $(INCL_FLAG2) iname=$*.ec oname=$*.c
$(CC) $(INCL_FLAG) $(CFLAGS_1) -c -o $*.o $*.c
rm -f $*.c
rm -f $*.lis
.c.o:
$(CC) $(INCL_FLAG) $(CFLAGS_1) -c -o $*.o $*.c
|