Subject: | multi_sth.t fails due to use of "suid" on MS SQL |
multi_sth.t uses master..sysprocesses' "suid" column which isn't available on SQL Server. Change the test so that when connecting to SQL Server it would use the "uid" column instead.
According to http://stackoverflow.com/a/8245884/1540600, "uid" = 1 is "dbo" i.e. it has the same semantics as Sybase's "suid" = 1.
--- t\multi_sth#1.t 2014-02-14 18:32:51.000000000 +-0100
+++ t\multi_sth.t 2014-02-14 18:29:22.000000000 +-0100
@@ -78,20 +78,22 @@
}
# Same thing, with placeholders.
sub test2 {
my $dbh = shift;
+ my $suidColumn = $dbh->{syb_server_version} eq 'Unknown' ? 'uid' : 'suid';
+
SKIP: {
skip '? placeholders not supported', 6 unless $dbh->{syb_dynamic_supported};
my $rc;
my $sth1 = $dbh->prepare("select * from master..sysprocesses where spid = ?");
ok(defined($sth1), 'test2 prepare1');
- my $sth2 = $dbh->prepare("select * from sysusers where suid = ?");
+ my $sth2 = $dbh->prepare("select * from sysusers where $suidColumn = ?");
ok(defined($sth2), 'test2 prepare2');
$rc = $sth1->execute(1);
ok(defined($rc), 'test2 execute1');
$rc = 0;
while(my $d = $sth1->fetch) {
@@ -92,25 +94,27 @@
ok(defined($sth2), 'test2 prepare2');
$rc = $sth1->execute(1);
ok(defined($rc), 'test2 execute1');
$rc = 0;
while(my $d = $sth1->fetch) {
}
# Same thing, with placeholders.
sub test3 {
my $dbh = shift;
+ my $suidColumn = $dbh->{syb_server_version} eq 'Unknown' ? 'uid' : 'suid';
+
SKIP: {
skip '? placeholders not supported', 6 unless $dbh->{syb_dynamic_supported};
my $rc;
my $sth1 = $dbh->prepare("select * from master..sysprocesses where spid = ?");
ok(defined($sth1), 'test3 prepare1');
- my $sth2 = $dbh->prepare("select * from sysusers where suid = ?");
+ my $sth2 = $dbh->prepare("select * from sysusers where $suidColumn = ?");
ok(defined($sth2), 'test3 prepare2');
$rc = $sth1->execute(1);
ok(defined($rc), 'test3 execute1');
# Interleaved execute()