Explorar o código

remove old workaround for DBD::Sprite 0.43 and include upgraded DBD::Pg patch from ISC OpenReg 1.0.2

Ralf S. Engelschall %!s(int64=22) %!d(string=hai) anos
pai
achega
256258138f
Modificáronse 2 ficheiros con 154 adicións e 5 borrados
  1. 150 0
      perl-dbi/perl-dbi.patch
  2. 4 5
      perl-dbi/perl-dbi.spec

+ 150 - 0
perl-dbi/perl-dbi.patch

@@ -0,0 +1,150 @@
+--- DBD-Pg-1.22/dbdimp.c.orig	Thu Mar 27 04:14:19 2003
++++ DBD-Pg-1.22/dbdimp.c	Sat May 17 13:26:56 2003
+@@ -97,6 +97,36 @@
+     free(err);
+ }
+ 
++
++int
++_dbd_begin(dbh, imp_dbh)
++    SV *dbh;
++    imp_dbh_t *imp_dbh;
++{
++    PGresult *result = NULL;
++    ExecStatusType status;
++
++    if (DBIc_has(imp_dbh, DBIcf_AutoCommit) == TRUE)
++        return 1;
++
++    if (imp_dbh->pg_need_begin == 0)
++        return 1;
++
++    imp_dbh->pg_need_begin = 0;
++
++    /* start new transaction.  AutoCommit must be FALSE, ref. ~8 lines up */
++    result = PQexec(imp_dbh->conn, "begin");
++    status = result ? PQresultStatus(result) : -1;
++    PQclear(result);
++    if (status != PGRES_COMMAND_OK) {
++        pg_error(dbh, status, "begin failed\n");
++        return 0;
++    }
++
++    return 1;
++}
++
++
+ static int
+ pgtype_bind_ok (dbtype)
+     int dbtype;
+@@ -193,6 +223,7 @@
+     imp_dbh->init_commit = 1;			/* initialize AutoCommit */
+     imp_dbh->pg_auto_escape = 1;		/* initialize pg_auto_escape */
+     imp_dbh->pg_bool_tf = 0;                    /* initialize pg_bool_tf */
++    imp_dbh->pg_need_begin = 1;                 /* initialize begin state */
+ 
+     DBIc_IMPSET_on(imp_dbh);			/* imp_dbh set up now */
+     DBIc_ACTIVE_on(imp_dbh);			/* call disconnect before freeing */
+@@ -284,7 +315,7 @@
+ 
+     if (NULL != imp_dbh->conn) {
+         PGresult* result = 0;
+-        ExecStatusType commitstatus, beginstatus;
++        ExecStatusType commitstatus;
+ 
+         /* execute commit */
+         result = PQexec(imp_dbh->conn, "commit");
+@@ -297,15 +328,8 @@
+ 	    pg_error(dbh, commitstatus, PQerrorMessage(imp_dbh->conn));
+         }
+ 
+-        /* start new transaction.  AutoCommit must be FALSE, ref. 20 lines up */
+-        result = PQexec(imp_dbh->conn, "begin");
+-        beginstatus = result ? PQresultStatus(result) : -1;
+-        PQclear(result);
+-        if (beginstatus != PGRES_COMMAND_OK) {
+-	    /* Maybe add some loud barf here? Raising some very high error? */
+-            pg_error(dbh, beginstatus, "begin failed\n");
+-            return 0;
+-        }
++        /* mark need for a begin at the start of the next command */
++        imp_dbh->pg_need_begin = 1;
+ 
+ 	/* if the initial COMMIT failed, return 0 now */
+ 	if (commitstatus != PGRES_COMMAND_OK) {
+@@ -335,6 +359,10 @@
+         PGresult* result = 0;
+         ExecStatusType status;
+         
++        /* no rollback is needed if we are not already in a transaction */
++        if (imp_dbh->pg_need_begin)
++            return 1;
++
+         /* execute rollback */
+         result = PQexec(imp_dbh->conn, "rollback");
+         status = result ? PQresultStatus(result) : -1;
+@@ -346,14 +374,8 @@
+             return 0;
+         }
+ 
+-        /* start new transaction.  AutoCommit must be FALSE, ref. 20 lines up */
+-        result = PQexec(imp_dbh->conn, "begin");
+-        status = result ? PQresultStatus(result) : -1;
+-        PQclear(result);
+-        if (status != PGRES_COMMAND_OK) {
+-            pg_error(dbh, status, "begin failed\n");
+-            return 0;
+-        }
++        /* mark need for a begin at the start of the next command */
++        imp_dbh->pg_need_begin = 1;
+         
+         return 1;
+     }
+@@ -377,7 +399,8 @@
+ 
+     if (NULL != imp_dbh->conn) {
+         /* rollback if AutoCommit = off */
+-        if (DBIc_has(imp_dbh, DBIcf_AutoCommit) == FALSE) {
++        if ((imp_dbh->pg_need_begin == 0)
++           && (DBIc_has(imp_dbh, DBIcf_AutoCommit) == FALSE)) {
+             PGresult* result = 0;
+             ExecStatusType status;
+             result = PQexec(imp_dbh->conn, "rollback");
+@@ -453,16 +476,7 @@
+             if (dbis->debug >= 2) { PerlIO_printf(DBILOGFP, "dbd_db_STORE: switch AutoCommit to on: commit\n"); }
+         } else if ((oldval != FALSE && newval == FALSE) || (oldval == FALSE && newval == FALSE && imp_dbh->init_commit)) {
+             if (NULL != imp_dbh->conn) {
+-                /* start new transaction */
+-                PGresult* result = 0;
+-                ExecStatusType status;
+-                result = PQexec(imp_dbh->conn, "begin");
+-                status = result ? PQresultStatus(result) : -1;
+-                PQclear(result);
+-                if (status != PGRES_COMMAND_OK) {
+-                    pg_error(dbh, status, "begin failed\n");
+-                    return 0;
+-                }
++                imp_dbh->pg_need_begin = 1;
+             }
+             if (dbis->debug >= 2) { PerlIO_printf(DBILOGFP, "dbd_db_STORE: switch AutoCommit to off: begin\n"); }
+         }
+@@ -1182,6 +1196,9 @@
+     SV **svp;
+ 
+     if (dbis->debug >= 1) { PerlIO_printf(DBILOGFP, "dbd_st_execute\n"); }
++
++    if (_dbd_begin(sth, imp_dbh) == 0)
++        return 0;
+ 
+     /*
+     here we get the statement from the statement handle where
+--- DBD-Pg-1.22/dbdimp.h.orig	Tue Mar 25 23:17:00 2003
++++ DBD-Pg-1.22/dbdimp.h	Sat May 17 13:29:12 2003
+@@ -28,6 +28,7 @@
+ #ifdef SvUTF8_off
+     int         pg_enable_utf8;	/* should we attempt to make utf8 strings? */
+ #endif
++    int         pg_need_begin;  /* does a begin need to be sent */
+ };
+ 
+ /* Define sth implementor data structure */

+ 4 - 5
perl-dbi/perl-dbi.spec

@@ -42,8 +42,8 @@ Packager:     The OpenPKG Project
 Distribution: OpenPKG [BASE]
 Group:        Language
 License:      GPL/Artistic
-Version:      20030516
-Release:      20030516
+Version:      20030517
+Release:      20030517
 
 #   package options
 %option       with_dbd_mysql   no
@@ -59,6 +59,7 @@ Source4:      http://www.cpan.org/modules/by-module/DBD/DBD-SQLite-%{V_dbd_sqlit
 Source5:      http://www.cpan.org/modules/by-module/DBD/DBD-mysql-%{V_dbd_mysql}.tar.gz
 Source6:      http://www.cpan.org/modules/by-module/DBD/DBD-Pg-%{V_dbd_pg}.tar.gz
 Source7:      http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-%{V_dbd_oracle}.tar.gz
+Patch0:       perl-dbi.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -100,11 +101,9 @@ AutoReqProv:  no
     %setup5 -q -T -D -a 5
     %setup6 -q -T -D -a 6
     %setup7 -q -T -D -a 7
+    %patch0 -p0
 
 %build
-    #   FIXME: can be removed in a later version than DBD::Sprite 0.43
-    ( cd DBD-Sprite-%{V_dbd_sprite}
-      %{l_shtool} subst -e '/realclean/d' Makefile.PL )
 
 %install
     #   perform common prolog operations