- 论坛徽章:
- 0
|
文件部署src/yang_db_drv.pc- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include "yang_const_define.h"
- #include "yang_struct_define.h"
- EXEC SQL BEGIN DECLARE SECTION;
- VARCHAR username[20];
- VARCHAR password[20];
- EXEC SQL END DECLARE SECTION;
- EXEC SQL INCLUDE sqlca;
- DB_RETCD
- yang_db_init(char *user , char *pwd )
- {
-
- strcpy( username.arr , user );
- username.len = strlen( username.arr );
- strcpy( password.arr , pwd );
- password.len = strlen( password.arr );
-
- EXEC SQL CONNECT :username IDENTIFIED BY :password;
-
- if(sqlca.sqlcode != 0)
- return DB_FAILURE;
- return DB_SUCCESS;
- }
- void
- yang_db_exit()
- {
- EXEC SQL COMMIT WORK RELEASE;
- }
- DB_RETCD
- yang_db_insert(SFTP_FILE_LOG *p_sftp_file_log)
- {
- return DB_SUCCESS;
- }
- DB_RETCD
- yang_db_select(SFTP_FILE_LOG *p_sftp_file_log , int mode )
- {
- return DB_SUCCESS;
- }
- DB_RETCD
- yang_db_update(SFTP_FILE_LOG *p_sftp_file_log , int mode )
- {
- return DB_SUCCESS;
- }
- DB_RETCD
- yang_db_delete(SFTP_FILE_LOG *p_sftp_file_log , int mode)
- {
- return DB_SUCCESS;
- }
复制代码 文件部署include/yang_const_define.h- #ifndef _YANG_CONST_DEFINE_H
- #define _YANG_CONST_DEFINE_H
- #define DB_SUCCESS 0
- #define DB_FAILURE 1
- #define DB_FATAL 2
- #define SUCCESS 0
- #define FAILURE 1
- #define FATAL 2
- #define DB_RETCD unsigned int
- #define RETCD unsigned int
- #endif
复制代码 文件部署include/yang_struct_define.h
[code#ifndef _YANG_STRUCT_DEFINE_H
#define _YANG_STRUCT_DEFINE_H
typedef struct
{
char s_file_name[150+1];
char s_txn_date[8+1];
char s_file_type[6+1];
char c_io_flag;
char s_member_id[12+1];
char s_member_type[2+1];
char s_cre_date_time[10+1];
char s_rcv_date_time[10+1];
char s_snd_date_time[10+1];
char s_server_pid[8+1];
char s_client_pid[8+1];
char s_rcv_pkg[4+1];
char c_status;
char s_ret_cd[8+1];
}
SFTP_FILE_LOG;
#endif[/code]
src名录下 执行 proc yang_db_drv.pc
错误如下:
================================================
[AIX:/si/usr/yangj/efss2dev/workspace/src]proc yang_db_drv.pc
Pro*C/C++: Release 10.2.0.3.0 - Production on Wed Feb 15 17:15:55 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /home2/oracle/app/oracle/product/10.2.0/precomp/admin/pcscfg.cfg
Syntax error at line 14, column 1, file yang_db_drv.pc:
Error at line 14, column 1 in file yang_db_drv.pc
yang_db_init(char *user , char *pwd )
1
PCC-S-02201, Encountered the symbol "yang_db_init" when expecting one of the fol
lowing:
; , = ( [
The symbol ";" was substituted for "yang_db_init" to continue.
Syntax error at line 36, column 1, file yang_db_drv.pc:
Error at line 36, column 1 in file yang_db_drv.pc
yang_db_insert(SFTP_FILE_LOG *p_sftp_file_log)
1
PCC-S-02201, Encountered the symbol "yang_db_insert" when expecting one of the f
ollowing:
; , = ( [
The symbol "=" was substituted for "yang_db_insert" to continue.
Syntax error at line 37, column 1, file yang_db_drv.pc:
Error at line 37, column 1 in file yang_db_drv.pc
{
1
PCC-S-02201, Encountered the symbol "{" when expecting one of the following:
; , = ( [ * ? | & < > + - / % . ^ *= /= %= += -= <<= >>= &&=
||= ^= | & == != <= >= << >> ++ -- ->
Syntax error at line 42, column 1, file yang_db_drv.pc:
Error at line 42, column 1 in file yang_db_drv.pc
yang_db_select(SFTP_FILE_LOG *p_sftp_file_log , int mode )
1
PCC-S-02201, Encountered the symbol "yang_db_select" when expecting one of the f
ollowing:
; , = : ( [ * ? | & < > + - / % . ^ *= /= %= += -= <<= >>=
&&= ||= ^= | & == != <= >= << >> ++ -- ->
The symbol ";" was substituted for "yang_db_select" to continue.
Syntax error at line 42, column 53, file yang_db_drv.pc:
Error at line 42, column 53 in file yang_db_drv.pc
yang_db_select(SFTP_FILE_LOG *p_sftp_file_log , int mode )
....................................................1
PCC-S-02201, Encountered the symbol "mode" when expecting one of the following:
, ( ) [ * const, long, short, signed, unsigned, volatile,
Syntax error at line 0, column 0, file yang_db_drv.pc:
Error at line 0, column 0 in file yang_db_drv.pc
PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the following:
; : an identifier, end-exec, random_terminal
Error at line 0, column 0 in file yang_db_drv.pc
PCC-F-02102, Fatal error while doing C preprocessing
====================================================
怎么包含编译成功?
/src
yang_test_ctl.c //主函数目录(测试各种操作)
yang_db_drv.pc //操作数据库函数
/include
yang_const_define.h //常量定义
yang_function_define.h //函数宏定义
yang_struct_define.h //结构体定义
yang_test_ctl.h //主函数头文件
yang_db_drv.h //oracle仿驱动头文件
如何生成可执行文件? 帮写个简单的makefile 或者 让pc成功变成.c也行 多谢大虾 请高手教导 指条明路 |
|