NAME
DBI::Library - DBI subclass providing a dynamic SQL Libary.
SYNOPSIS
FO Syntax
use DBI::Library qw(:all);
my $dbh = initDB({name => 'LZE',host => 'localhost',user => 'root',password =>'',style=> 'lze'});
OO Syntax
use DBI::Library;
my ($database,$dbh) = new DBI::Library(
{
name =>'LZE',
host => 'localhost',
user => 'root',
password =>'',
style=> 'lze'
}
);
my %execute = (
title => 'showTables',
description => 'description',
sql => 'show tables',
return => 'fetch_array',
);
$database->addexecute(\%execute);
$database->showTables();
Export Tags
:all execute useexecute quote void fetch_hashref fetch_AoH fetch_array updateModules deleteexecute editexecute addexecute tableLength tableExists initDB
:dynamic execute useexecute void fetch_hashref fetch_AoH fetch_array updateModules deleteexecute editexecute addexecute
independent: tableLength tableExists initDB :dynamic
DESCRIPTION
DBI::Library is a DBI subclass providing a dynamic SQL Libary.
new()
my $database = new DBI::Library();
my ($database,$m_dbh) = new DBI::Library(
{
name => $db,
host => $m_sHost,
user => $m_sUser,
password => $m_sPassword,
}
);
initDB()
my $dbh = initDB(
{
name => 'LZE',
host => 'localhost',
user => 'root',
password =>'',
}
);
Driver()
set or get the driver
Driver()
default: Mysql
CurrentDb()
return the current used Database
CurrentHost()
return the current Host
CurrentUser()
gibt den aktuellen user zurueck
CurrentPass()
return the cruuent password word
independent functions
tableExists()
$bool = $database->tableExists($table);
tableLength
$length = $database->tableLength($table);
dynamic statements
addexecute()
add sql statments to yourdatabase for later use witdh useexecute();
my %execute = (
title => 'showTables',
description => 'description',
sql => 'show tables',
return => 'fetch_array',
);
$database->addexecute(\%execute);
print join '<br/>' ,$m_oDatabase->showTables();
Fo Syntax:
print join '<br/>' , useexecute('showTables');
editexecute
my %hash = (
title => 'Titel',
newTitle => 'New Titel',
description => 'querys Abfragen',
sql => 'sql statement',
return => 'fetch_hashref', #subname
);
editexecute(\%hash);
useexecute()
useexecute($m_sTitle,optional hashref {identifier => {1 => 'news', 2 => 'querys'} , @parameter);
example:
my %execute = (
title => 'joins',
description => 'description',
sql => 'select * from table_1 JOIN table_2 ',
return => 'fetch_hashref'
);
$database->addexecute(\%execute5);
my $ref = $database->joins({identifier => {1 => 'news', 2 => 'querys'}});
deleteexecute()
deleteexecute($title);
fetch_array()
@A = $database->fetch_array($sql);
fetch_AoH()
@aoh = $database->fetch_AoH($sql)
fetch_hashref()
$hashref = $database->fetch_hashref($sql)
void()
void(sql)
quote()
$quotedString = $database->quote($sql);
selectTable
set a placeholder wihich is usesd by dynmaic statements.
<TABLE> will be replaced width this value.
default : querys;
Privat
updateModules()
getSelf()
AUTOLOAD()
statements add by addexecute can called like
$database->showTables()
prepare()
execute()
fetch()
SEE ALSO
MySQL::Admin::GUI DBI DBI::Library::Database
AUTHOR
Dirk Lindner <lze@cpan.org>
LICENSE
Copyright (C) 2005-2015 by Hr. Dirk Lindner
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.