NAME
EasyDB::Query::Insert - EasyDB INSERT query routines
SYNOPSIS
This file is used by EasyDB.
DESCRIPTION
Provides INSERT functionality for the EasyDB package.
CONSTRUCTOR
Takes as it's parameters a DBI database handle. Will return an INSERT query object.
METHODS
debug ( [level] )
Sets the debugging level of this object. The standard debug level would normally be 1, and that would tell you what the program is up to. If you want you can go as high as 5, which spurts out reams and reams of useless debugging information.
$easyDB->debug('1');
would be sufficient.
table ( [table name] )
When called with a table name this function will set the table that the query will execute on. Without a table name it will return the current table it is looking at.
$easyDB->add->table('table1');
If you have changed the table then the new table is returned.
sql ( )
This function will either return the current SQL string, if one has been generated, or nothing if there is no SQL statment stored.
my $string = $easyDB->add->sql();
string now holds the SQL statement.
data ( hash of data values )
This function is used to insert data into the database. You pass it a hash of data, in the same format as that used for criteria(). If then converta that into the correct SQL and runs it against the database.
$easyDB->add->table('table1');
$easyDB->add->data( Name => 'Iris',
Age => '23',
Height => '150' );
It will return 1 or 0 depending on the success of the INSERT query.
_do_insert_query ( $self object )
Function to execute an INSERT statement. This function is only ever called by the INSERT query object.
_debug ( error level, debug message[s] )
Internal function used to report error messages. When you specify the level of this message it is checked against the current debug level. If the debug level is equal or greater than the level of this message, it is displayed.
CAVEATS
Unsure as to how stable the SQL parsing engine is. I don't know its tolerance for bad syntax.
KNOWN BUGS
I'll have to get back to you on that one
SEE ALSO
EasyDB
ABOUT
This is part of Gaby Vanhegan's third year project for the University Of Leeds.
AUTHOR
Gaby Vanhegan <gaby@vanhegan.com>