
SQL::Bibliosoph::CatalogFile - Bibliosoph SQL Statements Parser

2.0

Reads a SQL library statements file, using the BB format (SEE below)

--[ 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
--[ 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 #?
--[ INSERT_USER ]
# This returns LAST_INSERT_ID if `user` has a auto_increment column
INSERT
INTO user (name,country)
VALUES
(?, IFNULL(?,'US') )
--[ AGE_USERS ]
# This returns the modified rows
UPDATE user
SET age = age + 1
WHERE birthday = ?
--[ 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?

SQL::Bibliosoph by Matias Alejo Garcia (matiu at cpan.org) and Lucas Lain (lucas at confronte.com).

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.

The SQL::Bibliosoph is free Open Source software. IT COMES WITHOUT WARRANTY OF ANY KIND.

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.

To Confronte.com and its associates to support the development of this module.