void SQL_INDEX_BATCH::RUN_BATCH()
{
    for ( int i = 0; i < NUMBER_OF_ROWS; i++ ) {
        for( int k = 0; k < NUMBER_OF_COMBOBOX; k++ ) {
            if (COMBOBOX_ARRAY[i][k]->currentIndex() EQ 0 ) {
                INDEXLER_ARRAY[NUMBER_OF_COMBOBOX + k + NUMBER_OF_COMBOBOX*i] = 0;
            }
            else {
                INDEXLER_ARRAY[NUMBER_OF_COMBOBOX + k + NUMBER_OF_COMBOBOX*i] =
                        GET_ALAN_ID(p_tablo_id, COMBOBOX_ARRAY[i][k]->currentText());
            }
        }
    }

    QString array_content = PACK_INT_ARRAY(INDEXLER_ARRAY,INDEXLER_ARRAY_SIZE);

    SQL_QUERY query (DB);

    query.PREPARE_UPDATE("sql_tablolar","tablo_id","indexler_array","tablo_id=:tablo_id");

    query.SET_VALUE     (":indexler_array",array_content);
    query.SET_VALUE     (":tablo_id"      ,p_tablo_id);

    query.UPDATE();

    DB->COMMIT_TRANSACTION();
}
Exemple #2
0
int SQL_TABLOLAR_FISI::ADD_FIS_RECORD()
{
    SQL_QUERY sql_query ( DB );
    sql_query.PREPARE_INSERT ( "sql_tablolar","tablo_id","tablo_adi, aciklama");
    sql_query.SET_VALUE (":tablo_adi"    , m_ui->lineEdit_tablo_adi->text()              );
    sql_query.SET_VALUE (":aciklama"     , m_ui->limitedTextEdit_aciklama->toPlainText() );

    int tablo_id = sql_query.INSERT();

    sql_query.PREPARE_INSERT( "sql_alanlar","alan_id", "tablo_id, alan_order_num, alan_adi, veritabanindaki_adi, "
                              "alan_tipi, uzunluk, auto_increment_mi, not_null_mi, dizi_mi, dizi_boyutu, aciklama ");

    sql_query.SET_VALUE ( ":tablo_id"            , tablo_id                         );
    sql_query.SET_VALUE ( ":alan_order_num"      , 1                                );
    sql_query.SET_VALUE ( ":alan_adi"            , m_ui->lineEdit_alan_adi->text()  );
    sql_query.SET_VALUE ( ":veritabanindaki_adi" , m_ui->lineEdit_alan_adi->text()  );
    sql_query.SET_VALUE ( ":alan_tipi"           , "INTEGER"                        );
    sql_query.SET_VALUE ( ":uzunluk"             , 0                                );
    sql_query.SET_VALUE ( ":auto_increment_mi"   , 1                                );
    sql_query.SET_VALUE ( ":not_null_mi"         , 1                                );
    sql_query.SET_VALUE ( ":dizi_mi"             , 0                                );
    sql_query.SET_VALUE ( ":dizi_boyutu"         , 1                                );
    sql_query.SET_VALUE ( ":aciklama"            , tr("Column for Table UNIQUE FIELD ID"));//Tablo UNIQUE ALAN ID kolonu

    int row_id = sql_query.INSERT();

    int indexler_array [INDEXLER_ARRAY_SIZE] = {0};
    indexler_array[0]                        = row_id;

    QString array_content = PACK_INT_ARRAY(indexler_array,INDEXLER_ARRAY_SIZE);

    SQL_QUERY query (DB);

    query.PREPARE_UPDATE("sql_tablolar","tablo_id","indexler_array","tablo_id=:tablo_id");

    query.SET_VALUE     (":indexler_array",array_content);
    query.SET_VALUE     (":tablo_id"      ,tablo_id);

    query.UPDATE();

    return tablo_id;
}