One Hat Cyber Team
Your IP :
216.73.216.216
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
vo
/
perl
/
mod
/
Msql-Mysql-modules-1.2211
/
mysql
/
View File Name :
mysql.c
/* * This file was generated automatically by xsubpp version 1.9507 from the * contents of mysql.xs. Do not edit this file, edit mysql.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "mysql.xs" /* Hej, Emacs, this is -*- C -*- mode! $Id: dbd.xs.in,v 1.4 1999/09/07 21:55:51 joe Exp $ Copyright (c) 1997, 1998 Jochen Wiedmann You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file, with the exception that it cannot be placed on a CD-ROM or similar media for commercial distribution without the prior approval of the author. */ #include "dbdimp.h" #include "../dbd/constants.h" DBISTATE_DECLARE; #line 32 "mysql.c" /* INCLUDE: Including 'mysql.xsi' from 'mysql.xs' */ XS(XS_DBD__mysql__dr_discon_all_) { dXSARGS; dXSI32; if (items != 1) croak("Usage: %s(drh)", GvNAME(CvGV(cv))); { SV * drh = ST(0); #line 36 "mysql.xsi" D_imp_drh(drh); if (0) ix = ix; /* avoid unused variable warning */ ST(0) = dbd_discon_all(drh, imp_drh) ? &sv_yes : &sv_no; #line 48 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db__login) { dXSARGS; if (items < 4 || items > 5) croak("Usage: DBD::mysql::db::_login(dbh, dbname, username, password, attribs=Nullsv)"); { SV * dbh = ST(0); char * dbname = (char *)SvPV(ST(1),PL_na); SV * username = ST(2); SV * password = ST(3); SV * attribs; if (items < 5) attribs = Nullsv; else { attribs = ST(4); } #line 55 "mysql.xsi" { STRLEN lna; D_imp_dbh(dbh); char *u = (SvOK(username)) ? SvPV(username,lna) : ""; char *p = (SvOK(password)) ? SvPV(password,lna) : ""; #ifdef dbd_db_login6 ST(0) = dbd_db_login6(dbh, imp_dbh, dbname, u, p, attribs) ? &sv_yes : &sv_no; #else ST(0) = dbd_db_login( dbh, imp_dbh, dbname, u, p) ? &sv_yes : &sv_no; #endif } #line 82 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_commit) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::commit(dbh)"); { SV * dbh = ST(0); #line 72 "mysql.xsi" D_imp_dbh(dbh); if (DBIc_has(imp_dbh,DBIcf_AutoCommit)) warn("commit ineffective with AutoCommit enabled"); ST(0) = dbd_db_commit(dbh, imp_dbh) ? &sv_yes : &sv_no; #line 99 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_rollback) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::rollback(dbh)"); { SV * dbh = ST(0); #line 81 "mysql.xsi" D_imp_dbh(dbh); if (DBIc_has(imp_dbh,DBIcf_AutoCommit)) warn("rollback ineffective with AutoCommit enabled"); ST(0) = dbd_db_rollback(dbh, imp_dbh) ? &sv_yes : &sv_no; #line 116 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_disconnect) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::disconnect(dbh)"); { SV * dbh = ST(0); #line 90 "mysql.xsi" D_imp_dbh(dbh); if ( !DBIc_ACTIVE(imp_dbh) ) { XSRETURN_YES; } /* pre-disconnect checks and tidy-ups */ if (DBIc_CACHED_KIDS(imp_dbh)) { SvREFCNT_dec(DBIc_CACHED_KIDS(imp_dbh)); /* cast them to the winds */ DBIc_CACHED_KIDS(imp_dbh) = Nullhv; } /* Check for disconnect() being called whilst refs to cursors */ /* still exists. This possibly needs some more thought. */ if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !dirty) { STRLEN lna; char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s"; warn("%s->disconnect invalidates %d active statement handle%s %s", SvPV(dbh,lna), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural, "(either destroy statement handles or call finish on them before disconnecting)"); } ST(0) = dbd_db_disconnect(dbh, imp_dbh) ? &sv_yes : &sv_no; DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ #line 149 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_STORE) { dXSARGS; if (items != 3) croak("Usage: DBD::mysql::db::STORE(dbh, keysv, valuesv)"); { SV * dbh = ST(0); SV * keysv = ST(1); SV * valuesv = ST(2); #line 118 "mysql.xsi" D_imp_dbh(dbh); if (SvGMAGICAL(valuesv)) mg_get(valuesv); ST(0) = &sv_yes; if (!dbd_db_STORE_attrib(dbh, imp_dbh, keysv, valuesv)) if (!DBIS->set_attr(dbh, keysv, valuesv)) ST(0) = &sv_no; #line 171 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_FETCH) { dXSARGS; if (items != 2) croak("Usage: DBD::mysql::db::FETCH(dbh, keysv)"); { SV * dbh = ST(0); SV * keysv = ST(1); #line 131 "mysql.xsi" D_imp_dbh(dbh); SV *valuesv = dbd_db_FETCH_attrib(dbh, imp_dbh, keysv); if (!valuesv) valuesv = DBIS->get_attr(dbh, keysv); ST(0) = valuesv; /* dbd_db_FETCH_attrib did sv_2mortal */ #line 190 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_DESTROY) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::DESTROY(dbh)"); SP -= items; { SV * dbh = ST(0); #line 142 "mysql.xsi" D_imp_dbh(dbh); ST(0) = &sv_yes; if (!DBIc_IMPSET(imp_dbh)) { /* was never fully set up */ STRLEN lna; if (DBIc_WARN(imp_dbh) && !dirty && DBIS->debug >= 2) fprintf(DBILOGFP, " DESTROY for %s ignored - handle not initialised\n", SvPV(dbh,lna)); } else { /* pre-disconnect checks and tidy-ups */ if (DBIc_CACHED_KIDS(imp_dbh)) { SvREFCNT_dec(DBIc_CACHED_KIDS(imp_dbh)); /* cast them to the winds */ DBIc_CACHED_KIDS(imp_dbh) = Nullhv; } if (DBIc_IADESTROY(imp_dbh)) { /* want's ineffective destroy */ DBIc_ACTIVE_off(imp_dbh); } if (DBIc_ACTIVE(imp_dbh)) { /* The application has not explicitly disconnected. That's bad. */ /* To ensure integrity we *must* issue a rollback. This will be */ /* harmless if the application has issued a commit. If it hasn't */ /* then it'll ensure integrity. Consider a Ctrl-C killing perl */ /* between two statements that must be executed as a transaction. */ /* Perl will call DESTROY on the dbh and, if we don't rollback, */ /* the server will automatically commit! Bham! Corrupt database! */ if (!DBIc_has(imp_dbh,DBIcf_AutoCommit)) { if (DBIc_WARN(imp_dbh) && (!dirty || DBIS->debug >= 3)) warn("Database handle destroyed without explicit disconnect"); if (DBIS->debug >= 2) fprintf(DBILOGFP, " IMPLICIT ROLLBACK ON DESTROY%s!\n", " of database handle that is still connected"); dbd_db_rollback(dbh, imp_dbh); /* ROLLBACK! */ } dbd_db_disconnect(dbh, imp_dbh); DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */ } dbd_db_destroy(dbh, imp_dbh); } #line 243 "mysql.c" PUTBACK; return; } } XS(XS_DBD__mysql__st__prepare) { dXSARGS; if (items < 2 || items > 3) croak("Usage: DBD::mysql::st::_prepare(sth, statement, attribs=Nullsv)"); { SV * sth = ST(0); char * statement = (char *)SvPV(ST(1),PL_na); SV * attribs; if (items < 3) attribs = Nullsv; else { attribs = ST(2); } #line 198 "mysql.xsi" { D_imp_sth(sth); DBD_ATTRIBS_CHECK("_prepare", sth, attribs); ST(0) = dbd_st_prepare(sth, imp_sth, statement, attribs) ? &sv_yes : &sv_no; } #line 270 "mysql.c" } XSRETURN(1); } #ifdef dbd_st_rows #define XSubPPtmpAAAA 1 XS(XS_DBD__mysql__st_rows) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::st::rows(sth)"); { SV * sth = ST(0); #line 211 "mysql.xsi" D_imp_sth(sth); XST_mIV(0, dbd_st_rows(sth, imp_sth)); #line 288 "mysql.c" } XSRETURN(1); } #endif XS(XS_DBD__mysql__st_bind_param) { dXSARGS; if (items < 3 || items > 4) croak("Usage: DBD::mysql::st::bind_param(sth, param, value, attribs=Nullsv)"); { SV * sth = ST(0); SV * param = ST(1); SV * value = ST(2); SV * attribs; if (items < 4) attribs = Nullsv; else { attribs = ST(3); } #line 224 "mysql.xsi" { IV sql_type = 0; D_imp_sth(sth); if (SvGMAGICAL(value)) mg_get(value); if (attribs) { if (SvNIOK(attribs)) { sql_type = SvIV(attribs); attribs = Nullsv; } else { SV **svp; DBD_ATTRIBS_CHECK("bind_param", sth, attribs); /* XXX we should perhaps complain if TYPE is not SvNIOK */ DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); } } ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, FALSE, 0) ? &sv_yes : &sv_no; } #line 331 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_bind_param_inout) { dXSARGS; if (items < 4 || items > 5) croak("Usage: DBD::mysql::st::bind_param_inout(sth, param, value_ref, maxlen, attribs=Nullsv)"); { SV * sth = ST(0); SV * param = ST(1); SV * value_ref = ST(2); IV maxlen = (IV)SvIV(ST(3)); SV * attribs; if (items < 5) attribs = Nullsv; else { attribs = ST(4); } #line 254 "mysql.xsi" { IV sql_type = 0; D_imp_sth(sth); SV *value; if (!SvROK(value_ref) || SvTYPE(SvRV(value_ref)) > SVt_PVMG) croak("bind_param_inout needs a reference to a scalar value"); value = SvRV(value_ref); if (SvREADONLY(value)) croak("Modification of a read-only value attempted"); if (SvGMAGICAL(value)) mg_get(value); if (attribs) { if (SvNIOK(attribs)) { sql_type = SvIV(attribs); attribs = Nullsv; } else { SV **svp; DBD_ATTRIBS_CHECK("bind_param", sth, attribs); DBD_ATTRIB_GET_IV(attribs, "TYPE",4, svp, sql_type); } } ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, maxlen) ? &sv_yes : &sv_no; } #line 379 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_execute) { dXSARGS; if (items < 1) croak("Usage: DBD::mysql::st::execute(sth, ...)"); { SV * sth = ST(0); #line 285 "mysql.xsi" D_imp_sth(sth); int retval; if (items > 1) { /* Handle binding supplied values to placeholders */ int i; SV *idx; if (items-1 != DBIc_NUM_PARAMS(imp_sth) && DBIc_NUM_PARAMS(imp_sth) != DBIc_NUM_PARAMS_AT_EXECUTE ) { croak("execute called with %ld bind variables when %d are needed", items-1, DBIc_NUM_PARAMS(imp_sth)); XSRETURN_UNDEF; } idx = sv_2mortal(newSViv(0)); for(i=1; i < items ; ++i) { SV* value = ST(i); if (SvGMAGICAL(value)) mg_get(value); /* trigger magic to FETCH the value */ sv_setiv(idx, i); if (!dbd_bind_ph(sth, imp_sth, idx, value, 0, Nullsv, FALSE, 0)) { XSRETURN_UNDEF; /* dbd_bind_ph already registered error */ } } } if (DBIc_ROW_COUNT(imp_sth) > 0) /* reset for re-execute */ DBIc_ROW_COUNT(imp_sth) = 0; retval = dbd_st_execute(sth, imp_sth); /* remember that dbd_st_execute must return <= -2 for error */ if (retval == 0) /* ok with no rows affected */ XST_mPV(0, "0E0"); /* (true but zero) */ else if (retval < -1) /* -1 == unknown number of rows */ XST_mUNDEF(0); /* <= -2 means error */ else XST_mIV(0, retval); /* typically 1, rowcount or -1 */ #line 426 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_fetchrow_arrayref) { dXSARGS; dXSI32; if (items != 1) croak("Usage: %s(sth)", GvNAME(CvGV(cv))); { SV * sth = ST(0); #line 327 "mysql.xsi" D_imp_sth(sth); AV *av; if (0) ix = ix; /* avoid unused variable warning */ av = dbd_st_fetch(sth, imp_sth); ST(0) = (av) ? sv_2mortal(newRV((SV *)av)) : &sv_undef; #line 445 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_fetchrow_array) { dXSARGS; dXSI32; if (items != 1) croak("Usage: %s(sth)", GvNAME(CvGV(cv))); SP -= items; { SV * sth = ST(0); #line 340 "mysql.xsi" D_imp_sth(sth); AV *av; if (0) ix = ix; /* avoid unused variable warning */ av = dbd_st_fetch(sth, imp_sth); if (av) { int num_fields = AvFILL(av)+1; int i; EXTEND(sp, num_fields); for(i=0; i < num_fields; ++i) { PUSHs(AvARRAY(av)[i]); } } #line 472 "mysql.c" PUTBACK; return; } } XS(XS_DBD__mysql__st_finish) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::st::finish(sth)"); { SV * sth = ST(0); #line 357 "mysql.xsi" D_imp_sth(sth); D_imp_dbh_from_sth; if (!DBIc_ACTIVE(imp_sth)) { /* No active statement to finish */ XSRETURN_YES; } if (!DBIc_ACTIVE(imp_dbh)) { /* Either an explicit disconnect() or global destruction */ /* has disconnected us from the database. Finish is meaningless */ DBIc_ACTIVE_off(imp_sth); XSRETURN_YES; } #ifdef dbd_db_finish3 ST(0) = dbd_st_finish3(sth, imp_sth, 0) ? &sv_yes : &sv_no; #else ST(0) = dbd_st_finish(sth, imp_sth) ? &sv_yes : &sv_no; #endif #line 503 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_blob_read) { dXSARGS; if (items < 4 || items > 6) croak("Usage: DBD::mysql::st::blob_read(sth, field, offset, len, destrv=Nullsv, destoffset=0)"); { SV * sth = ST(0); int field = (int)SvIV(ST(1)); long offset = (long)SvIV(ST(2)); long len = (long)SvIV(ST(3)); SV * destrv; long destoffset; if (items < 5) destrv = Nullsv; else { destrv = ST(4); } if (items < 6) destoffset = 0; else { destoffset = (long)SvIV(ST(5)); } #line 385 "mysql.xsi" { D_imp_sth(sth); if (!destrv) destrv = sv_2mortal(newRV(sv_2mortal(newSV(0)))); if (dbd_st_blob_read(sth, imp_sth, field, offset, len, destrv, destoffset)) ST(0) = SvRV(destrv); else ST(0) = &sv_undef; } #line 541 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_STORE) { dXSARGS; if (items != 3) croak("Usage: DBD::mysql::st::STORE(sth, keysv, valuesv)"); { SV * sth = ST(0); SV * keysv = ST(1); SV * valuesv = ST(2); #line 401 "mysql.xsi" D_imp_sth(sth); if (SvGMAGICAL(valuesv)) mg_get(valuesv); ST(0) = &sv_yes; if (!dbd_st_STORE_attrib(sth, imp_sth, keysv, valuesv)) if (!DBIS->set_attr(sth, keysv, valuesv)) ST(0) = &sv_no; #line 563 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_FETCH_attrib) { dXSARGS; dXSI32; if (items != 2) croak("Usage: %s(sth, keysv)", GvNAME(CvGV(cv))); { SV * sth = ST(0); SV * keysv = ST(1); #line 418 "mysql.xsi" D_imp_sth(sth); SV *valuesv; if (0) ix = ix; /* avoid unused variable warning */ valuesv = dbd_st_FETCH_attrib(sth, imp_sth, keysv); if (!valuesv) valuesv = DBIS->get_attr(sth, keysv); ST(0) = valuesv; /* dbd_st_FETCH_attrib did sv_2mortal */ #line 585 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__st_DESTROY) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::st::DESTROY(sth)"); SP -= items; { SV * sth = ST(0); #line 431 "mysql.xsi" D_imp_sth(sth); ST(0) = &sv_yes; if (!DBIc_IMPSET(imp_sth)) { /* was never fully set up */ STRLEN lna; if (DBIc_WARN(imp_sth) && !dirty && DBIS->debug >= 2) fprintf(DBILOGFP, "Statement handle %s DESTROY ignored - never set up", SvPV(sth,lna)); } else { if (DBIc_IADESTROY(imp_sth)) { /* want's ineffective destroy */ DBIc_ACTIVE_off(imp_sth); } if (DBIc_ACTIVE(imp_sth)) { D_imp_dbh_from_sth; if (DBIc_ACTIVE(imp_dbh)) { #ifdef dbd_db_finish3 dbd_st_finish3(sth, imp_sth, 1); #else dbd_st_finish(sth, imp_sth); #endif } else { DBIc_ACTIVE_off(imp_sth); } } dbd_st_destroy(sth, imp_sth); } #line 627 "mysql.c" PUTBACK; return; } } /* INCLUDE: Returning to 'mysql.xs' from 'mysql.xsi' */ XS(XS_DBD__mysql_constant) { dXSARGS; if (items != 2) croak("Usage: DBD::mysql::constant(name, arg)"); { char* name = (char *)SvPV(ST(0),PL_na); char* arg = (char *)SvPV(ST(1),PL_na); double RETVAL; #line 33 "mysql.xs" RETVAL = mymsql_constant(name, arg); #line 647 "mysql.c" ST(0) = sv_newmortal(); sv_setnv(ST(0), (double)RETVAL); } XSRETURN(1); } #if defined(DBD_MSQL) && defined(IDX_TYPE) && defined(HAVE_STRPTIME) #define XSubPPtmpAAAB 1 XS(XS_DBD__mysql_unixtimetodate) { dXSARGS; if (items < 1 || items > 2) croak("Usage: DBD::mysql::unixtimetodate(package = Package, clock)"); { time_t clock = (time_t)SvNV(ST(1)); char * RETVAL; #line 44 "mysql.xs" RETVAL = msqlUnixTimeToDate(clock); #line 667 "mysql.c" ST(0) = sv_newmortal(); sv_setpv((SV*)ST(0), RETVAL); } XSRETURN(1); } XS(XS_DBD__mysql_unixtimetotime) { dXSARGS; if (items < 1 || items > 2) croak("Usage: DBD::mysql::unixtimetotime(package = Package, clock)"); { time_t clock = (time_t)SvNV(ST(1)); char * RETVAL; #line 53 "mysql.xs" RETVAL = msqlUnixTimeToTime(clock); #line 684 "mysql.c" ST(0) = sv_newmortal(); sv_setpv((SV*)ST(0), RETVAL); } XSRETURN(1); } XS(XS_DBD__mysql_datetounixtime) { dXSARGS; if (items < 1 || items > 2) croak("Usage: DBD::mysql::datetounixtime(package = Package, clock)"); { char* clock = (char *)SvPV(ST(1),PL_na); time_t RETVAL; #line 62 "mysql.xs" RETVAL = msqlDateToUnixTime(clock); #line 701 "mysql.c" ST(0) = sv_newmortal(); sv_setnv(ST(0), (double)RETVAL); } XSRETURN(1); } XS(XS_DBD__mysql_timetounixtime) { dXSARGS; if (items < 1 || items > 2) croak("Usage: DBD::mysql::timetounixtime(package = Package, clock)"); { char* clock = (char *)SvPV(ST(1),PL_na); time_t RETVAL; #line 71 "mysql.xs" RETVAL = msqlTimeToUnixTime(clock); #line 718 "mysql.c" ST(0) = sv_newmortal(); sv_setnv(ST(0), (double)RETVAL); } XSRETURN(1); } #endif /* defined(DBD_MSQL) && defined(IDX_TYPE) && defined(HAVE_STRPTIME) */ XS(XS_DBD__mysql__dr__ListDBs) { dXSARGS; if (items < 2 || items > 3) croak("Usage: DBD::mysql::dr::_ListDBs(drh, host, port=NULL)"); SP -= items; { SV * drh = ST(0); char * host = (char *)SvPV(ST(1),PL_na); char * port; if (items < 3) port = NULL; else { port = (char *)SvPV(ST(2),PL_na); } #line 86 "mysql.xs" { #if defined(DBD_MYSQL) MYSQL mysql; dbh_t sock = &mysql; #elif defined(DBD_MSQL) dbh_t sock; #endif if (MyConnect(&sock,NULL,host,port,NULL,NULL,NULL,NULL)) { result_t res; row_t cur; res = MyListDbs(sock); if (!res) { do_error(drh, MyErrno(sock, JW_ERR_LIST_DB), MyError(sock)); } else { EXTEND(sp, MyNumRows(res)); while ((cur = MyFetchRow(res))) { PUSHs(sv_2mortal((SV*)newSVpv(cur[0], strlen(cur[0])))); } MyFreeResult(res); } MyClose(sock); } } #line 766 "mysql.c" PUTBACK; return; } } XS(XS_DBD__mysql__dr__admin_internal) { dXSARGS; if (items < 3 || items > 8) croak("Usage: DBD::mysql::dr::_admin_internal(drh,dbh,command,dbname=NULL,host=NULL,port=NULL,user=NULL,password=NULL)"); SP -= items; { SV* drh = ST(0); SV* dbh = ST(1); char* command = (char *)SvPV(ST(2),PL_na); char* dbname; char* host; char* port; char* user; char* password; if (items < 4) dbname = NULL; else { dbname = (char *)SvPV(ST(3),PL_na); } if (items < 5) host = NULL; else { host = (char *)SvPV(ST(4),PL_na); } if (items < 6) port = NULL; else { port = (char *)SvPV(ST(5),PL_na); } if (items < 7) user = NULL; else { user = (char *)SvPV(ST(6),PL_na); } if (items < 8) password = NULL; else { password = (char *)SvPV(ST(7),PL_na); } #line 122 "mysql.xs" { dbh_t sock; int result; #if defined(DBD_MYSQL) MYSQL mysql; sock = &mysql; #endif /* * Connect to the database, if required. */ if (SvOK(dbh)) { D_imp_dbh(dbh); sock = imp_dbh->svsock; } else { if (!MyConnect(&sock,NULL,host,port,user,password,NULL,NULL)) { do_error(drh, MyErrno(sock, JW_ERR_CONNECT), MyError(sock)); XSRETURN_NO; } } if (strEQ(command, "shutdown")) { result = MyShutdown(sock); } else if (strEQ(command, "reload")) { result = MyReload(sock); } else if (strEQ(command, "createdb")) { result = MyCreateDb(sock, dbname); } else if (strEQ(command, "dropdb")) { result = MyDropDb(sock, dbname); } else { croak("Unknown command: %s", command); } #if defined(DBD_MYSQL) if (result) { #elif defined(DBD_MSQL) if (result < 0) { #endif do_error(SvOK(dbh) ? dbh : drh, MyErrno(sock, JW_ERR_LIST_DB), MyError(sock)); result = 0; } else { result = 1; } if (SvOK(dbh)) { MyClose(sock); } if (result) { XSRETURN_YES; } else { XSRETURN_NO; } } #line 866 "mysql.c" PUTBACK; return; } } XS(XS_DBD__mysql__db_type_info_all) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::type_info_all(dbh)"); SP -= items; { SV* dbh = ST(0); #line 179 "mysql.xs" { /* static AV* types = NULL; */ /* if (!types) { */ /* D_imp_dbh(dbh); */ /* if (!(types = dbd_db_type_info_all(dbh, imp_dbh))) { */ /* croak("Cannot create types array (out of memory?)"); */ /* } */ /* } */ /* ST(0) = sv_2mortal(newRV_inc((SV*) types)); */ D_imp_dbh(dbh); ST(0) = sv_2mortal(newRV_noinc((SV*) dbd_db_type_info_all(dbh, imp_dbh))); XSRETURN(1); } #line 895 "mysql.c" PUTBACK; return; } } #if defined(DBD_MYSQL) #define XSubPPtmpAAAC 1 XS(XS_DBD__mysql__db__InsertID) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::_InsertID(dbh)"); { SV * dbh = ST(0); int RETVAL; #line 201 "mysql.xs" D_imp_dbh(dbh); SV* sv = perl_get_sv("DBD::mysql::QUIET", FALSE); MYSQL *sock = (MYSQL*) imp_dbh->svsock; if (!sv || !SvTRUE(sv)) { /* 1.21_07 */ warn("This method is deprecated. Use $dbh->{'mysql_insertid'}."); } EXTEND( sp, 1 ); RETVAL = mysql_insert_id(sock); #line 921 "mysql.c" ST(0) = sv_newmortal(); sv_setiv(ST(0), (IV)RETVAL); } XSRETURN(1); } #endif XS(XS_DBD__mysql__db__ListDBs) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::_ListDBs(dbh)"); SP -= items; { SV* dbh = ST(0); #line 218 "mysql.xs" D_imp_dbh(dbh); result_t res; row_t cur; res = MyListDbs(imp_dbh->svsock); if (!res && (!MyReconnect(imp_dbh->svsock, dbh) || !(res = MyListDbs(imp_dbh->svsock)))) { do_error(dbh, MyErrno(imp_dbh->svsock, JW_ERR_LIST_DB), MyError(imp_dbh->svsock)); } else { EXTEND(sp, MyNumRows(res)); while ((cur = MyFetchRow(res))) { PUSHs(sv_2mortal((SV*)newSVpv(cur[0], strlen(cur[0])))); } MyFreeResult(res); } #line 953 "mysql.c" PUTBACK; return; } } XS(XS_DBD__mysql__db__ListTables) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::_ListTables(dbh)"); SP -= items; { SV * dbh = ST(0); #line 239 "mysql.xs" D_imp_dbh(dbh); result_t res; row_t cur; res = MyListTables(imp_dbh->svsock); if (!res && (!MyReconnect(imp_dbh->svsock, dbh) || !(res = MyListTables(imp_dbh->svsock)))) { do_error(dbh, MyErrno(imp_dbh->svsock, JW_ERR_LIST_TABLES), MyError(imp_dbh->svsock)); } else { while ((cur = MyFetchRow(res))) { XPUSHs(sv_2mortal((SV*)newSVpv( cur[0], strlen(cur[0])))); } MyFreeResult(res); } #line 982 "mysql.c" PUTBACK; return; } } XS(XS_DBD__mysql__db_do) { dXSARGS; if (items < 2) croak("Usage: DBD::mysql::db::do(dbh, statement, attr=Nullsv, ...)"); { SV * dbh = ST(0); SV * statement = ST(1); SV * attr; if (items < 3) attr = Nullsv; else { attr = ST(2); } #line 262 "mysql.xs" { D_imp_dbh(dbh); struct imp_sth_ph_st* params = NULL; int numParams = 0; result_t cda = NULL; 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, sizeof(*params)*numParams, struct imp_sth_ph_st); for (i = 0; i < numParams; i++) { params[i].value = ST(i+3); params[i].type = SQL_VARCHAR; } } retval = dbd_st_internal_execute(dbh, statement, attr, numParams, params, &cda, imp_dbh->svsock, 0); Safefree(params); if (cda) { MyFreeResult(cda); } /* remember that dbd_st_execute must return <= -2 for error */ if (retval == 0) /* ok with no rows affected */ XST_mPV(0, "0E0"); /* (true but zero) */ else if (retval < -1) /* -1 == unknown number of rows */ XST_mUNDEF(0); /* <= -2 means error */ else XST_mIV(0, retval); /* typically 1, rowcount or -1 */ } #line 1036 "mysql.c" } XSRETURN(1); } XS(XS_DBD__mysql__db_ping) { dXSARGS; if (items != 1) croak("Usage: DBD::mysql::db::ping(dbh)"); { SV* dbh = ST(0); SV * RETVAL; #line 301 "mysql.xs" { int result; D_imp_dbh(dbh); #if defined(DBD_MYSQL) result = (mysql_ping(imp_dbh->svsock) == 0); if (!result && MyReconnect(imp_dbh->svsock, dbh)) { result = (mysql_ping(imp_dbh->svsock) == 0); } #elif defined(DBD_MSQL) result = TRUE; #endif RETVAL = boolSV(result); } #line 1063 "mysql.c" ST(0) = RETVAL; sv_2mortal(ST(0)); } XSRETURN(1); } XS(XS_DBD__mysql__db_quote) { dXSARGS; if (items < 2 || items > 3) croak("Usage: DBD::mysql::db::quote(dbh, str, type=NULL)"); SP -= items; { SV* dbh = ST(0); SV* str = ST(1); SV* type; if (items < 3) type = NULL; else { type = ST(2); } #line 326 "mysql.xs" { SV* quoted = dbd_db_quote(dbh, str, type); ST(0) = quoted ? sv_2mortal(quoted) : str; XSRETURN(1); } #line 1092 "mysql.c" PUTBACK; return; } } #if defined(DBD_MSQL) && defined(IDX_TYPE) #define XSubPPtmpAAAD 1 XS(XS_DBD__mysql__db_getsequenceinfo) { dXSARGS; if (items != 2) croak("Usage: DBD::mysql::db::getsequenceinfo(dbh, table)"); SP -= items; { SV* dbh = ST(0); char* table = (char *)SvPV(ST(1),PL_na); #line 341 "mysql.xs" { m_seq* seq; D_imp_dbh(dbh); seq = msqlGetSequenceInfo(imp_dbh->svsock, table); if (!seq) { do_error(dbh, MyErrno(sock, JW_ERR_SEQUENCE), MyError(sock)); XSRETURN_UNDEF; } else { EXTEND(sp, 2); ST(0) = sv_2mortal(newSViv(seq->step)); ST(1) = sv_2mortal(newSViv(seq->value)); XSRETURN(2); Safefree(seq); } } #line 1126 "mysql.c" PUTBACK; return; } } #endif /* defined(DBD_MSQL) && defined(IDX_TYPE) */ XS(XS_DBD__mysql__st_dataseek) { dXSARGS; if (items != 2) croak("Usage: DBD::mysql::st::dataseek(sth, pos)"); { SV* sth = ST(0); int pos = (int)SvIV(ST(1)); int RETVAL; #line 367 "mysql.xs" { D_imp_sth(sth); if (imp_sth->cda) { MyDataSeek(imp_sth->cda, pos); RETVAL = 1; } else { RETVAL = 0; do_error(sth, JW_ERR_NOT_ACTIVE, "Statement not active"); } } #line 1153 "mysql.c" ST(0) = sv_newmortal(); sv_setiv(ST(0), (IV)RETVAL); } XSRETURN(1); } #ifdef __cplusplus extern "C" #endif #ifdef PERL_CAPI XS(boot__CAPI_entry) #else XS(boot_DBD__mysql) #endif /* PERL_CAPI */ { dXSARGS; char* file = __FILE__; XS_VERSION_BOOTCHECK ; { CV * cv ; cv = newXS("DBD::mysql::dr::discon_all_", XS_DBD__mysql__dr_discon_all_, file); XSANY.any_i32 = 0 ; cv = newXS("DBD::mysql::dr::disconnect_all", XS_DBD__mysql__dr_discon_all_, file); XSANY.any_i32 = 1 ; newXS("DBD::mysql::db::_login", XS_DBD__mysql__db__login, file); newXS("DBD::mysql::db::commit", XS_DBD__mysql__db_commit, file); newXS("DBD::mysql::db::rollback", XS_DBD__mysql__db_rollback, file); newXS("DBD::mysql::db::disconnect", XS_DBD__mysql__db_disconnect, file); newXS("DBD::mysql::db::STORE", XS_DBD__mysql__db_STORE, file); newXS("DBD::mysql::db::FETCH", XS_DBD__mysql__db_FETCH, file); newXS("DBD::mysql::db::DESTROY", XS_DBD__mysql__db_DESTROY, file); newXS("DBD::mysql::st::_prepare", XS_DBD__mysql__st__prepare, file); #if XSubPPtmpAAAA newXS("DBD::mysql::st::rows", XS_DBD__mysql__st_rows, file); #endif newXS("DBD::mysql::st::bind_param", XS_DBD__mysql__st_bind_param, file); newXS("DBD::mysql::st::bind_param_inout", XS_DBD__mysql__st_bind_param_inout, file); newXS("DBD::mysql::st::execute", XS_DBD__mysql__st_execute, file); cv = newXS("DBD::mysql::st::fetchrow_arrayref", XS_DBD__mysql__st_fetchrow_arrayref, file); XSANY.any_i32 = 0 ; cv = newXS("DBD::mysql::st::fetch", XS_DBD__mysql__st_fetchrow_arrayref, file); XSANY.any_i32 = 1 ; cv = newXS("DBD::mysql::st::fetchrow_array", XS_DBD__mysql__st_fetchrow_array, file); XSANY.any_i32 = 0 ; cv = newXS("DBD::mysql::st::fetchrow", XS_DBD__mysql__st_fetchrow_array, file); XSANY.any_i32 = 1 ; newXS("DBD::mysql::st::finish", XS_DBD__mysql__st_finish, file); newXS("DBD::mysql::st::blob_read", XS_DBD__mysql__st_blob_read, file); newXS("DBD::mysql::st::STORE", XS_DBD__mysql__st_STORE, file); cv = newXS("DBD::mysql::st::FETCH_attrib", XS_DBD__mysql__st_FETCH_attrib, file); XSANY.any_i32 = 0 ; cv = newXS("DBD::mysql::st::FETCH", XS_DBD__mysql__st_FETCH_attrib, file); XSANY.any_i32 = 1 ; newXS("DBD::mysql::st::DESTROY", XS_DBD__mysql__st_DESTROY, file); newXS("DBD::mysql::constant", XS_DBD__mysql_constant, file); #if XSubPPtmpAAAB newXSproto("DBD::mysql::unixtimetodate", XS_DBD__mysql_unixtimetodate, file, "$$"); newXSproto("DBD::mysql::unixtimetotime", XS_DBD__mysql_unixtimetotime, file, "$$"); newXSproto("DBD::mysql::datetounixtime", XS_DBD__mysql_datetounixtime, file, "$$"); newXSproto("DBD::mysql::timetounixtime", XS_DBD__mysql_timetounixtime, file, "$$"); #endif newXS("DBD::mysql::dr::_ListDBs", XS_DBD__mysql__dr__ListDBs, file); newXS("DBD::mysql::dr::_admin_internal", XS_DBD__mysql__dr__admin_internal, file); newXS("DBD::mysql::db::type_info_all", XS_DBD__mysql__db_type_info_all, file); #if XSubPPtmpAAAC newXS("DBD::mysql::db::_InsertID", XS_DBD__mysql__db__InsertID, file); #endif newXS("DBD::mysql::db::_ListDBs", XS_DBD__mysql__db__ListDBs, file); newXS("DBD::mysql::db::_ListTables", XS_DBD__mysql__db__ListTables, file); newXSproto("DBD::mysql::db::do", XS_DBD__mysql__db_do, file, "$$;$@"); newXSproto("DBD::mysql::db::ping", XS_DBD__mysql__db_ping, file, "$"); newXSproto("DBD::mysql::db::quote", XS_DBD__mysql__db_quote, file, "$$;$"); #if XSubPPtmpAAAD newXSproto("DBD::mysql::db::getsequenceinfo", XS_DBD__mysql__db_getsequenceinfo, file, "$$"); #endif newXSproto("DBD::mysql::st::dataseek", XS_DBD__mysql__st_dataseek, file, "$$"); } /* Initialisation Section */ #line 14 "mysql.xsi" items = 0; /* avoid 'unused variable' warning */ DBISTATE_INIT; /* XXX this interface will change: */ DBI_IMP_SIZE("DBD::mysql::dr::imp_data_size", sizeof(imp_drh_t)); DBI_IMP_SIZE("DBD::mysql::db::imp_data_size", sizeof(imp_dbh_t)); DBI_IMP_SIZE("DBD::mysql::st::imp_data_size", sizeof(imp_sth_t)); dbd_init(DBIS); #if XSubPPtmpAAAA #endif #if XSubPPtmpAAAB #endif #if XSubPPtmpAAAC #endif #if XSubPPtmpAAAD #endif #line 1254 "mysql.c" /* End of Initialisation Section */ XSRETURN_YES; } #ifdef PERL_CAPI #define XSCAPI(name) void name(CV* cv, void* pPerl) #ifdef __cplusplus extern "C" #endif XSCAPI(boot_DBD__mysql) { SetCPerlObj(pPerl); boot__CAPI_entry(cv); } #endif /* PERL_CAPI */