Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sql::translator::parser::dbi(3pm) [debian man page]

SQL::Translator::Parser::DBI(3pm)			User Contributed Perl Documentation			 SQL::Translator::Parser::DBI(3pm)

NAME
SQL::Translator::Parser::DBI - "parser" for DBI handles SYNOPSIS
use DBI; use SQL::Translator; my $dbh = DBI->connect('dsn', 'user', 'pass', { RaiseError => 1, FetchHashKeyName => 'NAME_lc', } ); my $translator = SQL::Translator->new( parser => 'DBI', dbh => $dbh, ); Or: use SQL::Translator; my $translator = SQL::Translator->new( parser => 'DBI', parser_args => { dsn => 'dbi:mysql:FOO', db_user => 'guest', db_password => 'password', } ); DESCRIPTION
This parser accepts an open database handle (or the arguments to create one) and queries the database directly for the information. The following are acceptable arguments: o dbh An open DBI database handle. NB: Be sure to create the database with the "FetchHashKeyName => 'NAME_lc'" option as all the DBI parsers expect lowercased column names. o dsn The DSN to use for connecting to a database. o db_user The user name to use for connecting to a database. o db_password The password to use for connecting to a database. There is no need to specify which type of database you are querying as this is determined automatically by inspecting $dbh->{'Driver'}{'Name'}. If a parser exists for your database, it will be used automatically; if not, the code will fail automatically (and you can write the parser and contribute it to the project!). Currently parsers exist for the following databases: o MySQL o SQLite o Sybase o PostgreSQL (still experimental) Most of these parsers are able to query the database directly for the structure rather than parsing a text file. For large schemas, this is probably orders of magnitude faster than traditional parsing (which uses Parse::RecDescent, an amazing module but really quite slow). Though no Oracle parser currently exists, it would be fairly easy to query an Oracle database directly by using DDL::Oracle to generate a DDL for the schema and then using the normal Oracle parser on this. Perhaps future versions of SQL::Translator will include the ability to query Oracle directly and skip the parsing of a text file, too. AUTHOR
Ken Y. Clark <kclark@cpan.org>. SEE ALSO
DBI, SQL::Translator. perl v5.14.2 2012-05-01 SQL::Translator::Parser::DBI(3pm)

Check Out this Related Man Page

SQL::Translator::Producer::SQLServer(3pm)		User Contributed Perl Documentation		 SQL::Translator::Producer::SQLServer(3pm)

NAME
SQL::Translator::Producer::SQLServer - MS SQLServer producer for SQL::Translator SYNOPSIS
use SQL::Translator; my $t = SQL::Translator->new( parser => '...', producer => 'SQLServer' ); $t->translate; DESCRIPTION
This is currently a thin wrapper around the nextgen SQL::Translator::Generator::DDL::SQLServer DDL maker. Extra Attributes field.list List of values for an enum field. TODO
* !! Write some tests !! * Reserved words list needs updating to SQLServer. * Triggers, Procedures and Views DO NOT WORK # Text of view is already a 'create view' statement so no need to # be fancy foreach ( $schema->get_views ) { my $name = $_->name(); $output .= " "; $output .= "-- -- View: $name -- " unless $no_comments; my $text = $_->sql(); $text =~ s/ //g; $output .= "$text GO "; } # Text of procedure already has the 'create procedure' stuff # so there is no need to do anything fancy. However, we should # think about doing fancy stuff with granting permissions and # so on. foreach ( $schema->get_procedures ) { my $name = $_->name(); $output .= " "; $output .= "-- -- Procedure: $name -- " unless $no_comments; my $text = $_->sql(); $text =~ s/ //g; $output .= "$text GO "; } SEE ALSO
SQL::Translator AUTHORS
See the included AUTHORS file: http://search.cpan.org/dist/SQL-Translator/AUTHORS <http://search.cpan.org/dist/SQL-Translator/AUTHORS> COPYRIGHT
Copyright (c) 2012 the SQL::Translator "AUTHORS" as listed above. LICENSE
This code is free software and may be distributed under the same terms as Perl itself. perl v5.14.2 2012-05-10 SQL::Translator::Producer::SQLServer(3pm)
Man Page