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=> 'Crystal'});
OO Syntax
use DBI::Library;
my ($database,$dbh) = new DBI::Library(
{
name =>'LZE',
host => 'localhost',
user => 'root',
password =>'',
style=> 'Crystal'
}
);
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,$dbh) = new DBI::Library(
{
name => $db,
host => $host,
user => $user,
password => $password,
}
);
initDB()
my $dbh = initDB(
{
name => 'LZE',
host => 'localhost',
user => 'root',
password =>'',
}
);
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/>' ,$database->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($title,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()
AUTHOR
Dirk Lindner <lze@cpan.org>
LICENSE
Copyright (C) 2006-2008 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.