DBD-PrimeBase
view release on metacpan or search on metacpan
PrimeBase.xs view on Meta::CPAN
/*
$Id: PrimeBase.pm,v 1.4001 2001/07/30 19:29:50
Copyright (c) 2001 Snap Innovation
You may distribute under the terms of either the GNU General Public
License or the Artoistic License, as specified in the Perl README file.
*/
#include "PrimeBase.h"
DBISTATE_DECLARE;
MODULE = DBD::PrimeBase PACKAGE = DBD::PrimeBase
INCLUDE: PrimeBase.xsi
MODULE = DBD::PrimeBase PACKAGE = DBD::PrimeBase::dr
void
_admin_internal(drh,dbh,command,dbname=NULL,host=NULL,server=NULL,user=NULL,password=NULL)
SV* drh
SV* dbh
char* command
char* dbname
char* host
char* server
char* user
char* password
PPCODE:
{
int result;
int sessid;
SV* the_handle;
/*
* Connect to the database, if required.
*/
if (SvOK(dbh)) {
D_imp_dbh(dbh);
sessid = imp_dbh->sessid;
the_handle = dbh;
} else {
sessid = PrimeBase_dr_connect(drh, host, server, user, password);
the_handle = drh;
if (!sessid) {
XSRETURN_NO;
}
}
if (strEQ(command, "createdb")) {
result = PrimeBase_create_db(the_handle, sessid, dbname);
} else if (strEQ(command, "dropdb")) {
result = PrimeBase_drop_db(the_handle, sessid, dbname);
} else {
croak("Unknown command: %s", command);
}
if (!SvOK(dbh)) {
PrimeBase_dr_disconnect(sessid);
}
if (result) { XSRETURN_NO; } else { XSRETURN_YES; }
}
MODULE = DBD::PrimeBase PACKAGE = DBD::PrimeBase::db
void
do(dbh, statement, attr=Nullsv, ...)
SV * dbh
SV * statement
SV * attr
PROTOTYPE: $$;$@
CODE:
{
D_imp_dbh(dbh);
SV **params = NULL;
int numParams = 0;
int retval;
if (items > 3) {
/* Handle binding supplied values to placeholders */
/* Assume user has passed the correct number of parameters */
int i;
numParams = items-3;
Newz(0, params, numParams, SV *);
for (i = 0; i < numParams; i++) {
params[i] = ST(i+3);
( run in 2.350 seconds using v1.01-cache-2.11-cpan-71847e10f99 )