[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/keximdb/src
From: Martin Ellis <martin.ellis () kdemail ! net>
Date: 2006-05-10 19:47:08
Message-ID: 1147290428.763712.18236.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 539501 by martin:
Apply Jaroslaw's patch for importing decimal (numeric) values.
M +29 -3 diffs/data.diff
M +10 -5 mdbtools/libmdb/data.c
--- trunk/kdenonbeta/keximdb/src/diffs/data.diff #539500:539501
@@ -1,5 +1,5 @@
---- mdbtools.ansi/libmdb/data.c 2005-11-04 21:14:50.713744352 +0000
-+++ mdbtools/libmdb/data.c 2005-11-04 21:26:16.498489224 +0000
+--- mdbtools.ansi/libmdb/data.c 2006-05-10 20:29:52.344041264 +0100
++++ mdbtools/libmdb/data.c 2006-05-10 20:28:47.344922632 +0100
@@ -470,7 +470,7 @@
return 0;
}
@@ -72,7 +72,33 @@
tmpoff += len - 4;
} while (( pg_row = mdb_get_int32(buf, row_start) ));
if (tmpoff < memo_len) {
-@@ -852,7 +852,7 @@
+@@ -691,15 +691,20 @@
+ mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale)
+ {
+ char *text;
++ int negative;
+ gint32 l;
+
+ memcpy(&l, mdb->pg_buf+start+13, 4);
+-
+- text = (char *) g_malloc(prec+2);
+- sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
++ negative = (*(mdb->pg_buf+start) & 0x80) ? 1 : 0;
++ text = (char *) g_malloc(prec+2+negative);
++ if (negative) {
++ sprintf(text, "-%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
++ } else {
++ sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
++ }
+ if (scale) {
+- memmove(text+prec-scale, text+prec-scale+1, scale+1);
+- text[prec-scale] = '.';
++ memmove(text+prec-scale+1+negative, text+prec-scale+negative, scale+1);
++ text[prec-scale+negative] = '.';
+ }
+ return text;
+ }
+@@ -852,7 +857,7 @@
text = g_strdup("");
} else {
text = (char *) g_malloc(MDB_BIND_SIZE);
--- trunk/kdenonbeta/keximdb/src/mdbtools/libmdb/data.c #539500:539501
@@ -691,15 +691,20 @@
mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale)
{
char *text;
+ int negative;
gint32 l;
memcpy(&l, mdb->pg_buf+start+13, 4);
-
- text = (char *) g_malloc(prec+2);
- sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
+ negative = (*(mdb->pg_buf+start) & 0x80) ? 1 : 0;
+ text = (char *) g_malloc(prec+2+negative);
+ if (negative) {
+ sprintf(text, "-%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
+ } else {
+ sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
+ }
if (scale) {
- memmove(text+prec-scale, text+prec-scale+1, scale+1);
- text[prec-scale] = '.';
+ memmove(text+prec-scale+1+negative, text+prec-scale+negative, scale+1);
+ text[prec-scale+negative] = '.';
}
return text;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic