[gnome-db] LOCK TABLES with gda



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!


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