[libgda/LIBGDA_5.2] postgresql: improve server version number calculation
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_5.2] postgresql: improve server version number calculation
- Date: Mon, 17 Dec 2018 22:38:20 +0000 (UTC)
commit a5355eb42addc49a4dd63a8cc7d0367a09a5e60b
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date: Mon Dec 17 16:00:36 2018 -0600
postgresql: improve server version number calculation
Fix issue: #24
Once server version number is correctly calculated,
MetaData can be obtained aswell.
providers/reuseable/postgres/gda-postgres-reuseable.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/providers/reuseable/postgres/gda-postgres-reuseable.c
b/providers/reuseable/postgres/gda-postgres-reuseable.c
index 9144f8506..5980484d3 100644
--- a/providers/reuseable/postgres/gda-postgres-reuseable.c
+++ b/providers/reuseable/postgres/gda-postgres-reuseable.c
@@ -197,7 +197,7 @@ _gda_postgres_compute_version (GdaConnection *cnc, GdaPostgresReuseable *rdata,
if (!cvalue) {
g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
GDA_SERVER_PROVIDER_INTERNAL_ERROR, "%s",
- _("Can't import data from web server"));
+ _("Can't get version data from server"));
g_object_unref (model);
return FALSE;
}
@@ -222,24 +222,19 @@ _gda_postgres_compute_version (GdaConnection *cnc, GdaPostgresReuseable *rdata,
sscanf (ptr, "%d.%d.%d", &(prdata->major), &(prdata->minor), &(prdata->micro));
/* elaborate the version number as a float */
- gfloat div = 1;
- while (*ptr != ' ') {
- if (*ptr != '.') {
- rdata->version_float += (*ptr - '0')/div;
- div *= 10;
- }
- ptr++;
- }
+ rdata->version_float = ((gdouble) ((GdaProviderReuseable*)rdata)->major) +
+ ((gdouble) ((GdaProviderReuseable*)rdata)->minor) / 10.0 +
+ ((gdouble) ((GdaProviderReuseable*)rdata)->micro) / 100.0;
}
g_object_unref (model);
-
- /*
+
+/*
g_print ("VERSIONS: [%f] [%d.%d.%d]\n", rdata->version_float,
((GdaProviderReuseable*)rdata)->major,
((GdaProviderReuseable*)rdata)->minor,
((GdaProviderReuseable*)rdata)->micro);
- */
+*/
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]