/* Result Sets Interface */
#ifndef SQL_CRSR
# define SQL_CRSR
struct sql_cursor
{
unsigned int curocn;
void *ptr1;
void *ptr2;
unsigned long magic;
};
typedef struct sql_cursor sql_cursor;
typedef struct sql_cursor SQL_CURSOR;
#endif /* SQL_CRSR */
/* Thread Safety */
typedef void * sql_context;
typedef void * SQL_CONTEXT;
/* 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[13];
};
static struct sqlcxp sqlfpn =
{
12,
"db_detail.pc"
};
static unsigned long sqlctx = 291371;
static struct sqlexd {
unsigned int sqlvsn;
unsigned int arrsiz;
unsigned int iters;
unsigned int offset;
unsigned short selerr;
unsigned short sqlety;
unsigned int occurs;
short *cud;
unsigned char *sqlest;
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;
void *sqhstv[10];
unsigned int sqhstl[10];
int sqhsts[10];
void *sqindv[10];
int sqinds[10];
unsigned int sqharm[10];
unsigned int *sqharc[10];
unsigned short sqadto[10];
unsigned short sqtdso[10];
} sqlstm = {10,10};
/* SQLLIB Prototypes */
extern sqlcxt (/*_ void **, unsigned long *,
struct sqlexd *, struct sqlcxp * _*/);
extern sqlcx2t(/*_ void **, unsigned long *,
struct sqlexd *, struct sqlcxp * _*/);
extern sqlbuft(/*_ void **, char * _*/);
extern sqlgs2t(/*_ void **, char * _*/);
extern sqlorat(/*_ void **, unsigned long *, void * _*/);
/* Forms Interface */
static int IAPSUCC = 0;
static int IAPFAIL = 1403;
static int IAPFTL = 535;
extern void sqliem(/*_ char *, int * _*/);
static char *sq0008 =
"select ename ,sal from emp ";
static char *sq0027 =
"select * from sale where sale_date between to_date(:b0,'yyyymmddhh24miss')\
and to_date(:b1,'yyyymmddhh24miss') ";
static char *sq0028 =
"select * from sale where staff_id=:b0 ";
static char *sq0029 =
"select * from staff ";
typedef struct { unsigned short len; unsigned char arr[1]; } VARCHAR;
typedef struct { unsigned short len; unsigned char arr[1]; } varchar;
/* CUD (Compilation Unit Data) Array */
static short sqlcud0[] =
{10,4130,0,0,0,
5,0,0,1,0,0,24,25,0,0,1,1,0,1,0,1,97,0,0,
24,0,0,2,0,0,24,26,0,0,1,1,0,1,0,1,97,0,0,
43,0,0,3,0,0,24,27,0,0,1,1,0,1,0,1,97,0,0,
62,0,0,4,93,0,4,49,0,0,4,2,0,1,0,2,97,0,0,2,3,0,0,1,97,0,0,1,97,0,0,
93,0,0,5,82,0,4,76,0,0,10,1,0,1,0,2,97,0,0,2,97,0,0,2,97,0,0,2,97,0,0,2,4,0,0,
2,4,0,0,2,3,0,0,2,4,0,0,2,3,0,0,1,97,0,0,
148,0,0,6,0,0,27,108,0,0,4,4,0,1,0,1,97,0,0,1,97,0,0,1,97,0,0,1,10,0,0,
179,0,0,7,0,0,30,127,0,0,0,0,0,1,0,
194,0,0,8,39,0,9,141,0,0,0,0,0,1,0,
209,0,0,8,0,0,13,148,0,0,2,0,0,1,0,2,97,0,0,2,4,0,0,
232,0,0,8,0,0,15,154,0,0,0,0,0,1,0,
247,0,0,8,0,0,15,163,0,0,0,0,0,1,0,
262,0,0,9,63,0,4,186,0,0,1,0,0,1,0,2,97,0,0,
281,0,0,10,45,0,4,192,0,0,1,0,0,1,0,2,3,0,0,
300,0,0,11,45,0,4,197,0,0,1,0,0,1,0,2,3,0,0,
319,0,0,12,63,0,4,221,0,0,1,0,0,1,0,2,97,0,0,
338,0,0,13,78,0,3,230,0,0,6,6,0,1,0,1,97,0,0,1,97,0,0,1,97,0,0,1,4,0,0,1,4,0,0,
1,4,0,0,
377,0,0,14,52,0,5,242,0,0,3,3,0,1,0,1,3,0,0,1,3,0,0,1,97,0,0,
404,0,0,15,51,0,5,248,0,0,1,1,0,1,0,1,97,0,0,
423,0,0,16,52,0,4,255,0,0,1,0,0,1,0,2,3,0,0,
442,0,0,17,53,0,3,258,0,0,5,5,0,1,0,1,3,0,0,1,97,0,0,1,97,0,0,1,3,0,0,1,4,0,0,
477,0,0,18,0,0,29,264,0,0,0,0,0,1,0,
492,0,0,19,82,0,4,299,0,0,2,1,0,1,0,2,97,0,0,1,3,0,0,
515,0,0,20,74,0,4,317,0,0,7,1,0,1,0,2,97,0,0,2,97,0,0,2,97,0,0,2,97,0,0,2,3,0,
0,2,97,0,0,1,97,0,0,
558,0,0,21,51,0,3,359,0,0,6,6,0,1,0,1,97,0,0,1,97,0,0,1,97,0,0,1,3,0,0,1,3,0,0,
1,97,0,0,
597,0,0,22,0,0,29,361,0,0,0,0,0,1,0,
612,0,0,23,100,0,5,401,0,0,6,6,0,1,0,1,97,0,0,1,97,0,0,1,3,0,0,1,3,0,0,1,97,0,
0,1,97,0,0,
651,0,0,24,0,0,29,404,0,0,0,0,0,1,0,
666,0,0,25,43,0,5,432,0,0,1,1,0,1,0,1,97,0,0,
685,0,0,26,0,0,29,435,0,0,0,0,0,1,0,
700,0,0,27,122,0,9,476,0,0,2,2,0,1,0,1,97,0,0,1,97,0,0,
723,0,0,27,0,0,13,487,0,0,6,0,0,1,0,2,97,0,0,2,97,0,0,2,97,0,0,2,4,0,0,2,4,0,0,
2,4,0,0,
762,0,0,27,0,0,15,495,0,0,0,0,0,1,0,
777,0,0,8,0,0,15,506,0,0,0,0,0,1,0,
792,0,0,28,49,0,9,539,0,0,1,1,0,1,0,1,97,0,0,
811,0,0,28,0,0,13,550,0,0,6,0,0,1,0,2,97,0,0,2,97,0,0,2,97,0,0,2,4,0,0,2,4,0,0,
2,4,0,0,
850,0,0,28,0,0,15,554,0,0,0,0,0,1,0,
865,0,0,28,0,0,15,565,0,0,0,0,0,1,0,
880,0,0,29,32,0,9,593,0,0,0,0,0,1,0,
895,0,0,29,0,0,13,604,0,0,6,0,0,1,0,2,97,0,0,2,97,0,0,2,97,0,0,2,3,0,0,2,3,0,0,
2,97,0,0,
934,0,0,29,0,0,15,613,0,0,0,0,0,1,0,
949,0,0,29,0,0,15,623,0,0,0,0,0,1,0,
};
#include <stdio.h>
#include <sqlca.h>
#include <string.h>
#include "db_detail.h"
#include "pu.h"
#include "link.h"
/***************************************************************
func:系统启动时根用户名和密码导入数据库文件
para:char *username,用户名;char *passwd,密码;char *db,数据库实例
retu:0
****************************************************************/
int db_import(char *username, char *passwd , char *db)
{
char str1[512] = {0};
char str2[512] = {0};
char str3[512] = {0};
char str4[512] = {0};
sprintf(str1,"drop user %s cascade",username);
sprintf(str2,"create user %s identified by %s",username,passwd);
sprintf(str3,"grant connect,resource to %s",username);
db_connect("system","manager","orcl");
/* EXEC SQL EXECUTE IMMEDIATE:str1; */
{
struct sqlexd sqlstm;
sqlstm.sqlvsn = 10;
sqlstm.arrsiz = 1;
sqlstm.sqladtp = &sqladt;
sqlstm.sqltdsp = &sqltds;
sqlstm.stmt = "";
sqlstm.iters = (unsigned int )1;
sqlstm.offset = (unsigned int )5;
sqlstm.cud = sqlcud0;
sqlstm.sqlest = (unsigned char *)&sqlca;
sqlstm.sqlety = (unsigned short)256;
sqlstm.occurs = (unsigned int )0;
sqlstm.sqhstv[0] = ( void *)str1;
sqlstm.sqhstl[0] = (unsigned int )512;
sqlstm.sqhsts[0] = ( int )0;
sqlstm.sqindv[0] = ( void *)0;
sqlstm.sqinds[0] = ( int )0;
sqlstm.sqharm[0] = (unsigned int )0;
sqlstm.sqadto[0] = (unsigned short )0;
sqlstm.sqtdso[0] = (unsigned short )0;
sqlstm.sqphsv = sqlstm.sqhstv;
sqlstm.sqphsl = sqlstm.sqhstl;
sqlstm.sqphss = sqlstm.sqhsts;
sqlstm.sqpind = sqlstm.sqindv;
sqlstm.sqpins = sqlstm.sqinds;
sqlstm.sqparm = sqlstm.sqharm;
sqlstm.sqparc = sqlstm.sqharc;
sqlstm.sqpadto = sqlstm.sqadto;
sqlstm.sqptdso = sqlstm.sqtdso;
sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}
/* EXEC SQL EXECUTE IMMEDIATE:str2; */
{
struct sqlexd sqlstm;
sqlstm.sqlvsn = 10;
sqlstm.arrsiz = 1;
sqlstm.sqladtp = &sqladt;
sqlstm.sqltdsp = &sqltds;
sqlstm.stmt = "";
sqlstm.iters = (unsigned int )1;
sqlstm.offset = (unsigned int )24;
sqlstm.cud = sqlcud0;
sqlstm.sqlest = (unsigned char *)&sqlca;
sqlstm.sqlety = (unsigned short)256;
sqlstm.occurs = (unsigned int )0;
sqlstm.sqhstv[0] = ( void *)str2;
sqlstm.sqhstl[0]
zhujm320
- 粉丝: 9
- 资源: 7
最新资源
- 大气黄色背景的摄影设计企业网站模板下载.zip
- 大气活力风的体育运动新闻网站模板下载.rar
- 大气简单背景的视差装修案例展示模板下载.rar
- 大气极简的艺术设计自媒体网页模板下载.rar
- 大气简单的后台管理系统网站模板下载.zip
- 大气简洁扁平化的设计师作品展示网站模板下载.zip
- 大气简洁的办公室吊顶装修公司网站模板下载.rar
- 大气简洁的的跑步健身俱乐部企业网站模板下载.zip
- 大气简洁的动物企业网站模板下载.zip
- 大气简洁的个人博客网站模板下载.zip
- 大气简洁的互联网科技商务整站模板下载.zip
- 大气简洁的户外旅行社公司网站企业模板下载.zip
- 大气简洁的教育传媒公司企业网站模板下载.zip
- 大气简洁的机械五金加工厂企业网站模板下载.zip
- 大气简洁的前端工程师简历网站模板下载.zip
- 大气简洁的设计机构官网模板下载.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈