"Dr. Ralf Czekalla" wrote:
> please send your changes here to the forum. Maybe you have a diff file?
> The developer will read it here on his own, or it will be forwarded to
> him.
Alright here it is, the patch does two things:
1) It is now possible to prepare once and then execute several times.
2) Getting an empty result is no longer an error.
--- original.SAP_DB.pm Wed Oct 4 09:12:01 2000
+++ SAP_DB.pm Sun Oct 15 04:30:50 2000
@@ -183,6 +183,9 @@
}
$result = $sth->FETCH ('sapdb_prepared')->execute ($parameters);
};
+
+ return 1 if $@ =~ /^SQLError: \(100\)/; # FF: This is not an error!
+
if ($@) {
DBD::SAP_DB::parseError ($sth, $@);
return undef;
@@ -261,7 +264,7 @@
$cursor = $sth->FETCH ('sapdb_cursor');
eval {
- $row = $cursor->next ();
+ $row = $cursor->next() if defined $cursor; # FF: it might not be (empty
retsult)
};
if ($@) {
DBD::SAP_DB::parseError ($sth, $@);
@@ -323,6 +326,16 @@
my ($sth, $attrib, $value) = @_;
# would normally validate and only store known attributes
# else pass up to DBI to handle
+
+ # FF: This is just a quick hack to disallow setting NUM_OF_FIELDS more than once.
+ if ($attrib eq 'NUM_OF_FIELDS') {
+ if (exists $sth->{sapdb_NUM_OF_FIELDS}) {
+ return 1;
+ } else {
+ $sth->{sapdb_NUM_OF_FIELDS} = 1;
+ }
+ }
+
if ($attrib =~ /^sapdb_/) {
$sth->{$attrib} = $value; # Yes, we are allowed to do this,
return 1; # but only for our private attributes