⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sql.c

📁 程序实现了在ip协议之上加一层RUDP协议
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Result Sets Interface */#ifndef SQL_CRSR#  define SQL_CRSR  struct sql_cursor  {    unsigned int curocn;    void *ptr1;    void *ptr2;    unsigned int 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[7];};static struct sqlcxp sqlfpn ={    6,    "sql.pc"};static unsigned int sqlctx = 4971;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;   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[4];   unsigned int   sqhstl[4];            int   sqhsts[4];            void  *sqindv[4];            int   sqinds[4];   unsigned int   sqharm[4];   unsigned int   *sqharc[4];   unsigned short  sqadto[4];   unsigned short  sqtdso[4];} sqlstm = {12,4};/* SQLLIB Prototypes */extern sqlcxt (/*_ void **, unsigned int *,                   struct sqlexd *, struct sqlcxp * _*/);extern sqlcx2t(/*_ void **, unsigned int *,                   struct sqlexd *, struct sqlcxp * _*/);extern sqlbuft(/*_ void **, char * _*/);extern sqlgs2t(/*_ void **, char * _*/);extern sqlorat(/*_ void **, unsigned int *, void * _*/);/* Forms Interface */static int IAPSUCC = 0;static int IAPFAIL = 1403;static int IAPFTL  = 535;extern void sqliem(/*_ char *, int * _*/); static char *sq0002 = "select EQUIPID ,EQUIPTYPE ,EQUIPIP  from LOCALEQUIP            ";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[] ={12,4130,1,0,0,5,0,0,1,0,0,27,41,0,0,4,4,0,1,0,1,97,0,0,1,97,0,0,1,97,0,0,1,10,0,0,36,0,0,2,63,0,9,52,0,0,0,0,0,1,0,51,0,0,2,0,0,13,53,0,0,3,0,0,1,0,2,3,0,0,2,97,0,0,2,3,0,0,78,0,0,2,0,0,13,63,0,0,3,0,0,1,0,2,3,0,0,2,97,0,0,2,3,0,0,105,0,0,2,0,0,15,70,0,0,0,0,0,1,0,};#include <stdio.h>#include <string.h>#include <stdlib.h>#include <sqlda.h>#include <sqlcpr.h>/*先是.pc,编译成.c之后,里面的方法可以被其它文件调用*/  /* EXEC SQL BEGIN DECLARE SECTION; */ 	char		username[20];	char		password[20];	char		service[20]; 	/*int		EquipId[50];*/		/*在数据库中equipid是number(5,0) 一列多条记录用二维数组*/	/*char		EquipType[50];*/ 		/*设备类型 包发送的时候需要知道设备类型*/	int		id,count;		/*count表示记录的条数.*/  int		length;		/*返回的指针长度*/  /* EXEC SQL END DECLARE SECTION; */ /*   EXEC SQL INCLUDE SQLCA; */ /* * $Header: sqlca.h 24-apr-2003.12:50:58 mkandarp Exp $ sqlca.h  *//* Copyright (c) 1985, 2003, Oracle Corporation.  All rights reserved.  */ /*NAME  SQLCA : SQL Communications Area.FUNCTION  Contains no code. Oracle fills in the SQLCA with status info  during the execution of a SQL stmt.NOTES  **************************************************************  ***                                                        ***  *** This file is SOSD.  Porters must change the data types ***  *** appropriately on their platform.  See notes/pcport.doc ***  *** for more information.                                  ***  ***                                                        ***  **************************************************************  If the symbol SQLCA_STORAGE_CLASS is defined, then the SQLCA  will be defined to have this storage class. For example:     #define SQLCA_STORAGE_CLASS extern   will define the SQLCA as an extern.   If the symbol SQLCA_INIT is defined, then the SQLCA will be  statically initialized. Although this is not necessary in order  to use the SQLCA, it is a good pgming practice not to have  unitialized variables. However, some C compilers/OS's don't  allow automatic variables to be init'd in this manner. Therefore,  if you are INCLUDE'ing the SQLCA in a place where it would be  an automatic AND your C compiler/OS doesn't allow this style  of initialization, then SQLCA_INIT should be left undefined --  all others can define SQLCA_INIT if they wish.  If the symbol SQLCA_NONE is defined, then the SQLCA variable will  not be defined at all.  The symbol SQLCA_NONE should not be defined  in source modules that have embedded SQL.  However, source modules  that have no embedded SQL, but need to manipulate a sqlca struct  passed in as a parameter, can set the SQLCA_NONE symbol to avoid  creation of an extraneous sqlca variable. MODIFIED    lvbcheng   07/31/98 -  long to int    jbasu      12/12/94 -  Bug 217878: note this is an SOSD file    losborne   08/11/92 -  No sqlca var if SQLCA_NONE macro set   Clare      12/06/84 - Ch SQLCA to not be an extern.  Clare      10/21/85 - Add initialization.  Bradbury   01/05/86 - Only initialize when SQLCA_INIT set  Clare      06/12/86 - Add SQLCA_STORAGE_CLASS option.*/ #ifndef SQLCA#define SQLCA 1 struct   sqlca         {         /* ub1 */ char    sqlcaid[8];         /* b4  */ int     sqlabc;         /* b4  */ int     sqlcode;         struct           {           /* ub2 */ unsigned short sqlerrml;           /* ub1 */ char           sqlerrmc[70];           } sqlerrm;         /* ub1 */ char    sqlerrp[8];         /* b4  */ int     sqlerrd[6];         /* ub1 */ char    sqlwarn[8];         /* ub1 */ char    sqlext[8];         };#ifndef SQLCA_NONE #ifdef   SQLCA_STORAGE_CLASSSQLCA_STORAGE_CLASS struct sqlca sqlca#else         struct sqlca sqlca#endif #ifdef  SQLCA_INIT         = {         {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '},         sizeof(struct sqlca),         0,         { 0, {0}},         {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '},         {0, 0, 0, 0, 0, 0},         {0, 0, 0, 0, 0, 0, 0, 0},         {0, 0, 0, 0, 0, 0, 0, 0}         }#endif         ;#endif #endif /* end SQLCA *//*   EXEC SQL INCLUDE ORACA; */ /* * $Header: oraca.h 24-apr-2003.12:50:59 mkandarp Exp $ oraca.h  *//* Copyright (c) 1985, 2003, Oracle Corporation.  All rights reserved.  */ /*NAME  ORACA : Oracle Communications Area.FUNCTION  Contains no code. Provides supplementary communications to/from  Oracle (in addition to standard SQLCA).NOTES  **************************************************************  ***                                                        ***  *** This file is SOSD.  Porters must change the data types ***  *** appropriately on their platform.  See notes/pcport.doc ***  *** for more information.                                  ***  ***                                                        ***  **************************************************************  oracchf : Check cursor cache consistency flag. If set AND oradbgf            is set, then directs SQLLIB to perform cursor cache            consistency checks before every cursor operation            (OPEN, FETCH, SELECT, INSERT, etc.).  oradbgf : Master DEBUG flag. Used to turn all DEBUG options            on or off.  orahchf : Check Heap consistency flag. If set AND oradbgf is set,            then directs SQLLIB to perform heap consistency checks            everytime memory is dynamically allocated/free'd via            sqlalc/sqlfre/sqlrlc. MUST BE SET BEFORE 1ST CONNECT            and once set cannot be cleared (subsequent requests            to change it are ignored).  orastxtf: Save SQL stmt text flag. If set, then directs SQLLIB            to save the text of the current SQL stmt in orastxt            (in VARCHAR format).  orastxt : Saved len and text of current SQL stmt (in VARCHAR            format).  orasfnm : Saved len and text of filename containing current SQL            stmt (in VARCHAR format).  oraslnr : Saved line nr within orasfnm of current SQL stmt.   Cursor cache statistics. Set after COMMIT or ROLLBACK. Each  CONNECT'd DATABASE has its own set of statistics.   orahoc  : Highest Max Open OraCursors requested. Highest value            for MAXOPENCURSORS by any CONNECT to this DATABASE.  oramoc  : Max Open OraCursors required. Specifies the max nr            of OraCursors required to run this pgm. Can be higher            than orahoc if working set (MAXOPENCURSORS) was set            too low, thus forcing the PCC to expand the cache.  oracoc  : Current nr of OraCursors used.  oranor  : Nr of OraCursor cache reassignments. Can show the            degree of "thrashing" in the cache. Optimally, this            nr should be kept as low as possible (time vs space            optimization).  oranpr  : Nr of SQL stmt "parses".  oranex  : Nr of SQL stmt "executes". Optimally, the relation-            ship of oranex to oranpr should be kept as high as            possible.    If the symbol ORACA_NONE is defined, then there will be no ORACA  *variable*, although there will still be a struct defined.  This  macro should not normally be defined in application code.  If the symbol ORACA_INIT is defined, then the ORACA will be  statically initialized. Although this is not necessary in order  to use the ORACA, it is a good pgming practice not to have  unitialized variables. However, some C compilers/OS's don't  allow automatic variables to be init'd in this manner. Therefore,  if you are INCLUDE'ing the ORACA in a place where it would be  an automatic AND your C compiler/OS doesn't allow this style  of initialization, then ORACA_INIT should be left undefined --  all others can define ORACA_INIT if they wish. OWNER  ClareDATE  10/19/85MODIFIED    apopat     05/08/02  - [2362423] MVS PE to make lines shorter than 79    apopat     07/31/99 -  [707588] TAB to blanks for OCCS    lvbcheng   10/27/98 -  change long to int for oraca    pccint     10/03/96 -  Add IS_OSD for linting    jbasu      12/12/94 -  Bug 217878: note this is an SOSD file    losborne   09/04/92 -  Make oraca variable optional     Osborne    05/24/90 - Add ORACA_STORAGE_CLASS construct  Clare      02/20/86 - PCC [10101l] Feature: Heap consistency check.  Clare      03/04/86 - PCC [10101r] Port: ORACA init ifdef.  Clare      03/12/86 - PCC [10101ab] Feature: ORACA cuc statistics.*//* IS_OSD */ #ifndef  ORACA#define  ORACA     1 struct   oraca         {    /* text */ char oracaid[8];      /* Reserved                            */    /* ub4  */ int oracabc;          /* Reserved                            */     /*       Flags which are setable by User. */    /* ub4 */ int  oracchf;           /* <> 0 if "check cur cache consistncy"*/   /* ub4 */ int  oradbgf;           /* <> 0 if "do DEBUG mode checking"    */   /* ub4 */ int  orahchf;           /* <> 0 if "do Heap consistency check" */   /* ub4 */ int  orastxtf;          /* SQL stmt text flag                  */#define  ORASTFNON 0                 /* = don't save text of SQL stmt       */#define  ORASTFERR 1                 /* = only save on SQLERROR             */#define  ORASTFWRN 2                 /* = only save on SQLWARNING/SQLERROR  */#define  ORASTFANY 3                 /* = always save                       */         struct           {  /* ub2  */ unsigned short orastxtl;  /* text */ char  orastxtc[70];           } orastxt;                /* text of last SQL stmt               */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -