* Re: Oracle 9 interface for Guile?
2003-07-15 1:37 ` Robert Marlow
@ 2003-07-15 2:09 ` Nic
2003-07-15 3:20 ` Paul Jarc
1 sibling, 0 replies; 7+ messages in thread
From: Nic @ 2003-07-15 2:09 UTC (permalink / raw)
Cc: guile-user
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
Robert Marlow <bobstopper@australispro.com.au> writes:
> On Mon, 2003-07-14 at 23:32, Paul Jarc wrote:
> > Robert Marlow <bobstopper@australispro.com.au> wrote:
> > > Sergey's code expects Oracle 8, but we're running Oracle 9.
> >
> > He said he had made some changes to make it work with Oracle 9
> > (despite the "guile-oci8" name), so I'd guess it should be close to
> > working in your environment. But I haven't heard from him in a while.
>
> Oh right. Maybe he hasn't released that code yet... the most recent
> release I could find was from 2000 and it wouldn't compile after not
> finding expected Oracle 8 libraries. I might contact him. Thanks for
> your help, all.
Hmmm... is it not just the missing "min" function?
Try my attached libguileoci8.c which has the min function added.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patched file --]
[-- Type: text/x-csrc, Size: 112820 bytes --]
/***************************************************************************
*
* Filename: libguileoci8.c
* Project :
* Author :
* CVS : $Author: dsa $ $Date: 2003/06/25 04:35:31 $
* Creation: Mon Jul 30 2001 15:37 (YEKDT)
* Purpose :
*
* Modified: Thu Mar 27 09:38:16 YEKT 2003 by Sergey A. Dolin
* ------------------------------------------------------------
* Bugs :
* Exports :
* Using :
*
* You may distribute under the terms of the GNU GPL
***************************************************************************/
#include <oci.h>
#include <libguile.h>
#include <stdio.h>
#include <string.h>
/*#include <config.h>*/
#if !defined(SCM_MAJOR_VERSION) || (SCM_MAJOR_VERSION==1 && SCM_MINOR_VERSION==4)
#define guile_choose(x_1_4,x_1_6) x_1_4
#else
#define guile_choose(x_1_4,x_1_6) x_1_6
#endif
typedef guile_choose(long, scm_t_bits) tag_t;
#define DEFAULT_VARCHAR_LENGTH OCI_STRING_MAXLEN
SCM_SYMBOL(s_oci8_error,"oci8:error");
SCM_VCELL_INIT(s_oci_8_use_symbols,"oci8:use-symbols",SCM_BOOL_T);
#define DO_USE_SYMBOLS (SCM_BOOL_T==SCM_CDR(s_oci_8_use_symbols))
#define SCM_SYMBOL_LONG(c_name, scheme_name, init_val) \
SCM_SNARF_HERE(static SCM c_name) \
SCM_SNARF_INIT(c_name = scm_permanent_object (scm_intern0 (scheme_name));\
SCM_SETCDR (c_name, scm_long2num(init_val));c_name=SCM_CAR(c_name))
SCM_SYMBOL_LONG(s_SQLT_CHR,"SQLT_CHR",SQLT_CHR);
SCM_SYMBOL_LONG(s_SQLT_NUM,"SQLT_NUM",SQLT_NUM);
SCM_SYMBOL_LONG(s_SQLT_INT,"SQLT_INT",SQLT_INT);
SCM_SYMBOL_LONG(s_SQLT_FLT,"SQLT_FLT",SQLT_FLT);
SCM_SYMBOL_LONG(s_SQLT_STR,"SQLT_STR",SQLT_STR);
SCM_SYMBOL_LONG(s_SQLT_VNU,"SQLT_VNU",SQLT_VNU);
SCM_SYMBOL_LONG(s_SQLT_PDN,"SQLT_PDN",SQLT_PDN);
SCM_SYMBOL_LONG(s_SQLT_LNG,"SQLT_LNG",SQLT_LNG);
SCM_SYMBOL_LONG(s_SQLT_VCS,"SQLT_VCS",SQLT_VCS);
SCM_SYMBOL_LONG(s_SQLT_NON,"SQLT_NON",SQLT_NON);
SCM_SYMBOL_LONG(s_SQLT_RID,"SQLT_RID",SQLT_RID);
SCM_SYMBOL_LONG(s_SQLT_DAT,"SQLT_DAT",SQLT_DAT);
SCM_SYMBOL_LONG(s_SQLT_VBI,"SQLT_VBI",SQLT_VBI);
SCM_SYMBOL_LONG(s_SQLT_BIN,"SQLT_BIN",SQLT_BIN);
SCM_SYMBOL_LONG(s_SQLT_LBI,"SQLT_LBI",SQLT_LBI);
SCM_SYMBOL_LONG(s_SQLT_UIN,"SQLT_UIN",SQLT_UIN);
SCM_SYMBOL_LONG(s_SQLT_SLS,"SQLT_SLS",SQLT_SLS);
SCM_SYMBOL_LONG(s_SQLT_LVC,"SQLT_LVC",SQLT_LVC);
SCM_SYMBOL_LONG(s_SQLT_LVB,"SQLT_LVB",SQLT_LVB);
SCM_SYMBOL_LONG(s_SQLT_AFC,"SQLT_AFC",SQLT_AFC);
SCM_SYMBOL_LONG(s_SQLT_AVC,"SQLT_AVC",SQLT_AVC);
SCM_SYMBOL_LONG(s_SQLT_CUR,"SQLT_CUR",SQLT_CUR);
SCM_SYMBOL_LONG(s_SQLT_RDD,"SQLT_RDD",SQLT_RDD);
SCM_SYMBOL_LONG(s_SQLT_LAB,"SQLT_LAB",SQLT_LAB);
SCM_SYMBOL_LONG(s_SQLT_OSL,"SQLT_OSL",SQLT_OSL);
SCM_SYMBOL_LONG(s_SQLT_NTY,"SQLT_NTY",SQLT_NTY);
SCM_SYMBOL_LONG(s_SQLT_REF,"SQLT_REF",SQLT_REF);
SCM_SYMBOL_LONG(s_SQLT_CLOB,"SQLT_CLOB",SQLT_CLOB);
SCM_SYMBOL_LONG(s_SQLT_BLOB,"SQLT_BLOB",SQLT_BLOB);
SCM_SYMBOL_LONG(s_SQLT_BFILEE,"SQLT_BFILEE",SQLT_BFILEE);
SCM_SYMBOL_LONG(s_SQLT_CFILEE,"SQLT_CFILEE",SQLT_CFILEE);
SCM_SYMBOL_LONG(s_SQLT_RSET,"SQLT_RSET",SQLT_RSET);
SCM_SYMBOL_LONG(s_SQLT_NCO,"SQLT_NCO",SQLT_NCO);
SCM_SYMBOL_LONG(s_SQLT_VST,"SQLT_VST",SQLT_VST);
SCM_SYMBOL_LONG(s_SQLT_ODT,"SQLT_ODT",SQLT_ODT);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_REF,"OCI_TYPECODE_REF",OCI_TYPECODE_REF);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_DATE,"OCI_TYPECODE_DATE",OCI_TYPECODE_DATE);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_SIGNED8,"OCI_TYPECODE_SIGNED8",OCI_TYPECODE_SIGNED8);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_SIGNED16,"OCI_TYPECODE_SIGNED16",OCI_TYPECODE_SIGNED16);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_SIGNED32,"OCI_TYPECODE_SIGNED32",OCI_TYPECODE_SIGNED32);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_REAL,"OCI_TYPECODE_REAL",OCI_TYPECODE_REAL);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_DOUBLE,"OCI_TYPECODE_DOUBLE",OCI_TYPECODE_DOUBLE);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_FLOAT,"OCI_TYPECODE_FLOAT",OCI_TYPECODE_FLOAT);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_NUMBER,"OCI_TYPECODE_NUMBER",OCI_TYPECODE_NUMBER);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_DECIMAL,"OCI_TYPECODE_DECIMAL",OCI_TYPECODE_DECIMAL);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_UNSIGNED8,"OCI_TYPECODE_UNSIGNED8",OCI_TYPECODE_UNSIGNED8);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_UNSIGNED16,"OCI_TYPECODE_UNSIGNED16",OCI_TYPECODE_UNSIGNED16);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_UNSIGNED32,"OCI_TYPECODE_UNSIGNED32",OCI_TYPECODE_UNSIGNED32);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_OCTET,"OCI_TYPECODE_OCTET",OCI_TYPECODE_OCTET);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_SMALLINT,"OCI_TYPECODE_SMALLINT",OCI_TYPECODE_SMALLINT);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_INTEGER,"OCI_TYPECODE_INTEGER",OCI_TYPECODE_INTEGER);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_RAW,"OCI_TYPECODE_RAW",OCI_TYPECODE_RAW);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_PTR,"OCI_TYPECODE_PTR",OCI_TYPECODE_PTR);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_VARCHAR2,"OCI_TYPECODE_VARCHAR2",OCI_TYPECODE_VARCHAR2);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_CHAR,"OCI_TYPECODE_CHAR",OCI_TYPECODE_CHAR);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_VARCHAR,"OCI_TYPECODE_VARCHAR",OCI_TYPECODE_VARCHAR);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_MLSLABEL,"OCI_TYPECODE_MLSLABEL",OCI_TYPECODE_MLSLABEL);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_VARRAY,"OCI_TYPECODE_VARRAY",OCI_TYPECODE_VARRAY);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_TABLE,"OCI_TYPECODE_TABLE",OCI_TYPECODE_TABLE);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_OBJECT,"OCI_TYPECODE_OBJECT",OCI_TYPECODE_OBJECT);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_NAMEDCOLLECTION,"OCI_TYPECODE_NAMEDCOLLECTION",OCI_TYPECODE_NAMEDCOLLECTION);
/* SQL/OTS NAMED COLLECTION TYPE */
SCM_SYMBOL_LONG(s_OCI_TYPECODE_BLOB,"OCI_TYPECODE_BLOB",OCI_TYPECODE_BLOB);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_BFILE,"OCI_TYPECODE_BFILE",OCI_TYPECODE_BFILE);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_CLOB,"OCI_TYPECODE_CLOB",OCI_TYPECODE_CLOB);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_CFILE,"OCI_TYPECODE_CFILE",OCI_TYPECODE_CFILE);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_OTMFIRST,"OCI_TYPECODE_OTMFIRST",OCI_TYPECODE_OTMFIRST);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_OTMLAST,"OCI_TYPECODE_OTMLAST",OCI_TYPECODE_OTMLAST);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_SYSFIRST,"OCI_TYPECODE_SYSFIRST",OCI_TYPECODE_SYSFIRST);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_SYSLAST,"OCI_TYPECODE_SYSLAST",OCI_TYPECODE_SYSLAST);
/* the following are PL/SQL-only internal. They should not be used
SCM_SYMBOL_LONG(s_OCI_TYPECODE_ITABLE,"OCI_TYPECODE_ITABLE",OCI_TYPECODE_ITABLE);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_RECORD,"OCI_TYPECODE_RECORD",OCI_TYPECODE_RECORD);
SCM_SYMBOL_LONG(s_OCI_TYPECODE_BOOLEAN,"OCI_TYPECODE_BOOLEAN",OCI_TYPECODE_BOOLEAN);
*/
SCM_SYMBOL_LONG(s_OCI_DEFAULT,"OCI_DEFAULT",OCI_DEFAULT);
SCM_SYMBOL_LONG(s_OCI_THREADED,"OCI_THREADED",OCI_THREADED);
SCM_SYMBOL_LONG(s_OCI_OBJECT,"OCI_OBJECT",OCI_OBJECT);
SCM_SYMBOL_LONG(s_OCI_NON_BLOCKING,"OCI_NON_BLOCKING",OCI_NON_BLOCKING);
SCM_SYMBOL_LONG(s_OCI_ENV_NO_MUTEX,"OCI_ENV_NO_MUTEX",OCI_ENV_NO_MUTEX);
SCM_SYMBOL_LONG(s_OCI_HTYPE_FIRST,"OCI_HTYPE_FIRST",OCI_HTYPE_FIRST);
SCM_SYMBOL_LONG(s_OCI_HTYPE_ENV,"OCI_HTYPE_ENV",OCI_HTYPE_ENV);
SCM_SYMBOL_LONG(s_OCI_HTYPE_ERROR,"OCI_HTYPE_ERROR",OCI_HTYPE_ERROR);
SCM_SYMBOL_LONG(s_OCI_HTYPE_SVCCTX,"OCI_HTYPE_SVCCTX",OCI_HTYPE_SVCCTX);
SCM_SYMBOL_LONG(s_OCI_HTYPE_STMT,"OCI_HTYPE_STMT",OCI_HTYPE_STMT);
SCM_SYMBOL_LONG(s_OCI_HTYPE_BIND,"OCI_HTYPE_BIND",OCI_HTYPE_BIND);
SCM_SYMBOL_LONG(s_OCI_HTYPE_DEFINE,"OCI_HTYPE_DEFINE",OCI_HTYPE_DEFINE);
SCM_SYMBOL_LONG(s_OCI_HTYPE_DESCRIBE,"OCI_HTYPE_DESCRIBE",OCI_HTYPE_DESCRIBE);
SCM_SYMBOL_LONG(s_OCI_HTYPE_SERVER,"OCI_HTYPE_SERVER",OCI_HTYPE_SERVER);
SCM_SYMBOL_LONG(s_OCI_HTYPE_SESSION,"OCI_HTYPE_SESSION",OCI_HTYPE_SESSION);
SCM_SYMBOL_LONG(s_OCI_HTYPE_TRANS,"OCI_HTYPE_TRANS",OCI_HTYPE_TRANS);
SCM_SYMBOL_LONG(s_OCI_HTYPE_COMPLEXOBJECT,"OCI_HTYPE_COMPLEXOBJECT",OCI_HTYPE_COMPLEXOBJECT);
SCM_SYMBOL_LONG(s_OCI_HTYPE_SECURITY,"OCI_HTYPE_SECURITY",OCI_HTYPE_SECURITY);
SCM_SYMBOL_LONG(s_OCI_HTYPE_LAST,"OCI_HTYPE_LAST",OCI_HTYPE_LAST);
SCM_SYMBOL_LONG(s_OCI_DTYPE_FIRST,"OCI_DTYPE_FIRST",OCI_DTYPE_FIRST);
SCM_SYMBOL_LONG(s_OCI_DTYPE_LOB,"OCI_DTYPE_LOB",OCI_DTYPE_LOB);
SCM_SYMBOL_LONG(s_OCI_DTYPE_SNAP,"OCI_DTYPE_SNAP",OCI_DTYPE_SNAP);
SCM_SYMBOL_LONG(s_OCI_DTYPE_RSET,"OCI_DTYPE_RSET",OCI_DTYPE_RSET);
SCM_SYMBOL_LONG(s_OCI_DTYPE_PARAM,"OCI_DTYPE_PARAM",OCI_DTYPE_PARAM);
SCM_SYMBOL_LONG(s_OCI_DTYPE_ROWID,"OCI_DTYPE_ROWID",OCI_DTYPE_ROWID);
SCM_SYMBOL_LONG(s_OCI_DTYPE_COMPLEXOBJECTCOMP,"OCI_DTYPE_COMPLEXOBJECTCOMP",OCI_DTYPE_COMPLEXOBJECTCOMP);
SCM_SYMBOL_LONG(s_OCI_DTYPE_FILE,"OCI_DTYPE_FILE",OCI_DTYPE_FILE);
SCM_SYMBOL_LONG(s_OCI_DTYPE_AQMSG_PROPERTIES,"OCI_DTYPE_AQMSG_PROPERTIES",OCI_DTYPE_AQMSG_PROPERTIES);
SCM_SYMBOL_LONG(s_OCI_DTYPE_AQAGENT,"OCI_DTYPE_AQAGENT",OCI_DTYPE_AQAGENT);
SCM_SYMBOL_LONG(s_OCI_DTYPE_LAST,"OCI_DTYPE_LAST",OCI_DTYPE_LAST);
SCM_SYMBOL_LONG(s_OCI_OTYPE_NAME,"OCI_OTYPE_NAME",OCI_OTYPE_NAME);
SCM_SYMBOL_LONG(s_OCI_OTYPE_REF,"OCI_OTYPE_REF",OCI_OTYPE_REF);
SCM_SYMBOL_LONG(s_OCI_OTYPE_PTR,"OCI_OTYPE_PTR",OCI_OTYPE_PTR);
SCM_SYMBOL_LONG(s_OCI_ATTR_FNCODE,"OCI_ATTR_FNCODE",OCI_ATTR_FNCODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_OBJECT,"OCI_ATTR_OBJECT",OCI_ATTR_OBJECT);
SCM_SYMBOL_LONG(s_OCI_ATTR_NONBLOCKING_MODE,"OCI_ATTR_NONBLOCKING_MODE",OCI_ATTR_NONBLOCKING_MODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_SQLCODE,"OCI_ATTR_SQLCODE",OCI_ATTR_SQLCODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_ENV,"OCI_ATTR_ENV",OCI_ATTR_ENV);
SCM_SYMBOL_LONG(s_OCI_ATTR_SERVER,"OCI_ATTR_SERVER",OCI_ATTR_SERVER);
SCM_SYMBOL_LONG(s_OCI_ATTR_SESSION,"OCI_ATTR_SESSION",OCI_ATTR_SESSION);
SCM_SYMBOL_LONG(s_OCI_ATTR_TRANS,"OCI_ATTR_TRANS",OCI_ATTR_TRANS);
SCM_SYMBOL_LONG(s_OCI_ATTR_ROW_COUNT,"OCI_ATTR_ROW_COUNT",OCI_ATTR_ROW_COUNT);
SCM_SYMBOL_LONG(s_OCI_ATTR_SQLFNCODE,"OCI_ATTR_SQLFNCODE",OCI_ATTR_SQLFNCODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_PREFETCH_ROWS,"OCI_ATTR_PREFETCH_ROWS",OCI_ATTR_PREFETCH_ROWS);
SCM_SYMBOL_LONG(s_OCI_ATTR_NESTED_PREFETCH_ROWS,"OCI_ATTR_NESTED_PREFETCH_ROWS",OCI_ATTR_NESTED_PREFETCH_ROWS);
SCM_SYMBOL_LONG(s_OCI_ATTR_PREFETCH_MEMORY,"OCI_ATTR_PREFETCH_MEMORY",OCI_ATTR_PREFETCH_MEMORY);
SCM_SYMBOL_LONG(s_OCI_ATTR_NESTED_PREFETCH_MEMORY,"OCI_ATTR_NESTED_PREFETCH_MEMORY",OCI_ATTR_NESTED_PREFETCH_MEMORY);
SCM_SYMBOL_LONG(s_OCI_ATTR_CHAR_COUNT,"OCI_ATTR_CHAR_COUNT",OCI_ATTR_CHAR_COUNT);
SCM_SYMBOL_LONG(s_OCI_ATTR_PDSCL,"OCI_ATTR_PDSCL",OCI_ATTR_PDSCL);
#if OCI8_VERSION < 810
SCM_SYMBOL_LONG(s_OCI_ATTR_PDFMT,"OCI_ATTR_PDFMT",OCI_ATTR_PDFMT);
#endif
SCM_SYMBOL_LONG(s_OCI_ATTR_PARAM_COUNT,"OCI_ATTR_PARAM_COUNT",OCI_ATTR_PARAM_COUNT);
SCM_SYMBOL_LONG(s_OCI_ATTR_ROWID,"OCI_ATTR_ROWID",OCI_ATTR_ROWID);
SCM_SYMBOL_LONG(s_OCI_ATTR_CHARSET,"OCI_ATTR_CHARSET",OCI_ATTR_CHARSET);
SCM_SYMBOL_LONG(s_OCI_ATTR_NCHAR,"OCI_ATTR_NCHAR",OCI_ATTR_NCHAR);
SCM_SYMBOL_LONG(s_OCI_ATTR_USERNAME,"OCI_ATTR_USERNAME",OCI_ATTR_USERNAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_PASSWORD,"OCI_ATTR_PASSWORD",OCI_ATTR_PASSWORD);
SCM_SYMBOL_LONG(s_OCI_ATTR_STMT_TYPE,"OCI_ATTR_STMT_TYPE",OCI_ATTR_STMT_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_INTERNAL_NAME,"OCI_ATTR_INTERNAL_NAME",OCI_ATTR_INTERNAL_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_EXTERNAL_NAME,"OCI_ATTR_EXTERNAL_NAME",OCI_ATTR_EXTERNAL_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_XID,"OCI_ATTR_XID",OCI_ATTR_XID);
SCM_SYMBOL_LONG(s_OCI_ATTR_TRANS_LOCK,"OCI_ATTR_TRANS_LOCK",OCI_ATTR_TRANS_LOCK);
SCM_SYMBOL_LONG(s_OCI_ATTR_TRANS_NAME,"OCI_ATTR_TRANS_NAME",OCI_ATTR_TRANS_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_HEAPALLOC,"OCI_ATTR_HEAPALLOC",OCI_ATTR_HEAPALLOC);
SCM_SYMBOL_LONG(s_OCI_ATTR_CHARSET_ID,"OCI_ATTR_CHARSET_ID",OCI_ATTR_CHARSET_ID);
SCM_SYMBOL_LONG(s_OCI_ATTR_CHARSET_FORM,"OCI_ATTR_CHARSET_FORM",OCI_ATTR_CHARSET_FORM);
SCM_SYMBOL_LONG(s_OCI_ATTR_MAXDATA_SIZE,"OCI_ATTR_MAXDATA_SIZE",OCI_ATTR_MAXDATA_SIZE);
SCM_SYMBOL_LONG(s_OCI_ATTR_CACHE_OPT_SIZE,"OCI_ATTR_CACHE_OPT_SIZE",OCI_ATTR_CACHE_OPT_SIZE);
SCM_SYMBOL_LONG(s_OCI_ATTR_CACHE_MAX_SIZE,"OCI_ATTR_CACHE_MAX_SIZE",OCI_ATTR_CACHE_MAX_SIZE);
SCM_SYMBOL_LONG(s_OCI_ATTR_PINOPTION,"OCI_ATTR_PINOPTION",OCI_ATTR_PINOPTION);
SCM_SYMBOL_LONG(s_OCI_ATTR_ALLOC_DURATION,"OCI_ATTR_ALLOC_DURATION",OCI_ATTR_ALLOC_DURATION);
SCM_SYMBOL_LONG(s_OCI_ATTR_PIN_DURATION,"OCI_ATTR_PIN_DURATION",OCI_ATTR_PIN_DURATION);
SCM_SYMBOL_LONG(s_OCI_ATTR_FDO,"OCI_ATTR_FDO",OCI_ATTR_FDO);
SCM_SYMBOL_LONG(s_OCI_ATTR_POSTPROCESSING_CALLBACK,"OCI_ATTR_POSTPROCESSING_CALLBACK",OCI_ATTR_POSTPROCESSING_CALLBACK);
SCM_SYMBOL_LONG(s_OCI_ATTR_POSTPROCESSING_CONTEXT,"OCI_ATTR_POSTPROCESSING_CONTEXT",OCI_ATTR_POSTPROCESSING_CONTEXT);
SCM_SYMBOL_LONG(s_OCI_ATTR_ROWS_RETURNED,"OCI_ATTR_ROWS_RETURNED",OCI_ATTR_ROWS_RETURNED);
SCM_SYMBOL_LONG(s_OCI_ATTR_FOCBK,"OCI_ATTR_FOCBK",OCI_ATTR_FOCBK);
SCM_SYMBOL_LONG(s_OCI_ATTR_IN_V8_MODE,"OCI_ATTR_IN_V8_MODE",OCI_ATTR_IN_V8_MODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_LOBEMPTY,"OCI_ATTR_LOBEMPTY",OCI_ATTR_LOBEMPTY);
SCM_SYMBOL_LONG(s_OCI_ATTR_SESSLANG,"OCI_ATTR_SESSLANG",OCI_ATTR_SESSLANG);
SCM_SYMBOL_LONG(s_OCI_ATTR_UNK,"OCI_ATTR_UNK",OCI_ATTR_UNK);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_COLS,"OCI_ATTR_NUM_COLS",OCI_ATTR_NUM_COLS);
SCM_SYMBOL_LONG(s_OCI_ATTR_LIST_COLUMNS,"OCI_ATTR_LIST_COLUMNS",OCI_ATTR_LIST_COLUMNS);
SCM_SYMBOL_LONG(s_OCI_ATTR_RDBA,"OCI_ATTR_RDBA",OCI_ATTR_RDBA);
SCM_SYMBOL_LONG(s_OCI_ATTR_CLUSTERED,"OCI_ATTR_CLUSTERED",OCI_ATTR_CLUSTERED);
SCM_SYMBOL_LONG(s_OCI_ATTR_PARTITIONED,"OCI_ATTR_PARTITIONED",OCI_ATTR_PARTITIONED);
SCM_SYMBOL_LONG(s_OCI_ATTR_INDEX_ONLY,"OCI_ATTR_INDEX_ONLY",OCI_ATTR_INDEX_ONLY);
SCM_SYMBOL_LONG(s_OCI_ATTR_LIST_ARGUMENTS,"OCI_ATTR_LIST_ARGUMENTS",OCI_ATTR_LIST_ARGUMENTS);
SCM_SYMBOL_LONG(s_OCI_ATTR_LIST_SUBPROGRAMS,"OCI_ATTR_LIST_SUBPROGRAMS",OCI_ATTR_LIST_SUBPROGRAMS);
SCM_SYMBOL_LONG(s_OCI_ATTR_REF_TDO,"OCI_ATTR_REF_TDO",OCI_ATTR_REF_TDO);
SCM_SYMBOL_LONG(s_OCI_ATTR_LINK,"OCI_ATTR_LINK",OCI_ATTR_LINK);
SCM_SYMBOL_LONG(s_OCI_ATTR_MIN,"OCI_ATTR_MIN",OCI_ATTR_MIN);
SCM_SYMBOL_LONG(s_OCI_ATTR_MAX,"OCI_ATTR_MAX",OCI_ATTR_MAX);
SCM_SYMBOL_LONG(s_OCI_ATTR_INCR,"OCI_ATTR_INCR",OCI_ATTR_INCR);
SCM_SYMBOL_LONG(s_OCI_ATTR_CACHE,"OCI_ATTR_CACHE",OCI_ATTR_CACHE);
SCM_SYMBOL_LONG(s_OCI_ATTR_ORDER,"OCI_ATTR_ORDER",OCI_ATTR_ORDER);
SCM_SYMBOL_LONG(s_OCI_ATTR_HW_MARK,"OCI_ATTR_HW_MARK",OCI_ATTR_HW_MARK);
SCM_SYMBOL_LONG(s_OCI_ATTR_TYPE_SCHEMA,"OCI_ATTR_TYPE_SCHEMA",OCI_ATTR_TYPE_SCHEMA);
SCM_SYMBOL_LONG(s_OCI_ATTR_TIMESTAMP,"OCI_ATTR_TIMESTAMP",OCI_ATTR_TIMESTAMP);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_ATTRS,"OCI_ATTR_NUM_ATTRS",OCI_ATTR_NUM_ATTRS);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_PARAMS,"OCI_ATTR_NUM_PARAMS",OCI_ATTR_NUM_PARAMS);
SCM_SYMBOL_LONG(s_OCI_ATTR_OBJID,"OCI_ATTR_OBJID",OCI_ATTR_OBJID);
SCM_SYMBOL_LONG(s_OCI_ATTR_PTYPE,"OCI_ATTR_PTYPE",OCI_ATTR_PTYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_PARAM,"OCI_ATTR_PARAM",OCI_ATTR_PARAM);
SCM_SYMBOL_LONG(s_OCI_ATTR_OVERLOAD_ID,"OCI_ATTR_OVERLOAD_ID",OCI_ATTR_OVERLOAD_ID);
SCM_SYMBOL_LONG(s_OCI_ATTR_TABLESPACE,"OCI_ATTR_TABLESPACE",OCI_ATTR_TABLESPACE);
SCM_SYMBOL_LONG(s_OCI_ATTR_TDO,"OCI_ATTR_TDO",OCI_ATTR_TDO);
SCM_SYMBOL_LONG(s_OCI_ATTR_PARSE_ERROR_OFFSET,"OCI_ATTR_PARSE_ERROR_OFFSET",OCI_ATTR_PARSE_ERROR_OFFSET);
SCM_SYMBOL_LONG(s_OCI_CRED_RDBMS,"OCI_CRED_RDBMS",OCI_CRED_RDBMS);
SCM_SYMBOL_LONG(s_OCI_CRED_EXT,"OCI_CRED_EXT",OCI_CRED_EXT);
SCM_SYMBOL_LONG(s_OCI_SUCCESS,"OCI_SUCCESS",OCI_SUCCESS);
SCM_SYMBOL_LONG(s_OCI_SUCCESS_WITH_INFO,"OCI_SUCCESS_WITH_INFO",OCI_SUCCESS_WITH_INFO);
SCM_SYMBOL_LONG(s_OCI_NO_DATA,"OCI_NO_DATA",OCI_NO_DATA);
SCM_SYMBOL_LONG(s_OCI_ERROR,"OCI_ERROR",OCI_ERROR);
SCM_SYMBOL_LONG(s_OCI_INVALID_HANDLE,"OCI_INVALID_HANDLE",OCI_INVALID_HANDLE);
SCM_SYMBOL_LONG(s_OCI_NEED_DATA,"OCI_NEED_DATA",OCI_NEED_DATA);
SCM_SYMBOL_LONG(s_OCI_STILL_EXECUTING,"OCI_STILL_EXECUTING",OCI_STILL_EXECUTING);
SCM_SYMBOL_LONG(s_OCI_CONTINUE,"OCI_CONTINUE",OCI_CONTINUE);
SCM_SYMBOL_LONG(s_OCI_V7_SYNTAX,"OCI_V7_SYNTAX",OCI_V7_SYNTAX);
SCM_SYMBOL_LONG(s_OCI_V8_SYNTAX,"OCI_V8_SYNTAX",OCI_V8_SYNTAX);
SCM_SYMBOL_LONG(s_OCI_NTV_SYNTAX,"OCI_NTV_SYNTAX",OCI_NTV_SYNTAX);
SCM_SYMBOL_LONG(s_OCI_FETCH_NEXT,"OCI_FETCH_NEXT",OCI_FETCH_NEXT);
SCM_SYMBOL_LONG(s_OCI_FETCH_FIRST,"OCI_FETCH_FIRST",OCI_FETCH_FIRST);
SCM_SYMBOL_LONG(s_OCI_FETCH_LAST,"OCI_FETCH_LAST",OCI_FETCH_LAST);
SCM_SYMBOL_LONG(s_OCI_FETCH_PRIOR,"OCI_FETCH_PRIOR",OCI_FETCH_PRIOR);
SCM_SYMBOL_LONG(s_OCI_FETCH_ABSOLUTE,"OCI_FETCH_ABSOLUTE",OCI_FETCH_ABSOLUTE);
SCM_SYMBOL_LONG(s_OCI_FETCH_RELATIVE,"OCI_FETCH_RELATIVE",OCI_FETCH_RELATIVE);
SCM_SYMBOL_LONG(s_OCI_SB2_IND_PTR,"OCI_SB2_IND_PTR",OCI_SB2_IND_PTR);
SCM_SYMBOL_LONG(s_OCI_DATA_AT_EXEC,"OCI_DATA_AT_EXEC",OCI_DATA_AT_EXEC);
SCM_SYMBOL_LONG(s_OCI_DYNAMIC_FETCH,"OCI_DYNAMIC_FETCH",OCI_DYNAMIC_FETCH);
SCM_SYMBOL_LONG(s_OCI_PIECEWISE,"OCI_PIECEWISE",OCI_PIECEWISE);
SCM_SYMBOL_LONG(s_OCI_BATCH_MODE,"OCI_BATCH_MODE",OCI_BATCH_MODE);
SCM_SYMBOL_LONG(s_OCI_EXACT_FETCH,"OCI_EXACT_FETCH",OCI_EXACT_FETCH);
SCM_SYMBOL_LONG(s_OCI_KEEP_FETCH_STATE,"OCI_KEEP_FETCH_STATE",OCI_KEEP_FETCH_STATE);
#if OCI8_VERSION < 900
SCM_SYMBOL_LONG(s_OCI_SCROLLABLE_CURSOR,"OCI_SCROLLABLE_CURSOR",OCI_SCROLLABLE_CURSOR);
#endif
SCM_SYMBOL_LONG(s_OCI_DESCRIBE_ONLY,"OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY);
SCM_SYMBOL_LONG(s_OCI_COMMIT_ON_SUCCESS,"OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS);
SCM_SYMBOL_LONG(s_OCI_MIGRATE,"OCI_MIGRATE",OCI_MIGRATE);
SCM_SYMBOL_LONG(s_OCI_SYSDBA,"OCI_SYSDBA",OCI_SYSDBA);
SCM_SYMBOL_LONG(s_OCI_SYSOPER,"OCI_SYSOPER",OCI_SYSOPER);
SCM_SYMBOL_LONG(s_OCI_PRELIM_AUTH,"OCI_PRELIM_AUTH",OCI_PRELIM_AUTH);
SCM_SYMBOL_LONG(s_OCI_PARAM_IN,"OCI_PARAM_IN",OCI_PARAM_IN);
SCM_SYMBOL_LONG(s_OCI_PARAM_OUT,"OCI_PARAM_OUT",OCI_PARAM_OUT);
SCM_SYMBOL_LONG(s_OCI_TRANS_NEW,"OCI_TRANS_NEW",OCI_TRANS_NEW);
SCM_SYMBOL_LONG(s_OCI_TRANS_JOIN,"OCI_TRANS_JOIN",OCI_TRANS_JOIN);
SCM_SYMBOL_LONG(s_OCI_TRANS_RESUME,"OCI_TRANS_RESUME",OCI_TRANS_RESUME);
SCM_SYMBOL_LONG(s_OCI_TRANS_STARTMASK,"OCI_TRANS_STARTMASK",OCI_TRANS_STARTMASK);
SCM_SYMBOL_LONG(s_OCI_TRANS_READONLY,"OCI_TRANS_READONLY",OCI_TRANS_READONLY);
SCM_SYMBOL_LONG(s_OCI_TRANS_READWRITE,"OCI_TRANS_READWRITE",OCI_TRANS_READWRITE);
SCM_SYMBOL_LONG(s_OCI_TRANS_SERIALIZABLE,"OCI_TRANS_SERIALIZABLE",OCI_TRANS_SERIALIZABLE);
SCM_SYMBOL_LONG(s_OCI_TRANS_ISOLMASK,"OCI_TRANS_ISOLMASK",OCI_TRANS_ISOLMASK);
SCM_SYMBOL_LONG(s_OCI_TRANS_LOOSE,"OCI_TRANS_LOOSE",OCI_TRANS_LOOSE);
SCM_SYMBOL_LONG(s_OCI_TRANS_TIGHT,"OCI_TRANS_TIGHT",OCI_TRANS_TIGHT);
SCM_SYMBOL_LONG(s_OCI_TRANS_TYPEMASK,"OCI_TRANS_TYPEMASK",OCI_TRANS_TYPEMASK);
SCM_SYMBOL_LONG(s_OCI_TRANS_NOMIGRATE,"OCI_TRANS_NOMIGRATE",OCI_TRANS_NOMIGRATE);
SCM_SYMBOL_LONG(s_OCI_TRANS_TWOPHASE,"OCI_TRANS_TWOPHASE",OCI_TRANS_TWOPHASE);
SCM_SYMBOL_LONG(s_OCI_DEQ_FIRST_MSG ,"OCI_DEQ_FIRST_MSG ",OCI_DEQ_FIRST_MSG );
SCM_SYMBOL_LONG(s_OCI_DEQ_NEXT_MSG ,"OCI_DEQ_NEXT_MSG ",OCI_DEQ_NEXT_MSG );
SCM_SYMBOL_LONG(s_OCI_DEQ_NEXT_TRANSACTION,"OCI_DEQ_NEXT_TRANSACTION",OCI_DEQ_NEXT_TRANSACTION);
SCM_SYMBOL_LONG(s_OCI_OTYPE_UNK,"OCI_OTYPE_UNK",OCI_OTYPE_UNK);
SCM_SYMBOL_LONG(s_OCI_OTYPE_TABLE,"OCI_OTYPE_TABLE",OCI_OTYPE_TABLE);
SCM_SYMBOL_LONG(s_OCI_OTYPE_VIEW,"OCI_OTYPE_VIEW",OCI_OTYPE_VIEW);
SCM_SYMBOL_LONG(s_OCI_OTYPE_SYN,"OCI_OTYPE_SYN",OCI_OTYPE_SYN);
SCM_SYMBOL_LONG(s_OCI_OTYPE_PROC,"OCI_OTYPE_PROC",OCI_OTYPE_PROC);
SCM_SYMBOL_LONG(s_OCI_OTYPE_FUNC,"OCI_OTYPE_FUNC",OCI_OTYPE_FUNC);
SCM_SYMBOL_LONG(s_OCI_OTYPE_PKG,"OCI_OTYPE_PKG",OCI_OTYPE_PKG);
SCM_SYMBOL_LONG(s_OCI_OTYPE_STMT,"OCI_OTYPE_STMT",OCI_OTYPE_STMT);
SCM_SYMBOL_LONG(s_OCI_ATTR_DATA_SIZE,"OCI_ATTR_DATA_SIZE",OCI_ATTR_DATA_SIZE);
SCM_SYMBOL_LONG(s_OCI_ATTR_DATA_TYPE,"OCI_ATTR_DATA_TYPE",OCI_ATTR_DATA_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_DISP_SIZE,"OCI_ATTR_DISP_SIZE",OCI_ATTR_DISP_SIZE);
SCM_SYMBOL_LONG(s_OCI_ATTR_NAME,"OCI_ATTR_NAME",OCI_ATTR_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_PRECISION,"OCI_ATTR_PRECISION",OCI_ATTR_PRECISION);
SCM_SYMBOL_LONG(s_OCI_ATTR_SCALE,"OCI_ATTR_SCALE",OCI_ATTR_SCALE);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_NULL,"OCI_ATTR_IS_NULL",OCI_ATTR_IS_NULL);
SCM_SYMBOL_LONG(s_OCI_ATTR_TYPE_NAME,"OCI_ATTR_TYPE_NAME",OCI_ATTR_TYPE_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_SCHEMA_NAME,"OCI_ATTR_SCHEMA_NAME",OCI_ATTR_SCHEMA_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_SUB_NAME,"OCI_ATTR_SUB_NAME",OCI_ATTR_SUB_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_POSITION,"OCI_ATTR_POSITION",OCI_ATTR_POSITION);
SCM_SYMBOL_LONG(s_OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE,"OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE",OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE);
SCM_SYMBOL_LONG(s_OCI_ATTR_DISP_NAME,"OCI_ATTR_DISP_NAME",OCI_ATTR_DISP_NAME);
SCM_SYMBOL_LONG(s_OCI_ATTR_OVERLOAD,"OCI_ATTR_OVERLOAD",OCI_ATTR_OVERLOAD);
SCM_SYMBOL_LONG(s_OCI_ATTR_LEVEL,"OCI_ATTR_LEVEL",OCI_ATTR_LEVEL);
SCM_SYMBOL_LONG(s_OCI_ATTR_HAS_DEFAULT,"OCI_ATTR_HAS_DEFAULT",OCI_ATTR_HAS_DEFAULT);
SCM_SYMBOL_LONG(s_OCI_ATTR_IOMODE,"OCI_ATTR_IOMODE",OCI_ATTR_IOMODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_RADIX,"OCI_ATTR_RADIX",OCI_ATTR_RADIX);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_ARGS,"OCI_ATTR_NUM_ARGS",OCI_ATTR_NUM_ARGS);
SCM_SYMBOL_LONG(s_OCI_ATTR_TYPECODE,"OCI_ATTR_TYPECODE",OCI_ATTR_TYPECODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_COLLECTION_TYPECODE,"OCI_ATTR_COLLECTION_TYPECODE",OCI_ATTR_COLLECTION_TYPECODE);
SCM_SYMBOL_LONG(s_OCI_ATTR_VERSION,"OCI_ATTR_VERSION",OCI_ATTR_VERSION);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_INCOMPLETE_TYPE,"OCI_ATTR_IS_INCOMPLETE_TYPE",OCI_ATTR_IS_INCOMPLETE_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_SYSTEM_TYPE,"OCI_ATTR_IS_SYSTEM_TYPE",OCI_ATTR_IS_SYSTEM_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_PREDEFINED_TYPE,"OCI_ATTR_IS_PREDEFINED_TYPE",OCI_ATTR_IS_PREDEFINED_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_TRANSIENT_TYPE,"OCI_ATTR_IS_TRANSIENT_TYPE",OCI_ATTR_IS_TRANSIENT_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_SYSTEM_GENERATED_TYPE,"OCI_ATTR_IS_SYSTEM_GENERATED_TYPE",OCI_ATTR_IS_SYSTEM_GENERATED_TYPE);
SCM_SYMBOL_LONG(s_OCI_ATTR_HAS_NESTED_TABLE,"OCI_ATTR_HAS_NESTED_TABLE",OCI_ATTR_HAS_NESTED_TABLE);
SCM_SYMBOL_LONG(s_OCI_ATTR_HAS_LOB,"OCI_ATTR_HAS_LOB",OCI_ATTR_HAS_LOB);
SCM_SYMBOL_LONG(s_OCI_ATTR_HAS_FILE,"OCI_ATTR_HAS_FILE",OCI_ATTR_HAS_FILE);
SCM_SYMBOL_LONG(s_OCI_ATTR_COLLECTION_ELEMENT,"OCI_ATTR_COLLECTION_ELEMENT",OCI_ATTR_COLLECTION_ELEMENT);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_TYPE_ATTRS,"OCI_ATTR_NUM_TYPE_ATTRS",OCI_ATTR_NUM_TYPE_ATTRS);
SCM_SYMBOL_LONG(s_OCI_ATTR_LIST_TYPE_ATTRS,"OCI_ATTR_LIST_TYPE_ATTRS",OCI_ATTR_LIST_TYPE_ATTRS);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_TYPE_METHODS,"OCI_ATTR_NUM_TYPE_METHODS",OCI_ATTR_NUM_TYPE_METHODS);
SCM_SYMBOL_LONG(s_OCI_ATTR_LIST_TYPE_METHODS,"OCI_ATTR_LIST_TYPE_METHODS",OCI_ATTR_LIST_TYPE_METHODS);
SCM_SYMBOL_LONG(s_OCI_ATTR_MAP_METHOD,"OCI_ATTR_MAP_METHOD",OCI_ATTR_MAP_METHOD);
SCM_SYMBOL_LONG(s_OCI_ATTR_ORDER_METHOD,"OCI_ATTR_ORDER_METHOD",OCI_ATTR_ORDER_METHOD);
SCM_SYMBOL_LONG(s_OCI_ATTR_NUM_ELEMS,"OCI_ATTR_NUM_ELEMS",OCI_ATTR_NUM_ELEMS);
SCM_SYMBOL_LONG(s_OCI_ATTR_ENCAPSULATION,"OCI_ATTR_ENCAPSULATION",OCI_ATTR_ENCAPSULATION);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_SELFISH,"OCI_ATTR_IS_SELFISH",OCI_ATTR_IS_SELFISH);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_VIRTUAL,"OCI_ATTR_IS_VIRTUAL",OCI_ATTR_IS_VIRTUAL);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_INLINE,"OCI_ATTR_IS_INLINE",OCI_ATTR_IS_INLINE);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_CONSTANT,"OCI_ATTR_IS_CONSTANT",OCI_ATTR_IS_CONSTANT);
SCM_SYMBOL_LONG(s_OCI_ATTR_HAS_RESULT,"OCI_ATTR_HAS_RESULT",OCI_ATTR_HAS_RESULT);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_CONSTRUCTOR,"OCI_ATTR_IS_CONSTRUCTOR",OCI_ATTR_IS_CONSTRUCTOR);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_DESTRUCTOR,"OCI_ATTR_IS_DESTRUCTOR",OCI_ATTR_IS_DESTRUCTOR);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_OPERATOR,"OCI_ATTR_IS_OPERATOR",OCI_ATTR_IS_OPERATOR);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_MAP,"OCI_ATTR_IS_MAP",OCI_ATTR_IS_MAP);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_ORDER,"OCI_ATTR_IS_ORDER",OCI_ATTR_IS_ORDER);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_RNDS,"OCI_ATTR_IS_RNDS",OCI_ATTR_IS_RNDS);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_RNPS,"OCI_ATTR_IS_RNPS",OCI_ATTR_IS_RNPS);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_WNDS,"OCI_ATTR_IS_WNDS",OCI_ATTR_IS_WNDS);
SCM_SYMBOL_LONG(s_OCI_ATTR_IS_WNPS,"OCI_ATTR_IS_WNPS",OCI_ATTR_IS_WNPS);
SCM_SYMBOL_LONG(s_OCI_ATTR_DESC_PUBLIC,"OCI_ATTR_DESC_PUBLIC",OCI_ATTR_DESC_PUBLIC);
SCM_SYMBOL_LONG(s_OCI_AUTH,"OCI_AUTH",OCI_AUTH);
SCM_SYMBOL_LONG(s_OCI_MAX_FNS,"OCI_MAX_FNS",OCI_MAX_FNS);
SCM_SYMBOL_LONG(s_OCI_SQLSTATE_SIZE,"OCI_SQLSTATE_SIZE",OCI_SQLSTATE_SIZE);
SCM_SYMBOL_LONG(s_OCI_ERROR_MAXMSG_SIZE,"OCI_ERROR_MAXMSG_SIZE",OCI_ERROR_MAXMSG_SIZE);
SCM_SYMBOL_LONG(s_OCI_ROWID_LEN,"OCI_ROWID_LEN",OCI_ROWID_LEN);
SCM_SYMBOL_LONG(s_OCI_FO_END,"OCI_FO_END",OCI_FO_END);
SCM_SYMBOL_LONG(s_OCI_FO_ABORT,"OCI_FO_ABORT",OCI_FO_ABORT);
SCM_SYMBOL_LONG(s_OCI_FO_REAUTH,"OCI_FO_REAUTH",OCI_FO_REAUTH);
SCM_SYMBOL_LONG(s_OCI_FO_BEGIN,"OCI_FO_BEGIN",OCI_FO_BEGIN);
SCM_SYMBOL_LONG(s_OCI_FO_ERROR,"OCI_FO_ERROR",OCI_FO_ERROR);
SCM_SYMBOL_LONG(s_OCI_FO_NONE,"OCI_FO_NONE",OCI_FO_NONE);
SCM_SYMBOL_LONG(s_OCI_FO_SESSION,"OCI_FO_SESSION",OCI_FO_SESSION);
SCM_SYMBOL_LONG(s_OCI_FO_SELECT,"OCI_FO_SELECT",OCI_FO_SELECT);
SCM_SYMBOL_LONG(s_OCI_FO_TXNAL,"OCI_FO_TXNAL",OCI_FO_TXNAL);
SCM_SYMBOL_LONG(s_OCI_FNCODE_INITIALIZE,"OCI_FNCODE_INITIALIZE",OCI_FNCODE_INITIALIZE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_HANDLEALLOC,"OCI_FNCODE_HANDLEALLOC",OCI_FNCODE_HANDLEALLOC);
SCM_SYMBOL_LONG(s_OCI_FNCODE_HANDLEFREE,"OCI_FNCODE_HANDLEFREE",OCI_FNCODE_HANDLEFREE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DESCRIPTORALLOC,"OCI_FNCODE_DESCRIPTORALLOC",OCI_FNCODE_DESCRIPTORALLOC);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DESCRIPTORFREE,"OCI_FNCODE_DESCRIPTORFREE",OCI_FNCODE_DESCRIPTORFREE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_ENVINIT,"OCI_FNCODE_ENVINIT",OCI_FNCODE_ENVINIT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_SERVERATTACH,"OCI_FNCODE_SERVERATTACH",OCI_FNCODE_SERVERATTACH);
SCM_SYMBOL_LONG(s_OCI_FNCODE_SERVERDETACH,"OCI_FNCODE_SERVERDETACH",OCI_FNCODE_SERVERDETACH);
SCM_SYMBOL_LONG(s_OCI_FNCODE_SESSIONBEGIN,"OCI_FNCODE_SESSIONBEGIN",OCI_FNCODE_SESSIONBEGIN);
SCM_SYMBOL_LONG(s_OCI_FNCODE_SESSIONEND,"OCI_FNCODE_SESSIONEND",OCI_FNCODE_SESSIONEND);
SCM_SYMBOL_LONG(s_OCI_FNCODE_PASSWORDCHANGE,"OCI_FNCODE_PASSWORDCHANGE",OCI_FNCODE_PASSWORDCHANGE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_STMTPREPARE,"OCI_FNCODE_STMTPREPARE",OCI_FNCODE_STMTPREPARE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_BINDDYNAMIC,"OCI_FNCODE_BINDDYNAMIC",OCI_FNCODE_BINDDYNAMIC);
SCM_SYMBOL_LONG(s_OCI_FNCODE_BINDOBJECT,"OCI_FNCODE_BINDOBJECT",OCI_FNCODE_BINDOBJECT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_BINDARRAYOFSTRUCT,"OCI_FNCODE_BINDARRAYOFSTRUCT",OCI_FNCODE_BINDARRAYOFSTRUCT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_STMTEXECUTE,"OCI_FNCODE_STMTEXECUTE",OCI_FNCODE_STMTEXECUTE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DEFINEOBJECT,"OCI_FNCODE_DEFINEOBJECT",OCI_FNCODE_DEFINEOBJECT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DEFINEDYNAMIC,"OCI_FNCODE_DEFINEDYNAMIC",OCI_FNCODE_DEFINEDYNAMIC);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DEFINEARRAYOFSTRUCT,"OCI_FNCODE_DEFINEARRAYOFSTRUCT",OCI_FNCODE_DEFINEARRAYOFSTRUCT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_STMTFETCH,"OCI_FNCODE_STMTFETCH",OCI_FNCODE_STMTFETCH);
SCM_SYMBOL_LONG(s_OCI_FNCODE_STMTGETBIND,"OCI_FNCODE_STMTGETBIND",OCI_FNCODE_STMTGETBIND);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DESCRIBEANY,"OCI_FNCODE_DESCRIBEANY",OCI_FNCODE_DESCRIBEANY);
SCM_SYMBOL_LONG(s_OCI_FNCODE_TRANSSTART,"OCI_FNCODE_TRANSSTART",OCI_FNCODE_TRANSSTART);
SCM_SYMBOL_LONG(s_OCI_FNCODE_TRANSDETACH,"OCI_FNCODE_TRANSDETACH",OCI_FNCODE_TRANSDETACH);
SCM_SYMBOL_LONG(s_OCI_FNCODE_TRANSCOMMIT,"OCI_FNCODE_TRANSCOMMIT",OCI_FNCODE_TRANSCOMMIT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_ERRORGET,"OCI_FNCODE_ERRORGET",OCI_FNCODE_ERRORGET);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBOPENFILE,"OCI_FNCODE_LOBOPENFILE",OCI_FNCODE_LOBOPENFILE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBCLOSEFILE,"OCI_FNCODE_LOBCLOSEFILE",OCI_FNCODE_LOBCLOSEFILE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBCOPY,"OCI_FNCODE_LOBCOPY",OCI_FNCODE_LOBCOPY);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBAPPEND,"OCI_FNCODE_LOBAPPEND",OCI_FNCODE_LOBAPPEND);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBERASE,"OCI_FNCODE_LOBERASE",OCI_FNCODE_LOBERASE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBLENGTH,"OCI_FNCODE_LOBLENGTH",OCI_FNCODE_LOBLENGTH);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBTRIM,"OCI_FNCODE_LOBTRIM",OCI_FNCODE_LOBTRIM);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBREAD,"OCI_FNCODE_LOBREAD",OCI_FNCODE_LOBREAD);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBWRITE,"OCI_FNCODE_LOBWRITE",OCI_FNCODE_LOBWRITE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_SVCCTXBREAK,"OCI_FNCODE_SVCCTXBREAK",OCI_FNCODE_SVCCTXBREAK);
SCM_SYMBOL_LONG(s_OCI_FNCODE_SERVERVERSION,"OCI_FNCODE_SERVERVERSION",OCI_FNCODE_SERVERVERSION);
SCM_SYMBOL_LONG(s_OCI_FNCODE_ATTRGET,"OCI_FNCODE_ATTRGET",OCI_FNCODE_ATTRGET);
SCM_SYMBOL_LONG(s_OCI_FNCODE_ATTRSET,"OCI_FNCODE_ATTRSET",OCI_FNCODE_ATTRSET);
SCM_SYMBOL_LONG(s_OCI_FNCODE_PARAMSET,"OCI_FNCODE_PARAMSET",OCI_FNCODE_PARAMSET);
SCM_SYMBOL_LONG(s_OCI_FNCODE_PARAMGET,"OCI_FNCODE_PARAMGET",OCI_FNCODE_PARAMGET);
SCM_SYMBOL_LONG(s_OCI_FNCODE_STMTGETPIECEINFO,"OCI_FNCODE_STMTGETPIECEINFO",OCI_FNCODE_STMTGETPIECEINFO);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LDATOSVCCTX,"OCI_FNCODE_LDATOSVCCTX",OCI_FNCODE_LDATOSVCCTX);
SCM_SYMBOL_LONG(s_OCI_FNCODE_STMTSETPIECEINFO,"OCI_FNCODE_STMTSETPIECEINFO",OCI_FNCODE_STMTSETPIECEINFO);
SCM_SYMBOL_LONG(s_OCI_FNCODE_TRANSFORGET,"OCI_FNCODE_TRANSFORGET",OCI_FNCODE_TRANSFORGET);
SCM_SYMBOL_LONG(s_OCI_FNCODE_TRANSPREPARE,"OCI_FNCODE_TRANSPREPARE",OCI_FNCODE_TRANSPREPARE);
SCM_SYMBOL_LONG(s_OCI_FNCODE_TRANSROLLBACK,"OCI_FNCODE_TRANSROLLBACK",OCI_FNCODE_TRANSROLLBACK);
SCM_SYMBOL_LONG(s_OCI_FNCODE_DEFINEBYPOS,"OCI_FNCODE_DEFINEBYPOS",OCI_FNCODE_DEFINEBYPOS);
SCM_SYMBOL_LONG(s_OCI_FNCODE_BINDBYPOS,"OCI_FNCODE_BINDBYPOS",OCI_FNCODE_BINDBYPOS);
SCM_SYMBOL_LONG(s_OCI_FNCODE_BINDBYNAME,"OCI_FNCODE_BINDBYNAME",OCI_FNCODE_BINDBYNAME);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBASSIGN,"OCI_FNCODE_LOBASSIGN",OCI_FNCODE_LOBASSIGN);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBISEQUAL,"OCI_FNCODE_LOBISEQUAL",OCI_FNCODE_LOBISEQUAL);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBISINIT,"OCI_FNCODE_LOBISINIT",OCI_FNCODE_LOBISINIT);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBENABLEBUFFERING,"OCI_FNCODE_LOBENABLEBUFFERING",OCI_FNCODE_LOBENABLEBUFFERING);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBCHARSETID,"OCI_FNCODE_LOBCHARSETID",OCI_FNCODE_LOBCHARSETID);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBCHARSETFORM,"OCI_FNCODE_LOBCHARSETFORM",OCI_FNCODE_LOBCHARSETFORM);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBFILESETNAME,"OCI_FNCODE_LOBFILESETNAME",OCI_FNCODE_LOBFILESETNAME);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBFILEGETNAME,"OCI_FNCODE_LOBFILEGETNAME",OCI_FNCODE_LOBFILEGETNAME);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOGON,"OCI_FNCODE_LOGON",OCI_FNCODE_LOGON);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOGOFF,"OCI_FNCODE_LOGOFF",OCI_FNCODE_LOGOFF);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBDISABLEBUFFERING,"OCI_FNCODE_LOBDISABLEBUFFERING",OCI_FNCODE_LOBDISABLEBUFFERING);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBFLUSHBUFFER,"OCI_FNCODE_LOBFLUSHBUFFER",OCI_FNCODE_LOBFLUSHBUFFER);
SCM_SYMBOL_LONG(s_OCI_FNCODE_LOBLOADFROMFILE,"OCI_FNCODE_LOBLOADFROMFILE",OCI_FNCODE_LOBLOADFROMFILE);
SCM_SYMBOL_LONG(s_OCI_ONE_PIECE,"OCI_ONE_PIECE",OCI_ONE_PIECE);
SCM_SYMBOL_LONG(s_OCI_FIRST_PIECE,"OCI_FIRST_PIECE",OCI_FIRST_PIECE);
SCM_SYMBOL_LONG(s_OCI_NEXT_PIECE,"OCI_NEXT_PIECE",OCI_NEXT_PIECE);
SCM_SYMBOL_LONG(s_OCI_LAST_PIECE,"OCI_LAST_PIECE",OCI_LAST_PIECE);
SCM_SYMBOL_LONG(s_OCI_FILE_READONLY,"OCI_FILE_READONLY",OCI_FILE_READONLY);
SCM_SYMBOL_LONG(s_OCI_LOB_BUFFER_FREE,"OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE);
SCM_SYMBOL_LONG(s_OCI_LOB_BUFFER_NOFREE,"OCI_LOB_BUFFER_NOFREE",OCI_LOB_BUFFER_NOFREE);
SCM_SYMBOL_LONG(s_OCI_PTYPE_UNK,"OCI_PTYPE_UNK",OCI_PTYPE_UNK);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TABLE,"OCI_PTYPE_TABLE",OCI_PTYPE_TABLE);
SCM_SYMBOL_LONG(s_OCI_PTYPE_VIEW,"OCI_PTYPE_VIEW",OCI_PTYPE_VIEW);
SCM_SYMBOL_LONG(s_OCI_PTYPE_PROC,"OCI_PTYPE_PROC",OCI_PTYPE_PROC);
SCM_SYMBOL_LONG(s_OCI_PTYPE_FUNC,"OCI_PTYPE_FUNC",OCI_PTYPE_FUNC);
SCM_SYMBOL_LONG(s_OCI_PTYPE_PKG,"OCI_PTYPE_PKG",OCI_PTYPE_PKG);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TYPE,"OCI_PTYPE_TYPE",OCI_PTYPE_TYPE);
SCM_SYMBOL_LONG(s_OCI_PTYPE_SYN,"OCI_PTYPE_SYN",OCI_PTYPE_SYN);
SCM_SYMBOL_LONG(s_OCI_PTYPE_SEQ,"OCI_PTYPE_SEQ",OCI_PTYPE_SEQ);
SCM_SYMBOL_LONG(s_OCI_PTYPE_COL,"OCI_PTYPE_COL",OCI_PTYPE_COL);
SCM_SYMBOL_LONG(s_OCI_PTYPE_ARG,"OCI_PTYPE_ARG",OCI_PTYPE_ARG);
SCM_SYMBOL_LONG(s_OCI_PTYPE_LIST,"OCI_PTYPE_LIST",OCI_PTYPE_LIST);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TYPE_ATTR,"OCI_PTYPE_TYPE_ATTR",OCI_PTYPE_TYPE_ATTR);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TYPE_COLL,"OCI_PTYPE_TYPE_COLL",OCI_PTYPE_TYPE_COLL);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TYPE_METHOD,"OCI_PTYPE_TYPE_METHOD",OCI_PTYPE_TYPE_METHOD);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TYPE_ARG,"OCI_PTYPE_TYPE_ARG",OCI_PTYPE_TYPE_ARG);
SCM_SYMBOL_LONG(s_OCI_PTYPE_TYPE_RESULT,"OCI_PTYPE_TYPE_RESULT",OCI_PTYPE_TYPE_RESULT);
SCM_SYMBOL_LONG(s_OCI_LTYPE_UNK,"OCI_LTYPE_UNK",OCI_LTYPE_UNK);
SCM_SYMBOL_LONG(s_OCI_LTYPE_COLUMN,"OCI_LTYPE_COLUMN",OCI_LTYPE_COLUMN);
SCM_SYMBOL_LONG(s_OCI_LTYPE_ARG_PROC,"OCI_LTYPE_ARG_PROC",OCI_LTYPE_ARG_PROC);
SCM_SYMBOL_LONG(s_OCI_LTYPE_ARG_FUNC,"OCI_LTYPE_ARG_FUNC",OCI_LTYPE_ARG_FUNC);
SCM_SYMBOL_LONG(s_OCI_LTYPE_SUBPRG,"OCI_LTYPE_SUBPRG",OCI_LTYPE_SUBPRG);
SCM_SYMBOL_LONG(s_OCI_LTYPE_TYPE_ATTR,"OCI_LTYPE_TYPE_ATTR",OCI_LTYPE_TYPE_ATTR);
SCM_SYMBOL_LONG(s_OCI_LTYPE_TYPE_METHOD,"OCI_LTYPE_TYPE_METHOD",OCI_LTYPE_TYPE_METHOD);
SCM_SYMBOL_LONG(s_OCI_LTYPE_TYPE_ARG_PROC,"OCI_LTYPE_TYPE_ARG_PROC",OCI_LTYPE_TYPE_ARG_PROC);
SCM_SYMBOL_LONG(s_OCI_LTYPE_TYPE_ARG_FUNC,"OCI_LTYPE_TYPE_ARG_FUNC",OCI_LTYPE_TYPE_ARG_FUNC);
/*long->symbol conversion*/
SCM_PROC(s_oci_typecode_to_symbol,"oci8:typecode->symbol",1,0,0,scm_oci_typecode_to_symbol);
static SCM
scm_oci_typecode_to_symbol(SCM code)
{
SCM_ASSERT(SCM_IMP(code)&&SCM_INUMP(code),
code,
SCM_ARG1,
s_oci_typecode_to_symbol);
switch (SCM_INUM(code)){
case OCI_TYPECODE_REF: return s_OCI_TYPECODE_REF;
case OCI_TYPECODE_DATE: return s_OCI_TYPECODE_DATE;
case OCI_TYPECODE_SIGNED8: return s_OCI_TYPECODE_SIGNED8;
case OCI_TYPECODE_SIGNED16: return s_OCI_TYPECODE_SIGNED16;
case OCI_TYPECODE_SIGNED32: return s_OCI_TYPECODE_SIGNED32;
case OCI_TYPECODE_REAL: return s_OCI_TYPECODE_REAL;
case OCI_TYPECODE_DOUBLE: return s_OCI_TYPECODE_DOUBLE;
case OCI_TYPECODE_FLOAT: return s_OCI_TYPECODE_FLOAT;
case OCI_TYPECODE_NUMBER: return s_OCI_TYPECODE_NUMBER;
case OCI_TYPECODE_DECIMAL: return s_OCI_TYPECODE_DECIMAL;
case OCI_TYPECODE_UNSIGNED8: return s_OCI_TYPECODE_UNSIGNED8;
case OCI_TYPECODE_UNSIGNED16: return s_OCI_TYPECODE_UNSIGNED16;
case OCI_TYPECODE_UNSIGNED32: return s_OCI_TYPECODE_UNSIGNED32;
case OCI_TYPECODE_OCTET: return s_OCI_TYPECODE_OCTET;
case OCI_TYPECODE_SMALLINT: return s_OCI_TYPECODE_SMALLINT;
case OCI_TYPECODE_INTEGER: return s_OCI_TYPECODE_INTEGER;
case OCI_TYPECODE_RAW: return s_OCI_TYPECODE_RAW;
case OCI_TYPECODE_PTR: return s_OCI_TYPECODE_PTR;
case OCI_TYPECODE_VARCHAR2: return s_OCI_TYPECODE_VARCHAR2;
case OCI_TYPECODE_CHAR: return s_OCI_TYPECODE_CHAR;
case OCI_TYPECODE_VARCHAR: return s_OCI_TYPECODE_VARCHAR;
case OCI_TYPECODE_MLSLABEL: return s_OCI_TYPECODE_MLSLABEL;
case OCI_TYPECODE_VARRAY: return s_OCI_TYPECODE_VARRAY;
case OCI_TYPECODE_TABLE: return s_OCI_TYPECODE_TABLE;
case OCI_TYPECODE_OBJECT: return s_OCI_TYPECODE_OBJECT;
case OCI_TYPECODE_NAMEDCOLLECTION: return s_OCI_TYPECODE_NAMEDCOLLECTION;
/* SQL/OTS NAMED COLLECTION TYPE */
case OCI_TYPECODE_BLOB: return s_OCI_TYPECODE_BLOB;
case OCI_TYPECODE_BFILE: return s_OCI_TYPECODE_BFILE;
case OCI_TYPECODE_CLOB: return s_OCI_TYPECODE_CLOB;
case OCI_TYPECODE_CFILE: return s_OCI_TYPECODE_CFILE;
//case OCI_TYPECODE_OTMFIRST: return s_OCI_TYPECODE_OTMFIRST;
//case OCI_TYPECODE_OTMLAST: return s_OCI_TYPECODE_OTMLAST;
case OCI_TYPECODE_SYSFIRST: return s_OCI_TYPECODE_SYSFIRST;
case OCI_TYPECODE_SYSLAST: return s_OCI_TYPECODE_SYSLAST;
}
return SCM_BOOL_F;
}
SCM_PROC(s_oci_ptype_to_symbol,"oci8:ptype->symbol",1,0,0,scm_oci_ptype_to_symbol);
static SCM
scm_oci_ptype_to_symbol(SCM code)
{
SCM_ASSERT(SCM_IMP(code)&&SCM_INUMP(code),
code,
SCM_ARG1,
s_oci_ptype_to_symbol);
switch (SCM_INUM(code)){
case OCI_PTYPE_UNK: return s_OCI_PTYPE_UNK;
case OCI_PTYPE_TABLE: return s_OCI_PTYPE_TABLE;
case OCI_PTYPE_VIEW: return s_OCI_PTYPE_VIEW;
case OCI_PTYPE_PROC: return s_OCI_PTYPE_PROC;
case OCI_PTYPE_FUNC: return s_OCI_PTYPE_FUNC;
case OCI_PTYPE_PKG: return s_OCI_PTYPE_PKG;
case OCI_PTYPE_TYPE: return s_OCI_PTYPE_TYPE;
case OCI_PTYPE_SYN: return s_OCI_PTYPE_SYN;
case OCI_PTYPE_SEQ: return s_OCI_PTYPE_SEQ;
case OCI_PTYPE_COL: return s_OCI_PTYPE_COL;
case OCI_PTYPE_ARG: return s_OCI_PTYPE_ARG;
case OCI_PTYPE_LIST: return s_OCI_PTYPE_LIST;
case OCI_PTYPE_TYPE_ATTR: return s_OCI_PTYPE_TYPE_ATTR;
case OCI_PTYPE_TYPE_COLL: return s_OCI_PTYPE_TYPE_COLL;
case OCI_PTYPE_TYPE_METHOD: return s_OCI_PTYPE_TYPE_METHOD;
case OCI_PTYPE_TYPE_ARG: return s_OCI_PTYPE_TYPE_ARG;
case OCI_PTYPE_TYPE_RESULT: return s_OCI_PTYPE_TYPE_RESULT;
}
return SCM_BOOL_F;
}
SCM_PROC(s_oci_error_to_symbol,"oci8:error->symbol",1,0,0,scm_oci_error_to_symbol);
static SCM
scm_oci_error_to_symbol(SCM code)
{
SCM_ASSERT(SCM_IMP(code)&&SCM_INUMP(code),
code,
SCM_ARG1,
s_oci_error_to_symbol);
switch (SCM_INUM(code)){
case OCI_SUCCESS: return s_OCI_SUCCESS;
case OCI_SUCCESS_WITH_INFO: return s_OCI_SUCCESS_WITH_INFO;
case OCI_NO_DATA: return s_OCI_NO_DATA;
case OCI_ERROR: return s_OCI_ERROR;
case OCI_INVALID_HANDLE: return s_OCI_INVALID_HANDLE;
case OCI_NEED_DATA: return s_OCI_NEED_DATA;
case OCI_STILL_EXECUTING: return s_OCI_STILL_EXECUTING;
case OCI_CONTINUE: return s_OCI_CONTINUE;
}
return SCM_BOOL_F;
}
SCM_PROC(s_oci_attr_to_symbol,"oci8:attr->symbol",1,0,0,scm_oci_attr_to_symbol);
static SCM
scm_oci_attr_to_symbol(SCM code)
{
SCM_ASSERT(SCM_IMP(code)&&SCM_INUMP(code),
code,
SCM_ARG1,
s_oci_attr_to_symbol);
switch (SCM_INUM(code)){
case OCI_ATTR_FNCODE: return s_OCI_ATTR_FNCODE;
case OCI_ATTR_OBJECT: return s_OCI_ATTR_OBJECT;
case OCI_ATTR_NONBLOCKING_MODE: return s_OCI_ATTR_NONBLOCKING_MODE;
case OCI_ATTR_SQLCODE: return s_OCI_ATTR_SQLCODE;
case OCI_ATTR_ENV: return s_OCI_ATTR_ENV;
case OCI_ATTR_SERVER: return s_OCI_ATTR_SERVER;
case OCI_ATTR_SESSION: return s_OCI_ATTR_SESSION;
case OCI_ATTR_TRANS: return s_OCI_ATTR_TRANS;
case OCI_ATTR_ROW_COUNT: return s_OCI_ATTR_ROW_COUNT;
case OCI_ATTR_SQLFNCODE: return s_OCI_ATTR_SQLFNCODE;
case OCI_ATTR_PREFETCH_ROWS: return s_OCI_ATTR_PREFETCH_ROWS;
case OCI_ATTR_NESTED_PREFETCH_ROWS: return s_OCI_ATTR_NESTED_PREFETCH_ROWS;
case OCI_ATTR_PREFETCH_MEMORY: return s_OCI_ATTR_PREFETCH_MEMORY;
case OCI_ATTR_NESTED_PREFETCH_MEMORY: return s_OCI_ATTR_NESTED_PREFETCH_MEMORY;
case OCI_ATTR_CHAR_COUNT: return s_OCI_ATTR_CHAR_COUNT;
case OCI_ATTR_PDSCL: return s_OCI_ATTR_PDSCL;
#if OCI8_VERSION < 810
case OCI_ATTR_PDFMT: return s_OCI_ATTR_PDFMT;
#endif
case OCI_ATTR_PARAM_COUNT: return s_OCI_ATTR_PARAM_COUNT;
case OCI_ATTR_ROWID: return s_OCI_ATTR_ROWID;
case OCI_ATTR_CHARSET: return s_OCI_ATTR_CHARSET;
case OCI_ATTR_NCHAR: return s_OCI_ATTR_NCHAR;
case OCI_ATTR_USERNAME: return s_OCI_ATTR_USERNAME;
case OCI_ATTR_PASSWORD: return s_OCI_ATTR_PASSWORD;
case OCI_ATTR_STMT_TYPE: return s_OCI_ATTR_STMT_TYPE;
case OCI_ATTR_INTERNAL_NAME: return s_OCI_ATTR_INTERNAL_NAME;
case OCI_ATTR_EXTERNAL_NAME: return s_OCI_ATTR_EXTERNAL_NAME;
case OCI_ATTR_XID: return s_OCI_ATTR_XID;
case OCI_ATTR_TRANS_LOCK: return s_OCI_ATTR_TRANS_LOCK;
case OCI_ATTR_TRANS_NAME: return s_OCI_ATTR_TRANS_NAME;
case OCI_ATTR_HEAPALLOC: return s_OCI_ATTR_HEAPALLOC;
case OCI_ATTR_CHARSET_ID: return s_OCI_ATTR_CHARSET_ID;
case OCI_ATTR_CHARSET_FORM: return s_OCI_ATTR_CHARSET_FORM;
case OCI_ATTR_MAXDATA_SIZE: return s_OCI_ATTR_MAXDATA_SIZE;
case OCI_ATTR_CACHE_OPT_SIZE: return s_OCI_ATTR_CACHE_OPT_SIZE;
case OCI_ATTR_CACHE_MAX_SIZE: return s_OCI_ATTR_CACHE_MAX_SIZE;
case OCI_ATTR_PINOPTION: return s_OCI_ATTR_PINOPTION;
case OCI_ATTR_ALLOC_DURATION: return s_OCI_ATTR_ALLOC_DURATION;
case OCI_ATTR_PIN_DURATION: return s_OCI_ATTR_PIN_DURATION;
case OCI_ATTR_FDO: return s_OCI_ATTR_FDO;
case OCI_ATTR_POSTPROCESSING_CALLBACK: return s_OCI_ATTR_POSTPROCESSING_CALLBACK;
case OCI_ATTR_POSTPROCESSING_CONTEXT: return s_OCI_ATTR_POSTPROCESSING_CONTEXT;
case OCI_ATTR_ROWS_RETURNED: return s_OCI_ATTR_ROWS_RETURNED;
case OCI_ATTR_FOCBK: return s_OCI_ATTR_FOCBK;
case OCI_ATTR_IN_V8_MODE: return s_OCI_ATTR_IN_V8_MODE;
case OCI_ATTR_LOBEMPTY: return s_OCI_ATTR_LOBEMPTY;
case OCI_ATTR_SESSLANG: return s_OCI_ATTR_SESSLANG;
case OCI_ATTR_UNK: return s_OCI_ATTR_UNK;
case OCI_ATTR_NUM_COLS: return s_OCI_ATTR_NUM_COLS;
case OCI_ATTR_LIST_COLUMNS: return s_OCI_ATTR_LIST_COLUMNS;
case OCI_ATTR_RDBA: return s_OCI_ATTR_RDBA;
case OCI_ATTR_CLUSTERED: return s_OCI_ATTR_CLUSTERED;
case OCI_ATTR_PARTITIONED: return s_OCI_ATTR_PARTITIONED;
case OCI_ATTR_INDEX_ONLY: return s_OCI_ATTR_INDEX_ONLY;
case OCI_ATTR_LIST_ARGUMENTS: return s_OCI_ATTR_LIST_ARGUMENTS;
case OCI_ATTR_LIST_SUBPROGRAMS: return s_OCI_ATTR_LIST_SUBPROGRAMS;
case OCI_ATTR_REF_TDO: return s_OCI_ATTR_REF_TDO;
case OCI_ATTR_LINK: return s_OCI_ATTR_LINK;
case OCI_ATTR_MIN: return s_OCI_ATTR_MIN;
case OCI_ATTR_MAX: return s_OCI_ATTR_MAX;
case OCI_ATTR_INCR: return s_OCI_ATTR_INCR;
case OCI_ATTR_CACHE: return s_OCI_ATTR_CACHE;
case OCI_ATTR_ORDER: return s_OCI_ATTR_ORDER;
case OCI_ATTR_HW_MARK: return s_OCI_ATTR_HW_MARK;
case OCI_ATTR_TYPE_SCHEMA: return s_OCI_ATTR_TYPE_SCHEMA;
case OCI_ATTR_TIMESTAMP: return s_OCI_ATTR_TIMESTAMP;
case OCI_ATTR_NUM_ATTRS: return s_OCI_ATTR_NUM_ATTRS;
case OCI_ATTR_NUM_PARAMS: return s_OCI_ATTR_NUM_PARAMS;
case OCI_ATTR_OBJID: return s_OCI_ATTR_OBJID;
case OCI_ATTR_PTYPE: return s_OCI_ATTR_PTYPE;
case OCI_ATTR_PARAM: return s_OCI_ATTR_PARAM;
case OCI_ATTR_OVERLOAD_ID: return s_OCI_ATTR_OVERLOAD_ID;
case OCI_ATTR_TABLESPACE: return s_OCI_ATTR_TABLESPACE;
case OCI_ATTR_TDO: return s_OCI_ATTR_TDO;
case OCI_ATTR_PARSE_ERROR_OFFSET: return s_OCI_ATTR_PARSE_ERROR_OFFSET;
}
return SCM_BOOL_F;
}
SCM_PROC(s_oci_attr_param_to_symbol,"oci8:attr/param->symbol",1,0,0,scm_oci_attr_param_to_symbol);
static SCM
scm_oci_attr_param_to_symbol(SCM code)
{
SCM_ASSERT(SCM_IMP(code)&&SCM_INUMP(code),
code,
SCM_ARG1,
s_oci_attr_to_symbol);
switch (SCM_INUM(code)){
case OCI_ATTR_DATA_SIZE: return s_OCI_ATTR_DATA_SIZE;
case OCI_ATTR_DATA_TYPE: return s_OCI_ATTR_DATA_TYPE;
case OCI_ATTR_DISP_SIZE: return s_OCI_ATTR_DISP_SIZE;
case OCI_ATTR_NAME: return s_OCI_ATTR_NAME;
case OCI_ATTR_PRECISION: return s_OCI_ATTR_PRECISION;
case OCI_ATTR_SCALE: return s_OCI_ATTR_SCALE;
case OCI_ATTR_IS_NULL: return s_OCI_ATTR_IS_NULL;
case OCI_ATTR_TYPE_NAME: return s_OCI_ATTR_TYPE_NAME;
case OCI_ATTR_SCHEMA_NAME: return s_OCI_ATTR_SCHEMA_NAME;
case OCI_ATTR_SUB_NAME: return s_OCI_ATTR_SUB_NAME;
case OCI_ATTR_POSITION: return s_OCI_ATTR_POSITION;
case OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE: return s_OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE;
case OCI_ATTR_DISP_NAME: return s_OCI_ATTR_DISP_NAME;
case OCI_ATTR_OVERLOAD: return s_OCI_ATTR_OVERLOAD;
case OCI_ATTR_LEVEL: return s_OCI_ATTR_LEVEL;
case OCI_ATTR_HAS_DEFAULT: return s_OCI_ATTR_HAS_DEFAULT;
case OCI_ATTR_IOMODE: return s_OCI_ATTR_IOMODE;
case OCI_ATTR_RADIX: return s_OCI_ATTR_RADIX;
case OCI_ATTR_NUM_ARGS: return s_OCI_ATTR_NUM_ARGS;
case OCI_ATTR_TYPECODE: return s_OCI_ATTR_TYPECODE;
case OCI_ATTR_COLLECTION_TYPECODE: return s_OCI_ATTR_COLLECTION_TYPECODE;
case OCI_ATTR_VERSION: return s_OCI_ATTR_VERSION;
case OCI_ATTR_IS_INCOMPLETE_TYPE: return s_OCI_ATTR_IS_INCOMPLETE_TYPE;
case OCI_ATTR_IS_SYSTEM_TYPE: return s_OCI_ATTR_IS_SYSTEM_TYPE;
case OCI_ATTR_IS_PREDEFINED_TYPE: return s_OCI_ATTR_IS_PREDEFINED_TYPE;
case OCI_ATTR_IS_TRANSIENT_TYPE: return s_OCI_ATTR_IS_TRANSIENT_TYPE;
case OCI_ATTR_IS_SYSTEM_GENERATED_TYPE: return s_OCI_ATTR_IS_SYSTEM_GENERATED_TYPE;
case OCI_ATTR_HAS_NESTED_TABLE: return s_OCI_ATTR_HAS_NESTED_TABLE;
case OCI_ATTR_HAS_LOB: return s_OCI_ATTR_HAS_LOB;
case OCI_ATTR_HAS_FILE: return s_OCI_ATTR_HAS_FILE;
case OCI_ATTR_COLLECTION_ELEMENT: return s_OCI_ATTR_COLLECTION_ELEMENT;
case OCI_ATTR_NUM_TYPE_ATTRS: return s_OCI_ATTR_NUM_TYPE_ATTRS;
case OCI_ATTR_LIST_TYPE_ATTRS: return s_OCI_ATTR_LIST_TYPE_ATTRS;
case OCI_ATTR_NUM_TYPE_METHODS: return s_OCI_ATTR_NUM_TYPE_METHODS;
case OCI_ATTR_LIST_TYPE_METHODS: return s_OCI_ATTR_LIST_TYPE_METHODS;
case OCI_ATTR_MAP_METHOD: return s_OCI_ATTR_MAP_METHOD;
case OCI_ATTR_ORDER_METHOD: return s_OCI_ATTR_ORDER_METHOD;
case OCI_ATTR_NUM_ELEMS: return s_OCI_ATTR_NUM_ELEMS;
case OCI_ATTR_ENCAPSULATION: return s_OCI_ATTR_ENCAPSULATION;
case OCI_ATTR_IS_SELFISH: return s_OCI_ATTR_IS_SELFISH;
case OCI_ATTR_IS_VIRTUAL: return s_OCI_ATTR_IS_VIRTUAL;
case OCI_ATTR_IS_INLINE: return s_OCI_ATTR_IS_INLINE;
case OCI_ATTR_IS_CONSTANT: return s_OCI_ATTR_IS_CONSTANT;
case OCI_ATTR_HAS_RESULT: return s_OCI_ATTR_HAS_RESULT;
case OCI_ATTR_IS_CONSTRUCTOR: return s_OCI_ATTR_IS_CONSTRUCTOR;
case OCI_ATTR_IS_DESTRUCTOR: return s_OCI_ATTR_IS_DESTRUCTOR;
case OCI_ATTR_IS_OPERATOR: return s_OCI_ATTR_IS_OPERATOR;
case OCI_ATTR_IS_MAP: return s_OCI_ATTR_IS_MAP;
case OCI_ATTR_IS_ORDER: return s_OCI_ATTR_IS_ORDER;
case OCI_ATTR_IS_RNDS: return s_OCI_ATTR_IS_RNDS;
case OCI_ATTR_IS_RNPS: return s_OCI_ATTR_IS_RNPS;
case OCI_ATTR_IS_WNDS: return s_OCI_ATTR_IS_WNDS;
case OCI_ATTR_IS_WNPS: return s_OCI_ATTR_IS_WNPS;
case OCI_ATTR_DESC_PUBLIC: return s_OCI_ATTR_DESC_PUBLIC;
}
return SCM_BOOL_F;
}
/**********************************************************
Misc funcs
**********************************************************/
static SCM
scm_oci_err_code(sword code)
{
//return SCM_MAKINUM(code);
SCM scm_code=SCM_MAKINUM(code);
if (DO_USE_SYMBOLS){
SCM ret=scm_oci_error_to_symbol(scm_code);
if (SCM_NFALSEP(ret))
return ret;
}
return scm_code;
}
/**********************************************************
OCIEnv
**********************************************************/
static tag_t tag_env;
typedef struct tag_env{
OCIEnv *handle;
} env;
#define SCM_OCIENV(smob) ((env*)SCM_CDR(smob))
#define SCM_OCIENVP(smob) SCM_SMOB_PREDICATE(tag_env,smob)
static scm_sizet
free_env (SCM smob)
{
if (SCM_OCIENV(smob)->handle)
OCIHandleFree(SCM_OCIENV(smob)->handle,OCI_HTYPE_ENV);
free(SCM_OCIENV(smob));
return sizeof(env);
};
static int
print_env (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIEnv",SCM_OCIENV(smob)->handle);
scm_puts(buf,port);
return 1;
}
static SCM
scm_make_env(OCIEnv *handle,const char* func)
{
env* e=scm_must_malloc(sizeof(env),func);
e->handle=handle;
SCM_RETURN_NEWSMOB(tag_env,e);
}
/**********************************************************
OCIError
**********************************************************/
static tag_t tag_error;
typedef struct tag_error{
OCIError *handle;
SCM env;
} error;
#define SCM_OCIERROR(smob) ((error*)SCM_CDR(smob))
#define SCM_OCIERRORP(smob) SCM_SMOB_PREDICATE(tag_error,smob)
static SCM
mark_error (SCM smob)
{
scm_gc_mark((SCM_OCIERROR(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_error (SCM smob)
{
if (SCM_OCIERROR(smob)->handle)
OCIHandleFree(SCM_OCIERROR(smob)->handle,OCI_HTYPE_ERROR);
free(SCM_OCIERROR(smob));
return sizeof(error);
};
static int
print_error (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIError",SCM_OCIERROR(smob)->handle);
scm_puts(buf,port);
return 1;
}
static SCM
scm_make_error(SCM env,dvoid *handle,const char* func)
{
error* h=scm_must_malloc(sizeof(error),func);
h->handle=(OCIError*)handle;
h->env=env;
SCM_RETURN_NEWSMOB(tag_error,h);
}
/**********************************************************
OCISvcCtx
**********************************************************/
static tag_t tag_svcctx;
typedef struct tag_svcctx{
OCISvcCtx *handle;
SCM env;
} svcctx;
#define SCM_OCISVCCTX(smob) ((svcctx*)SCM_CDR(smob))
#define SCM_OCISVCCTXP(smob) SCM_SMOB_PREDICATE(tag_svcctx,smob)
static SCM
mark_svcctx (SCM smob)
{
scm_gc_mark((SCM_OCISVCCTX(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_svcctx (SCM smob)
{
if (SCM_OCISVCCTX(smob)->handle)
OCIHandleFree(SCM_OCISVCCTX(smob)->handle,OCI_HTYPE_SVCCTX);
free(SCM_OCISVCCTX(smob));
return sizeof(svcctx);
};
static int
print_svcctx (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCISvcCtx",SCM_OCISVCCTX(smob)->handle);
scm_puts(buf,port);
return 1;
}
static SCM
scm_make_svcctx(SCM env,dvoid *handle,const char* func)
{
svcctx* h=scm_must_malloc(sizeof(svcctx),func);
h->handle=(OCISvcCtx*)handle;
h->env=env;
SCM_RETURN_NEWSMOB(tag_svcctx,h);
}
/**********************************************************
OCIStmt
**********************************************************/
static tag_t tag_stmt;
typedef struct tag_stmt{
OCIStmt *handle;
SCM env;
} stmt;
#define SCM_OCISTMT(smob) ((struct tag_stmt*)SCM_CDR(smob))
#define SCM_OCISTMTP(smob) SCM_SMOB_PREDICATE(tag_stmt,smob)
static SCM
mark_stmt (SCM smob)
{
scm_gc_mark((SCM_OCISTMT(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_stmt (SCM smob)
{
if (SCM_OCISTMT(smob)->handle)
OCIHandleFree(SCM_OCISTMT(smob)->handle,OCI_HTYPE_STMT);
free(SCM_OCISTMT(smob));
return sizeof(stmt);
};
static int
print_stmt (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIStmt",SCM_OCISTMT(smob)->handle);
scm_puts(buf,port);
return 1;
}
static SCM
scm_make_stmt(SCM env,dvoid *handle,const char* func)
{
stmt* h=scm_must_malloc(sizeof(stmt),func);
h->handle=(OCIStmt*)handle;
h->env=env;
SCM_RETURN_NEWSMOB(tag_stmt,h);
}
/**********************************************************
placeholder
**********************************************************/
typedef struct tag_placeholder{
dvoid* valuep;
sb4 value_sz;
ub2 dty;
dvoid* indp;
ub2* alenp;
ub2* rcodep;
ub4 maxarr_len;
ub4 curele;
SCM stmt;
}placeholder;
void static
free_placeholder(placeholder *pl)
{
free (pl->valuep);
free (pl->indp);
free (pl->alenp);
free (pl->rcodep);
};
/**********************************************************
OCIBind
**********************************************************/
static tag_t tag_bind;
typedef struct tag_bind{
placeholder pl;
OCIBind *handle;
//SCM env;
} bind;
#define SCM_OCIBIND(smob) ((bind*)SCM_CDR(smob))
#define SCM_OCIBINDP(smob) SCM_SMOB_PREDICATE(tag_bind,smob)
static SCM
mark_bind (SCM smob)
{
scm_gc_mark((SCM_OCIBIND(smob))->pl.stmt);
return SCM_BOOL_F;
}
static scm_sizet
free_bind (SCM smob)
{
/*NB, Oracle Programmers Guide says Bind handle is freed by Stmt
* But deja.com argue with it. So...
*/
/*if (SCM_OCIBIND(smob)->handle)
OCIHandleFree(SCM_OCIBIND(smob)->handle,OCI_HTYPE_BIND);*/
free_placeholder(&SCM_OCIBIND(smob)->pl);
free(SCM_OCIBIND(smob));
return sizeof(bind);
};
static int
print_bind (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[128];
sprintf(buf,"#<%s(%s): %p>","OCIBind",
SCM_CHARS(scm_oci_typecode_to_symbol(
SCM_MAKINUM((SCM_OCIBIND(smob)->pl.dty)))),
SCM_OCIBIND(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCIDefine
**********************************************************/
static tag_t tag_define;
typedef struct tag_define{
placeholder pl;
OCIDefine *handle;
//SCM env;
} define;
#define SCM_OCIDEFINE(smob) ((define*)SCM_CDR(smob))
#define SCM_OCIDEFINEP(smob) SCM_SMOB_PREDICATE(tag_define,smob)
static SCM
mark_define (SCM smob)
{
//scm_gc_mark((SCM_OCIDEFINE(smob))->env);
scm_gc_mark((SCM_OCIBIND(smob))->pl.stmt);
return SCM_BOOL_F;
}
static scm_sizet
free_define (SCM smob)
{
/*if (SCM_OCIDEFINE(smob)->handle)
OCIHandleFree(SCM_OCIDEFINE(smob)->handle,OCI_HTYPE_DEFINE);*/
free_placeholder(&SCM_OCIDEFINE(smob)->pl);
free(SCM_OCIDEFINE(smob));
return sizeof(define);
};
static int
print_define (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIDefine",SCM_OCIDEFINE(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCIDescribe
**********************************************************/
static tag_t tag_describe;
typedef struct tag_describe{
OCIDescribe *handle;
SCM env;
} describe;
#define SCM_OCIDESCRIBE(smob) ((describe*)SCM_CDR(smob))
#define SCM_OCIDESCRIBEP(smob) SCM_SMOB_PREDICATE(tag_describe,smob)
static SCM
mark_describe (SCM smob)
{
scm_gc_mark((SCM_OCIDESCRIBE(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_describe (SCM smob)
{
if (SCM_OCIDESCRIBE(smob)->handle)
OCIHandleFree(SCM_OCIDESCRIBE(smob)->handle,OCI_HTYPE_DESCRIBE);
free(SCM_OCIDESCRIBE(smob));
return sizeof(describe);
};
static int
print_describe (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIDescribe",SCM_OCIDESCRIBE(smob)->handle);
scm_puts(buf,port);
return 1;
}
static SCM
scm_make_describe(SCM env,dvoid *handle,const char* func)
{
describe* h=scm_must_malloc(sizeof(describe),func);
h->handle=(OCIDescribe*)handle;
h->env=env;
SCM_RETURN_NEWSMOB(tag_describe,h);
}
/**********************************************************
OCIServer
**********************************************************/
static tag_t tag_server;
typedef struct tag_server{
OCIServer *handle;
SCM env;
} server;
#define SCM_OCISERVER(smob) ((server*)SCM_CDR(smob))
#define SCM_OCISERVERP(smob) SCM_SMOB_PREDICATE(tag_server,smob)
static SCM
mark_server (SCM smob)
{
scm_gc_mark((SCM_OCISERVER(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_server (SCM smob)
{
if (SCM_OCISERVER(smob)->handle)
OCIHandleFree(SCM_OCISERVER(smob)->handle,OCI_HTYPE_SERVER);
free(SCM_OCISERVER(smob));
return sizeof(server);
};
static int
print_server (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIServer",SCM_OCISERVER(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCISession
**********************************************************/
static tag_t tag_session;
typedef struct tag_session{
OCISession *handle;
SCM env;
} session;
#define SCM_OCISESSION(smob) ((session*)SCM_CDR(smob))
#define SCM_OCISESSIONP(smob) SCM_SMOB_PREDICATE(tag_session,smob)
static SCM
mark_session (SCM smob)
{
scm_gc_mark((SCM_OCISESSION(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_session (SCM smob)
{
if (SCM_OCISESSION(smob)->handle)
OCIHandleFree(SCM_OCISESSION(smob)->handle,OCI_HTYPE_SESSION);
free(SCM_OCISESSION(smob));
return sizeof(session);
};
static int
print_session (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCISession",SCM_OCISESSION(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCIComplexObject
**********************************************************/
static tag_t tag_complexobject;
typedef struct tag_complexobject{
OCIComplexObject *handle;
SCM env;
} complexobject;
#define SCM_OCICOMPLEXOBJECT(smob) ((complexobject*)SCM_CDR(smob))
#define SCM_OCICOMPLEXOBJECTP(smob) SCM_SMOB_PREDICATE(tag_complexobject,smob)
static SCM
mark_complexobject (SCM smob)
{
scm_gc_mark((SCM_OCICOMPLEXOBJECT(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_complexobject (SCM smob)
{
if (SCM_OCICOMPLEXOBJECT(smob)->handle)
OCIHandleFree(SCM_OCICOMPLEXOBJECT(smob)->handle,OCI_HTYPE_COMPLEXOBJECT);
free(SCM_OCICOMPLEXOBJECT(smob));
return sizeof(complexobject);
};
static int
print_complexobject (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIComplexObject",SCM_OCICOMPLEXOBJECT(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCITrans
**********************************************************/
static tag_t tag_trans;
typedef struct tag_trans{
OCITrans *handle;
SCM env;
} trans;
#define SCM_OCITRANS(smob) ((trans*)SCM_CDR(smob))
#define SCM_OCITRANSP(smob) SCM_SMOB_PREDICATE(tag_trans,smob)
static SCM
mark_trans (SCM smob)
{
scm_gc_mark((SCM_OCITRANS(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_trans (SCM smob)
{
if (SCM_OCITRANS(smob)->handle)
OCIHandleFree(SCM_OCITRANS(smob)->handle,OCI_HTYPE_TRANS);
free(SCM_OCITRANS(smob));
return sizeof(trans);
};
static int
print_trans (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCITrans",SCM_OCITRANS(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCISecurity
**********************************************************/
static tag_t tag_security;
typedef struct tag_security{
OCISecurity *handle;
SCM env;
} security;
#define SCM_OCISECURITY(smob) ((security*)SCM_CDR(smob))
#define SCM_OCISECURITYP(smob) SCM_SMOB_PREDICATE(tag_security,smob)
static SCM
mark_security (SCM smob)
{
scm_gc_mark((SCM_OCISECURITY(smob))->env);
return SCM_BOOL_F;
}
static scm_sizet
free_security (SCM smob)
{
if (SCM_OCISECURITY(smob)->handle)
OCIHandleFree(SCM_OCISECURITY(smob)->handle,OCI_HTYPE_SECURITY);
free(SCM_OCISECURITY(smob));
return sizeof(security);
};
static int
print_security (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCISecurity",SCM_OCISECURITY(smob)->handle);
scm_puts(buf,port);
return 1;
}
/**********************************************************
OCIParam
**********************************************************/
static tag_t tag_param;
typedef struct tag_param{
OCIParam *handle;
} param;
#define SCM_OCIPARAM(smob) ((param*)SCM_CDR(smob))
#define SCM_OCIPARAMP(smob) SCM_SMOB_PREDICATE(tag_param,smob)
/*
static SCM
mark_param (SCM smob)
{
scm_gc_mark((SCM_OCIPARAM(smob))->env);
return SCM_BOOL_F;
}
*/
static scm_sizet
free_param (SCM smob)
{
if (SCM_OCIPARAM(smob)->handle)
OCIDescriptorFree(SCM_OCIPARAM(smob)->handle,OCI_DTYPE_PARAM);
free(SCM_OCIPARAM(smob));
return sizeof(param);
};
static int
print_param (SCM smob,SCM port,scm_print_state *pstate)
{
char buf[64];
sprintf(buf,"#<%s: %p>","OCIParam",SCM_OCIPARAM(smob)->handle);
scm_puts(buf,port);
return 1;
}
static SCM
scm_make_param(dvoid *handle,const char* func)
{
param* h=scm_must_malloc(sizeof(param),func);
h->handle=(OCIParam*)handle;
SCM_RETURN_NEWSMOB(tag_param,h);
}
/**********************************************************
Error handling
**********************************************************/
static SCM scm_ErrorGet (SCM scm_hndlp,SCM scm_recordno);
static void oci_error(const char *subr,sword code,SCM err)
{
SCM msg;
SCM ecode;
if (SCM_FALSEP(err)){
msg=scm_makfrom0str(" N/A");
ecode=SCM_BOOL_F;
}else{
SCM code_msg=scm_ErrorGet(err,SCM_UNDEFINED);
msg=SCM_CDR(code_msg);
ecode=SCM_CAR(code_msg);
}
scm_error(s_oci8_error,
subr,
"OCI failed with code ~A/~A (~A)",
SCM_LIST3(SCM_MAKINUM(code),
scm_oci_err_code(code),
msg),
SCM_LIST2(ecode,msg));
}
/**********************************************************
OCI Funcs
**********************************************************/
SCM_PROC(s_Initialize,"OCIInitialize",0,1,0,scm_Initialize);
static SCM
scm_Initialize (SCM scm_mode)
{
sword c;
int mode;
SCM_ASSERT(SCM_UNBNDP(scm_mode) || (SCM_IMP(scm_mode) && SCM_INUMP(scm_mode)),
scm_mode,
SCM_ARG1,
s_Initialize);
if (SCM_UNBNDP(scm_mode)){
mode=OCI_DEFAULT;
}else{
SCM_ASSERT(SCM_IMP(scm_mode)&&SCM_INUMP(scm_mode),
scm_mode,SCM_ARG1,s_Initialize);
mode=SCM_INUM(scm_mode);
}
if (OCI_SUCCESS==(c=OCIInitialize(mode,0,NULL,NULL,NULL)))
return SCM_BOOL_T;
else
oci_error(s_Initialize,
c,
SCM_LIST1(scm_mode));
return SCM_BOOL_F;
}
SCM_PROC(s_HandleAlloc,"OCIHandleAlloc",2,0,0,scm_HandleAlloc);
static SCM
scm_HandleAlloc (SCM scm_parenth,SCM scm_type)
{
dvoid* hndlpp;
ub4 type;
sword c;
SCM (*make_func)(SCM env,dvoid* handle,const char *func_name);
SCM_ASSERT(SCM_OCIENVP(scm_parenth),scm_parenth,SCM_ARG1,s_HandleAlloc);
SCM_ASSERT(SCM_IMP(scm_type) && SCM_INUMP(scm_type),
scm_type,SCM_ARG2,s_HandleAlloc);
type=SCM_INUM(scm_type);
switch (type){
case OCI_HTYPE_SVCCTX:
make_func=scm_make_svcctx;
break;
case OCI_HTYPE_ERROR:
make_func=scm_make_error;
break;
case OCI_HTYPE_STMT:
make_func=scm_make_stmt;
break;
case OCI_HTYPE_DESCRIBE:
make_func=scm_make_describe;
break;
default:
SCM_ASSERT(0,scm_type,SCM_ARG2,s_HandleAlloc);
return SCM_BOOL_F;
}
if (OCI_SUCCESS==(c=OCIHandleAlloc(SCM_OCIENV(scm_parenth)->handle,
&hndlpp,type,0,NULL)))
return make_func(scm_parenth,hndlpp,s_HandleAlloc);
else
oci_error(s_HandleAlloc,c,SCM_BOOL_F);
return SCM_BOOL_F;
}
SCM_PROC(s_HandleFree,"OCIHandleFree",1,0,0,scm_HandleFree);
static SCM
scm_HandleFree (SCM scm_hndlp)
{
dvoid** hndlp;
ub4 htype;
sword c;
if (SCM_OCISTMTP(scm_hndlp)){
htype=OCI_HTYPE_STMT;
hndlp=(dvoid**)&SCM_OCISTMT(scm_hndlp)->handle;
}else if (SCM_OCIDESCRIBEP(scm_hndlp)){
htype=OCI_HTYPE_DESCRIBE;
hndlp=(dvoid**)&SCM_OCIDESCRIBE(scm_hndlp)->handle;
}else if (SCM_OCICOMPLEXOBJECTP(scm_hndlp)){
htype=OCI_HTYPE_COMPLEXOBJECT;
hndlp=(dvoid**)&SCM_OCICOMPLEXOBJECT(scm_hndlp)->handle;
}else{
SCM_ASSERT(0,scm_hndlp,SCM_ARG1,s_HandleFree);
return 0;
}
if (OCI_SUCCESS==(c=OCIHandleFree(*hndlp,htype))){
*hndlp=NULL;
return SCM_BOOL_T;
}else
oci_error(s_HandleFree,c,SCM_BOOL_F);
return SCM_BOOL_F;
}
/*
SCM_PROC(s_DescriptorAlloc,"OCIDescriptorAlloc",5,0,0,scm_DescriptorAlloc);
static SCM
scm_DescriptorAlloc (SCM scm_parenth,SCM scm_descpp,SCM scm_type,SCM scm_xtramem_sz,SCM scm_usrmempp)
{
dvoid* parenth;
dvoid** descpp;
ub4 type;
size_t xtramem_sz;
dvoid** usrmempp;
return SCM_MAKINUM(OCIDescriptorAlloc(parenth,descpp,type,xtramem_sz,usrmempp));
}
*/
SCM_PROC(s_DescriptorFree,"OCIDescriptorFree",1,0,0,scm_DescriptorFree);
static SCM
scm_DescriptorFree (SCM scm_hndlp)
{
dvoid** hndlp;
ub4 htype;
sword c;
if (SCM_OCIPARAMP(scm_hndlp)){
htype=OCI_DTYPE_PARAM;
hndlp=(dvoid**)&SCM_OCIPARAM(scm_hndlp)->handle;
}else{
SCM_ASSERT(0,scm_hndlp,SCM_ARG1,s_HandleFree);
return 0;
}
if (OCI_SUCCESS==(c=OCIDescriptorFree(*hndlp,htype))){
*hndlp=NULL;
return SCM_BOOL_T;
}else
oci_error(s_DescriptorFree,c,SCM_BOOL_F);
return SCM_BOOL_F;
}
SCM_PROC(s_EnvInit,"OCIEnvInit",0,1,0,scm_EnvInit);
static SCM
scm_EnvInit (SCM scm_mode)
{
OCIEnv* envp;
ub4 mode;
sword c;
SCM_ASSERT(SCM_UNBNDP(scm_mode) || (SCM_IMP(scm_mode) && SCM_INUMP(scm_mode)),
scm_mode,
SCM_ARG1,
s_Initialize);
if (SCM_UNBNDP(scm_mode)){
mode=OCI_DEFAULT;
}else{
SCM_ASSERT(SCM_IMP(scm_mode)&&SCM_INUMP(scm_mode),
scm_mode,SCM_ARG1,s_EnvInit);
mode=SCM_INUM(scm_mode);
}
if (OCI_SUCCESS==(c=OCIEnvInit(&envp,mode,0,NULL)))
return scm_make_env(envp,s_EnvInit);
else
oci_error(s_EnvInit,c,SCM_BOOL_F);
return SCM_BOOL_F;
}
/*
SCM_PROC(s_ServerAttach,"OCIServerAttach",5,0,0,scm_ServerAttach);
static SCM
scm_ServerAttach (SCM scm_srvhp,SCM scm_errhp,SCM scm_dblink,SCM scm_dblink_len,SCM scm_mode)
{
OCIServer* srvhp;
OCIError* errhp;
text* dblink;
sb4 dblink_len;
ub4 mode;
return SCM_MAKINUM(OCIServerAttach(srvhp,errhp,dblink,dblink_len,mode));
}
SCM_PROC(s_ServerDetach,"OCIServerDetach",3,0,0,scm_ServerDetach);
static SCM
scm_ServerDetach (SCM scm_srvhp,SCM scm_errhp,SCM scm_mode)
{
OCIServer* srvhp;
OCIError* errhp;
ub4 mode;
return SCM_MAKINUM(OCIServerDetach(srvhp,errhp,mode));
}
SCM_PROC(s_SessionBegin,"OCISessionBegin",5,0,0,scm_SessionBegin);
static SCM
scm_SessionBegin (SCM scm_svchp,SCM scm_errhp,SCM scm_usrhp,SCM scm_credt,SCM scm_mode)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCISession* usrhp;
ub4 credt;
ub4 mode;
return SCM_MAKINUM(OCISessionBegin(svchp,errhp,usrhp,credt,mode));
}
SCM_PROC(s_SessionEnd,"OCISessionEnd",4,0,0,scm_SessionEnd);
static SCM
scm_SessionEnd (SCM scm_svchp,SCM scm_errhp,SCM scm_usrhp,SCM scm_mode)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCISession* usrhp;
ub4 mode;
return SCM_MAKINUM(OCISessionEnd(svchp,errhp,usrhp,mode));
}
*/
SCM_PROC(s_Logon,"OCILogon",5,0,0,scm_Logon);
static SCM
scm_Logon (SCM scm_envhp,SCM scm_errhp,SCM scm_username,SCM scm_password,SCM scm_dbname)
{
OCIEnv* envhp;
OCIError* errhp;
OCISvcCtx* svchp;
text* username;
ub4 uname_len;
text* password;
ub4 passwd_len;
text* dbname;
ub4 dbname_len;
sword c;
SCM_ASSERT(SCM_OCIENVP(scm_envhp),scm_envhp,SCM_ARG1,s_Logon);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_Logon);
SCM_ASSERT(SCM_STRINGP(scm_username),scm_username,SCM_ARG3,s_Logon);
SCM_ASSERT(SCM_STRINGP(scm_password),scm_password,SCM_ARG4,s_Logon);
SCM_ASSERT(SCM_STRINGP(scm_dbname),scm_dbname,SCM_ARG5,s_Logon);
envhp=SCM_OCIENV(scm_envhp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
username=SCM_CHARS(scm_username);
uname_len=SCM_LENGTH(scm_username);
password=SCM_CHARS(scm_password);
passwd_len=SCM_LENGTH(scm_password);
dbname=SCM_CHARS(scm_dbname);
dbname_len=SCM_LENGTH(scm_dbname);
if (OCI_SUCCESS==(c=OCILogon(envhp,
errhp,
&svchp,
username,
uname_len,
password,
passwd_len,
dbname,
dbname_len)))
return scm_make_svcctx(scm_envhp,svchp,s_Logon);
else
oci_error(s_Logon,c,scm_errhp);
return SCM_BOOL_F;
}
SCM_PROC(s_Logoff,"OCILogoff",2,0,0,scm_Logoff);
static SCM
scm_Logoff (SCM scm_svchp,SCM scm_errhp)
{
OCISvcCtx* svchp;
OCIError* errhp;
sword c;
SCM_ASSERT(SCM_OCISVCCTX(scm_svchp),scm_svchp,SCM_ARG1,s_Logoff);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_Logoff);
svchp=SCM_OCISVCCTX(scm_svchp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
if (OCI_SUCCESS==(c=OCILogoff(svchp,errhp)))
return SCM_BOOL_T;
else
oci_error(s_Logoff,c,scm_errhp);
return SCM_BOOL_F;
}
/*
SCM_PROC(s_PasswordChange,"OCIPasswordChange",9,0,0,scm_PasswordChange);
static SCM
scm_PasswordChange (SCM scm_svchp,SCM scm_errhp,SCM scm_user_name,SCM scm_usernm_len,SCM scm_opasswd,SCM scm_opasswd_len,SCM scm_npasswd,SCM scm_npasswd_len,SCM scm_mode)
{
OCISvcCtx* svchp;
OCIError* errhp;
text* user_name;
ub4 usernm_len;
text* opasswd;
ub4 opasswd_len;
text* npasswd;
ub4 npasswd_len;
ub4 mode;
return SCM_MAKINUM(OCIPasswordChange(svchp,errhp,user_name,usernm_len,opasswd,opasswd_len,npasswd,npasswd_len,mode));
}
*/
SCM_PROC(s_StmtPrepare,"OCIStmtPrepare",3,2,0,scm_StmtPrepare);
static SCM
scm_StmtPrepare (SCM scm_stmtp,SCM scm_errhp,SCM scm_stmt,SCM scm_language,SCM scm_mode)
{
OCIStmt* stmtp;
OCIError* errhp;
text* stmt;
ub4 stmt_len;
ub4 language;
ub4 mode;
sword c;
SCM_ASSERT(SCM_OCISTMTP(scm_stmtp),scm_stmtp,SCM_ARG1,s_StmtPrepare);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_StmtPrepare);
SCM_ASSERT(SCM_STRINGP(scm_stmt),scm_stmt,SCM_ARG3,s_StmtPrepare);
if (SCM_UNBNDP(scm_language)){
language=OCI_NTV_SYNTAX;
}else{
SCM_ASSERT(SCM_IMP(scm_language)&&SCM_INUMP(scm_language),
scm_language,SCM_ARG4,s_StmtPrepare);
language=SCM_INUM(scm_language);
}
if (SCM_UNBNDP(scm_mode)){
mode=OCI_DEFAULT;
}else{
SCM_ASSERT(SCM_IMP(scm_mode)&&SCM_INUMP(scm_mode),
scm_mode,SCM_ARG5,s_StmtPrepare);
mode=SCM_INUM(scm_mode);
}
stmtp=SCM_OCISTMT(scm_stmtp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
stmt=SCM_CHARS(scm_stmt);
stmt_len=SCM_LENGTH(scm_stmt);
if (OCI_SUCCESS==(c=OCIStmtPrepare(stmtp,errhp,stmt,stmt_len,language,mode)))
return SCM_BOOL_T;
else
oci_error(s_StmtPrepare,c,scm_errhp);
return SCM_BOOL_F;
}
static void
alloc_plhldrs(placeholder *pl,SCM scm_stmt,SCM scm_dty,SCM scm_value_sz,SCM scm_maxarr_len,SCM scm_curelep,const char* func)
{
int i;
ub4 maxarr_len;
int size_ind=sizeof(sb2);/*everywhere exept SQLT_NTY*/
ub2 alen=0;
pl->dty=SCM_INUM(scm_dty);
switch (pl->dty){
case OCI_TYPECODE_DATE:
pl->value_sz=7;
SCM_ASSERT(
SCM_UNBNDP(scm_value_sz)||
SCM_FALSEP(scm_value_sz)||
SCM_INUM(scm_value_sz)==7,
scm_value_sz,
guile_choose("sizeof of DATE datatype must be 7",SCM_ARGn),
func);
alen=pl->value_sz;
break;
case OCI_TYPECODE_FLOAT:
pl->value_sz=sizeof(double);
SCM_ASSERT(
SCM_UNBNDP(scm_value_sz)||
SCM_FALSEP(scm_value_sz)||
SCM_INUM(scm_value_sz)==sizeof(double),
scm_value_sz,
guile_choose("sizeof of FLOAT datatype must be equal sizeof(double)",SCM_ARGn),
func);
alen=pl->value_sz;
break;
case OCI_TYPECODE_INTEGER:
pl->value_sz=(SCM_UNBNDP(scm_value_sz)||SCM_FALSEP(scm_value_sz))?
sizeof(sb4):SCM_INUM(scm_value_sz);
SCM_ASSERT (pl->value_sz==sizeof(sb1) ||
pl->value_sz==sizeof(sb2) ||
pl->value_sz==sizeof(sb4),
scm_value_sz,
guile_choose("sizeof of INTEGER datatype must be 1,2 or 4",SCM_ARGn),
func);
alen=pl->value_sz;
break;
case OCI_TYPECODE_VARCHAR:
case SQLT_STR:
case SQLT_LVC:
pl->value_sz=(SCM_UNBNDP(scm_value_sz)||SCM_FALSEP(scm_value_sz))?
DEFAULT_VARCHAR_LENGTH:SCM_INUM(scm_value_sz);
SCM_ASSERT (pl->value_sz>0,
scm_value_sz,
guile_choose("sizeof of STRING'ish datatype must be greter than 0",SCM_ARGn),
func);
switch (pl->dty){
case SQLT_LVC:
if (pl->value_sz<UB2MAXVAL-1)
pl->value_sz+=sizeof(int);/*length of string*/
break;
case OCI_TYPECODE_VARCHAR:
if (pl->value_sz<UB2MAXVAL-1)
pl->value_sz+=sizeof(short int);/*length of string*/
break;
case SQLT_STR:
if (pl->value_sz<UB2MAXVAL)
pl->value_sz++;/*zero at the end*/
break;
}
alen=0;
break;
default:
SCM_ASSERT (0,
scm_dty,
guile_choose("Can't handle this datatype",SCM_ARGn),
func);
}
pl->maxarr_len=(SCM_UNBNDP(scm_maxarr_len)||SCM_FALSEP(scm_maxarr_len))?
0:SCM_INUM(scm_maxarr_len);
maxarr_len=(0==pl->maxarr_len)?1:pl->maxarr_len;
pl->valuep=scm_must_malloc(maxarr_len * pl->value_sz,func);
memset(pl->valuep,0,maxarr_len * pl->value_sz);
pl->indp=scm_must_malloc(maxarr_len*size_ind,func);
if (pl->dty!=SQLT_NTY)
for (i=0;i<maxarr_len;i++) ((sb2*)pl->indp)[i]=-1;
else{
puts("SQLT_NTY bind/define not implemented");
exit(1);
}
pl->alenp=scm_must_malloc(maxarr_len*sizeof(ub2),func);
if (alen!=0)
for (i=0;i<maxarr_len;i++) pl->alenp[i]=alen;
pl->rcodep=scm_must_malloc(maxarr_len*sizeof(ub2),func);
for (i=0;i<maxarr_len;i++) pl->rcodep[i]=0;
pl->curele=SCM_UNBNDP(scm_curelep)||SCM_FALSEP(scm_curelep)?0:SCM_INUM(scm_curelep);
pl->stmt=scm_stmt;
}
SCM_PROC(s_BindByName,"OCIBindByName",4,4,0,scm_BindByName);
static SCM
scm_BindByName (SCM scm_stmtp,SCM scm_errhp,SCM scm_placeholder,SCM scm_dty,SCM scm_value_sz,SCM scm_maxarr_len,SCM scm_curelep,SCM scm_mode)
{
OCIStmt* stmtp;
OCIError* errhp;
text* placeholdert;
sb4 placeh_len;
bind *b;
sword c;
ub4 mode;
SCM_ASSERT(SCM_OCISTMTP(scm_stmtp),scm_stmtp,SCM_ARG1,s_BindByName);
stmtp=SCM_OCISTMT(scm_stmtp)->handle;
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_BindByName);
errhp=SCM_OCIERROR(scm_errhp)->handle;
SCM_ASSERT(SCM_STRINGP(scm_placeholder)||SCM_SYMBOLP(scm_placeholder),
scm_placeholder,SCM_ARG3,s_BindByName);
placeholdert=SCM_CHARS(scm_placeholder);
placeh_len=SCM_LENGTH(scm_placeholder);
SCM_ASSERT(SCM_UNBNDP(scm_dty) || (SCM_IMP(scm_dty) && SCM_INUMP(scm_dty)),
scm_dty,
SCM_ARG4,
s_BindByName);
SCM_ASSERT(SCM_UNBNDP(scm_value_sz) || (SCM_IMP(scm_value_sz) && SCM_INUMP(scm_value_sz)),
scm_value_sz,
SCM_ARG5,
s_BindByName);
SCM_ASSERT(SCM_UNBNDP(scm_maxarr_len) || (SCM_IMP(scm_maxarr_len) && SCM_INUMP(scm_maxarr_len)),
scm_maxarr_len,
SCM_ARG6,
s_BindByName);
SCM_ASSERT(SCM_UNBNDP(scm_curelep) || (SCM_IMP(scm_curelep) &&
SCM_INUMP(scm_curelep)),
scm_curelep,
SCM_ARG7,
s_BindByName);
SCM_ASSERT(SCM_UNBNDP(scm_mode) || (SCM_IMP(scm_mode) && SCM_INUMP(scm_mode)),
scm_mode,
SCM_ARGn,
s_BindByName);
mode=(SCM_UNBNDP(scm_mode))?OCI_DEFAULT:SCM_INUM(scm_mode);
b=scm_must_malloc(sizeof(bind),s_BindByName);
b->handle=NULL;
alloc_plhldrs(&(b->pl),scm_stmtp,scm_dty,scm_value_sz,scm_maxarr_len,
scm_curelep,s_BindByName);
if (OCI_SUCCESS==
(c=OCIBindByName(stmtp,
&b->handle,
errhp,
placeholdert,
placeh_len,
b->pl.valuep,
b->pl.value_sz,
b->pl.dty,
b->pl.indp,
b->pl.alenp,
b->pl.rcodep,
b->pl.maxarr_len,
(SCM_UNBNDP(scm_curelep)||SCM_FALSEP(scm_curelep))?
NULL:&b->pl.curele,mode)))
{
SCM_RETURN_NEWSMOB(tag_bind,b);
}else{
free_placeholder((placeholder*) &b->pl);
oci_error(s_BindByName,c,scm_errhp);
return SCM_BOOL_F;
}
}
SCM_PROC(s_BindByPos,"OCIBindByPos",4,4,0,scm_BindByPos);
static SCM
scm_BindByPos (SCM scm_stmtp,SCM scm_errhp,SCM scm_pos,SCM scm_dty,SCM scm_value_sz,SCM scm_maxarr_len,SCM scm_curelep,SCM scm_mode)
{
OCIStmt* stmtp;
OCIError* errhp;
ub4 pos;
bind *b;
sword c;
ub4 mode;
SCM_ASSERT(SCM_OCISTMTP(scm_stmtp),scm_stmtp,SCM_ARG1,s_BindByPos);
stmtp=SCM_OCISTMT(scm_stmtp)->handle;
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_BindByPos);
errhp=SCM_OCIERROR(scm_errhp)->handle;
SCM_ASSERT(SCM_IMP(scm_pos) && SCM_INUMP(scm_pos),scm_pos,SCM_ARG3,s_BindByPos);
pos=SCM_INUM(scm_pos);
SCM_ASSERT(SCM_UNBNDP(scm_dty) || (SCM_IMP(scm_dty) && SCM_INUMP(scm_dty)),
scm_dty,
SCM_ARG4,
s_BindByPos);
SCM_ASSERT(SCM_UNBNDP(scm_value_sz) || (SCM_IMP(scm_value_sz) &&
SCM_INUMP(scm_value_sz)),
scm_value_sz,
SCM_ARG5,
s_BindByPos);
SCM_ASSERT(SCM_UNBNDP(scm_maxarr_len) || (SCM_IMP(scm_maxarr_len)
&& SCM_INUMP(scm_maxarr_len)),
scm_maxarr_len,
SCM_ARG6,
s_BindByPos);
SCM_ASSERT(SCM_UNBNDP(scm_curelep) || (SCM_IMP(scm_curelep) &&
SCM_INUMP(scm_curelep)),
scm_curelep,
SCM_ARG7,
s_BindByPos);
SCM_ASSERT(SCM_UNBNDP(scm_mode) || (SCM_IMP(scm_mode) &&
SCM_INUMP(scm_mode)),
scm_mode,
SCM_ARGn,
s_BindByPos);
mode=(SCM_UNBNDP(scm_mode))?OCI_DEFAULT:SCM_INUM(scm_mode);
b=scm_must_malloc(sizeof(bind),s_BindByPos);
b->handle=NULL;
alloc_plhldrs(&b->pl,scm_stmtp,scm_dty,scm_value_sz,scm_maxarr_len,
scm_curelep,s_BindByPos);
if (OCI_SUCCESS==(c=OCIBindByPos(stmtp,
&b->handle,
errhp,
pos,
b->pl.valuep,
b->pl.value_sz,
b->pl.dty,
b->pl.indp,
b->pl.alenp,
b->pl.rcodep,
b->pl.maxarr_len,
(SCM_UNBNDP(scm_curelep)||SCM_FALSEP(scm_curelep))?
NULL:&b->pl.curele,mode)))
{
SCM_RETURN_NEWSMOB(tag_bind,b);
}else{
free_placeholder((placeholder*) &b->pl);
oci_error( s_BindByPos,c,scm_errhp);
return SCM_BOOL_F;
}
}
/*
SCM_PROC(s_BindObject,"OCIBindObject",7,0,0,scm_BindObject);
static SCM
scm_BindObject (SCM scm_bindp,SCM scm_errhp,SCM scm_type,SCM scm_pgvpp,SCM scm_pvszsp,SCM scm_indpp,SCM scm_indszp)
{
OCIBind* bindp;
OCIError* errhp;
OCIType* type;
dvoid** pgvpp;
ub4* pvszsp;
dvoid** indpp;
ub4* indszp;
return SCM_MAKINUM(OCIBindObject(bindp,errhp,type,pgvpp,pvszsp,indpp,indszp));
}
SCM_PROC(s_BindDynamic,"OCIBindDynamic",6,0,0,scm_BindDynamic);
static SCM
scm_BindDynamic (SCM scm_bindp,SCM scm_errhp,SCM scm_ictxp,SCM scm_icbfp,SCM scm_octxp,SCM scm_ocbfp)
{
OCIBind* bindp;
OCIError* errhp;
dvoid* ictxp;
OCICallbackInBind icbfp;
dvoid* octxp;
OCICallbackOutBind ocbfp;
return SCM_MAKINUM(OCIBindDynamic(bindp,errhp,ictxp,icbfp,octxp,ocbfp));
}
SCM_PROC(s_BindArrayOfStruct,"OCIBindArrayOfStruct",6,0,0,scm_BindArrayOfStruct);
static SCM
scm_BindArrayOfStruct (SCM scm_bindp,SCM scm_errhp,SCM scm_pvskip,SCM scm_indskip,SCM scm_alskip,SCM scm_rcskip)
{
OCIBind* bindp;
OCIError* errhp;
ub4 pvskip;
ub4 indskip;
ub4 alskip;
ub4 rcskip;
return SCM_MAKINUM(OCIBindArrayOfStruct(bindp,errhp,pvskip,indskip,alskip,rcskip));
}
SCM_PROC(s_StmtGetPieceInfo,"OCIStmtGetPieceInfo",8,0,0,scm_StmtGetPieceInfo);
static SCM
scm_StmtGetPieceInfo (SCM scm_stmtp,SCM scm_errhp,SCM scm_hndlpp,SCM scm_typep,SCM scm_in_outp,SCM scm_iterp,SCM scm_idxp,SCM scm_piecep)
{
OCIStmt* stmtp;
OCIError* errhp;
dvoid** hndlpp;
ub4* typep;
ub1* in_outp;
ub4* iterp;
ub4* idxp;
ub1* piecep;
return SCM_MAKINUM(OCIStmtGetPieceInfo(stmtp,errhp,hndlpp,typep,in_outp,iterp,idxp,piecep));
}
SCM_PROC(s_StmtSetPieceInfo,"OCIStmtSetPieceInfo",8,0,0,scm_StmtSetPieceInfo);
static SCM
scm_StmtSetPieceInfo (SCM scm_hndlp,SCM scm_type,SCM scm_errhp,SCM scm_bufp,SCM scm_alenp,SCM scm_piece,SCM scm_indp,SCM scm_rcodep)
{
dvoid* hndlp;
ub4 type;
OCIError* errhp;
dvoid* bufp;
ub4* alenp;
ub1 piece;
dvoid* indp;
ub2* rcodep;
return SCM_MAKINUM(OCIStmtSetPieceInfo(hndlp,type,errhp,bufp,alenp,piece,indp,rcodep));
}
*/
SCM_PROC(s_StmtExecute,"OCIStmtExecute",3,5,0,scm_StmtExecute);
static SCM
scm_StmtExecute (SCM scm_svchp,SCM scm_stmtp,SCM scm_errhp,SCM scm_iters,SCM scm_rowoff,SCM scm_snap_in,SCM scm_snap_out,SCM scm_mode)
{
OCISvcCtx* svchp;
OCIStmt* stmtp;
OCIError* errhp;
ub4 iters;
ub4 rowoff;
OCISnapshot* snap_in=NULL;
OCISnapshot* snap_out=NULL;
ub4 mode;
sword c;
SCM_ASSERT(SCM_OCISVCCTX(scm_svchp),scm_svchp,SCM_ARG1,s_StmtExecute);
SCM_ASSERT(SCM_OCISTMTP(scm_stmtp),scm_stmtp,SCM_ARG2,s_StmtExecute);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG3,s_StmtExecute);
stmtp=SCM_OCISTMT(scm_stmtp)->handle;
svchp=SCM_OCISVCCTX(scm_svchp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
if (SCM_UNBNDP(scm_iters)){
ub2 t=0;
if (OCI_SUCCESS!=
(c=OCIAttrGet(stmtp,OCI_HTYPE_STMT,&t,NULL,OCI_ATTR_STMT_TYPE,errhp)))
oci_error(s_StmtExecute,c,scm_errhp);
if (OCI_STMT_SELECT==t)
iters=0;
else
iters=1;
}else{
SCM_ASSERT(SCM_IMP(scm_iters)&&SCM_INUMP(scm_iters),
scm_iters,SCM_ARG5,s_StmtExecute);
iters=SCM_INUM(scm_iters);
}
if (SCM_UNBNDP(scm_rowoff)){
rowoff=0;
}else{
SCM_ASSERT(SCM_IMP(scm_rowoff)&&SCM_INUMP(scm_rowoff),
scm_rowoff,SCM_ARG6,s_StmtExecute);
rowoff=SCM_INUM(scm_rowoff);
}
if (SCM_UNBNDP(scm_mode)){
mode=OCI_DEFAULT;
}else{
SCM_ASSERT(SCM_IMP(scm_mode)&&SCM_INUMP(scm_mode),
scm_mode,SCM_ARGn,s_StmtExecute);
mode=SCM_INUM(scm_mode);
}
if (OCI_SUCCESS==(c=OCIStmtExecute(svchp,stmtp,errhp,iters,rowoff,snap_in,snap_out,mode)))
return SCM_BOOL_T;
else
oci_error(s_StmtExecute,c,scm_errhp);
return SCM_BOOL_F;
}
SCM_PROC(s_DefineByPos,"OCIDefineByPos",5,1,0,scm_DefineByPos);
static SCM
scm_DefineByPos (SCM scm_stmtp,SCM scm_errhp,SCM scm_position,
SCM scm_value_sz,SCM scm_dty,SCM scm_mode)
{
OCIStmt* stmtp;
OCIError* errhp;
ub4 position;
ub2 dty;
ub4 mode;
define *d;
sword c;
SCM_ASSERT(SCM_OCISTMTP(scm_stmtp),scm_stmtp,SCM_ARG1,s_DefineByPos);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_DefineByPos);
stmtp=SCM_OCISTMT(scm_stmtp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
SCM_ASSERT(SCM_IMP(scm_position)&&SCM_INUMP(scm_position),
scm_position,SCM_ARG3,s_DefineByPos);
position=SCM_INUM(scm_position);
SCM_ASSERT(SCM_FALSEP(scm_value_sz)||
(SCM_IMP(scm_value_sz)&&SCM_INUMP(scm_value_sz)),
scm_value_sz,SCM_ARG4,s_DefineByPos);
SCM_ASSERT(SCM_IMP(scm_dty)&&SCM_INUMP(scm_dty),
scm_dty,SCM_ARG5,s_DefineByPos);
dty=SCM_INUM(scm_dty);
SCM_ASSERT(SCM_UNBNDP(scm_mode) ||
(SCM_IMP(scm_mode) && SCM_INUMP(scm_mode)),
scm_mode,
SCM_ARGn,
s_BindByPos);
mode=(SCM_UNBNDP(scm_mode))?OCI_DEFAULT:SCM_INUM(scm_mode);
d=scm_must_malloc(sizeof(define),s_DefineByPos);
alloc_plhldrs(&d->pl,scm_stmtp,scm_dty,scm_value_sz,SCM_MAKINUM(1),SCM_UNDEFINED,s_DefineByPos);
if (OCI_SUCCESS==(c=OCIDefineByPos(stmtp,&d->handle,errhp,position,
d->pl.valuep,d->pl.value_sz,d->pl.dty,d->pl.indp,
d->pl.alenp,d->pl.rcodep,mode)))
{
SCM_RETURN_NEWSMOB(tag_define,d);
}else{
free_placeholder((placeholder*) &d->pl);
oci_error(s_DefineByPos,c,scm_errhp);
return SCM_BOOL_F;
}
}
/*
SCM_PROC(s_DefineObject,"OCIDefineObject",7,0,0,scm_DefineObject);
static SCM
scm_DefineObject (SCM scm_defnp,SCM scm_errhp,SCM scm_type,SCM scm_pgvpp,SCM scm_pvszsp,SCM scm_indpp,SCM scm_indszp)
{
OCIDefine* defnp;
OCIError* errhp;
OCIType* type;
dvoid** pgvpp;
ub4* pvszsp;
dvoid** indpp;
ub4* indszp;
return SCM_MAKINUM(OCIDefineObject(defnp,errhp,type,pgvpp,pvszsp,indpp,indszp));
}
SCM_PROC(s_DefineDynamic,"OCIDefineDynamic",4,0,0,scm_DefineDynamic);
static SCM
scm_DefineDynamic (SCM scm_defnp,SCM scm_errhp,SCM scm_octxp,SCM scm_ocbfp)
{
OCIDefine* defnp;
OCIError* errhp;
dvoid* octxp;
OCICallbackDefine ocbfp;
return SCM_MAKINUM(OCIDefineDynamic(defnp,errhp,octxp,ocbfp));
}
SCM_PROC(s_DefineArrayOfStruct,"OCIDefineArrayOfStruct",6,0,0,scm_DefineArrayOfStruct);
static SCM
scm_DefineArrayOfStruct (SCM scm_defnp,SCM scm_errhp,SCM scm_pvskip,SCM scm_indskip,SCM scm_rlskip,SCM scm_rcskip)
{
OCIDefine* defnp;
OCIError* errhp;
ub4 pvskip;
ub4 indskip;
ub4 rlskip;
ub4 rcskip;
return SCM_MAKINUM(OCIDefineArrayOfStruct(defnp,errhp,pvskip,indskip,rlskip,rcskip));
}
*/
SCM_PROC(s_StmtFetch,"OCIStmtFetch",2,3,0,scm_StmtFetch);
static SCM
scm_StmtFetch (SCM scm_stmtp,SCM scm_errhp,
SCM scm_nrows,SCM scm_orientation,SCM scm_mode)
{
OCIStmt* stmtp;
OCIError* errhp;
ub2 orientation;
ub4 mode;
sword c;
(void)scm_nrows;
SCM_ASSERT(SCM_OCISTMTP(scm_stmtp),scm_stmtp,SCM_ARG1,s_DefineByPos);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_DefineByPos);
stmtp=SCM_OCISTMT(scm_stmtp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
SCM_ASSERT(SCM_UNBNDP(scm_orientation) || SCM_FALSEP (scm_orientation) ||
(SCM_IMP(scm_orientation) && SCM_INUMP(scm_orientation)),
scm_orientation,
SCM_ARG4,
s_StmtFetch);
orientation=(SCM_UNBNDP(scm_orientation) || SCM_FALSEP(scm_orientation))?
OCI_FETCH_NEXT:SCM_INUM(scm_orientation);
SCM_ASSERT(SCM_UNBNDP(scm_mode) || SCM_FALSEP (scm_mode) ||
(SCM_IMP(scm_mode) && SCM_INUMP(scm_mode)),
scm_mode,
SCM_ARG5,
s_StmtFetch);
mode=(SCM_UNBNDP(scm_mode) || SCM_FALSEP(scm_mode))?
OCI_DEFAULT:SCM_INUM(scm_mode);
c=OCIStmtFetch(stmtp,errhp,1,orientation,mode);
if (OCI_SUCCESS==c)
{
return SCM_BOOL_T;
/*NB. I don't undestand why those two codes may be returned*/
}else if (OCI_NO_DATA==c||1002==c){
return SCM_BOOL_F;
}else{
oci_error( s_StmtFetch, c,scm_errhp);
return SCM_BOOL_F;
}
}
/*
SCM_PROC(s_StmtGetBindInfo,"OCIStmtGetBindInfo",11,0,0,scm_StmtGetBindInfo);
static SCM
scm_StmtGetBindInfo (SCM scm_stmtp,SCM scm_errhp,SCM scm_size,SCM scm_startloc,SCM scm_found,SCM scm_bvnp[],SCM scm_bvnl[],SCM scm_invp[],SCM scm_inpl[],SCM scm_dupl[],SCM scm_hndl[])
{
OCIStmt* stmtp;
OCIError* errhp;
ub4 size;
ub4 startloc;
sb4* found;
text* bvnp[];
ub1 bvnl[];
text* invp[];
ub1 inpl[];
ub1 dupl[];
OCIBind* hndl[];
return SCM_MAKINUM(OCIStmtGetBindInfo(stmtp,errhp,size,startloc,found,bvnp[],bvnl[],invp[],inpl[],dupl[],hndl[]));
}
*/
SCM_PROC(s_DescribeAny,"OCIDescribeAny",6,0,0,scm_DescribeAny);
static SCM
scm_DescribeAny (SCM scm_svchp,SCM scm_errhp,SCM scm_objptr,SCM scm_objptr_typ,SCM scm_objtyp,SCM scm_dschp)
{
OCISvcCtx* svchp;
OCIError* errhp;
dvoid* objptr=NULL;
ub4 objnm_len=0;
ub1 objptr_typ;
ub1 objtyp;
OCIDescribe* dschp;
sword c;
SCM_ASSERT(SCM_OCISVCCTX(scm_svchp),scm_svchp,SCM_ARG1,s_DescribeAny);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_DescribeAny);
SCM_ASSERT(SCM_NIMP(scm_objptr) && SCM_STRINGP(scm_objptr),scm_objptr,SCM_ARG3,s_DescribeAny);
SCM_ASSERT(
SCM_IMP(scm_objptr_typ) && SCM_INUMP(scm_objptr_typ),
scm_objptr_typ,SCM_ARG4,s_DescribeAny);
SCM_ASSERT(
SCM_IMP(scm_objtyp) && SCM_INUMP(scm_objtyp),
scm_objtyp,SCM_ARG5,s_DescribeAny);
SCM_ASSERT(
SCM_OCIDESCRIBEP(scm_dschp),
scm_dschp,SCM_ARG6,s_DescribeAny);
svchp=SCM_OCISVCCTX(scm_svchp)->handle;
errhp=SCM_OCIERROR(scm_errhp)->handle;
if (SCM_NIMP(scm_objptr)&&SCM_STRINGP(scm_objptr)){
objptr=(dvoid*)SCM_CHARS(scm_objptr);
objnm_len=SCM_LENGTH(scm_objptr);
}
objptr_typ=SCM_INUM(scm_objptr_typ);
objtyp=SCM_INUM(scm_objtyp);
dschp=SCM_OCIDESCRIBE(scm_dschp)->handle;
if (OCI_SUCCESS==(c=OCIDescribeAny(svchp,errhp,objptr,objnm_len,objptr_typ,OCI_DEFAULT,objtyp,dschp))){
return SCM_BOOL_T;
}else
oci_error(s_DescribeAny,c,scm_errhp);
return SCM_BOOL_F;
}
SCM_PROC(s_ParamGet,"OCIParamGet",2,1,0,scm_ParamGet);
static SCM
scm_ParamGet (SCM scm_hndlp,SCM scm_errhp,SCM scm_pos)
{
dvoid* hndlp;
ub4 htype;
OCIError* errhp;
dvoid* parmdpp=NULL;
ub4 pos;
sword c;
if (SCM_OCISTMTP(scm_hndlp)){
htype=OCI_HTYPE_STMT;
hndlp=SCM_OCISTMT(scm_hndlp)->handle;
}else if (SCM_OCIDESCRIBEP(scm_hndlp)){
htype=OCI_HTYPE_DESCRIBE;
hndlp=SCM_OCIDESCRIBE(scm_hndlp)->handle;
}else if (SCM_OCICOMPLEXOBJECTP(scm_hndlp)){
htype=OCI_HTYPE_COMPLEXOBJECT;
hndlp=SCM_OCICOMPLEXOBJECT(scm_hndlp)->handle;
}else if (SCM_OCIPARAMP(scm_hndlp)){
htype=OCI_DTYPE_PARAM;
hndlp=SCM_OCIPARAM(scm_hndlp)->handle;
}else{
SCM_ASSERT(0,scm_hndlp,SCM_ARG1,s_ParamGet);
return 0;
}
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG2,s_ParamGet);
if (SCM_UNBNDP(scm_pos)){
pos=0;
}else{
SCM_ASSERT(SCM_IMP(scm_pos)&&SCM_INUMP(scm_pos),
scm_pos,SCM_ARG3,s_ParamGet);
pos=SCM_INUM(scm_pos);
}
errhp=SCM_OCIERROR(scm_errhp)->handle;
if (OCI_SUCCESS==(c=OCIParamGet(hndlp,htype,errhp,&parmdpp,pos))){
return scm_make_param(parmdpp,s_ParamGet);
}else{
if (c==OCI_NO_DATA)
return SCM_BOOL_F;
else{
oci_error(s_ParamGet,c,scm_errhp);
return SCM_UNDEFINED;
}
}
}
/*
SCM_PROC(s_ParamSet,"OCIParamSet",6,0,0,scm_ParamSet);
static SCM
scm_ParamSet (SCM scm_hdlp,SCM scm_htyp,SCM scm_errhp,SCM scm_dscp,SCM scm_dtyp,SCM scm_pos)
{
dvoid* hdlp;
ub4 htyp;
OCIError* errhp;
dvoid* dscp;
ub4 dtyp;
ub4 pos;
return SCM_MAKINUM(OCIParamSet(hdlp,htyp,errhp,dscp,dtyp,pos));
}
SCM_PROC(s_TransStart,"OCITransStart",4,0,0,scm_TransStart);
static SCM
scm_TransStart (SCM scm_svchp,SCM scm_errhp,SCM scm_timeout,SCM scm_flags)
{
OCISvcCtx* svchp;
OCIError* errhp;
uword timeout;
ub4 flags;
return SCM_MAKINUM(OCITransStart(svchp,errhp,timeout,flags));
}
SCM_PROC(s_TransDetach,"OCITransDetach",3,0,0,scm_TransDetach);
static SCM
scm_TransDetach (SCM scm_svchp,SCM scm_errhp,SCM scm_flags)
{
OCISvcCtx* svchp;
OCIError* errhp;
ub4 flags;
return SCM_MAKINUM(OCITransDetach(svchp,errhp,flags));
}
SCM_PROC(s_TransCommit,"OCITransCommit",3,0,0,scm_TransCommit);
static SCM
scm_TransCommit (SCM scm_svchp,SCM scm_errhp,SCM scm_flags)
{
OCISvcCtx* svchp;
OCIError* errhp;
ub4 flags;
return SCM_MAKINUM(OCITransCommit(svchp,errhp,flags));
}
SCM_PROC(s_TransRollback,"OCITransRollback",3,0,0,scm_TransRollback);
static SCM
scm_TransRollback (SCM scm_svchp,SCM scm_errhp,SCM scm_flags)
{
OCISvcCtx* svchp;
OCIError* errhp;
ub4 flags;
return SCM_MAKINUM(OCITransRollback(svchp,errhp,flags));
}
SCM_PROC(s_TransPrepare,"OCITransPrepare",3,0,0,scm_TransPrepare);
static SCM
scm_TransPrepare (SCM scm_svchp,SCM scm_errhp,SCM scm_flags)
{
OCISvcCtx* svchp;
OCIError* errhp;
ub4 flags;
return SCM_MAKINUM(OCITransPrepare(svchp,errhp,flags));
}
SCM_PROC(s_TransForget,"OCITransForget",3,0,0,scm_TransForget);
static SCM
scm_TransForget (SCM scm_svchp,SCM scm_errhp,SCM scm_flags)
{
OCISvcCtx* svchp;
OCIError* errhp;
ub4 flags;
return SCM_MAKINUM(OCITransForget(svchp,errhp,flags));
}
*/
SCM_PROC(s_ErrorGet,"OCIErrorGet",1,1,0,scm_ErrorGet);
static SCM
scm_ErrorGet (SCM scm_hndlp,SCM scm_recordno)
{
dvoid* hndlp;
ub4 recordno;
text* sqlstate=NULL;
sb4 errcodep;
text bufp[1024];
ub4 bufsiz=sizeof(bufp);
ub4 type;
sword c;
SCM_ASSERT(
SCM_OCIENVP(scm_hndlp)||SCM_OCIERRORP(scm_hndlp),
scm_hndlp,
SCM_ARG1,
s_ErrorGet);
if (SCM_OCIENVP(scm_hndlp)) {
type=OCI_HTYPE_ERROR;
hndlp=SCM_OCIENV(scm_hndlp)->handle;
}else{
type=OCI_HTYPE_ERROR;
hndlp=SCM_OCIERROR(scm_hndlp)->handle;
}
if (SCM_UNBNDP(scm_recordno)){
recordno=1;
}else{
SCM_ASSERT(SCM_IMP(scm_recordno)&&SCM_INUMP(scm_recordno),
scm_recordno,SCM_ARG2,s_StmtExecute);
recordno=SCM_INUM(scm_recordno);
}
if (OCI_SUCCESS==(c=OCIErrorGet(hndlp,recordno,sqlstate,&errcodep,bufp,bufsiz,type)))
return scm_cons(SCM_MAKINUM(errcodep),scm_makfrom0str(bufp));
else
oci_error(s_ErrorGet,c,SCM_BOOL_F);
return SCM_BOOL_F;
}
/*
SCM_PROC(s_LobAppend,"OCILobAppend",4,0,0,scm_LobAppend);
static SCM
scm_LobAppend (SCM scm_svchp,SCM scm_errhp,SCM scm_dst_locp,SCM scm_src_locp)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* dst_locp;
OCILobLocator* src_locp;
return SCM_MAKINUM(OCILobAppend(svchp,errhp,dst_locp,src_locp));
}
SCM_PROC(s_LobAssign,"OCILobAssign",4,0,0,scm_LobAssign);
static SCM
scm_LobAssign (SCM scm_envhp,SCM scm_errhp,SCM scm_src_locp,SCM scm_dst_locpp)
{
OCIEnv* envhp;
OCIError* errhp;
OCILobLocator* src_locp;
OCILobLocator** dst_locpp;
return SCM_MAKINUM(OCILobAssign(envhp,errhp,src_locp,dst_locpp));
}
SCM_PROC(s_LobCharSetForm,"OCILobCharSetForm",4,0,0,scm_LobCharSetForm);
static SCM
scm_LobCharSetForm (SCM scm_envhp,SCM scm_errhp,SCM scm_locp,SCM scm_csfrm)
{
OCIEnv* envhp;
OCIError* errhp;
OCILobLocator* locp;
ub1* csfrm;
return SCM_MAKINUM(OCILobCharSetForm(envhp,errhp,locp,csfrm));
}
SCM_PROC(s_LobCharSetId,"OCILobCharSetId",4,0,0,scm_LobCharSetId);
static SCM
scm_LobCharSetId (SCM scm_envhp,SCM scm_errhp,SCM scm_locp,SCM scm_csid)
{
OCIEnv* envhp;
OCIError* errhp;
OCILobLocator* locp;
ub2* csid;
return SCM_MAKINUM(OCILobCharSetId(envhp,errhp,locp,csid));
}
SCM_PROC(s_LobCopy,"OCILobCopy",7,0,0,scm_LobCopy);
static SCM
scm_LobCopy (SCM scm_svchp,SCM scm_errhp,SCM scm_dst_locp,SCM scm_src_locp,SCM scm_amount,SCM scm_dst_offset,SCM scm_src_offset)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* dst_locp;
OCILobLocator* src_locp;
ub4 amount;
ub4 dst_offset;
ub4 src_offset;
return SCM_MAKINUM(OCILobCopy(svchp,errhp,dst_locp,src_locp,amount,dst_offset,src_offset));
}
SCM_PROC(s_LobDisableBuffering,"OCILobDisableBuffering",3,0,0,scm_LobDisableBuffering);
static SCM
scm_LobDisableBuffering (SCM scm_svchp,SCM scm_errhp,SCM scm_locp)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
return SCM_MAKINUM(OCILobDisableBuffering(svchp,errhp,locp));
}
SCM_PROC(s_LobEnableBuffering,"OCILobEnableBuffering",3,0,0,scm_LobEnableBuffering);
static SCM
scm_LobEnableBuffering (SCM scm_svchp,SCM scm_errhp,SCM scm_locp)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
return SCM_MAKINUM(OCILobEnableBuffering(svchp,errhp,locp));
}
SCM_PROC(s_LobErase,"OCILobErase",5,0,0,scm_LobErase);
static SCM
scm_LobErase (SCM scm_svchp,SCM scm_errhp,SCM scm_locp,SCM scm_amount,SCM scm_offset)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
ub4* amount;
ub4 offset;
return SCM_MAKINUM(OCILobErase(svchp,errhp,locp,amount,offset));
}
SCM_PROC(s_LobFileClose,"OCILobFileClose",3,0,0,scm_LobFileClose);
static SCM
scm_LobFileClose (SCM scm_svchp,SCM scm_errhp,SCM scm_filep)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* filep;
return SCM_MAKINUM(OCILobFileClose(svchp,errhp,filep));
}
SCM_PROC(s_LobFileCloseAll,"OCILobFileCloseAll",2,0,0,scm_LobFileCloseAll);
static SCM
scm_LobFileCloseAll (SCM scm_svchp,SCM scm_errhp)
{
OCISvcCtx* svchp;
OCIError* errhp;
return SCM_MAKINUM(OCILobFileCloseAll(svchp,errhp));
}
SCM_PROC(s_LobFileExists,"OCILobFileExists",4,0,0,scm_LobFileExists);
static SCM
scm_LobFileExists (SCM scm_svchp,SCM scm_errhp,SCM scm_filep,SCM scm_flag)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* filep;
boolean* flag;
return SCM_MAKINUM(OCILobFileExists(svchp,errhp,filep,flag));
}
SCM_PROC(s_LobFileGetName,"OCILobFileGetName",7,0,0,scm_LobFileGetName);
static SCM
scm_LobFileGetName (SCM scm_envhp,SCM scm_errhp,SCM scm_filep,SCM scm_dir_alias,SCM scm_d_length,SCM scm_filename,SCM scm_f_length)
{
OCIEnv* envhp;
OCIError* errhp;
OCILobLocator* filep;
text* dir_alias;
ub2* d_length;
text* filename;
ub2* f_length;
return SCM_MAKINUM(OCILobFileGetName(envhp,errhp,filep,dir_alias,d_length,filename,f_length));
}
SCM_PROC(s_LobFileIsOpen,"OCILobFileIsOpen",4,0,0,scm_LobFileIsOpen);
static SCM
scm_LobFileIsOpen (SCM scm_svchp,SCM scm_errhp,SCM scm_filep,SCM scm_flag)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* filep;
boolean* flag;
return SCM_MAKINUM(OCILobFileIsOpen(svchp,errhp,filep,flag));
}
SCM_PROC(s_LobFileOpen,"OCILobFileOpen",4,0,0,scm_LobFileOpen);
static SCM
scm_LobFileOpen (SCM scm_svchp,SCM scm_errhp,SCM scm_filep,SCM scm_mode)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* filep;
ub1 mode;
return SCM_MAKINUM(OCILobFileOpen(svchp,errhp,filep,mode));
}
SCM_PROC(s_LobFileSetName,"OCILobFileSetName",7,0,0,scm_LobFileSetName);
static SCM
scm_LobFileSetName (SCM scm_envhp,SCM scm_errhp,SCM scm_filepp,SCM scm_dir_alias,SCM scm_d_length,SCM scm_filename,SCM scm_f_length)
{
OCIEnv* envhp;
OCIError* errhp;
OCILobLocator** filepp;
text* dir_alias;
ub2 d_length;
text* filename;
ub2 f_length;
return SCM_MAKINUM(OCILobFileSetName(envhp,errhp,filepp,dir_alias,d_length,filename,f_length));
}
SCM_PROC(s_LobFlushBuffer,"OCILobFlushBuffer",4,0,0,scm_LobFlushBuffer);
static SCM
scm_LobFlushBuffer (SCM scm_svchp,SCM scm_errhp,SCM scm_locp,SCM scm_flag)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
ub4 flag;
return SCM_MAKINUM(OCILobFlushBuffer(svchp,errhp,locp,flag));
}
SCM_PROC(s_LobGetLength,"OCILobGetLength",4,0,0,scm_LobGetLength);
static SCM
scm_LobGetLength (SCM scm_svchp,SCM scm_errhp,SCM scm_locp,SCM scm_lenp)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
ub4* lenp;
return SCM_MAKINUM(OCILobGetLength(svchp,errhp,locp,lenp));
}
SCM_PROC(s_LobIsEqual,"OCILobIsEqual",4,0,0,scm_LobIsEqual);
static SCM
scm_LobIsEqual (SCM scm_envhp,SCM scm_x,SCM scm_y,SCM scm_is_equal)
{
OCIEnv* envhp;
OCILobLocator* x;
OCILobLocator* y;
boolean* is_equal;
return SCM_MAKINUM(OCILobIsEqual(envhp,x,y,is_equal));
}
SCM_PROC(s_LobLoadFromFile,"OCILobLoadFromFile",7,0,0,scm_LobLoadFromFile);
static SCM
scm_LobLoadFromFile (SCM scm_svchp,SCM scm_errhp,SCM scm_dst_locp,SCM scm_src_filep,SCM scm_amount,SCM scm_dst_offset,SCM scm_src_offset)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* dst_locp;
OCILobLocator* src_filep;
ub4 amount;
ub4 dst_offset;
ub4 src_offset;
return SCM_MAKINUM(OCILobLoadFromFile(svchp,errhp,dst_locp,src_filep,amount,dst_offset,src_offset));
}
SCM_PROC(s_LobLocatorIsInit,"OCILobLocatorIsInit",4,0,0,scm_LobLocatorIsInit);
static SCM
scm_LobLocatorIsInit (SCM scm_envhp,SCM scm_errhp,SCM scm_locp,SCM scm_is_initialized)
{
OCIEnv* envhp;
OCIError* errhp;
OCILobLocator* locp;
boolean* is_initialized;
return SCM_MAKINUM(OCILobLocatorIsInit(envhp,errhp,locp,is_initialized));
}
SCM_PROC(s_LobRead,"OCILobRead",14,0,0,scm_LobRead);
static SCM
scm_LobRead (SCM scm_svchp,SCM scm_errhp,SCM scm_locp,SCM scm_amtp,SCM scm_offset,SCM scm_bufp,SCM scm_bufl,SCM scm_ctxp,SCM scm_(*cbfp,SCM scm_bufp,SCM scm_len,SCM scm_piece,SCM scm_csid,SCM scm_csfrm)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
ub4* amtp;
ub4 offset;
dvoid* bufp;
ub4 bufl;
dvoid* ctxp;
sb4 (*cbfp;
dvoid* bufp;
ub4 len;
ub1 piece;
ub2 csid;
ub1 csfrm;
return SCM_MAKINUM(OCILobRead(svchp,errhp,locp,amtp,offset,bufp,bufl,ctxp,(*cbfp,bufp,len,piece,csid,csfrm));
}
SCM_PROC(s_LobTrim,"OCILobTrim",4,0,0,scm_LobTrim);
static SCM
scm_LobTrim (SCM scm_svchp,SCM scm_errhp,SCM scm_locp,SCM scm_newlen)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
ub4 newlen;
return SCM_MAKINUM(OCILobTrim(svchp,errhp,locp,newlen));
}
SCM_PROC(s_LobWrite,"OCILobWrite",15,0,0,scm_LobWrite);
static SCM
scm_LobWrite (SCM scm_svchp,SCM scm_errhp,SCM scm_locp,SCM scm_amtp,SCM scm_offset,SCM scm_bufp,SCM scm_buflen,SCM scm_piece,SCM scm_ctxp,SCM scm_(*cbfp,SCM scm_bufp,SCM scm_len,SCM scm_piece,SCM scm_csid,SCM scm_csfrm)
{
OCISvcCtx* svchp;
OCIError* errhp;
OCILobLocator* locp;
ub4* amtp;
ub4 offset;
dvoid* bufp;
ub4 buflen;
ub1 piece;
dvoid* ctxp;
sb4 (*cbfp;
dvoid* bufp;
ub4* len;
ub1* piece;
ub2 csid;
ub1 csfrm;
return SCM_MAKINUM(OCILobWrite(svchp,errhp,locp,amtp,offset,bufp,buflen,piece,ctxp,(*cbfp,bufp,len,piece,csid,csfrm));
}
SCM_PROC(s_Break,"OCIBreak",2,0,0,scm_Break);
static SCM
scm_Break (SCM scm_hndlp,SCM scm_errhp)
{
dvoid* hndlp;
OCIError* errhp;
return SCM_MAKINUM(OCIBreak(hndlp,errhp));
}
SCM_PROC(s_Reset,"OCIReset",2,0,0,scm_Reset);
static SCM
scm_Reset (SCM scm_hndlp,SCM scm_errhp)
{
dvoid* hndlp;
OCIError* errhp;
return SCM_MAKINUM(OCIReset(hndlp,errhp));
}
SCM_PROC(s_ServerVersion,"OCIServerVersion",5,0,0,scm_ServerVersion);
static SCM
scm_ServerVersion (SCM scm_hndlp,SCM scm_errhp,SCM scm_bufp,SCM scm_bufsz,SCM scm_hndltype)
{
dvoid* hndlp;
OCIError* errhp;
text* bufp;
ub4 bufsz;
ub1 hndltype;
return SCM_MAKINUM(OCIServerVersion(hndlp,errhp,bufp,bufsz,hndltype));
}
*/
SCM_PROC(s_AttrGet,"OCIAttrGet",3,0,0,scm_AttrGet);
static SCM
scm_AttrGet (SCM scm_trgthndlp,SCM scm_attrtype,SCM scm_errhp)
{
dvoid* trgthndlp;
ub4 trghndltyp;
dvoid* attributep;
ub4 sizep=0;
ub4 attrtype;
OCIError* errhp;
sword c;
ub1 _ub1;
ub2 _ub2;
ub4 _ub4;
text *_text;
int ret_type;
if (SCM_OCIPARAMP(scm_trgthndlp)){
trgthndlp=(dvoid*)(SCM_OCIPARAM(scm_trgthndlp)->handle);
trghndltyp=OCI_DTYPE_PARAM;
}else if (SCM_OCISTMTP(scm_trgthndlp)){
trgthndlp=(dvoid*)(SCM_OCISTMT(scm_trgthndlp)->handle);
trghndltyp=OCI_HTYPE_STMT;
}else{
SCM_ASSERT(0,scm_trgthndlp,SCM_ARG1,s_AttrGet);
return 0;
}
SCM_ASSERT(SCM_IMP(scm_attrtype)&&SCM_INUMP(scm_attrtype),
scm_attrtype,SCM_ARG2,s_AttrGet);
attrtype=SCM_INUM(scm_attrtype);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG3,s_AttrGet);
errhp=SCM_OCIERROR(scm_errhp)->handle;
switch (attrtype){
case OCI_ATTR_PARAM_COUNT:
attributep=(dvoid*)&_ub4;
ret_type=1;
break;
case OCI_ATTR_PTYPE:
case OCI_ATTR_TIMESTAMP:
case OCI_ATTR_PRECISION:
case OCI_ATTR_SCALE:
case OCI_ATTR_CHARSET_FORM:
attributep=(dvoid*)&_ub1;
ret_type=2;
break;
case OCI_ATTR_DATA_TYPE:
case OCI_ATTR_DATA_SIZE:
case OCI_ATTR_NUM_ATTRS:
case OCI_ATTR_NUM_PARAMS:
case OCI_ATTR_CHARSET_ID:
attributep=(dvoid*)&_ub2;
ret_type=3;
break;
case OCI_ATTR_NAME:
case OCI_ATTR_TYPE_NAME:
case OCI_ATTR_SCHEMA_NAME:
attributep=(dvoid*)&_text;
ret_type=4;
break;
case OCI_ATTR_IS_NULL:
attributep=(dvoid*)&_ub1;
ret_type=5;
break;
default:
SCM_ASSERT(0,scm_errhp,guile_choose("Can't handle this attribute yet",SCM_ARG3),s_AttrGet);
return SCM_BOOL_F;
}
if (OCI_SUCCESS==(c=OCIAttrGet(trgthndlp,trghndltyp,attributep,&sizep,attrtype,errhp))){
switch (ret_type){
case 1:
return SCM_MAKINUM(_ub4);
case 2:
return SCM_MAKINUM(_ub1);
case 3:
return SCM_MAKINUM(_ub2);
case 4:
return scm_makfromstr(_text,sizep,0);
case 5:
return (_ub1==0)?SCM_BOOL_F:SCM_BOOL_T;
default:
/*never reached, but just in case*/
return SCM_UNDEFINED;
}
}else
scm_error(s_oci8_error,s_AttrGet,"(OCIAttrGet ~S ~S ~S) failed with code ~A",SCM_LIST4(scm_trgthndlp,scm_attrtype,scm_errhp,scm_oci_err_code(c)),scm_errhp);
return SCM_BOOL_F;
}
SCM_PROC(s_AttrSet,"OCIAttrSet",4,0,0,scm_AttrSet);
static void
trans_to_ub4(ub4 *_ub4,SCM val)
{
if (SCM_IMP(val)&&SCM_INUMP(val)){
*_ub4=SCM_INUM(val);
}else
SCM_ASSERT(0,val,guile_choose("Can't convert to ub4 datatype",SCM_ARG2),s_AttrSet);
}
static SCM
scm_AttrSet (SCM scm_trgthndlp,SCM scm_attributep,SCM scm_attrtype,SCM scm_errhp)
{
dvoid* trgthndlp;
ub4 trghndltyp;
dvoid* attributep;
ub4 size;
ub4 attrtype;
OCIError* errhp;
sword c;
ub4 _ub4;
int type;
if (SCM_OCIPARAMP(scm_trgthndlp)){
trgthndlp=(dvoid*)(SCM_OCIPARAM(scm_trgthndlp)->handle);
trghndltyp=OCI_DTYPE_PARAM;
}else if (SCM_OCISTMTP(scm_trgthndlp)){
trgthndlp=(dvoid*)(SCM_OCISTMT(scm_trgthndlp)->handle);
trghndltyp=OCI_HTYPE_STMT;
}else{
SCM_ASSERT(0,scm_trgthndlp,
guile_choose("Don't know how to set attribute of this handle",SCM_ARG1),s_AttrSet);
return 0;
}
SCM_ASSERT(SCM_IMP(scm_attrtype)&&SCM_INUMP(scm_attrtype),
scm_attrtype,SCM_ARG2,s_AttrSet);
attrtype=SCM_INUM(scm_attrtype);
SCM_ASSERT(SCM_OCIERRORP(scm_errhp),scm_errhp,SCM_ARG3,s_AttrSet);
errhp=SCM_OCIERROR(scm_errhp)->handle;
switch (attrtype){
case OCI_ATTR_PREFETCH_ROWS:
case OCI_ATTR_PREFETCH_MEMORY:
type=1;
trans_to_ub4(&_ub4,scm_attributep);
attributep=(void*)&_ub4;
size=4;
break;
default:
SCM_ASSERT(0,scm_attributep,
guile_choose("Don't know how to set this attribute",SCM_ARG2),s_AttrSet);
return SCM_BOOL_F;
}
if (OCI_SUCCESS==(c=OCIAttrSet(trgthndlp,trghndltyp,attributep,size,attrtype,errhp))){
return SCM_UNDEFINED;
}else
oci_error(s_AttrSet,c,scm_errhp);
return SCM_BOOL_F;
}
/*
SCM_PROC(s_SvcCtxToLda,"OCISvcCtxToLda",3,0,0,scm_SvcCtxToLda);
static SCM
scm_SvcCtxToLda (SCM scm_svchp,SCM scm_errhp,SCM scm_ldap)
{
OCISvcCtx* svchp;
OCIError* errhp;
Lda_Def* ldap;
return SCM_MAKINUM(OCISvcCtxToLda(svchp,errhp,ldap));
}
SCM_PROC(s_LdaToSvcCtx,"OCILdaToSvcCtx",3,0,0,scm_LdaToSvcCtx);
static SCM
scm_LdaToSvcCtx (SCM scm_svchpp,SCM scm_errhp,SCM scm_ldap)
{
OCISvcCtx** svchpp;
OCIError* errhp;
Lda_Def* ldap;
return SCM_MAKINUM(OCILdaToSvcCtx(svchpp,errhp,ldap));
}
SCM_PROC(s_ResultSetToStmt,"OCIResultSetToStmt",2,0,0,scm_ResultSetToStmt);
static SCM
scm_ResultSetToStmt (SCM scm_rsetdp,SCM scm_errhp)
{
OCIResult* rsetdp;
OCIError* errhp;
return SCM_MAKINUM(OCIResultSetToStmt(rsetdp,errhp));
}
SCM_PROC(s_SecurityInitialize,"OCISecurityInitialize",2,0,0,scm_SecurityInitialize);
static SCM
scm_SecurityInitialize (SCM scm_sechandle,SCM scm_error_handle)
{
OCISecurity* sechandle;
OCIError* error_handle;
return SCM_MAKINUM(OCISecurityInitialize(sechandle,error_handle));
}
SCM_PROC(s_SecurityTerminate,"OCISecurityTerminate",2,0,0,scm_SecurityTerminate);
static SCM
scm_SecurityTerminate (SCM scm_sechandle,SCM scm_error_handle)
{
OCISecurity* sechandle;
OCIError* error_handle;
return SCM_MAKINUM(OCISecurityTerminate(sechandle,error_handle));
}
*/
int
min (int x, int y)
{
return (x < y) ? x:y;
}
SCM_PROC (s_oci_set_x,"oci8:set!",2,1,0,scm_oci_set_x);
static SCM
scm_oci_set_x(SCM scm_plholder,SCM scm_val,SCM scm_row)
{
placeholder* pl;
ub4 row;
int ok=0;
SCM_ASSERT(SCM_OCIBINDP(scm_plholder),scm_plholder,SCM_ARG1,s_oci_set_x);
pl=&SCM_OCIBIND(scm_plholder)->pl;
SCM_ASSERT(SCM_UNBNDP(scm_row) || (SCM_IMP(scm_row) && SCM_INUMP(scm_row)),
scm_row,SCM_ARG3,s_oci_set_x);
row=SCM_UNBNDP(scm_row)?1:SCM_INUM(scm_row);
SCM_ASSERT (row>0 && (row<=pl->maxarr_len||(row==1 && pl->maxarr_len==0)),
scm_row,
SCM_OUTOFRANGE,
s_oci_set_x);
row--;
if (SCM_NULLP(scm_val)){
if (pl->dty!=SQLT_NTY){
((ub2*)pl->indp)[row]=-1;
ok=1;
}
}else{
SCM x=SCM_UNDEFINED;
switch (pl->dty){
case OCI_TYPECODE_CHAR:
case OCI_TYPECODE_VARCHAR:
case OCI_TYPECODE_VARCHAR2:
case SQLT_STR:
if (SCM_STRINGP(scm_val)||SCM_SYMBOLP(scm_val)){
x=scm_val;
}else if ((SCM_IMP(scm_val)&&SCM_INUMP(scm_val))||
(SCM_NIMP(scm_val)&&SCM_NUMBERP(scm_val)))
{
x=scm_number_to_string(scm_val,SCM_MAKINUM(10));
}else
SCM_ASSERT(0,scm_val,guile_choose("Don't know how to convert to string",SCM_ARG2),
s_oci_set_x);
{
char *s=SCM_CHARS(x);
int len=strlen(s);
/*TODO: check for diffirence between VARCHAR,VARCHAR2 and SQLT_STR*/
/*TODO: check for overflow and having not zero at end of string*/
if (pl->dty==OCI_TYPECODE_CHAR){
memset(pl->valuep+pl->value_sz*row,' ',pl->value_sz);
strncpy(pl->valuep+pl->value_sz*row,s,min(pl->value_sz,len));
}else{
strncpy(pl->valuep+pl->value_sz*row,s,pl->value_sz);
}
pl->alenp[row]=len;
/*TODO: handle zero-length string*/
ok=1;
}
break;
case OCI_TYPECODE_INTEGER:
if (SCM_STRINGP(scm_val)||SCM_SYMBOLP(scm_val)){
x=scm_string_to_number(scm_val,SCM_UNDEFINED);
}else if (SCM_IMP(scm_val)&&SCM_INUMP(scm_val))
x=scm_val;
if (SCM_NIMP(x)&&SCM_NUMBERP(x))
x=scm_inexact_to_exact(x);
SCM_ASSERT(SCM_IMP(x)&&SCM_INUMP(x),
scm_val,guile_choose("Don't know how to convert to integer",SCM_ARG2),
s_oci_set_x);
{
int i;
i=SCM_INUM(x);
switch (pl->value_sz){
case 1:
if (i>=SB1MINVAL && i<=SB1MAXVAL){
((sb1*)pl->valuep)[row]=(sb1)i;
ok=1;
}
break;
case 2:
if (i>=SB2MINVAL && i<=SB2MAXVAL){
((sb2*)pl->valuep)[row]=(sb2)i;
ok=1;
}
break;
case 4:
if (i>=SB4MINVAL && i<=SB4MAXVAL){
((sb4*)pl->valuep)[row]=(sb4)i;
ok=1;
}
}
}
break;
case OCI_TYPECODE_FLOAT:
if (SCM_STRINGP(scm_val)||SCM_SYMBOLP(scm_val)){
x=scm_string_to_number(scm_val,SCM_UNDEFINED);
}else if ((SCM_IMP(scm_val)&&SCM_INUMP(scm_val))||
(SCM_NIMP(scm_val)&&SCM_NUMBERP(scm_val)))
x=scm_val;
else
SCM_ASSERT(0,scm_val,guile_choose("Don't know how to convert to double",SCM_ARG2),
s_oci_set_x);
((double*)(pl->valuep))[row]=scm_num2dbl(x,"");
ok=1;
break;
case OCI_TYPECODE_DATE:
if (SCM_NIMP(scm_val)&&SCM_VECTORP(scm_val)){
int i;
sb1* date=(sb1*)pl->valuep+row*7;
SCM_ASSERT(SCM_INUM(scm_vector_length(scm_val))==7,scm_val,
guile_choose("DATE datatype requires vector of 7 elts",SCM_ARG2),s_oci_set_x);
for (i=0;i<7;i++){
SCM el;
el=scm_vector_ref(scm_val,SCM_MAKINUM(i));
SCM_ASSERT(SCM_IMP(el)&&SCM_INUMP(el),
el,
guile_choose("DATE datatype requires integer elemnets of vector",SCM_ARGn),
s_oci_set_x);
date[i]=SCM_INUM(el);
}
ok=1;
}else if (SCM_NIMP(scm_val)&&SCM_CONSP (scm_val)){
int i=0;
sb1* date=(sb1*)pl->valuep+row*7;
SCM el;
do{
el=SCM_CAR(scm_val);
SCM_ASSERT(SCM_IMP(el)&&SCM_INUMP(el),
el,
guile_choose("DATE datatype requires integer elemnets of list",SCM_ARGn),
s_oci_set_x);
date[i++]=(ub1)SCM_INUM(el);
}while (i<7);
SCM_ASSERT(SCM_NULLP(el),
el,
guile_choose("DATE datatype requires 7 elemnets of list",SCM_ARG2),
s_oci_set_x);
ok=1;
} else
SCM_ASSERT(0,scm_val,
guile_choose("DATE datatype requires vector or list of 7 items",SCM_ARG2),
s_oci_set_x);
break;
}
/*TODO SQLNTY, NULL*/
if (pl->dty!=SQLT_NTY)
((sb2*)pl->indp)[row]=1;
}
SCM_ASSERT(ok, scm_val, SCM_ARG2, s_oci_set_x);
return SCM_UNDEFINED;
}
SCM_PROC (s_oci_ind,"oci8:ind",1,1,0,scm_oci_ind);
static SCM scm_oci_ind(SCM scm_plholder,SCM scm_row)
{
placeholder* pl;
ub4 row;
SCM_ASSERT(SCM_OCIBINDP(scm_plholder)||SCM_OCIDEFINEP(scm_plholder),
scm_plholder,SCM_ARG1,s_oci_ind);
pl=(SCM_OCIBINDP(scm_plholder)?
&(SCM_OCIBIND(scm_plholder)->pl):
&(SCM_OCIDEFINE(scm_plholder)->pl));
SCM_ASSERT(SCM_UNBNDP(scm_row) || (SCM_IMP(scm_row) && SCM_INUMP(scm_row)),
scm_row,SCM_ARG3,s_oci_ind);
row=SCM_UNBNDP(scm_row)?1:SCM_INUM(scm_row);
SCM_ASSERT (row>0 && (row<=pl->maxarr_len||(row==1 && pl->maxarr_len==0)),
scm_row,
SCM_OUTOFRANGE,
s_oci_ind);
row--;
/*TODO SQLNTY, NULL*/
if (pl->dty!=SQLT_NTY){
return SCM_MAKINUM(((sb2*)pl->indp)[row]);
}else
return SCM_UNDEFINED;
}
SCM_PROC (s_oci_ref,"oci8:ref",1,1,0,scm_oci_ref);
static SCM scm_oci_ref(SCM scm_plholder,SCM scm_row)
{
placeholder* pl;
ub4 row;
SCM_ASSERT(SCM_OCIBINDP(scm_plholder)||SCM_OCIDEFINEP(scm_plholder),
scm_plholder,SCM_ARG1,s_oci_ref);
pl=(SCM_OCIBINDP(scm_plholder)?
&(SCM_OCIBIND(scm_plholder)->pl):
&(SCM_OCIDEFINE(scm_plholder)->pl));
SCM_ASSERT(SCM_UNBNDP(scm_row) || (SCM_IMP(scm_row) && SCM_INUMP(scm_row)),
scm_row,SCM_ARG3,s_oci_ref);
row=SCM_UNBNDP(scm_row)?1:SCM_INUM(scm_row);
SCM_ASSERT (row>0 && (row<=pl->maxarr_len||(row==1 && pl->maxarr_len==0)),
scm_row,
SCM_OUTOFRANGE,
s_oci_ref);
row--;
/*TODO SQLNTY, NULL*/
if (pl->dty!=SQLT_NTY){
if (((sb2*)pl->indp)[row]==-1)
return SCM_EOL;
}
switch (pl->dty){
case OCI_TYPECODE_DATE:
{
SCM vec=scm_make_vector(SCM_MAKINUM(7),SCM_BOOL_F);
int i;
ub1 *date=(ub1*)pl->valuep+(row*7);
for (i=0;i<7;i++){
scm_vector_set_x(vec,SCM_MAKINUM(i),SCM_MAKINUM(date[i]));
};
return vec;
}
case OCI_TYPECODE_INTEGER:
switch (pl->value_sz){
case 1:
return SCM_MAKINUM(((sb1*)pl->valuep)[row]);
case 2:
return SCM_MAKINUM(((sb2*)pl->valuep)[row]);
case 4:
return SCM_MAKINUM(((sb4*)pl->valuep)[row]);
}
break;
case OCI_TYPECODE_FLOAT:
return scm_make_real(((double*)(pl->valuep))[row]);
case OCI_TYPECODE_VARCHAR:
return scm_makfromstr(pl->valuep+pl->value_sz*row,pl->alenp[row],0);
case OCI_TYPECODE_VARCHAR2:
return scm_makfromstr(pl->valuep+pl->value_sz*row+2,pl->alenp[row],0);
case SQLT_LVC:
return scm_makfromstr(pl->valuep+pl->value_sz*row+4,pl->alenp[row],0);
case SQLT_STR:
return scm_makfrom0str(pl->valuep+pl->value_sz*row);
}
SCM_ASSERT (0,
scm_oci_typecode_to_symbol(SCM_MAKINUM(pl->dty)),
guile_choose("Can't handle this datatype",SCM_ARG1),
s_oci_ref);
return SCM_UNDEFINED;
}
SCM_PROC (s_oci_stmt_p,"oci8:stmt?",1,0,0,scm_oci_stmt_p);
static SCM scm_oci_stmt_p(SCM smob)
{
return SCM_OCISTMTP(smob)?SCM_BOOL_T:SCM_BOOL_F;
}
SCM_PROC (s_oci_version,"oci8:version",0,0,0,scm_oci_version);
static SCM scm_oci_version()
{
return scm_makfrom0str(VERSION);
}
int init_oci8(void);
int init_oci8()
{
tag_env=scm_make_smob_type("OCIENV",0) ;
scm_set_smob_print(tag_env,print_env);
scm_set_smob_free(tag_env,free_env);
tag_error=scm_make_smob_type("OCIERROR",0) ;
scm_set_smob_mark(tag_error,mark_error);
scm_set_smob_print(tag_error,print_error);
scm_set_smob_free(tag_error,free_error);
tag_svcctx=scm_make_smob_type("OCISVCCTX",0) ;
scm_set_smob_mark(tag_svcctx,mark_svcctx);
scm_set_smob_print(tag_svcctx,print_svcctx);
scm_set_smob_free(tag_svcctx,free_svcctx);
tag_stmt=scm_make_smob_type("OCISTMT",0) ;
scm_set_smob_mark(tag_stmt,mark_stmt);
scm_set_smob_print(tag_stmt,print_stmt);
scm_set_smob_free(tag_stmt,free_stmt);
tag_bind=scm_make_smob_type("OCIBIND",0) ;
scm_set_smob_mark(tag_bind,mark_bind);
scm_set_smob_print(tag_bind,print_bind);
scm_set_smob_free(tag_bind,free_bind);
tag_define=scm_make_smob_type("OCIDEFINE",0) ;
scm_set_smob_mark(tag_define,mark_define);
scm_set_smob_print(tag_define,print_define);
scm_set_smob_free(tag_define,free_define);
tag_describe=scm_make_smob_type("OCIDESCRIBE",0) ;
scm_set_smob_mark(tag_describe,mark_describe);
scm_set_smob_print(tag_describe,print_describe);
scm_set_smob_free(tag_describe,free_describe);
tag_server=scm_make_smob_type("OCISERVER",0) ;
scm_set_smob_mark(tag_server,mark_server);
scm_set_smob_print(tag_server,print_server);
scm_set_smob_free(tag_server,free_server);
tag_session=scm_make_smob_type("OCISESSION",0) ;
scm_set_smob_mark(tag_session,mark_session);
scm_set_smob_print(tag_session,print_session);
scm_set_smob_free(tag_session,free_session);
tag_complexobject=scm_make_smob_type("OCICOMPLEXOBJECT",0) ;
scm_set_smob_mark(tag_complexobject,mark_complexobject);
scm_set_smob_print(tag_complexobject,print_complexobject);
scm_set_smob_free(tag_complexobject,free_complexobject);
tag_trans=scm_make_smob_type("OCITRANS",0) ;
scm_set_smob_mark(tag_trans,mark_trans);
scm_set_smob_print(tag_trans,print_trans);
scm_set_smob_free(tag_trans,free_trans);
tag_security=scm_make_smob_type("OCISECURITY",0) ;
scm_set_smob_mark(tag_security,mark_security);
scm_set_smob_print(tag_security,print_security);
scm_set_smob_free(tag_security,free_security);
tag_param=scm_make_smob_type("OCIPARAM",0) ;
/*scm_set_smob_mark(tag_param,mark_param);*/
scm_set_smob_print(tag_param,print_param);
scm_set_smob_free(tag_param,free_param);
#include "libguileoci8.x"
return 0;
}
void scm_init_database_interface_oracle_oci8_module(void);
void scm_init_database_interface_oracle_oci8_module(void)
{
scm_register_module_xxx("database interface oracle oci8",(void*)init_oci8);
}
[-- Attachment #3: Type: text/plain, Size: 52 bytes --]
--
Nic Ferrier
http://www.tapsellferrier.co.uk
[-- Attachment #4: Type: text/plain, Size: 139 bytes --]
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 7+ messages in thread