Re: [gnome-db] LOCK TABLES with gda



On 28 October 2010 01:11, Nicola Mattei <jahmax cuneo linux it> wrote:
> Hi to all,
> I'm currently trying something like this (with mysql):
>
> gboolean
> lock_table (GdaConnection *cnc, gchar *tname)
> {
>  GdaStatement *stmt;
>  gchar *sql = g_strdup_printf ("LOCK TABLES %s WRITE;", tname);
>  GError *error = NULL;
>  gint afr;
>  GdaSqlParser *parser;
>
>  if (gda_connection_begin_transaction(cnc, NULL,
> GDA_TRANSACTION_ISOLATION_UNKNOWN, NULL)) {
>    g_print ("BEGIN TRANSACTION\n");
>    parser = gda_connection_create_parser (cnc);
>    stmt = gda_sql_parser_parse_string (parser, sql, NULL, NULL);
>    g_object_unref (parser);
>
>    afr = gda_connection_statement_execute_non_select (cnc, stmt,
> NULL, NULL, &error);
>    g_object_unref (stmt);
>    if (afr < 0)
>      return FALSE;
>    else return TRUE;
>  }
>  return FALSE;
> }
>
> But this doesn't seem to lock the table.

I found the problem: for some statements, MySQL does not allow one to
use the prepared statement API (from what I've gathered using Google,
the non DML statements should not work but it's not true because some
do work...)

Anyway, this means I have to make some modifications to the MySQL
provider to handle that case, which I'll do ASAP.

In the meanwhile, can you file a bug report in bugzilla.gnome.org so
we can keep a record of that problem?

Regards,

Vivien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]