Taxi::Mysql::Handle - extendable full-text index using mysql: database handles |
Taxi::Mysql::Handle - extendable full-text index using mysql: database handles
##======================================================================== ## PRELIMINARIES
use Taxi::Mysql::Handle;
##======================================================================== ## Constructors etc.
$ih = $CLASS_OR_OBJ->new(%args);
##======================================================================== ## Connections
$bool = $ih->dbhok(); $bool = $ih->ensureConnected(); $bool = $ih->connected(); $rc = $ih->connect(); undef = $ih->_dbconnect(); undef = $ih->disconnect();
##======================================================================== ## SQL utilities
($sth,$rv) = $ih->execSQL($sql) ##-- array context $sth = $ih->execSQL($sql) ##-- scalar context
@row_array = $ih->fetch1row_array($sql); $row_arrayref = $ih->fetch1row_arrayref($sql); $row_hashref = $ih->fetch1row_hashref($sql);
##======================================================================== ## Database utilities
$bool = $ih->dbTableExists($table_or_fullname); $bool = $ih->dbTableClear($table_or_fullname); $bool = $ih->dbTableDrop($table_or_fullname); $bool = $ih->dbTableCreate($table_or_sql); $bool = $ih->dbTableLoadDataInfile($table,%options); $bool = $ih->dbTableExportDataFileServer($table,%options); $bool = $ih->sqlExportDataFile($sql,%args); $bool = $ih->dbTableAnalyze($table_or_fullname, %options); $bool = $ih->dbTableOptimize($table_or_fullname, %options);
Taxi::Mysql::Handle is a wrapper class for various backend MySQL database-related tasks and activities which supports verbose messaging and tracing using Taxi::Mysql::Logger.
Taxi::Mysql::Handle inherits from Taxi::Mysql::Base.
$ih = $CLASS_OR_OBJ->new(%args);
Object structure / keyword %args:
{ ##-- SQL connection information dsn=>$mysql_dsn, ##-- see DBD::Mysql(3pm) ## + default "DBI:mysql:database=$ENV{LOGNAME}_db;host=localhost" user=>$user, ##-- user name [default=undef] password=>$password, ##-- password [default=undef] charset=>$charset, ##-- mysql charset for server communication (default='binary')
##-- verbosity behavior verbose => $vlevel, ##-- See Taxi::Mysql::Base dummy => $bool, ##-- don't do anything at all really
##-- low-level data dbh=>$database_handle, }
$bool = $ih->dbhok();
Returns true iff the handle connection is currently error-free.
$bool = $ih->ensureConnected();
Ensures that the handle is connected to the backed database. Returns true on success.
$bool = $ih->connected();
Returns true iff handle is currently connected to a backend database.
$rc = $ih->connect();
(Re-)connect to the backend database. Returns true on success.
undef = $ih->_dbconnect();
Guts for connect(). Implicitly sets the character set to use for communication with the backend DB to $ih->{charset} if defined.
undef = $ih->disconnect();
Disconnects from the backend DB.
($sth,$rv) = $ih->execSQL($sql) ##-- array context $sth = $ih->execSQL($sql) ##-- scalar context
Run some SQL code. Returns a DBI statment handle in scalar context,
and additionally the DBI return value for execute()
in list context.
$row_arrayref = $ih->fetch1row_arrayref($sql);
Executes an SQL query and fetches a single result row as an ARRAY reference.
$row_hashref = $ih->fetch1row_hashref($sql);
Executes an SQL query and fetches a single result row as a HASH reference.
$bool = $ih->dbTableExists($table_or_fullname);
Returns true iff the table $table_or_fullname exists. $table_or_fullname may be either the SQL name of a table or a Taxi::Mysql::Table object.
$bool = $ih->dbTableClear($table_or_fullname);
Clears all data from $table_or_fullname, which may be either the SQL name of a table or a Taxi::Mysql::Table object.
The table must exist in the backend DB.
$bool = $ih->dbTableDrop($table_or_fullname);
Drops a table $table_or_fullname from the backend DB. $table_or_fullname may be either the SQL name of a table or a Taxi::Mysql::Table object.
The table must exist in the backend DB.
$bool = $ih->dbTableCreate($table_or_sql);
Create a table in the backend DB. $table_or_sql may be either SQL code to create a table or a Taxi::Mysql::Table object.
The table to be created may not exist already.
$bool = $ih->dbTableLoadDataInfile($table,%options);
Loads text data into an existing backend table.
$table must be a Taxi::Mysql::Table object.
See $ih->dbTableLoadDataInfileSQL()
for details
on known %options.
$bool = $ih->dbTableExportDataFileServer($table,%options);
Server-side data export using ``SELECT ... INTO OUTFILE''.
$bool = $ih->sqlExportDataFile($sql,%args);
Export query results to a local text file. $sql is the SQL query to be exported. Known %args:
file => $filename, ##-- may be relative to cwd (default="${table_sqlname}.txt") fieldsep => $str, ##-- field separator string (default="\t") linesep => $str, ##-- line separator string (default="\n") encoding => $encoding, ##-- output encoding (for encode) dbEncoding => $encoding, ##-- database encoding (for decode)
$bool = $ih->dbTableAnalyze($table_or_fullname, %options);
Calls SQL ``ANALYZE TABLE'' on $table_or_fullname. Known %options:
local => $bool, #-- default=false binlog => $bool, #-- default
$bool = $ih->dbTableOptimize($table_or_fullname, %options);
Calls SQL ``OPTIMIZE TABLE'' on $table_or_fullname. Known %options:
local => $bool, #-- default=false binlog => $bool, #-- default
Perl by Larry Wall.
Bryan Jurish <moocow@ling.uni-potsdam.de>
Copyright (C) 2006 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
perl(1), Taxi::Mysql(3perl),, Taxi::Mysql::Handle::Dummy(3perl), Taxi::Mysql::Connection(3perl).
Taxi::Mysql::Handle - extendable full-text index using mysql: database handles |