Author: timbo
Date: Mon Jul 16 04:09:56 2007
New Revision: 9743

Modified:
   dbi/trunk/DBI.pm
   dbi/trunk/dbixs_rev.pl

Log:
Add doc note about sth attributes relating to current result set.
Rework dbixs_rev.pl to not assume svnversion command is available.


Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Mon Jul 16 04:09:56 2007
@@ -6209,6 +6209,9 @@
 statement, like SELECT. Typically the attribute will be C<undef>
 in these situations.
 
+For drivers which support stored procedures and multiple result sets
+(see L</more_results>) these attributes relate to the I<current> result set.
+
 See also L</finish> to learn more about the effect it
 may have on some attributes.
 

Modified: dbi/trunk/dbixs_rev.pl
==============================================================================
--- dbi/trunk/dbixs_rev.pl      (original)
+++ dbi/trunk/dbixs_rev.pl      Mon Jul 16 04:09:56 2007
@@ -1,42 +1,51 @@
 #!perl -w
 use strict;
 
-my $file = "dbixs_rev.h";
-my $svnversion = `svnversion -n`;
+my $dbixs_rev_file = "dbixs_rev.h";
+
 my $is_make_dist;
+my $svnversion;
 
-if ($svnversion eq 'exported') {
+if (is_dbi_svn_dir(".")) {
+    $svnversion = `svnversion -n`;
+}
+elsif (is_dbi_svn_dir("..")) {
+    # presumably we're in a subdirectory because the user is doing a 'make 
dist'
     $svnversion = `svnversion -n ..`;
-    if (-f "../MANIFEST.SKIP") {
-        # presumably we're in a subdirectory because the user is doing a 'make 
dist'
-        $is_make_dist = 1;
-    }
-    else {
-        # presumably we're being run by an end-user because their file 
timestamps
-        # got messed up
-        print "Skipping regeneration of $file\n";
-        utime(time(), time(), $file); # update modification time
-        exit 0;
-    }
+    $is_make_dist = 1;
+}
+else {
+    # presumably we're being run by an end-user because their file timestamps
+    # got messed up
+    print "Skipping regeneration of $dbixs_rev_file\n";
+    utime(time(), time(), $dbixs_rev_file); # update modification time
+    exit 0;
 }
 
 my @warn;
 die "Neither current directory nor parent directory are an svn working copy\n"
     unless $svnversion and $svnversion =~ m/^\d+/;
-push @warn, "Mixed revision working copy"
-    if $svnversion =~ s/:\d+//;
+push @warn, "Mixed revision working copy ($svnversion:$1)"
+    if $svnversion =~ s/:(\d+)//;
 push @warn, "Code modified since last checkin"
     if $svnversion =~ s/[MS]+$//;
-warn "$file warning: $_\n" for @warn;
+warn "$dbixs_rev_file warning: $_\n" for @warn;
 die "$0 failed\n" if $is_make_dist && @warn;
 
-write_header($file, DBIXS_REVISION => $svnversion, [EMAIL PROTECTED]);
+write_header($dbixs_rev_file, DBIXS_REVISION => $svnversion, [EMAIL 
PROTECTED]);
 
 sub write_header {
     my ($file, $macro, $version, $comments_ref) = @_;
     open my $fh, ">$file" or die "Can't open $file: $!\n";
+    unshift @$comments_ref, scalar localtime(time);
     print $fh "/* $_ */\n" for @$comments_ref;
     print $fh "#define $macro $version\n";
     close $fh or die "Error closing $file: $!\n";
     print "Wrote $macro $version to $file\n";
 }
+
+sub is_dbi_svn_dir {
+    my ($dir) = @_;
+    return (-d "$dir/.svn" && -f "$dir/MANIFEST.SKIP");
+}
+

Reply via email to