Subject: | main.t dies half-way through |
main.t dies with
ok 23 - spid column in second result set
ok 24 - last insert id
type_info_all result has 19 keys but 20 fields at t/main.t line 147
It turns out that on SQL Server 2005+, sp_datatype_info returns 20 columns rather than just 19 (is there an SQL Server version that does 19?). To deal with this, add the 20th column to Sybase.pm's type_info_all().
Also, to make sure that any number of columns is handled (Sybase's 13, the mysterious 19, and the SQL Server's 20), remove the condition about "< 19".
Sam
--- Sybase#1.pm 2014-02-14 11:37:08.000000000 +-0100
+++ Sybase.pm 2014-02-14 11:57:32.000000000 +-0100
@@ -399,22 +399,21 @@
MINIMUM_SCALE => 13,
MAXIMUM_SCALE => 14,
sql_data_type => 15,
sql_datetime_sub => 16,
num_prec_radix => 17,
interval_precision => 18,
+ USERTYPE => 19,
},
];
- # ASE 11.x only returns 13 columns:
- my $c;
- if ( ( $c = scalar( @{ $data->[0] } ) ) < 19 ) {
- foreach ( keys( %{ $ti->[0] } ) ) {
- if ( $ti->[0]->{$_} >= $c ) {
- delete( $ti->[0]->{$_} );
- }
+ # ASE 11.x only returns the first 13 columns; SQL server returns 20
+ my $columnCount = @{$data->[0]};
+ foreach my $columnName ( keys( %{ $ti->[0] } ) ) {
+ if ( $ti->[0]->{$columnName} >= $columnCount ) {
+ delete( $ti->[0]->{$_} );
}
}
push( @$ti, @$data );
return $ti;
}