[libgda] Correction for bug #691099
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Correction for bug #691099
- Date: Sun, 6 Jan 2013 14:51:15 +0000 (UTC)
commit 73a8cb8e3c6516891a2df8e3faf1e3622637f884
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Jan 6 15:50:30 2013 +0100
Correction for bug #691099
Added data handler for binary data
libgda/gda-data-handler.c | 18 +++++++++---------
providers/mysql/.gitignore | 2 ++
providers/mysql/Makefile.am | 16 ++++++++++++++--
providers/mysql/gda-mysql-provider.c | 14 +++++++++-----
4 files changed, 34 insertions(+), 16 deletions(-)
---
diff --git a/libgda/gda-data-handler.c b/libgda/gda-data-handler.c
index 66fc101..b57a8d2 100644
--- a/libgda/gda-data-handler.c
+++ b/libgda/gda-data-handler.c
@@ -81,6 +81,15 @@ gda_data_handler_iface_init (G_GNUC_UNUSED gpointer g_class)
MUTEX_UNLOCK();
}
+static gboolean
+_accepts_g_type (GdaDataHandler *dh, GType type)
+{
+ if (GDA_DATA_HANDLER_GET_IFACE (dh)->accepts_g_type)
+ return (GDA_DATA_HANDLER_GET_IFACE (dh)->accepts_g_type) (dh, type);
+ else
+ return FALSE;
+}
+
/**
* gda_data_handler_get_sql_from_value:
* @dh: an object which implements the #GdaDataHandler interface
@@ -234,15 +243,6 @@ gda_data_handler_get_sane_init_value (GdaDataHandler *dh, GType type)
return NULL;
}
-static gboolean
-_accepts_g_type (GdaDataHandler *dh, GType type)
-{
- if (GDA_DATA_HANDLER_GET_IFACE (dh)->accepts_g_type)
- return (GDA_DATA_HANDLER_GET_IFACE (dh)->accepts_g_type) (dh, type);
- else
- return FALSE;
-}
-
/**
* gda_data_handler_accepts_g_type:
* @dh: an object which implements the #GdaDataHandler interface
diff --git a/providers/mysql/.gitignore b/providers/mysql/.gitignore
new file mode 100644
index 0000000..1f6a84e
--- /dev/null
+++ b/providers/mysql/.gitignore
@@ -0,0 +1,2 @@
+gda-mysql-handler-bin.c
+gda-mysql-handler-bin.h
\ No newline at end of file
diff --git a/providers/mysql/Makefile.am b/providers/mysql/Makefile.am
index 23912bd..839ed8c 100644
--- a/providers/mysql/Makefile.am
+++ b/providers/mysql/Makefile.am
@@ -9,7 +9,17 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/libgda \
-I$(top_builddir) \
-I$(top_srcdir)/providers/reuseable/mysql \
- $(COREDEPS_CFLAGS) $(COREDEPS_WFLAGS) $(MYSQL_CFLAGS)
+ $(COREDEPS_CFLAGS) $(COREDEPS_WFLAGS) $(MYSQL_CFLAGS) -DCLASS_PREFIX=\""GdaMySQL"\"
+
+gda-mysql-handler-bin.c: $(top_srcdir)/libgda/sqlite/gda-sqlite-handler-bin.c
+ cat $(top_srcdir)/libgda/sqlite/gda-sqlite-handler-bin.c | sed -e 's/SQLITE/MYSQL/g' -e 's/sqlite/mysql/g' -e 's/Sqlite/Mysql/g' -e 's/SQLite/MySQL/g' > gda-mysql-handler-bin.c
+
+gda-mysql-handler-bin.h: $(top_srcdir)/libgda/sqlite/gda-sqlite-handler-bin.h
+ cat $(top_srcdir)/libgda/sqlite/gda-sqlite-handler-bin.h | sed -e 's/SQLITE/MYSQL/g' -e 's/sqlite/mysql/g' -e 's/Sqlite/Mysql/g' -e 's/SQLite/MySQL/g' > gda-mysql-handler-bin.h
+
+genfiles = gda-mysql-handler-bin.c gda-mysql-handler-bin.h
+
+$(libgda_mysql_la_OBJECTS): $(genfiles)
libgda_mysql_la_SOURCES = \
gda-mysql-blob-op.c \
@@ -18,6 +28,7 @@ libgda_mysql_la_SOURCES = \
gda-mysql-ddl.h \
gda-mysql-handler-boolean.c \
gda-mysql-handler-boolean.h \
+ $(genfiles) \
gda-mysql-provider.c \
gda-mysql-provider.h \
gda-mysql-recordset.c \
@@ -55,9 +66,10 @@ xml_in_files = \
@INTLTOOL_XML_RULE@
xml_DATA = $(xml_in_files:.xml.in=.xml)
+CLEANFILES = $(genfiles)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgda-mysql-5.0.pc
EXTRA_DIST = $(xml_in_files) libgda-mysql-5.0.pc.in
-DISTCLEANFILES = $(xml_DATA)
+DISTCLEANFILES = $(xml_DATA) $(genfiles)
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index e7396bd..d83d073 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -12,7 +12,7 @@
* Copyright (C) 2004 Jülleter <j bitron ch>
* Copyright (C) 2004 Szalai Ferenc <szferi einstein ki iif hu>
* Copyright (C) 2005 - 2009 Bas Driessen <bas driessen xobas com>
- * Copyright (C) 2005 - 2012 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2005 - 2013 Vivien Malerba <malerba gnome-db org>
* Copyright (C) 2005 Ávaro Peñalvaropg telefonica net>
* Copyright (C) 2007 Armin Burgmeier <armin openismus com>
* Copyright (C) 2007 - 2011 Murray Cumming <murrayc murrayc com>
@@ -56,6 +56,7 @@
#include "gda-mysql-util.h"
#include "gda-mysql-parser.h"
#include "gda-mysql-handler-boolean.h"
+#include "gda-mysql-handler-bin.h"
#define _GDA_PSTMT(x) ((GdaPStmt*)(x))
@@ -1314,10 +1315,13 @@ gda_mysql_provider_get_data_handler (GdaServerProvider *provider,
TO_IMPLEMENT; /* use @dbms_type */
dh = NULL;
}
- else if ((type == GDA_TYPE_BINARY) ||
- (type == GDA_TYPE_BLOB)) {
- TO_IMPLEMENT; /* define data handlers for these types */
- dh = NULL;
+ else if (type == GDA_TYPE_BINARY) {
+ dh = gda_server_provider_handler_find (provider, cnc, type, NULL);
+ if (!dh) {
+ dh = _gda_mysql_handler_bin_new ();
+ gda_server_provider_handler_declare (provider, dh, NULL, GDA_TYPE_BINARY, NULL);
+ g_object_unref (dh);
+ }
}
else if ((type == GDA_TYPE_TIME) ||
(type == GDA_TYPE_TIMESTAMP) ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]