Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

awora.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2002 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 #ifndef __AW_ORA__
00022 #define __AW_ORA__
00023 
00024 #include "awdb.h"
00025 
00026 #include "monitor.h"
00027 
00028 #include "wire.h"
00029 
00030 #include "regexmatch.h"
00031 
00032 #include <oratypes.h>
00033 /* LDA and CDA struct declarations */
00034 #include <ocidfn.h>
00035 #include <ociapr.h>
00036 
00037 
00046 /*
00047 
00048 Changes:
00049 
00050 01-28-03 Russell Leighton
00051 Make connect/noconnect stateful
00052 
00053 */
00054 
00055 #define MAX_ITEM_BUFFER_SIZE    33
00056 #define MAX_SELECT_LIST_SIZE    12
00057 #define MAX_SQL_IDENTIFIER      31
00058 
00059 /*  internal/external datatype codes */
00060 #define VARCHAR2_TYPE            1
00061 #define NUMBER_TYPE              2
00062 #define INT_TYPE                 3
00063 #define FLOAT_TYPE               4
00064 #define STRING_TYPE              5
00065 #define ROWID_TYPE              11
00066 #define DATE_TYPE               12
00067 
00068 /*  ORACLE error codes used in demonstration programs */
00069 #define VAR_NOT_IN_LIST       1007
00070 #ifndef NO_DATA_FOUND
00071 #  define NO_DATA_FOUND         1403
00072 #endif
00073 #define NULL_VALUE_RETURNED   1405
00074 
00075 /*  some SQL and OCI function codes */
00076 #define FT_INSERT                3
00077 #define FT_SELECT                4
00078 #define FT_UPDATE                5
00079 #define FT_DELETE                9
00080 
00081 #define FC_OOPEN                14
00082 
00083 #define PARSE_NO_DEFER           0
00084 #define PARSE_V7_LNG             2
00085 
00086 /* Declare structures for query information. */
00087 struct describe
00088 {
00089     sb4             dbsize;
00090     sb2             dbtype;
00091     sb1             buf[MAX_ITEM_BUFFER_SIZE];
00092     sb4             buflen;
00093     sb4             dsize;
00094     sb2             precision;
00095     sb2             scale;
00096     sb2             nullok;
00097 };
00098 
00099 struct define
00100 {
00101     ub1             buf[MAX_ITEM_BUFFER_SIZE];
00102     float           flt_buf;
00103     sword           int_buf;
00104     sb2             indp;
00105     ub2             col_retlen, col_retcode;
00106 };
00107 
00108 /* END crap ripped off from demo */
00109 
00110 
00114 typedef struct {
00115   
00116   byte_t 
00117    *user,
00118    *passwd,
00119    *db;
00120 
00121 } aw_ora_cinfo_t ;
00122 
00126 typedef struct {
00127   
00128   /* oracle handles */
00129   Lda_Def 
00130    lda;
00131   ub4
00132    hda[HDA_SIZE/sizeof(ub4)];
00133   Cda_Def 
00134    cda;
00135   struct describe 
00136    desc[MAX_SELECT_LIST_SIZE];
00137   struct define   
00138    def[MAX_SELECT_LIST_SIZE];
00139 
00140 } aw_ora_conn_t;
00141 
00145 typedef struct {
00146   
00147   int32_t
00148     prev_connected, /* value for previous attempt */
00149     connected;      /* 1 for connected, -1 for not connected */
00150 
00151   u_int32_t
00152    connection_attempts;
00153 
00154   aw_ora_conn_t
00155    *conn;
00156 
00157   /* array 1-1 with the watchers, each val marks
00158      if a match occured during the probe, could be a bitmap, but I am being lazy */
00159   u_int32_t
00160    *match_markers;
00161   
00162 } aw_ora_state_t ;
00163 
00167 byte_t *aw_ora_error(Lda_Def *lda, Cda_Def *cursor, text *msg, sword msgsize);
00168 
00172 void aw_ora_init(void);
00173 
00177 int32_t aw_ora_initialized(void);
00178 
00186 void aw_ora_disconnect(aw_ora_cinfo_t *cinfo, aw_ora_state_t *state, aw_logger_t *logger, int32_t close);
00187 
00194 void aw_ora_disconnect_all(aw_ora_cinfo_t *cinfo, aw_ora_state_t *state, aw_logger_t *logger);
00195 
00202 void aw_ora_connect(aw_ora_cinfo_t *cinfo, aw_ora_state_t *state, aw_logger_t *logger);
00203 
00207 sword aw_ora_describe_define(Lda_Def *lda, Cda_Def *cda, struct describe *desc, struct define *def);
00208 
00209 #endif
00210 
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)