Steve Hay wrote:

>Patrick Galbraith wrote:
>
>  
>
>>Dear DBD::mysql Users and Developers,
>>
>>I am pleased to announce the release of DBD::mysql 3.0000, now 
>>available via CPAN!
>>
>>    
>>
>Oh dear.
>
>This doesn't build at all on Win32.  You still haven't incorporated the 
>patches that I sent here:
>
>http://www.mail-archive.com/dbi-dev@perl.org/msg03889.html
>
>to remove all mention of mysql_config which doesn't exist on Win32, and 
>to sort out problems with "long long", "strncasecmp", etc.
>
>It also doesn't incorporate the patch that I sent here:
>
>http://lists.mysql.com/perl/3554
>
>without which you can't bind the undef value to insert a NULL into the 
>database.
>
>Any chance of these issues being addressed anytime soon?
>
To assist you, here's a new patch incorporating all of the above which 
applies to DBD-mysql-3.000.

With this patch applied, it builds OK (bar a few warnings) and all tests 
pass OK on Win32.

Anything else I can do to help?

- Steve


------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are 
confidential and intended for the addressee(s) only.  If you have received this 
message in error or there are any problems, please notify the sender 
immediately.  The unauthorized use, disclosure, copying or alteration of this 
message is strictly forbidden.  Note that any views or opinions presented in 
this email are solely those of the author and do not necessarily represent 
those of Radan Computational Ltd.  The recipient(s) of this message should 
check it and any attached files for viruses: Radan Computational will accept no 
liability for any damage caused by any virus transmitted by this email.
diff -ruN DBD-mysql-3.0000.orig/Makefile.PL DBD-mysql-3.0000/Makefile.PL
--- DBD-mysql-3.0000.orig/Makefile.PL   2005-07-01 01:03:38.000000000 +0100
+++ DBD-mysql-3.0000/Makefile.PL        2005-07-01 10:28:20.615693100 +0100
@@ -50,36 +50,39 @@
 
 my $source = {};
 
-#Check for mysql_config first
-$source->{'mysql_config'}="guessed";
-if ($opt->{'mysql_config'})
-{  
-  if (-f $opt->{'mysql_config'})
-  {
-    $source->{'mysql_config'} = "Users choice";
-  }
-  else
-  {
-    print <<"MSG";
+if ($^O !~ /mswin32/i)
+{
+  #Check for mysql_config first
+  $source->{'mysql_config'}="guessed";
+  if ($opt->{'mysql_config'})
+  {  
+    if (-f $opt->{'mysql_config'})
+    {
+      $source->{'mysql_config'} = "Users choice";
+    }
+    else
+    {
+      print <<"MSG";
 
 Specified mysql configuration script '$opt->{'mysql_config'}' doesn't exist. 
 Please check path/permissions. Will try to use default mysql_config 
 script found through PATH.
 MSG
-    $opt->{'mysql_config'}= "mysql_config";
+      $opt->{'mysql_config'}= "mysql_config";
+    }
   }
-}
-else
-{
-  if (! `mysql_config`)
+  else
   {
-    print <<MSG;
+    if (! `mysql_config`)
+    {
+      print <<MSG;
 
 Cannot find the file 'mysql_config'! Your execution PATH doesn't seem 
 not contain the path to mysql_config. Resorting to guessed values!
 MSG
+    }
+    $opt->{'mysql_config'} = "mysql_config";
   }
-  $opt->{'mysql_config'} = "mysql_config";
 }
 
 foreach my $key (qw/testdb testhost testuser testpassword testsocket 
@@ -373,9 +376,11 @@
 Possible options are:
 
   --cflags=<flags>       Use <flags> for running the C compiler; defaults
-                         to the value of "mysql_config --cflags"
+                         to the value of "mysql_config --cflags" or a gussed
+                         value
   --libs=<libs>          Use <libs> for running the linker; defaults
-                         to the value of "mysql_config --libs"
+                         to the value of "mysql_config --libs" or a guessed
+                         value
   --embedded=<libs>      Build embedded version of DBD and use <libs> for this;
                          defaults to the value of "mysql_config --embedded" 
                          (default: off)
@@ -391,6 +396,7 @@
                          by default the port number is choosen from the
                          mysqlclient library
   --mysql_config=<path>  Specify <path> for mysql_config script
+                         (Not supported on Win32)
   --nocatchstderr        Supress using the "myld" script that redirects
                          STDERR while running the linker.
   --nofoundrows          Change the behavoiur of \$sth->rows() so that it
@@ -403,7 +409,8 @@
   --help                 Print this message and exit
 
 All options may be configured on the command line. If they are
-not present on the command line, then mysql_config is called:
+not present on the command line, then mysql_config is called (if
+it can be found):
 
   mysql_config --cflags
   mysql_config --libs
@@ -438,39 +445,42 @@
     return;
   }
 
-  # First try to get options values from mysql_config
-  my $command = $opt->{'mysql_config'} . " --$param";
-  eval 
+  if ($^O !~ /mswin32/i)
   {
-    open(PIPE, "$command |") or die "Can't find mysql_config.";
-  };
+    # First try to get options values from mysql_config
+    my $command = $opt->{'mysql_config'} . " --$param";
+    eval 
+    {
+      open(PIPE, "$command |") or die "Can't find mysql_config.";
+    };
 
-  if (!$@)
-  {
-    my $str = "";
-    while (defined(my $line = <PIPE>)) 
+    if (!$@)
     {
+      my $str = "";
+      while (defined(my $line = <PIPE>)) 
+      {
       $str .= $line;
+      }
+      if ($str ne ""  &&  $str !~ /Options:/) 
+      {
+        $str =~ s/\s+$//s;
+        $str =~ s/^\s+//s;
+
+        # Unfortunately ExtUtils::MakeMaker doesn't deal very well
+        # with -L'...'
+        $str =~ s/\-L\'(.*?)\'/-L$1/sg;
+        $str =~ s/\-L\"(.*?)\"/-L$1/sg;
+
+        $opt->{$param} = $str;
+        $source->{$param} = "mysql_config";
+        return;
+      }
     }
-    if ($str ne ""  &&  $str !~ /Options:/) 
+    else
     {
-      $str =~ s/\s+$//s;
-      $str =~ s/^\s+//s;
-
-      # Unfortunately ExtUtils::MakeMaker doesn't deal very well
-      # with -L'...'
-      $str =~ s/\-L\'(.*?)\'/-L$1/sg;
-      $str =~ s/\-L\"(.*?)\"/-L$1/sg;
-
-      $opt->{$param} = $str;
-      $source->{$param} = "mysql_config";
-      return;
+      #print "Can't find mysql_config. Use --mysql_config option to specify 
where mysql_config is located\n";
     }
   }
-  else
-  {
-    #print "Can't find mysql_config. Use --mysql_config option to specify 
where mysql_config is located\n";
-  }
 
   # Ok, mysql_config doesn't work. We need to do our best
   if ($param eq "nocatchstderr" || $param eq "nofoundrows")
diff -ruN DBD-mysql-3.0000.orig/dbdimp.c DBD-mysql-3.0000/dbdimp.c
--- DBD-mysql-3.0000.orig/dbdimp.c      2005-07-01 01:59:36.000000000 +0100
+++ DBD-mysql-3.0000/dbdimp.c   2005-07-01 10:28:29.834266100 +0100
@@ -492,7 +492,7 @@
     if (! limit_flag)
     {
       if ((*statement_ptr == 'l' || *statement_ptr == 'L') &&
-         !strncasecmp(statement_ptr+1, "imit", 4))
+         !Perl_ibcmp(pTHX_ statement_ptr+1, "imit", 4))
         limit_flag = 1;
     }
     switch (*statement_ptr)
@@ -2104,10 +2104,10 @@
     for ( i = 0; i < statement_length - 1; i++) {
       searchptr= &statement[i];
       /* prepared statements for SHOW commands are not supported */
-      if (!strncasecmp(searchptr, "SHOW ", 5))
+      if (!Perl_ibcmp(pTHX_ searchptr, "SHOW ", 5))
         imp_sth->use_server_side_prepare = 0;
       /* if there is a 'limit' in the statement... */
-      if (!limit_flag && !strncasecmp(searchptr, "limit ", 6))
+      if (!limit_flag && !Perl_ibcmp(pTHX_ searchptr, "limit ", 6))
       {
         limit_flag = 1;
         i += 6;
@@ -2153,7 +2153,7 @@
   */
 
     /* this is a better way to do this */
-  if ( !strncasecmp(statement, "listfields ", 11) && 
imp_sth->use_server_side_prepare )
+  if ( !Perl_ibcmp(pTHX_ statement, "listfields ", 11) && 
imp_sth->use_server_side_prepare )
   {
     if (dbis->debug >= 2)
       PerlIO_printf(DBILOGFP, "\"listfields\" Statement: %s\n setting 
use_server_side_prepare to 0\n", statement);
@@ -2296,7 +2296,7 @@
     *result= NULL;
   }
 
-  if (slen >= 11 && !strncasecmp(sbuf, "listfields ", 11))
+  if (slen >= 11 && !Perl_ibcmp(pTHX_ sbuf, "listfields ", 11))
   {
     /* remove pre-space */
     slen -= 10;
@@ -2704,6 +2704,10 @@
   AV *av;
   MYSQL_ROW cols;
   unsigned long* lengths;
+  int rc;
+  imp_sth_fbh_t * fbh;
+  MYSQL_BIND *bind;
+  D_imp_dbh_from_sth;
 
 #if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
   if (imp_sth->use_server_side_prepare)
@@ -2745,13 +2749,9 @@
     return Nullav;
   }
 
-  D_imp_dbh_from_sth;
   (imp_dbh->mysql).net.last_errno = 0;
 
 #if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
-  int rc;
-  imp_sth_fbh_t * fbh;   
-  MYSQL_BIND *bind;
   if (imp_sth->use_server_side_prepare)
   {
     if (dbis->debug >= 2)
@@ -3465,15 +3465,16 @@
 
   /* 
      This fixes the bug whereby no warning was issued upone binding a 
-     non-numeric as numeric
+     defined non-numeric as numeric
    */
-  if (sql_type == SQL_NUMERIC  ||
-      sql_type == SQL_DECIMAL  ||
-      sql_type == SQL_INTEGER  ||
-      sql_type == SQL_SMALLINT ||
-      sql_type == SQL_FLOAT    ||
-      sql_type == SQL_REAL     ||
-      sql_type == SQL_DOUBLE)
+  if (SvOK(value) &&
+      (sql_type == SQL_NUMERIC  ||
+       sql_type == SQL_DECIMAL  ||
+       sql_type == SQL_INTEGER  ||
+       sql_type == SQL_SMALLINT ||
+       sql_type == SQL_FLOAT    ||
+       sql_type == SQL_REAL     ||
+       sql_type == SQL_DOUBLE) )
   {
     if (! looks_like_number(value))
     {
diff -ruN DBD-mysql-3.0000.orig/dbdimp.h DBD-mysql-3.0000/dbdimp.h
--- DBD-mysql-3.0000.orig/dbdimp.h      2005-07-01 01:03:38.000000000 +0100
+++ DBD-mysql-3.0000/dbdimp.h   2005-07-01 10:28:20.756315400 +0100
@@ -19,7 +19,8 @@
  */
 #include <DBIXS.h>  /* installed by the DBI module                        */
 #include <mysql.h>  /* Comes with MySQL-devel */
-#include <mysqld_error.h>  /* Comes MySQL */
+#include <mysqld_error.h>  /* Comes with MySQL */
+#include <my_global.h>  /* Comes with MySQL */
 #include <errmsg.h> /* Comes with MySQL-devel */
 
 /*
@@ -173,7 +174,7 @@
     char           * data;
     double        ddata;
     long          ldata;
-    long long     lldata;
+    longlong      lldata;
 
 } imp_sth_fbh_t;
 

Reply via email to