~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbxt/src/ha_pbxt.cc

  • Committer: Brian Aker
  • Date: 2010-09-10 16:41:50 UTC
  • mto: (1759.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1762.
  • Revision ID: brian@tangent.org-20100910164150-grktr2kjfgvk4iw2
This add a couple of utility table functions to be used with testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
390
390
        }
391
391
 
392
392
        if (share->sh_ex_cond) {
393
 
                thr_lock_delete(&share->sh_lock);
 
393
                share->sh_lock.unlock();
394
394
                xt_delete_cond(self, (xt_cond_type *) share->sh_ex_cond);
395
395
                share->sh_ex_cond = NULL;
396
396
        }
1528
1528
        return 0;
1529
1529
}
1530
1530
 
1531
 
Cursor *PBXTStorageEngine::create(TableShare& table, memory::Root *mem_root)
 
1531
Cursor *PBXTStorageEngine::create(TableShare& table)
1532
1532
{
1533
 
        return new (mem_root) ha_pbxt(*this, table);
 
1533
        return new ha_pbxt(*this, table);
1534
1534
}
1535
1535
 
1536
1536
/*
2315
2315
 
2316
2316
                ha_open_share(self, pb_share);
2317
2317
 
2318
 
                thr_lock_data_init(&pb_share->sh_lock, &pb_lock, NULL);
 
2318
                pb_lock.init(&pb_share->sh_lock);
2319
2319
                if (!(pb_open_tab = xt_db_open_table_using_tab(pb_share->sh_table, self)))
2320
2320
                        xt_throw(self);
2321
2321
                pb_open_tab->ot_thread = self;
2456
2456
                doStartIndexScan(TS(table)->next_number_index, 0);
2457
2457
                if (!TS(table)->next_number_key_offset) {
2458
2458
                        // Autoincrement at key-start
2459
 
                        err = index_last(table->record[1]);
 
2459
                        err = index_last(table->getUpdateRecord());
2460
2460
                        if (!err && !table->next_number_field->is_null(TS(table)->rec_buff_length)) {
2461
2461
                                /* {PRE-INC} */
2462
2462
                                nr = (xtWord8) table->next_number_field->val_int_offset(TS(table)->rec_buff_length);
2469
2469
                         */
2470
2470
                        xtWord8 val;
2471
2471
 
2472
 
                        err = index_first(table->record[1]);
 
2472
                        err = index_first(table->getUpdateRecord());
2473
2473
                        while (!err) {
2474
2474
                                /* {PRE-INC} */
2475
2475
                                val = (xtWord8) table->next_number_field->val_int_offset(TS(table)->rec_buff_length);
2476
2476
                                if (val > nr)
2477
2477
                                        nr = val;
2478
 
                                err = index_next(table->record[1]);
 
2478
                                err = index_next(table->getUpdateRecord());
2479
2479
                        }
2480
2480
                }
2481
2481
 
2676
2676
                        pb_import_row_count++;
2677
2677
        }
2678
2678
 
2679
 
        if (table->next_number_field && buf == table->record[0]) {
 
2679
        if (table->next_number_field && buf == table->getInsertRecord()) {
2680
2680
                int update_err = update_auto_increment();
2681
2681
                if (update_err) {
2682
2682
                        ha_log_pbxt_thread_error_for_mysql(pb_ignore_dup_key);
2799
2799
         * update t1 set a=2 where a=1;
2800
2800
         * insert into t1 (val) values (1);
2801
2801
         */
2802
 
        if (table->found_next_number_field && new_data == table->record[0]) {
 
2802
        if (table->found_next_number_field && new_data == table->getInsertRecord()) {
2803
2803
                MX_LONGLONG_T   nr;
2804
2804
                my_bitmap_map   *old_map;
2805
2805
 
3553
3553
         *
3554
3554
     * if (!table->file->inited)
3555
3555
     *    table->file->startIndexScan(tab->index, tab->sorted);
3556
 
     *  if ((error=tab->table->file->index_first(tab->table->record[0])))
 
3556
     *  if ((error=tab->table->file->index_first(tab->table->getInsertRecord())))
3557
3557
         */
3558
3558
        if (active_index == MAX_KEY) {
3559
3559
                err = HA_ERR_WRONG_INDEX;
3948
3948
                        stats.mean_rec_length = (ulong) ot->ot_rec_size;
3949
3949
                }
3950
3950
 
 
3951
#if 0 // Commented out, I am pretty sure this will blow up on someone since the global share should be treated as being non-mutable
3951
3952
                if (flag & HA_STATUS_CONST) {
3952
3953
                        ha_rows         rec_per_key;
3953
3954
                        XTIndexPtr      ind;
3991
3992
#ifdef MY_PTHREAD_FASTMUTEX
3992
3993
                                my_pthread_fastmutex_lock(&share->WHICH_MUTEX);
3993
3994
#else
3994
 
                                pthread_mutex_lock(&share->WHICH_MUTEX);
 
3995
                                share->lock();
3995
3996
#endif
3996
3997
 
3997
3998
#endif // SAFE_MUTEX
4027
4028
#ifdef MY_PTHREAD_FASTMUTEX
4028
4029
                                pthread_mutex_unlock(&share->WHICH_MUTEX.mutex);
4029
4030
#else
4030
 
                                pthread_mutex_unlock(&share->WHICH_MUTEX);
 
4031
                                share->unlock();
4031
4032
#endif
4032
4033
#endif
4033
4034
                        /*
4044
4045
                                index_file_name = info.index_file_name;
4045
4046
                        */
4046
4047
                }
 
4048
#endif  // if(0)
4047
4049
 
4048
4050
                if (flag & HA_STATUS_ERRKEY)
4049
4051
                        errkey = ot->ot_err_index_no;