1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
/*
$Id: dbdimp.h,v 1.1 1997/07/09 18:59:55 k Exp $
Copyright (c) 1994,1995 Tim Bunce
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the Perl README file.
*/
/* these are (almost) random values ! */
#define MAX_COLS 99
#define MAX_COL_NAME_LEN 99
#define MAX_BIND_VARS 99
#ifndef HDA_SIZE
#define HDA_SIZE 512
#endif
/* We need to define some Oracle typedefs too */
#define eb1 char
#define ub1 unsigned char
#define ub2 unsigned short
#define ub4 unsigned long
#define sb1 signed char
#define sb2 signed short
#define sb4 signed int
#define sword signed int
typedef struct imp_fbh_st imp_fbh_t;
/* Lda_def is defined to just being an int. It holds the socket code return
* - value.
*
* We also find from $ORACLE_HOME/rdbms/demo/ocidfn.h that Cda_Def is the
* - same as Lda_Def
*/
struct imp_drh_st {
dbih_drc_t com; /* MUST be first element in structure */
};
struct Lda_Def_st {
int lda;
sb2 rc; /* Return code? */
char *svdb; /* Database Name */
char *svhost; /* Hostname of database */
int svsock; /* Socket doo-dah */
};
typedef struct Lda_Def_st Lda_Def;
/* typedef struct Lda_Def_st Cda_Def; */
typedef struct result_s Cda_Def;
/* Define dbh implementor data structure */
struct imp_dbh_st {
dbih_dbc_t com; /* MUST be first element in structure */
Lda_Def lda;
ub1 hda[HDA_SIZE];
};
/* Define sth implementor data structure */
struct imp_sth_st {
dbih_stc_t com; /* MUST be first element in structure */
Cda_Def *cda; /* currently just points to cdabuf below */
Cda_Def cdabuf;
/* imp_dbh_t *imp_dbh;
U32 dbh_generation;
U16 flags; */
/* Current row index? */
int currow;
int row_num;
/* Input Details */
char *statement; /* sql (see sth_scan) */
HV *bind_names;
int is_insert;
int is_create;
int is_update;
int is_drop;
int is_delete;
int is_select;
/* Output Details */
int done_desc; /* have we described this sth yet ? */
int done_execute;/** Have we executed this sth yet? */
int fbh_num; /* number of output fields */
imp_fbh_t *fbh; /* array of imp_fbh_t structs */
char *fbh_cbuf; /* memory for all field names */
sb4 long_buflen; /* length for long/longraw (if >0) */
bool long_trunc_ok; /* is truncating a long an error */
};
#define IMP_STH_EXECUTING 0x0001
struct imp_fbh_st { /* field buffer EXPERIMENTAL */
imp_sth_t *imp_sth; /* 'parent' statement */
/* Oracle's description of the field */
sb4 dbsize;
sb2 dbtype;
sb1 *cbuf; /* ptr to name of select-list item */
sb4 cbufl; /* length of select-list item name */
sb4 dsize; /* max display size if field is a char */
sb2 prec;
sb2 scale;
sb2 nullok;
/* Our storage space for the field data as it's fetched */
sb2 indp; /* null/trunc indicator variable */
sword ftype; /* external datatype we wish to get */
ub1 *buf; /* data buffer (points to sv data) */
ub2 bufl; /* length of data buffer */
ub2 rlen; /* length of returned data */
ub2 rcode; /* field level error status */
SV *sv;
};
typedef struct phs_st phs_t; /* scalar placeholder */
struct phs_st { /* scalar placeholder EXPERIMENTAL */
SV *sv; /* the scalar holding the value */
sword ftype; /* external OCI field type */
sb2 indp; /* null indicator */
};
extern SV *dbd_errnum;
extern SV *dbd_errstr;
/** Prototype definitions */
void dbd_init _((dbistate_t *dbistate));
void do_mSQL_error( sb2, char * );
void fbh_dump _((imp_fbh_t *fbh, int i));
int dbd_db_login _((SV *dbh, char *host, char *dbname, char *junk));
int dbd_db_commit _((SV *dbh));
int dbd_db_rollback _((SV *dbh));
int dbd_db_disconnect _((SV *dbh));
void dbd_db_destroy _((SV *dbh));
int dbd_db_STORE _((SV *dbh, SV *keysv, SV *valuesv));
SV *dbd_db_FETCH _((SV *dbh, SV *keysv));
SV *dbd_db_fieldlist _((m_result *res));
int dbd_st_prepare _((SV *sth, char *statement, SV *attribs));
int dbd_st_finish _((SV *sth));
void dbd_st_destroy _((SV *sth));
int dbd_st_STORE _((SV *sth, SV *keysv, SV *valuesv));
SV *dbd_st_FETCH _((SV *sth, SV *keysv));
void dbd_preparse _((imp_sth_t *imp_sth, char *statement));
int dbd_describe _((SV *h, imp_sth_t *imp_sth));
/* end */
|