NAME
SQL::Bibliosoph::CatalogFile - Bibliosoph SQL Statements Parser
VERSION
2.0
DESCRIPTION
Reads a SQL library statements file, using the BB format (SEE below)
BB Format
--[ Query_name1 ] SQL statement
The query name must be a simple string, case sensitive, with no spaces. The file can have comment in every line, starting with #. Statements can include bind params denoted with question mark `?`. Optionally, parameters can be numbered: 1?, 2?, 3? ... This allows to reuse paraments, like in:
SELECT *
FROM user
WHERE name = 1? OR nick = 1?
The bind parameter number can be preceded by a `#`. This force the parameter to be strictly numeric. This is useful for using bind parameters with the LIMIT clause.
==head1 Examples
- A simple query, using two bind parament
-
--[ GET_T1 ] # A very nice commentA SELECT t1.* FROM table1 t1 # A other comment LEFT JOIN table2 t2 ON t1.id = t2.t1_fk WHERE t2.id = ? LIMIT #?
- An insert statement. This returns the last inserted ID.
-
--[ INSERT_USER ] # This returns LAST_INSERT_ID if `user` has a auto_increment column INSERT INTO user (name,country) VALUES (?, IFNULL(?,'US') )
- An update statement. Returns modifed rows.
-
--[ AGE_USERS ] # This returns the modified rows UPDATE user SET age = age + 1 WHERE birthday = ?
- The select using numeric and ordered params
-
--[ GET_USERS ] # Example using numeric and ordered params SELECT * FROM user WHERE (1? IS NULL OR country = 1? ) AND (2? IS NULL OR state = 2?) LIMIT #3?,#4?
AUTHORS
SQL::Bibliosoph by Matias Alejo Garcia (matiu at cpan.org) and Lucas Lain (lucas at confronte.com).
COPYRIGHT
Copyright (c) 2007-2009 Matias Alejo Garcia. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SUPPORT / WARRANTY
The SQL::Bibliosoph is free Open Source software. IT COMES WITHOUT WARRANTY OF ANY KIND.
SEE ALSO
SQL::Bibliosoph
SQL::Bibliosoph::CatalogFile
At http://nits.com.ar/bibliosoph you can find: * Examples * VIM syntax highlighting definitions for bb files * CTAGS examples for indexing bb files.
ACKNOWLEDGEMENTS
To Confronte.com and its associates to support the development of this module.