[gnome-db] LOCK TABLES with gda

Nicola Mattei <[email protected]>
Newsgroups gmane.comp.gnome.db
Message-ID <[email protected]>
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.
Any suggestion in appreciated.

Thanks in advantage!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.