SQL::Generator::Command - base class for a pseudo bnf's implementation
validate( $href_args )
validate correct types and all required fields for existance.
my $sqlgen = new SQL::Generator( debug => 0 ); printf "%s\n\n", $sqlgen->CREATE( COLS => [ 'col1 VARCHAR', 'col2 INTEGER', 'col3 BLOB' ], TABLE => 'mytable', ); my $sqltext = $sqlgen->INSERT( COLS => [ qw/ col1 col2 col3 / ], VALUES => [ qw/ 1 2 3 / ], INTO => 'mytable', WHERE => 'col1 = 99 AND col3 = 99' ); my %cols = ( 'id' => '0', 'created' => 'NOW()', 'data' => '?' ); my $sqltext = $sqlgen->INSERT( COLS => [keys %cols], VALUES => [values %cols], INTO => 'article' ); my $sqltext = $sqlgen->SELECT( COLS => [ qw/ col1 col2 col3 / ], FROM => 'mytable', WHERE => 'col1 = 12 AND col3 = 1' );
finally following strings are constructed:
sprintf( "USE %s" ); sprintf( "SELECT * FROM $table WHERE id = %d", $id ); sprintf( 'INSERT INTO %s (%s) VALUES (%s)', $args{'table'}, $nam, $val ); sprintf( "DROP TABLE $table" ); sprintf( "CREATE TABLE $table ( col ROWTYPE, col ROWTYPE )" ); sprintf( "UPDATE $table SET %s WHERE id = %d", join( ', ', @sql_cols ), $this->get('id') );
Module Version 0.04
None by default.
Murat Uenalan, muenalan@cpan.org
Copyright (c) 1998-2002 Murat Uenalan. Germany. All rights reserved. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
perl(1), DBI, DBD::*
To install Object::ObjectList, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Object::ObjectList
CPAN shell
perl -MCPAN -e shell install Object::ObjectList
For more information on module installation, please visit the detailed CPAN module installation guide.