[gnome-db] I need some help



Hello!

I have some problem. I made a new GdaDataModel object and I added the neccessary column fields to it. I read datas from the other GdaDataModel object to GdaRow object. I would like to add a new row to GdaDataModel but my model is not updatable. How can I set up my model GDA_DATA_MODEL_ACCESS_WRITE flag?

I have an old table in the database and I'd like to add some new fields to it or modify some fileds. And after it I'd like to copy the old tables datas to the new table. Plese help me! If you have some sample code please send me!

Thanks, Norbert

part of my souce code:
----------------------

  // Set data models
  source_table_model = get_table_data_model(conn_source, source_table_name);
  target_table_model = get_table_data_model(conn_target, target_table_name);

  GValue *value;
  GList *value_list = NULL;
  gchar *column_names_target[col_num_target];

  // read data row from source table model & create new row
  for (row_id = 0; row_id < row_num_source; row_id++){
    row = (GdaRow *) gda_data_model_row_get_row (GDA_DATA_MODEL_ROW (source_table_model), row_id, &error);
    value_list = NULL;
    for (column_id = 0; column_id < col_num_target; column_id++){
      value = gda_row_get_value (row, column_id);
      value_list = g_list_append(value_list, value);

    }

    GdaRow *new_row = gda_row_new_from_list (target_table_model, value_list);

    /// IT IS FALSE !!! I CANT WRITE THIS DATA MODEL
    g_print("<<<<<<<<<%i>>>>>>> ", gda_data_model_is_updatable(target_table_model));

    // I'd like to add value_list to the target_table_model, but target_table_model is not updatable
    result = gda_data_model_append_values (target_table_model, value_list, &error);
  }

_________________________________________
LEGYÉL NÁLUNK TE A PÜNKÖSDI KIRÁLY!
Hosszú-hétvégi ajánlatok az Adrián! Részletekért klikk ide!


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