| 1 | package DBIO::Informix::Storage; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Base Storage Class for Informix Support | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 12 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 12 | ▶ | use base qw/DBIO::Storage::DBI/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 12 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 12 | __PACKAGE__->register_driver('Informix' => __PACKAGE__); | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | ▶ | use Context::Preserve 'preserve_context'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 12 | ▶ | use DBI (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 12 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | use DBIO::Exception (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 12 | ▶ | use DBIO::Informix::Types qw(lob_kind is_numeric_type); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 12 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 12 | __PACKAGE__->sql_quote_char ('"'); | |||||||||||||||||||||||||||||||||||||||||
| 22 | 12 | __PACKAGE__->datetime_parser_type ( | |||||||||||||||||||||||||||||||||||||||||
| 23 | 'DBIO::Informix::Storage::DateTime::Format' | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 12 | __PACKAGE__->sql_maker_class('DBIO::Informix::SQLMaker'); | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub dbio_deploy_class { 'DBIO::Informix::Deploy' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dbio_deploy_class: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub deploy_setup { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deploy_setup: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | ▶ | sub _connect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connect: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | local $ENV{DELIMIDENT} = 'y'; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | local $ENV{DBDATE} = 'MDY4/'; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | local @ENV{qw(DBCENTURY GL_DATE)}; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | delete @ENV{qw(DBCENTURY GL_DATE)}; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | return $self->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | # ADR 0026 (karr k23) -- DDL in a LOGGED Informix database is part of the | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # transaction and is undone by ROLLBACK. Measured against Informix 15.0.1: | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # CREATE TABLE, DROP TABLE, ALTER TABLE ADD / DROP / MODIFY of a column, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | # ADD / DROP CONSTRAINT FOREIGN KEY, CREATE [UNIQUE] INDEX, DROP INDEX, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # CREATE VIEW, RENAME COLUMN and RENAME TABLE, each issued after BEGIN WORK, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # were all taken back by ROLLBACK WORK (t/65-transactional-ddl.t, live block). | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # So core wraps a deploy's DDL loop in txn_do and a failing statement takes | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # the earlier ones with it. | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # The one place it does not hold is an UNLOGGED database (CREATE DATABASE | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # without WITH LOG): there BEGIN WORK is SQL -256 "Transaction not available" | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # and a connection with AutoCommit off cannot be made at all, so no DBIO | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # transaction exists there, DDL or not, and declaring 1 changes nothing for | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # it. The answer is therefore a class fact and not a probe of | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # sysmaster:sysdatabases.is_logging. | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 12 | __PACKAGE__->_use_transactional_ddl(1); | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | # ADR 0037 (karr k23) -- Informix 15.0.1 takes a FROM-less SELECT and takes | ||||||||||||||||||||||||||||||||||||||||||
| 61 | # FROM sysmaster:sysdual. Neither is what this hook may rely on: it is a | ||||||||||||||||||||||||||||||||||||||||||
| 62 | # static class fact that cannot ask which release it talks to, a FROM-less | ||||||||||||||||||||||||||||||||||||||||||
| 63 | # SELECT is not something the older releases are known to take, and sysdual | ||||||||||||||||||||||||||||||||||||||||||
| 64 | # is a cross-database reference into sysmaster. systables is in every | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # database of every release, and tabid 1 is systables itself, so exactly one | ||||||||||||||||||||||||||||||||||||||||||
| 66 | # row. Only the FROM clause is ours; the CASE spelling stays core's. | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | ▶ | sub _exists_value_sql { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exists_value_sql: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | return $self->next::method(@_) . ' FROM systables WHERE tabid = 1'; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 12 | __PACKAGE__->_use_supports_exists_query(1); | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | # ADR 0039 (karr k23) -- UNION, UNION ALL, INTERSECT and EXCEPT are spelled | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # as core's base map spells them (all four measured on Informix 15.0.1; MINUS | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # is a synonym of EXCEPT). INTERSECT ALL and EXCEPT ALL are SQL -201 there. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | # The refusal is unconditional: the hook cannot ask the server's release, and | ||||||||||||||||||||||||||||||||||||||||||
| 79 | # no release is known to have them. | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 12 | my %UNSUPPORTED_SET_OPERATION = map { $_ => 1 } qw(intersect_all except_all); | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | ▶ | sub _set_operation_keyword { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_operation_keyword: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 9 | my ($self, $op) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | $self->throw_exception( | ||||||||||||||||||||||||||||||||||||||||||
| 86 | "Informix cannot express the set operation '$op': it has UNION, UNION ALL, " | ||||||||||||||||||||||||||||||||||||||||||
| 87 | . 'INTERSECT and EXCEPT (MINUS) and only in their distinct forms -- ' | ||||||||||||||||||||||||||||||||||||||||||
| 88 | . 'INTERSECT ALL and EXCEPT ALL are a syntax error, SQL -201 (measured on ' | ||||||||||||||||||||||||||||||||||||||||||
| 89 | . 'Informix 15.0.1). The refusal holds for every release because this hook ' | ||||||||||||||||||||||||||||||||||||||||||
| 90 | . 'chooses the keyword without a connection (ADR 0039 section 7). The ' | ||||||||||||||||||||||||||||||||||||||||||
| 91 | . 'distinct forms, INTERSECT and EXCEPT, are available as $rs->intersect ' | ||||||||||||||||||||||||||||||||||||||||||
| 92 | . 'and $rs->except.' | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 9 | ▶ | ) if defined $op and $UNSUPPORTED_SET_OPERATION{$op}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $op and $UNSUPPORTED_SET_OPERATION{$op}
MC/DC50%1/2
defined $op and $UNSUPPORTED_SET_OPERATION{$op}
defined $op
$UNSUPPORTED_SET_OPERATION{$op}
Truth table66%2/3
A and B
A= defined $opB= $UNSUPPORTED_SET_OPERATION{$op}
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 6 | return $self->next::method($op); | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | # ADR 0011 / karr k23 -- Informix 15.0.1 has no random-number function: | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # RANDOM(), RAND(), DBMS_RANDOM_RANDOM() and a dbms_random package are all | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # SQL -674 "Routine can not be resolved" (and the SQL Syntax reference lists | ||||||||||||||||||||||||||||||||||||||||||
| 101 | # no such function among the math functions). Inheriting core's RANDOM() | ||||||||||||||||||||||||||||||||||||||||||
| 102 | # would be the same -674 from the server; naming something invented | ||||||||||||||||||||||||||||||||||||||||||
| 103 | # (a session id, a clock) would shuffle nothing. So the hook refuses, at | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # query-build time, and says why. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | ▶ | sub _random_function { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_random_function: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | $self->throw_exception( | |||||||||||||||||||||||||||||||||||||||||
| 109 | 'Informix has no random-number function, so $rs->rand cannot order by ' | ||||||||||||||||||||||||||||||||||||||||||
| 110 | . 'one: RANDOM(), RAND() and DBMS_RANDOM are all SQL -674 (routine can not ' | ||||||||||||||||||||||||||||||||||||||||||
| 111 | . 'be resolved) on Informix 15.0.1. A random function has to exist on the ' | ||||||||||||||||||||||||||||||||||||||||||
| 112 | . 'server first (an SPL or UDR routine of your own), and can then be ' | ||||||||||||||||||||||||||||||||||||||||||
| 113 | . 'ordered by through the order_by attribute.' | ||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | # ADR 0040 section 7 (karr k23) -- the engine answers somewhere this seam does | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # not reach. Informix has no EXPLAIN statement (core's inherited one is SQL | ||||||||||||||||||||||||||||||||||||||||||
| 119 | # -201); its plan facility is SET EXPLAIN ON [AVOID_EXECUTE], which writes the | ||||||||||||||||||||||||||||||||||||||||||
| 120 | # plan to the file sqexplain.out on the SERVER. The one place SQL can see a | ||||||||||||||||||||||||||||||||||||||||||
| 121 | # plan, sysmaster:syssqexplain, lists the statements running at the moment of | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # the query that reads it (measured on 15.0.1: the row's plan is that of the | ||||||||||||||||||||||||||||||||||||||||||
| 123 | # query reading the view, the explained statement of a moment earlier is not | ||||||||||||||||||||||||||||||||||||||||||
| 124 | # there), so there is no second statement to read a plan back with. Refused | ||||||||||||||||||||||||||||||||||||||||||
| 125 | # before any statement is issued; in particular SET EXPLAIN is never turned on | ||||||||||||||||||||||||||||||||||||||||||
| 126 | # for the session as a side effect. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 1 | ▶ | sub _explain_query { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_explain_query: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | $self->throw_exception( | |||||||||||||||||||||||||||||||||||||||||
| 131 | 'Informix cannot return a query plan as rows: it has no EXPLAIN ' | ||||||||||||||||||||||||||||||||||||||||||
| 132 | . 'statement (SQL -201), and SET EXPLAIN ON [AVOID_EXECUTE] writes the plan ' | ||||||||||||||||||||||||||||||||||||||||||
| 133 | . 'to the file sqexplain.out on the database server, where no statement of ' | ||||||||||||||||||||||||||||||||||||||||||
| 134 | . 'this connection can read it back. sysmaster:syssqexplain shows only the ' | ||||||||||||||||||||||||||||||||||||||||||
| 135 | . 'statements running at that moment, not the one explained before. Read ' | ||||||||||||||||||||||||||||||||||||||||||
| 136 | . 'the plan from sqexplain.out on the server.' | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | # ADR 0057 (karr k23) -- DBD::Informix takes dbi:Informix:database[@server] | ||||||||||||||||||||||||||||||||||||||||||
| 141 | # and nothing else: dbi:Informix:database=x and dbi:Informix:dbname=x;server=y | ||||||||||||||||||||||||||||||||||||||||||
| 142 | # are SQL -354. What follows the @ is a DBSERVERNAME of the sqlhosts file, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | # not a host name: "database@a.host.name" and "database@server:9088" are both | ||||||||||||||||||||||||||||||||||||||||||
| 144 | # SQL -25555 "Server ... is not listed as a dbserver name in sqlhosts". | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 11 | ▶ | sub _connect_params_dsn { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connect_params_dsn: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 11 | my ($self, $driver, $params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 11 | my ($dbname, $host, $port) = @{$params}{qw(dbname host port)}; | |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 11 | my $form = "DBD::$driver connects with dbi:$driver:<database>[\@<server>], " | |||||||||||||||||||||||||||||||||||||||||
| 151 | . 'where the server is a DBSERVERNAME of the sqlhosts file'; | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 11 | ▶ | $self->throw_exception( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | "Cannot build a DBD::$driver DSN from connection parameters without a " | ||||||||||||||||||||||||||||||||||||||||||
| 155 | . "dbname: $form, and a DBIO storage needs a database. Give dbname, or " | ||||||||||||||||||||||||||||||||||||||||||
| 156 | . 'supply a dsn instead.' | ||||||||||||||||||||||||||||||||||||||||||
| 157 | ) unless defined $dbname; | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 10 | ▶ | $self->throw_exception( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | "Cannot build a DBD::$driver DSN from the connection parameter port: " | ||||||||||||||||||||||||||||||||||||||||||
| 161 | . "$form. The port belongs to that server's entry in sqlhosts and the DSN " | ||||||||||||||||||||||||||||||||||||||||||
| 162 | . 'has no place for it, so a port given here would be dropped and the ' | ||||||||||||||||||||||||||||||||||||||||||
| 163 | . 'connection would go wherever sqlhosts says. Leave port out (host is ' | ||||||||||||||||||||||||||||||||||||||||||
| 164 | . 'the DBSERVERNAME), or supply a dsn instead.' | ||||||||||||||||||||||||||||||||||||||||||
| 165 | ) if defined $port; | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 8 | ▶ | return defined $host | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | ? "dbi:$driver:$dbname\@$host" | ||||||||||||||||||||||||||||||||||||||||||
| 169 | : "dbi:$driver:$dbname"; | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | # ADR 0013 addendum (karr k23) -- the HostBound view's seam. The same form, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | # the same meaning of the host: the view's host replaces the DBSERVERNAME of | ||||||||||||||||||||||||||||||||||||||||||
| 174 | # dbi:Informix:database@server, and a DSN that names none gets it. A view | ||||||||||||||||||||||||||||||||||||||||||
| 175 | # that carries a port declines: the DSN cannot say it (see above). Every | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # other form -- the key=value one core's default writes included -- is no | ||||||||||||||||||||||||||||||||||||||||||
| 177 | # Informix DSN, and declines too. The form is named, never a value. | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 8 | ▶ | sub _bind_host_into_dsn { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bind_host_into_dsn: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 8 | my ($self, $driver, $dsn, $host, $port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 8 | ▶ | return (undef, 'a DSN that is not of the form dbi:Informix:database[@server]') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $dsn and $dsn =~ /\A(dbi:Informix(?:\([^)]*\))?:)([^\@;=]*)(?:\@[^;=]*)?\z/is
MC/DC50%1/2
defined $dsn and $dsn =~ /\A(dbi:Informix(?:\([^)]*\))?:)([^\@;=]*)(?:\@[^;=]*)?\z/is
defined $dsn
$dsn =~ /\A(dbi:Informix(?:\([^)]*\))?:)([^\@;=]*)(?:\@[^;=]*)?\z/is
Truth table66%2/3
A and B
A= defined $dsnB= $dsn =~ /\A(dbi:Informix(?:\([^)]*\))?:)([^\@;=]*)(?:\@[^;=]*)?\z/is
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | unless defined $dsn | ||||||||||||||||||||||||||||||||||||||||||
| 183 | and $dsn =~ /\A(dbi:Informix(?:\([^)]*\))?:)([^@;=]*)(?:\@[^;=]*)?\z/is; | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 6 | my ($prefix, $database) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 6 | ▶ | return (undef, 'a view with a port; the DSN has no place for a port, it ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | . 'belongs to the server\'s entry in sqlhosts') | ||||||||||||||||||||||||||||||||||||||||||
| 188 | if defined $port; | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 5 | return "$prefix$database\@$host"; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 12 | __PACKAGE__->mk_group_accessors('simple' => '__last_insert_id'); | |||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | sub _execute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_execute: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my ($rv, $sth, @rest) = $self->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $self->__last_insert_id($sth->{ix_sqlerrd}[1]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | if $self->_perform_autoinc_retrieval; | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return (wantarray ? ($rv, $sth, @rest) : $rv); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub last_insert_id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_insert_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | shift->__last_insert_id; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | sub bind_attribute_by_data_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bind_attribute_by_data_type: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my ($self, $data_type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | my $kind = lob_kind($data_type) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | return $kind eq 'text' ? DBI::SQL_LONGVARCHAR() : DBI::SQL_LONGVARBINARY(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 5 | ▶ | sub _gen_sql_bind { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gen_sql_bind: called CC=19 SCAR=50.8
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 5 | my ($self, $op, $ident, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 5 | my ($sql, $bind) = $self->next::method($op, $ident, $args); | |||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 5 | ▶ | if ($op eq 'select') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 5 | for my $b (@$bind) { | |||||||||||||||||||||||||||||||||||||||||
| 227 | 6 | my ($info, $v) = @$b; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 6 | ▶ | next unless ref $info eq 'HASH' and defined $v and !ref $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $info eq "HASH" and defined $v and not ref $v
ref $info eq "HASH" and defined $v
MC/DC0%0/3
ref $info eq "HASH" and defined $v and not ref $v
ref $info eq "HASH"
defined $v
not ref $v
Truth table25%1/4
A and B and not(C)
A= ref $info eq "HASH"B= defined $vC= not ref $v
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 6 | ▶ | my $kind = lob_kind($info->{sqlt_datatype}, $info->{sqlt_size}) or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $column = $info->{dbic_colname} // '?'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$info->{"dbic_colname"} // "?"
MC/DC0%0/1
$info->{"dbic_colname"} // "?"
$info->{"dbic_colname"}
Truth table0%0/2
A
A= $info->{"dbic_colname"}
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my ($alias) = $column =~ /\A(.*)\.[^.]*\z/; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $column =~ s/\A.*\.//; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $table = $self->_select_table_name($ident, $alias); | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | # the other TEXT / BYTE columns of the table, which cannot be compared either | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my %lob; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | for my $name ($self->schema->sources) { | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $source = $self->schema->source($name); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | next unless !ref $source->name and $source->name eq $table; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $source->name and $source->name eq $table
MC/DC0%0/2
not ref $source->name and $source->name eq $table
not ref $source->name
$source->name eq $table
Truth table0%0/3
not(A) and B
A= not ref $source->nameB= $source->name eq $table
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $infos = $source->columns_info; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $lob{$_} = 1 for grep { lob_kind($infos->{$_}{data_type}, $infos->{$_}{size}) } $source->columns; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | my $lobs = %lob ? " ($table holds the TEXT or BYTE columns " . join(', ', sort keys %lob) . ')' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | DBIO::Exception->throw(sprintf | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 'refusing to compare the %s column %s.%s with a bound value: Informix allows no ' | ||||||||||||||||||||||||||||||||||||||||||
| 247 | . 'TEXT or BYTE in a comparison (-615, Blobs are not allowed in this expression; ' | ||||||||||||||||||||||||||||||||||||||||||
| 248 | . 'a cast to a character type is refused as well, -9634)%s. Compare a column that is ' | ||||||||||||||||||||||||||||||||||||||||||
| 249 | . 'not a TEXT or BYTE.', | ||||||||||||||||||||||||||||||||||||||||||
| 250 | ($kind eq 'text' ? 'TEXT' : 'BYTE'), $table, $column, $lobs); | ||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 5 | $sql = $self->_strip_sql_comments($sql); | |||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 5 | ▶ | if ($op eq 'insert' and Scalar::Util::blessed($ident) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$op eq "insert" and builtin::blessed($ident) and $sql =~ /\A(INSERT INTO .+?) DEFAULT VALUES\z/s
$op eq "insert" and builtin::blessed($ident)
MC/DC0%0/3
$op eq "insert" and builtin::blessed($ident) and $sql =~ /\A(INSERT INTO .+?) DEFAULT VALUES\z/s
$op eq "insert"
builtin::blessed($ident)
$sql =~ /\A(INSERT INTO .+?) DEFAULT VALUES\z/s
Truth table25%1/4
A and B and C
A= $op eq "insert"B= builtin::blessed($ident)C= $sql =~ /\A(INSERT INTO .+?) DEFAULT VALUES\z/s
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | and $sql =~ /\A(INSERT INTO .+?) DEFAULT VALUES\z/s) { | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my $head = $1; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $infos = $ident->columns_info; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my ($auto) = grep { $infos->{$_}{is_auto_increment} } $ident->columns; | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my ($nullable) = grep { $infos->{$_}{is_nullable} } $ident->columns; | |||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if (defined $auto) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $sql = sprintf '%s (%s) VALUES (0)', $head, $self->sql_maker->_quote($auto); | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | elsif (defined $nullable) { | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $sql = sprintf '%s (%s) VALUES (NULL)', $head, $self->sql_maker->_quote($nullable); | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 5 | return ($sql, $bind); | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | # the table behind an alias of a SELECT's from, for a message | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | sub _select_table_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_select_table_name: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my ($self, $ident, $alias) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | return $ident->name if Scalar::Util::blessed($ident) and $ident->can('name') and !ref $ident->name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
builtin::blessed($ident) and $ident->can("name") and not ref $ident->name
builtin::blessed($ident) and $ident->can("name")
MC/DC0%0/3
builtin::blessed($ident) and $ident->can("name") and not ref $ident->name
builtin::blessed($ident)
$ident->can("name")
not ref $ident->name
Truth table0%0/4
A and B and not(C)
A= builtin::blessed($ident)B= $ident->can("name")C= not ref $ident->name
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my %table; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | for my $part (ref $ident eq 'ARRAY' ? @$ident : ()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | my $hash = ref $part eq 'ARRAY' ? $part->[0] : $part; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | next unless ref $hash eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | for my $key (grep { !/\A-/ } keys %$hash) { | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | $table{$key} = $hash->{$key} unless ref $hash->{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | return $table{$alias} if defined $alias and defined $table{$alias}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $alias and defined $table{$alias}
MC/DC0%0/2
defined $alias and defined $table{$alias}
defined $alias
defined $table{$alias}
Truth table0%0/3
A and B
A= defined $aliasB= defined $table{$alias}
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | return (values %table)[0] if keys %table == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | return '?'; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | # /* ... */ comments out of a statement, found by reading the SQL: one in a | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # string, an identifier or another comment is not one | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 5 | ▶ | sub _strip_sql_comments { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_strip_sql_comments: called CC=4 SCAR=23.7
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 5 | my ($self, $sql) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 297 | 5 | ▶ | return $sql unless index($sql, '/*') >= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $out = ''; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | while ($sql =~ m~\G(?: ('(?:[^']|'')*') | ("(?:[^"]|"")*") | (--[^\n]*(?:\n|\z)) | (\{[^}]*\}) | (/\*\+.*?\*/) | (/\*.*?\*/) | (.) )~gsx) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $out .= defined $6 ? ' ' : $&; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | # A value for a numeric column that is no number (karr k24). DBD::Informix | ||||||||||||||||||||||||||||||||||||||||||
| 307 | # hands the server the text of the value, and the server turns '' into NULL | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # without a word (a row with a NULL where the caller wrote ''), while 'x' is | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # an error (-1213). So that the answer does not depend on the text, a value | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # that is no number for a numeric column is refused before the DBD sees it. | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # The column is known from the bind's sqlt_datatype; a parameter without it is | ||||||||||||||||||||||||||||||||||||||||||
| 312 | # left as the caller wrote it. | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub _adjust_bind_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_adjust_bind_values: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my ($self, $sth, $bind, $bind_attrs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | for my $b (@$bind) { | |||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my ($info, $v) = @$b; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | next unless ref $info eq 'HASH' and defined $v and !ref $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
ref $info eq "HASH" and defined $v and not ref $v
ref $info eq "HASH" and defined $v
MC/DC0%0/3
ref $info eq "HASH" and defined $v and not ref $v
ref $info eq "HASH"
defined $v
not ref $v
Truth table0%0/4
A and B and not(C)
A= ref $info eq "HASH"B= defined $vC= not ref $v
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | next unless is_numeric_type($info->{sqlt_datatype}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | next if Scalar::Util::looks_like_number($v); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | DBIO::Exception->throw(sprintf | ||||||||||||||||||||||||||||||||||||||||||
| 322 | q{refusing the value '%s' for the numeric column '%s': it is no number, and Informix would } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | . q{store NULL for '' or answer a conversion error (-1213) for other text}, | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | $v, $info->{dbic_colname} // '?'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$info->{"dbic_colname"} // "?"
MC/DC0%0/1
$info->{"dbic_colname"} // "?"
$info->{"dbic_colname"}
Truth table0%0/2
A
A= $info->{"dbic_colname"}
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | return $self->next::method($sth, $bind, $bind_attrs); | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub _exec_svp_begin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exec_svp_begin: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $self->_dbh->do("SAVEPOINT $name"); | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | # can't release savepoints | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub _exec_svp_release { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exec_svp_release: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | sub _exec_svp_rollback { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exec_svp_rollback: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $self->_dbh->do("ROLLBACK TO SAVEPOINT $name") | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | ▶ | sub with_deferred_fk_checks { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
with_deferred_fk_checks: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | my ($self, $sub) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 1 | my $txn_scope_guard = $self->txn_scope_guard; | |||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | $self->_do_query('SET CONSTRAINTS ALL DEFERRED'); | |||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | # constraint mode ends with the transaction: IMMEDIATE after the COMMIT is | ||||||||||||||||||||||||||||||||||||||||||
| 353 | # -255 "Not in transaction". Before it, it also runs the deferred checks. | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | ▶ | return preserve_context { $sub->() } after => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | $self->_do_query('SET CONSTRAINTS ALL IMMEDIATE'); | |||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | $txn_scope_guard->commit; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | ▶ | sub connect_call_datetime_setup { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect_call_datetime_setup: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | $ENV{GL_DATETIME} = "%Y-%m-%d %H:%M:%S.%F5"; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | package DBIO::Informix::Storage::DateTime::Format; | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 12 | ▶ | use base 'DBIO::Storage::DateTimeFormat'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | # No preferred_format_class: there is no maintained DateTime::Format::Informix. | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 12 | __PACKAGE__->datetime_parse_pattern('%Y-%m-%d %H:%M:%S.%5N'); # %F %T | |||||||||||||||||||||||||||||||||||||||||
| 375 | 12 | __PACKAGE__->datetime_format_pattern('%Y-%m-%d %H:%M:%S.%5N'); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 12 | __PACKAGE__->date_parse_pattern('%m/%d/%Y'); | |||||||||||||||||||||||||||||||||||||||||
| 377 | 12 | __PACKAGE__->date_format_pattern('%m/%d/%Y'); | |||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | __END__ | ||||||||||||||||||||||||||||||||||||||||||