Package Info

perl-SQL-SplitStatement


Split any SQL code into atomic statements


Development/Libraries/Perl

This is a simple module which tries to split any SQL code, even including non-standard extensions (for the details see the the /SUPPORTED DBMSs manpage section below), into the atomic statements it is composed of.

The logic used to split the SQL code is more sophisticated than a raw 'split' on the ';' (semicolon) character: first, various different statement terminator tokens are recognized (see below for the list), then this module is able to correctly handle the presence of said tokens inside identifiers, values, comments, 'BEGIN ... END' blocks (even nested), dollar-quoted strings, MySQL custom 'DELIMITER's, procedural code etc., as (partially) exemplified in the the /SYNOPSIS manpage above.

Consider however that this is by no means a validating parser (technically speaking, it's just a context-sensitive tokenizer). It should rather be seen as an in-progress heuristic approach, which will gradually improve as test cases will be reported. This also means that, except for the the /LIMITATIONS manpage detailed below, there is no known (to the author) SQL code the most current release of this module can't correctly split.

The test suite bundled with the distribution (which now includes the popular Sakila and Pagila sample db schemata, as detailed in the the /SHOWCASE manpage section below) should give you an idea of the capabilities of this module

If your atomic statements are to be fed to a DBMS, you are encouraged to use the DBIx::MultiStatementDo manpage instead, which uses this module and also (optionally) offers automatic transactions support, so that you'll have the all-or-nothing behavior you would probably want.


License: Artistic-1.0 or GPL-1.0+
URL: http://search.cpan.org/dist/SQL-SplitStatement/

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
1.00020-bp155.2.8 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement
1.00020-bp154.1.24 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement
1.00020-bp153.1.12 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement
1.00020-bp152.3.15 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement
1.00020-bp151.3.1 info GA Release 2019-07-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement
1.00020-bp151.2.10 info GA Release 2019-05-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement
1.00020-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-SQL-SplitStatement