DBD_SQLFLEX

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

/*
 * @(#)$Id: dbdimp.ec,v 58.4 1998/01/15 18:46:24 johnl Exp $ 
 *
 * DBD::Sqlflex for Perl Version 5 -- implementation details
 *
 * Portions Copyright
 *           (c) 1994-95 Tim Bunce
 *           (c) 1995-96 Alligator Descartes
 *           (c) 1994    Bill Hailes
 *           (c) 1996    Terry Nightingale
 *           (c) 1996-98 Jonathan Leffler
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Artistic License, as specified in the Perl README file.
 */
#include <sqlhdr.h>
#include <sqtypes.h>

/*TABSTOP=4*/

#ifndef lint
static const char rcs[] = "@(#)$Id: dbdimp.ec,v 58.4 1998/01/15 18:46:24 johnl Exp $";
#endif

#include <stdio.h>
#include <string.h>

#define MAIN_PROGRAM	/* Embed version information for JLSS headers */
#include "Sqlflex.h"
#include "decsci.h"

#define L_CURLY	'{'
#define R_CURLY	'}'

DBISTATE_DECLARE;

static SV *ix_errnum = NULL;
static SV *ix_errstr = NULL;
static SV *ix_state = NULL;

extern int *  pcGSQLFlexSvc;

char * my_errlist[] =
  {
  "Duplicate record",              /* 100 */
  "File not open",                 /* 101 */
  "Illegal argument",              /* 102 */
  "Bad key descriptor",            /* 103 */
  "Too many files",                /* 104 */
  "Corrupted isam file",           /* 105 */
  "Need exclusive access",         /* 106 */
  "Record or file locked",         /* 107 */
  "Index already exists",          /* 108 */
  "Illegal primary key operation", /* 109 */
  "End of file",                   /* 110 */
  "Record not found",              /* 111 */
  "No current record",             /* 112 */
  "File is in use",                /* 113 */
  "File name too long",            /* 114 */
  "Bad lock device",               /* 115 */
  "Can't allocate memory",         /* 116 */
  "Bad collating table",           /* 117 */
  "Can't read log record",         /* 118 */
  "Bad log record",                /* 119 */
  "Can't open log file",           /* 120 */
  "Can't write log record",        /* 121 */
  "No transaction",                /* 122 */
  "No shared memory",              /* 123 */
  "No begin work yet",             /* 124 */
  "Can't use nfs",                 /* 125 */
  "Bad rowid",                     /* 126 */
  "No primary key",                /* 127 */
  "No logging",                    /* 128 */
  "Too many users",                /* 129 */
  "No such dbspace",               /* 130 */
  "No free disk space",            /* 131 */
  "Rowsize too big",               /* 132 */
  "Audit trail exists",            /* 133 */
  "No more locks"                  /* 134 */
  };

static void dbd_ix_blobs(imp_sth_t *imp_sth);
static int dbd_ix_declare(imp_sth_t *imp_sth);
static void dbd_ix_printenv(const char *s1, const char *s2);
static void dbd_st_destroyer(void *data);
static void del_connection(imp_dbh_t *imp_dbh);
static void dbd_db_destroyer(void *data);
static void dbd_ix_savesqlca(imp_dbh_t *imp_dbh);
static void dbd_ix_sqlcode(imp_dbh_t *imp_dbh);
static void     new_connection(imp_dbh_t *imp_dbh);
static int dbd_db_setconnection(imp_dbh_t *imp_dbh);
static int      dbd_ix_begin(imp_dbh_t *dbh);
static int      dbd_ix_commit(imp_dbh_t *dbh);
static int      dbd_ix_rollback(imp_dbh_t *dbh);
static void noop(void *data);
static void     new_statement(imp_dbh_t *imp_dbh, imp_sth_t *imp_sth);
static void del_statement(imp_sth_t *imp_sth);
static int dbd_ix_setbindnum(imp_sth_t *imp_sth, int items);
static int dbd_ix_bindsv(imp_sth_t *imp_sth, int idx, SV *val);
static int count_blobs(char *descname, int ncols);
static int dbd_ix_preparse(char *statement);
static char *decgen(dec_t *val, int plus);
static int dbd_ix_open(imp_sth_t *imp_sth);
static int dbd_ix_exec(imp_sth_t *imp_sth);

/*
** SQLSTATE is only supported in version 6.00 and later.
** The DBI 0.81 spec says that the value S1000 should be returned
** when the implementation does not support SQLSTATE.
*/

static const char SQLSTATE[] = " S1000";



( run in 1.780 second using v1.01-cache-2.11-cpan-df04353d9ac )