Package: gda2-mysql
Version: 1.2.4-1.2
Severity: grave
Justification: renders package unusable


I was using the gda-mysql providor for libgad2. I was trying to insert in a 
field 
text some text with semicolons ej:

CREATE TABLE gamusino (id INT,texto TEXT);
INSERT INTO gamusino (1,';;;;;');

with the  C code at the end of the report. When the program execute
the line:
 command = gda_command_new ("INSERT INTO gamusino (id,texto) VALUES (1,';;;')",
                GDA_COMMAND_TYPE_SQL,GDA_COMMAND_OPTION_STOP_ON_ERRORS);
        assert(command != NULL);
        rc = gda_connection_execute_non_query(conn,command,NULL)

There is an error. If I use the query log option of MySQL (in my.cnf I 
activated the log with general_log_file        = /var/log/mysql/mysql.log and  
general_log             = 1 )

I can see that the query is bad:


100917 15:07:07   910 Connect   r...@localhost on snort
                  910 Query     CREATE TEMPORARY TABLE  gamusino (id INT,texto 
TEXT)
                  910 Query     INSERT INTO gamusino (id,texto) VALUES 
(1,'HOLA')
                  910 Query     INSERT INTO gamusino (id,texto) VALUES (1,'

If you look at the last line, the query is incorrect. I think that the problems 
resides in the gda-mysql-provider.c , in the function  process_sql_commands, 
because it splits the SQL command without considering that the ";" is a legal 
char in a string



#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#include <libgda/libgda.h>
#include <assert.h>
#define DSN "PORT=3306;USER=root;PASSWORD=XXXXX;DATABASE=snort;HOST=127.0.0.1"
void test_bug (void){
        GdaClient *client;
        GdaConnection *conn;
        GdaCommand *command;
        int rc;
        client = gda_client_new ();
        conn = gda_client_open_connection_from_string (client,
                "MySQL",DSN ,0);
        assert(conn != NULL);
        command = gda_command_new("CREATE TEMPORARY TABLE  gamusino (id 
INT,texto TEXT)",
                                
GDA_COMMAND_TYPE_SQL,GDA_COMMAND_OPTION_STOP_ON_ERRORS);
        assert(command != NULL);
        rc = gda_connection_execute_non_query(conn,command,NULL);
        assert (rc!=-1);
        gda_command_free (command);
        command = gda_command_new ("INSERT INTO gamusino (id,texto) VALUES 
(1,'HOLA')",
                GDA_COMMAND_TYPE_SQL,GDA_COMMAND_OPTION_STOP_ON_ERRORS);
        assert(command != NULL);
        rc = gda_connection_execute_non_query(conn,command,NULL);
        assert (rc!=-1);
        gda_command_free (command);
        command = gda_command_new ("INSERT INTO gamusino (id,texto) VALUES 
(1,';;;')",
                GDA_COMMAND_TYPE_SQL,GDA_COMMAND_OPTION_STOP_ON_ERRORS);
        assert(command != NULL);
        rc = gda_connection_execute_non_query(conn,command,NULL);
        if (rc==-1){
                GList *errors = gda_error_list_copy (gda_connection_get_errors 
(conn));
                int i;
    for (i = 0; i < g_list_length(errors); i++)
    {
      GdaError *error = (GdaError *) g_list_nth_data (errors, i);

      g_message ("ERROR %lu: %s", gda_error_get_number (error), 
gda_error_get_description (error));
    }
    gda_error_list_free (errors);
  }
        assert (rc!=-1);

        gda_client_close_all_connections (client);
        g_object_unref(G_OBJECT(client));
}

int main(int argc,char **argv){
        gda_init("BugGDA","1.0",argc,argv);
        test_bug();
}


-- System Information:
Debian Release: 5.0.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31.6 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gda2-mysql depends on:
ii  libc6               2.7-18lenny4         GNU C Library: Shared libraries
ii  libct4              0.82-4               libraries for connecting to MS SQL
ii  libgda2-3           1.2.4-1.2            GNOME Data Access library for GNOM
ii  libglib2.0-0        2.16.6-3             The GLib library of C routines
ii  libmysqlclient15off 5.0.51a-24+lenny4    MySQL database client library
ii  libxml2             2.6.32.dfsg-5+lenny1 GNOME XML library
ii  libxslt1.1          1.1.24-2             XSLT processing library - runtime 

gda2-mysql recommends no packages.

gda2-mysql suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to