Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing POD indentation #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions lib/SQL/SplitStatement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -754,36 +754,36 @@ SQL::SplitStatement - Split any SQL code into atomic statements
=head1 SYNOPSIS

# Multiple SQL statements in a single string
my $sql_code = <<'SQL';
CREATE TABLE parent(a, b, c , d );
CREATE TABLE child (x, y, "w;", "z;z");
/* C-style comment; */
CREATE TRIGGER "check;delete;parent;" BEFORE DELETE ON parent WHEN
EXISTS (SELECT 1 FROM child WHERE old.a = x AND old.b = y)
BEGIN
SELECT RAISE(ABORT, 'constraint failed;'); -- Inline SQL comment
END;
-- Standalone SQL; comment; with semicolons;
INSERT INTO parent (a, b, c, d) VALUES ('pippo;', 'pluto;', NULL, NULL);
SQL
use SQL::SplitStatement;
my $sql_splitter = SQL::SplitStatement->new;
my @statements = $sql_splitter->split($sql_code);
# @statements now is:
#
# (
# 'CREATE TABLE parent(a, b, c , d )',
# 'CREATE TABLE child (x, y, "w;", "z;z")',
# 'CREATE TRIGGER "check;delete;parent;" BEFORE DELETE ON parent WHEN
# EXISTS (SELECT 1 FROM child WHERE old.a = x AND old.b = y)
# BEGIN
# SELECT RAISE(ABORT, \'constraint failed;\');
# END',
# 'INSERT INTO parent (a, b, c, d) VALUES (\'pippo;\', \'pluto;\', NULL, NULL)'
# )
my $sql_code = <<'SQL';
CREATE TABLE parent(a, b, c , d );
CREATE TABLE child (x, y, "w;", "z;z");
/* C-style comment; */
CREATE TRIGGER "check;delete;parent;" BEFORE DELETE ON parent WHEN
EXISTS (SELECT 1 FROM child WHERE old.a = x AND old.b = y)
BEGIN
SELECT RAISE(ABORT, 'constraint failed;'); -- Inline SQL comment
END;
-- Standalone SQL; comment; with semicolons;
INSERT INTO parent (a, b, c, d) VALUES ('pippo;', 'pluto;', NULL, NULL);
SQL

use SQL::SplitStatement;

my $sql_splitter = SQL::SplitStatement->new;
my @statements = $sql_splitter->split($sql_code);

# @statements now is:
#
# (
# 'CREATE TABLE parent(a, b, c , d )',
# 'CREATE TABLE child (x, y, "w;", "z;z")',
# 'CREATE TRIGGER "check;delete;parent;" BEFORE DELETE ON parent WHEN
# EXISTS (SELECT 1 FROM child WHERE old.a = x AND old.b = y)
# BEGIN
# SELECT RAISE(ABORT, \'constraint failed;\');
# END',
# 'INSERT INTO parent (a, b, c, d) VALUES (\'pippo;\', \'pluto;\', NULL, NULL)'
# )

=head1 DESCRIPTION

Expand Down