Hello community,

here is the log from the commit of package libdbi for openSUSE:Factory checked 
in at 2014-07-08 13:02:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libdbi (Old)
 and      /work/SRC/openSUSE:Factory/.libdbi.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libdbi"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libdbi/libdbi.changes    2014-05-13 
20:44:36.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libdbi.new/libdbi.changes       2014-07-08 
13:02:09.000000000 +0200
@@ -1,0 +2,7 @@
+Mon Jun 30 19:17:12 UTC 2014 - [email protected]
+
+- Update to git snapshot 0.9.0+git30
+* dbi: make a distinction between SQL strings and decimals
+  (add new type DBI_TYPE_XDECIMAL)
+
+-------------------------------------------------------------------

Old:
----
  libdbi-0.9.0.g27.tar.xz

New:
----
  libdbi-0.9.0.g30.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libdbi.spec ++++++
--- /var/tmp/diff_new_pack.hof7ZD/_old  2014-07-08 13:02:10.000000000 +0200
+++ /var/tmp/diff_new_pack.hof7ZD/_new  2014-07-08 13:02:10.000000000 +0200
@@ -18,8 +18,8 @@
 
 Name:           libdbi
 %define lname  libdbi3
-Version:        0.9.0.g27
-#Snapshot:     libdbi-0.9.0-27-g814d7ea
+Version:        0.9.0.g30
+#Snapshot:     libdbi-0.9.0-30-g812a059
 Release:        0
 Summary:        Database Independent Abstraction Layer for C
 License:        LGPL-2.1+

++++++ libdbi-0.9.0.g27.tar.xz -> libdbi-0.9.0.g30.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdbi/drivers/example/dbd_example.c 
new/libdbi/drivers/example/dbd_example.c
--- old/libdbi/drivers/example/dbd_example.c    2013-11-14 15:09:43.000000000 
+0100
+++ new/libdbi/drivers/example/dbd_example.c    2014-06-27 19:39:15.000000000 
+0200
@@ -295,7 +295,14 @@
     _attribs |= DBI_DATETIME_TIME;
     break;
                        
-  case FIELD_TYPE_DECIMAL: /* decimal is actually a string, has arbitrary 
precision, no floating point rounding */
+  case FIELD_TYPE_DECIMAL:
+    /*
+     * Decimal is actually a string, has arbitrary precision, no
+     * floating point rounding. But we need a way to distinguish it
+     * from real strings, so here goes.
+     */
+    _type = DBI_TYPE_XDECIMAL;
+    break;
   case FIELD_TYPE_ENUM:
   case FIELD_TYPE_SET:
   case FIELD_TYPE_VAR_STRING:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdbi/include/dbi/Makefile.am 
new/libdbi/include/dbi/Makefile.am
--- old/libdbi/include/dbi/Makefile.am  2013-11-14 15:09:43.000000000 +0100
+++ new/libdbi/include/dbi/Makefile.am  2014-06-27 19:37:17.000000000 +0200
@@ -5,3 +5,5 @@
 includeexec_HEADERS = dbi.h dbi-dev.h dbd.h
 
 EXTRA_DIST = dbi.h.in
+
+config.status: dbi.h.in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdbi/include/dbi/dbi.h.in 
new/libdbi/include/dbi/dbi.h.in
--- old/libdbi/include/dbi/dbi.h.in     2014-01-05 13:48:31.000000000 +0100
+++ new/libdbi/include/dbi/dbi.h.in     2014-06-27 19:39:15.000000000 +0200
@@ -122,6 +122,7 @@
 #define DBI_TYPE_STRING 3
 #define DBI_TYPE_BINARY 4
 #define DBI_TYPE_DATETIME 5
+#define DBI_TYPE_XDECIMAL 6 /* exact decimal (as string) */
 
 /* values for the bitmask in field_type_attributes[] */
 #define DBI_INTEGER_UNSIGNED   (1 << 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdbi/src/dbi_result.c new/libdbi/src/dbi_result.c
--- old/libdbi/src/dbi_result.c 2014-05-03 20:30:39.000000000 +0200
+++ new/libdbi/src/dbi_result.c 2014-06-30 14:18:56.000000000 +0200
@@ -26,6 +26,7 @@
 #include <config.h>
 #endif
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -652,8 +653,9 @@
     if (!result->rows[rowidx]) continue;
                        
     for (fieldidx = 0; fieldidx < result->numfields; fieldidx++) {
-      if ((result->field_types[fieldidx] == DBI_TYPE_STRING
-        || result->field_types[fieldidx] == DBI_TYPE_BINARY) 
+      if ((result->field_types[fieldidx] == DBI_TYPE_STRING ||
+           result->field_types[fieldidx] == DBI_TYPE_XDECIMAL ||
+           result->field_types[fieldidx] == DBI_TYPE_BINARY) 
         && result->rows[rowidx]->field_values[fieldidx].d_string)
       {
         free(result->rows[rowidx]->field_values[fieldidx].d_string);
@@ -1089,6 +1091,8 @@
     _error_handler(RESULT->conn, DBI_ERROR_BADIDX);
     return my_ERROR;
   }
+  if (RESULT->field_types[fieldidx] == DBI_TYPE_XDECIMAL)
+    return dbi_result_get_double_idx(Result, fieldidx);
   if (RESULT->field_types[fieldidx] != DBI_TYPE_DECIMAL) {
     _verbose_handler(RESULT->conn, "%s: field `%s` is not float type\n",
                      __func__, dbi_result_get_field_name(Result, fieldidx+1));
@@ -1134,6 +1138,25 @@
     _error_handler(RESULT->conn, DBI_ERROR_BADIDX);
     return my_ERROR;
   }
+  if (RESULT->field_types[fieldidx] == DBI_TYPE_XDECIMAL) {
+       const char *s = 
RESULT->rows[RESULT->currowidx]->field_values[fieldidx].d_string;
+       double v = 0, xpow;
+       if (s == NULL)
+               return 0;
+       for (; isdigit(*s); ++s) {
+               v *= 10;
+               v += *s - '0';
+       }
+       if (*s++ != '.')
+               /* I hear SQL mandates the dot as a separator */
+               return v;
+       xpow = 0.1;
+       for (; isdigit(*s); ++s) {
+               v += (*s - '0') * xpow;
+               xpow /= 10;
+       }
+       return v;
+  }
   if (RESULT->field_types[fieldidx] != DBI_TYPE_DECIMAL) {
     _verbose_handler(RESULT->conn, "%s: field `%s` is not double type\n",
                      __func__, dbi_result_get_field_name(Result, fieldidx+1));
@@ -1180,7 +1203,8 @@
     return my_ERROR;
   }
 
-  if (RESULT->field_types[fieldidx] != DBI_TYPE_STRING) {
+  if (RESULT->field_types[fieldidx] != DBI_TYPE_STRING &&
+      RESULT->field_types[fieldidx] != DBI_TYPE_XDECIMAL) {
     dbi_conn_t *conn = RESULT->conn;
     _verbose_handler(conn, "%s: field `%s` is not string type\n",
                      __func__, dbi_result_get_field_name(Result, fieldidx+1));
@@ -1263,7 +1287,8 @@
     _error_handler(RESULT->conn, DBI_ERROR_BADIDX);
     return strdup(my_ERROR);
   }
-  if (RESULT->field_types[fieldidx] != DBI_TYPE_STRING) {
+  if (RESULT->field_types[fieldidx] != DBI_TYPE_STRING &&
+      RESULT->field_types[fieldidx] != DBI_TYPE_XDECIMAL) {
     _verbose_handler(RESULT->conn, "%s: field `%s` is not string type\n",
                      __func__, dbi_result_get_field_name(Result, fieldidx+1));
     _error_handler(RESULT->conn, DBI_ERROR_BADTYPE);
@@ -1472,6 +1497,7 @@
       return my_ERROR;
     }
   case DBI_TYPE_STRING:
+  case DBI_TYPE_XDECIMAL:
     if (RESULT->rows[RESULT->currowidx]->field_sizes[fieldidx] == 0
        && RESULT->rows[RESULT->currowidx]->field_values[fieldidx].d_string == 
NULL) {
       /* string does not exist */
@@ -1575,6 +1601,7 @@
     }
     break;
   case DBI_TYPE_STRING:
+  case DBI_TYPE_XDECIMAL:
     if (RESULT->rows[RESULT->currowidx]->field_sizes[fieldidx] == 0
        && RESULT->rows[RESULT->currowidx]->field_values[fieldidx].d_string == 
NULL) {
       /* string does not exist */

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to