~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/row0mysql.h

  • Committer: lbieber
  • Date: 2010-10-06 16:34:16 UTC
  • mfrom: (1816.1.3 build)
  • Revision ID: lbieber@orisndriz08-20101006163416-ea0sl59qgpglk21y
Merge Monty - Change the requirement from either libinnodb to libhaildb. Also, tied it to version 2.2
Merge Andrew - fix bug 650935: remove --compress from all clients
Merge Andrew - fix bug 653471: Add -A to drizzle client
Merge Travis - 621861 = To change C structs to C++ classes in Drizzle

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 2000, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
103
103
        ulint           col_len);       /*!< in: BLOB reference length
104
104
                                        (not BLOB length) */
105
105
/**************************************************************//**
106
 
Pad a column with spaces. */
107
 
UNIV_INTERN
108
 
void
109
 
row_mysql_pad_col(
110
 
/*==============*/
111
 
        ulint   mbminlen,       /*!< in: minimum size of a character,
112
 
                                in bytes */
113
 
        byte*   pad,            /*!< out: padded buffer */
114
 
        ulint   len);           /*!< in: number of bytes to pad */
115
 
 
116
 
/**************************************************************//**
117
106
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
118
107
The counterpart of this function is row_sel_field_store_in_mysql_format() in
119
108
row0sel.c.
188
177
                                        in MySQL handle */
189
178
        trx_t*          trx);           /*!< in: transaction handle */
190
179
/*********************************************************************//**
191
 
Unlocks AUTO_INC type locks that were possibly reserved by a trx. This
192
 
function should be called at the the end of an SQL statement, by the
193
 
connection thread that owns the transaction (trx->mysql_thd). */
 
180
Unlocks AUTO_INC type locks that were possibly reserved by a trx. */
194
181
UNIV_INTERN
195
182
void
196
183
row_unlock_table_autoinc_for_mysql(
264
251
/*==============================*/
265
252
        const dict_table_t*     table); /*!< in: table */
266
253
/*********************************************************************//**
 
254
Calculates the key number used inside MySQL for an Innobase index. We have
 
255
to take into account if we generated a default clustered index for the table
 
256
@return the key number used inside MySQL */
 
257
UNIV_INTERN
 
258
ulint
 
259
row_get_mysql_key_number_for_index(
 
260
/*===============================*/
 
261
        const dict_index_t*     index); /*!< in: index */
 
262
/*********************************************************************//**
267
263
Does an update or delete of a row for MySQL.
268
264
@return error code or DB_SUCCESS */
269
265
UNIV_INTERN
275
271
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in MySQL
276
272
                                        handle */
277
273
/*********************************************************************//**
278
 
This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
279
 
session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
280
 
Before calling this function row_search_for_mysql() must have
281
 
initialized prebuilt->new_rec_locks to store the information which new
282
 
record locks really were set. This function removes a newly set
283
 
clustered index record lock under prebuilt->pcur or
284
 
prebuilt->clust_pcur.  Thus, this implements a 'mini-rollback' that
285
 
releases the latest clustered index record lock we set.
286
 
@return error code or DB_SUCCESS */
 
274
This can only be used when srv_locks_unsafe_for_binlog is TRUE or
 
275
session is using a READ COMMITTED isolation level. Before
 
276
calling this function we must use trx_reset_new_rec_lock_info() and
 
277
trx_register_new_rec_lock() to store the information which new record locks
 
278
really were set. This function removes a newly set lock under prebuilt->pcur,
 
279
and also under prebuilt->clust_pcur. Currently, this is only used and tested
 
280
in the case of an UPDATE or a DELETE statement, where the row lock is of the
 
281
LOCK_X type.
 
282
Thus, this implements a 'mini-rollback' that releases the latest record
 
283
locks we set.
 
284
@return error code or DB_SUCCESS */
287
285
UNIV_INTERN
288
286
int
289
287
row_unlock_for_mysql(
290
288
/*=================*/
291
 
        row_prebuilt_t* prebuilt,       /*!< in/out: prebuilt struct in MySQL
 
289
        row_prebuilt_t* prebuilt,       /*!< in: prebuilt struct in MySQL
292
290
                                        handle */
293
 
        ibool           has_latches_on_recs);/*!< in: TRUE if called
294
 
                                        so that we have the latches on
295
 
                                        the records under pcur and
296
 
                                        clust_pcur, and we do not need
297
 
                                        to reposition the cursors. */
 
291
        ibool           has_latches_on_recs);/*!< TRUE if called so that we have
 
292
                                        the latches on the records under pcur
 
293
                                        and clust_pcur, and we do not need to
 
294
                                        reposition the cursors. */
298
295
/*********************************************************************//**
299
296
Creates an query graph node of 'update' type to be used in the MySQL
300
297
interface.
404
401
                                FOREIGN KEY (a, b) REFERENCES table2(c, d),
405
402
                                        table2 can be written also with the
406
403
                                        database name before it: test.table2 */
407
 
        size_t          sql_length,     /*!< in: length of sql_string */
408
404
        const char*     name,           /*!< in: table full name in the
409
405
                                        normalized form
410
406
                                        database_name/table_name */
453
449
        const char*     name,   /*!< in: table name */
454
450
        trx_t*          trx,    /*!< in: transaction handle */
455
451
        ibool           drop_db);/*!< in: TRUE=dropping whole database */
456
 
/*********************************************************************//**
457
 
Drop all temporary tables during crash recovery. */
458
 
UNIV_INTERN
459
 
void
460
 
row_mysql_drop_temp_tables(void);
461
 
/*============================*/
462
452
 
463
453
/*********************************************************************//**
464
454
Discards the tablespace of a table which stored in an .ibd file. Discarding
502
492
        trx_t*          trx,            /*!< in: transaction handle */
503
493
        ibool           commit);        /*!< in: if TRUE then commit trx */
504
494
/*********************************************************************//**
505
 
Checks that the index contains entries in an ascending order, unique
506
 
constraint is not broken, and calculates the number of index entries
507
 
in the read view of the current transaction.
508
 
@return DB_SUCCESS if ok */
 
495
Checks a table for corruption.
 
496
@return DB_ERROR or DB_SUCCESS */
509
497
UNIV_INTERN
510
498
ulint
511
 
row_check_index_for_mysql(
 
499
row_check_table_for_mysql(
512
500
/*======================*/
513
 
        row_prebuilt_t*         prebuilt,       /*!< in: prebuilt struct
514
 
                                                in MySQL handle */
515
 
        const dict_index_t*     index,          /*!< in: index */
516
 
        ulint*                  n_rows);        /*!< out: number of entries
517
 
                                                seen in the consistent read */
 
501
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in MySQL
 
502
                                        handle */
518
503
 
519
504
/*********************************************************************//**
520
505
Determines if a table is a magic monitor table.
538
523
                                        Innobase record in the current index;
539
524
                                        not defined if template_type is
540
525
                                        ROW_MYSQL_WHOLE_ROW */
541
 
        ulint   clust_rec_field_no;     /*!< field number of the column in an
542
 
                                        Innobase record in the clustered index;
543
 
                                        not defined if template_type is
544
 
                                        ROW_MYSQL_WHOLE_ROW */
545
526
        ulint   mysql_col_offset;       /*!< offset of the column in the MySQL
546
527
                                        row format */
547
528
        ulint   mysql_col_len;          /*!< length of the column in the MySQL
630
611
                                        the secondary index, then this is
631
612
                                        set to TRUE */
632
613
        unsigned        templ_contains_blob:1;/*!< TRUE if the template contains
633
 
                                        a column with DATA_BLOB ==
634
 
                                        get_innobase_type_from_mysql_type();
635
 
                                        not to be confused with InnoDB
636
 
                                        externally stored columns
637
 
                                        (VARCHAR can be off-page too) */
 
614
                                        BLOB column(s) */
638
615
        mysql_row_templ_t* mysql_template;/*!< template used to transform
639
616
                                        rows fast between MySQL and Innobase
640
617
                                        formats; memory for this template
713
690
        ulint           new_rec_locks;  /*!< normally 0; if
714
691
                                        srv_locks_unsafe_for_binlog is
715
692
                                        TRUE or session is using READ
716
 
                                        COMMITTED or READ UNCOMMITTED
717
 
                                        isolation level, set in
718
 
                                        row_search_for_mysql() if we set a new
719
 
                                        record lock on the secondary
720
 
                                        or clustered index; this is
721
 
                                        used in row_unlock_for_mysql()
722
 
                                        when releasing the lock under
723
 
                                        the cursor if we determine
724
 
                                        after retrieving the row that
725
 
                                        it does not need to be locked
726
 
                                        ('mini-rollback') */
 
693
                                        COMMITTED isolation level, in a
 
694
                                        cursor search, if we set a new
 
695
                                        record lock on an index, this is
 
696
                                        incremented; this is used in
 
697
                                        releasing the locks under the
 
698
                                        cursors if we are performing an
 
699
                                        UPDATE and we determine after
 
700
                                        retrieving the row that it does
 
701
                                        not need to be locked; thus,
 
702
                                        these can be used to implement a
 
703
                                        'mini-rollback' that releases
 
704
                                        the latest record locks */
727
705
        ulint           mysql_prefix_len;/*!< byte offset of the end of
728
706
                                        the last requested column */
729
707
        ulint           mysql_row_len;  /*!< length in bytes of a row in the
769
747
                                        store it here so that we can return
770
748
                                        it to MySQL */
771
749
        /*----------------------*/
 
750
        UT_LIST_NODE_T(row_prebuilt_t)  prebuilts;
 
751
                                        /*!< list node of table->prebuilts */
772
752
        ulint           magic_n2;       /*!< this should be the same as
773
753
                                        magic_n */
774
754
};