Author: timbo
Date: Mon Feb 19 06:32:51 2007
New Revision: 9133
Modified:
dbi/trunk/lib/DBI/Gofer/Execute.pm
dbi/trunk/lib/DBI/Gofer/Request.pm
dbi/trunk/lib/DBI/Gofer/Response.pm
Log:
Add version skew protection
Modified: dbi/trunk/lib/DBI/Gofer/Execute.pm
==============================================================================
--- dbi/trunk/lib/DBI/Gofer/Execute.pm (original)
+++ dbi/trunk/lib/DBI/Gofer/Execute.pm Mon Feb 19 06:32:51 2007
@@ -193,6 +193,10 @@
my $response = eval {
+ my $version = $request->version || 0;
+ die ref($request)." version $version is not supported"
+ if $version < 0.009116 or $version >= 1;
+
($request->is_sth_request)
? $self->execute_sth_request($request)
: $self->execute_dbh_request($request);
Modified: dbi/trunk/lib/DBI/Gofer/Request.pm
==============================================================================
--- dbi/trunk/lib/DBI/Gofer/Request.pm (original)
+++ dbi/trunk/lib/DBI/Gofer/Request.pm Mon Feb 19 06:32:51 2007
@@ -13,6 +13,7 @@
__PACKAGE__->mk_accessors(qw(
+ version
connect_args
dbh_method_call
dbh_wantarray
@@ -22,10 +23,18 @@
sth_result_attr
));
+
+sub new {
+ my ($self, $args) = @_;
+ $args->{version} ||= $VERSION;
+ return $self->SUPER::new($args);
+}
+
+
sub reset {
my $self = shift;
- # remove everything except connect
- %$self = ( connect_args => $self->{connect_args} );
+ # remove everything except connect and version
+ %$self = ( version => $self->{version}, connect_args =>
$self->{connect_args} );
}
sub is_sth_request {
Modified: dbi/trunk/lib/DBI/Gofer/Response.pm
==============================================================================
--- dbi/trunk/lib/DBI/Gofer/Response.pm (original)
+++ dbi/trunk/lib/DBI/Gofer/Response.pm Mon Feb 19 06:32:51 2007
@@ -12,6 +12,7 @@
our $VERSION = sprintf("0.%06d", q$Revision$ =~ /(\d+)/o);
__PACKAGE__->mk_accessors(qw(
+ version
rv
err
errstr
@@ -23,6 +24,13 @@
));
+sub new {
+ my ($self, $args) = @_;
+ $args->{version} ||= $VERSION;
+ return $self->SUPER::new($args);
+}
+
+
sub add_err {
my ($self, $err, $errstr, $state, $trace) = @_;