DBD-QBase
view release on metacpan or search on metacpan
#include "DBIXS.h"
#include "dbdimp.h"
DBISTATE_DECLARE;
static SV *qb_long;
static SV *qb_trunc;
id qb; /* Should be moved to correct structure in
* dbdimp.h for multi connects */
boot_QBase()
/*
* For staticly built systems...Currently a hack
*/
{
}
void
dbd_init(dbistate)
dbistate_t *dbistate;
/*
* Initialize the database object so we can get some work done.
*/
{
DBIS = dbistate;
qb_long = perl_get_sv("QBase::qb_long", GV_ADDMULTI);
qb_trunc = perl_get_sv("QBase::qb_trunc", GV_ADDMULTI);
}
/* Database specific error handling.
This will be split up into specific routines
for dbh and sth level.
Also split into helper routine to set number & string.
Err, many changes needed, ramble ...
*/
void
qb_error(h, what)
SV *h;
char *what;
/*
* Currently we just warn, but we should print out more information and we
* really should send it to standard Error out so it does not get lost in
* the pipe stream.
*/
{
printf("Warning: %s\n", what);
}
void
fbh_dump(fbh, i)
imp_fbh_t *fbh;
int i;
/*
* Dump information about imp_fbh_t. Currently not used since cursors is
* not working
*/
{
}
/* ================================================================== */
static void
dump_error_status(cda)
/* struct cda_def *cda; */
int *cda;
/*
* Dump error status, currently not used.
*/
{
}
/* ================================================================== */
int
dbd_db_login(dbh, dbname, uid, pwd)
SV *dbh;
char *dbname;
char *uid;
char *pwd;
/*
* Login in routines. Currently does support softwareIDs nor network
* database request
*/
{
D_imp_dbh(dbh);
int ret;
qb = [QuickBase alloc];
[qb init];
[qb initDatabase:dbname software:NULL login:uid
password:pwd return:&ret];
switch (ret) {
case ERR_SFTUSRLIM:
qb_error(dbh, "No more software licenses left.");
return 0;
case ERR_DBSUSRLIM:
qb_error(dbh, "No more database license left.");
return 0;
case ERR_NOSERVER:
qb_error(dbh, "Can't find server!");
return 0;
case ERR_INCORRECT_LOGIN:
qb_error(dbh, "login failed");
return 0;
}
DBIc_IMPSET_on(imp_dbh); /* imp_dbh set up now */
DBIc_ACTIVE_on(imp_dbh); /* call disconnect before freeing */
return 1;
}
( run in 0.430 second using v1.01-cache-2.11-cpan-39bf76dae61 )