~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/row0ins.h

  • Committer: Monty Taylor
  • Date: 2009-03-18 18:45:23 UTC
  • mto: (950.1.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 943.
  • Revision ID: mordred@inaugust.com-20090318184523-mfbjyj5wkipv4n3b
Moved big tests to big suite. Added make target "make test-big" to allow for easy running of the big tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1996, 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
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file include/row0ins.h
 
19
/******************************************************
21
20
Insert into a table
22
21
 
23
22
Created 4/20/1996 Heikki Tuuri
33
32
#include "trx0types.h"
34
33
#include "row0types.h"
35
34
 
36
 
/***************************************************************//**
 
35
/*******************************************************************
37
36
Checks if foreign key constraint fails for an index entry. Sets shared locks
38
37
which lock either the success or the failure of the constraint. NOTE that
39
 
the caller must have a shared latch on dict_foreign_key_check_lock.
40
 
@return DB_SUCCESS, DB_LOCK_WAIT, DB_NO_REFERENCED_ROW, or
41
 
DB_ROW_IS_REFERENCED */
 
38
the caller must have a shared latch on dict_foreign_key_check_lock. */
42
39
UNIV_INTERN
43
40
ulint
44
41
row_ins_check_foreign_constraint(
45
42
/*=============================*/
46
 
        ibool           check_ref,/*!< in: TRUE If we want to check that
 
43
                                /* out: DB_SUCCESS, DB_LOCK_WAIT,
 
44
                                DB_NO_REFERENCED_ROW,
 
45
                                or DB_ROW_IS_REFERENCED */
 
46
        ibool           check_ref,/* in: TRUE If we want to check that
47
47
                                the referenced table is ok, FALSE if we
48
 
                                want to check the foreign key table */
49
 
        dict_foreign_t* foreign,/*!< in: foreign constraint; NOTE that the
 
48
                                want to to check the foreign key table */
 
49
        dict_foreign_t* foreign,/* in: foreign constraint; NOTE that the
50
50
                                tables mentioned in it must be in the
51
51
                                dictionary cache if they exist at all */
52
 
        dict_table_t*   table,  /*!< in: if check_ref is TRUE, then the foreign
 
52
        dict_table_t*   table,  /* in: if check_ref is TRUE, then the foreign
53
53
                                table, else the referenced table */
54
 
        dtuple_t*       entry,  /*!< in: index entry for index */
55
 
        que_thr_t*      thr);   /*!< in: query thread */
56
 
/*********************************************************************//**
57
 
Creates an insert node struct.
58
 
@return own: insert node struct */
 
54
        dtuple_t*       entry,  /* in: index entry for index */
 
55
        que_thr_t*      thr);   /* in: query thread */
 
56
/*************************************************************************
 
57
Creates an insert node struct. */
59
58
UNIV_INTERN
60
59
ins_node_t*
61
60
ins_node_create(
62
61
/*============*/
63
 
        ulint           ins_type,       /*!< in: INS_VALUES, ... */
64
 
        dict_table_t*   table,          /*!< in: table where to insert */
65
 
        mem_heap_t*     heap);          /*!< in: mem heap where created */
66
 
/*********************************************************************//**
 
62
                                        /* out, own: insert node struct */
 
63
        ulint           ins_type,       /* in: INS_VALUES, ... */
 
64
        dict_table_t*   table,          /* in: table where to insert */
 
65
        mem_heap_t*     heap);          /* in: mem heap where created */
 
66
/*************************************************************************
67
67
Sets a new row to insert for an INS_DIRECT node. This function is only used
68
68
if we have constructed the row separately, which is a rare case; this
69
69
function is quite slow. */
71
71
void
72
72
ins_node_set_new_row(
73
73
/*=================*/
74
 
        ins_node_t*     node,   /*!< in: insert node */
75
 
        dtuple_t*       row);   /*!< in: new row (or first row) for the node */
76
 
/***************************************************************//**
 
74
        ins_node_t*     node,   /* in: insert node */
 
75
        dtuple_t*       row);   /* in: new row (or first row) for the node */
 
76
/*******************************************************************
77
77
Inserts an index entry to index. Tries first optimistic, then pessimistic
78
78
descent down the tree. If the entry matches enough to a delete marked record,
79
79
performs the insert by updating or delete unmarking the delete marked
80
 
record.
81
 
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DUPLICATE_KEY, or some other error code */
 
80
record. */
82
81
UNIV_INTERN
83
82
ulint
84
83
row_ins_index_entry(
85
84
/*================*/
86
 
        dict_index_t*   index,  /*!< in: index */
87
 
        dtuple_t*       entry,  /*!< in/out: index entry to insert */
88
 
        ulint           n_ext,  /*!< in: number of externally stored columns */
89
 
        ibool           foreign,/*!< in: TRUE=check foreign key constraints
90
 
                                (foreign=FALSE only during CREATE INDEX) */
91
 
        que_thr_t*      thr);   /*!< in: query thread */
92
 
/***********************************************************//**
 
85
                                /* out: DB_SUCCESS, DB_LOCK_WAIT,
 
86
                                DB_DUPLICATE_KEY, or some other error code */
 
87
        dict_index_t*   index,  /* in: index */
 
88
        dtuple_t*       entry,  /* in: index entry to insert */
 
89
        ulint           n_ext,  /* in: number of externally stored columns */
 
90
        ibool           foreign,/* in: TRUE=check foreign key constraints */
 
91
        que_thr_t*      thr);   /* in: query thread */
 
92
/***************************************************************
93
93
Inserts a row to a table. This is a high-level function used in
94
 
SQL execution graphs.
95
 
@return query thread to run next or NULL */
 
94
SQL execution graphs. */
96
95
UNIV_INTERN
97
96
que_thr_t*
98
97
row_ins_step(
99
98
/*=========*/
100
 
        que_thr_t*      thr);   /*!< in: query thread */
101
 
/***********************************************************//**
 
99
                                /* out: query thread to run next or NULL */
 
100
        que_thr_t*      thr);   /* in: query thread */
 
101
/***************************************************************
102
102
Creates an entry template for each index of a table. */
103
103
UNIV_INTERN
104
104
void
105
105
ins_node_create_entry_list(
106
106
/*=======================*/
107
 
        ins_node_t*     node);  /*!< in: row insert node */
 
107
        ins_node_t*     node);  /* in: row insert node */
108
108
 
109
109
/* Insert node structure */
110
110
 
111
111
struct ins_node_struct{
112
 
        que_common_t    common; /*!< node type: QUE_NODE_INSERT */
 
112
        que_common_t    common; /* node type: QUE_NODE_INSERT */
113
113
        ulint           ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */
114
 
        dtuple_t*       row;    /*!< row to insert */
115
 
        dict_table_t*   table;  /*!< table where to insert */
116
 
        sel_node_t*     select; /*!< select in searched insert */
 
114
        dtuple_t*       row;    /* row to insert */
 
115
        dict_table_t*   table;  /* table where to insert */
 
116
        sel_node_t*     select; /* select in searched insert */
117
117
        que_node_t*     values_list;/* list of expressions to evaluate and
118
118
                                insert in an INS_VALUES insert */
119
 
        ulint           state;  /*!< node execution state */
120
 
        dict_index_t*   index;  /*!< NULL, or the next index where the index
 
119
        ulint           state;  /* node execution state */
 
120
        dict_index_t*   index;  /* NULL, or the next index where the index
121
121
                                entry should be inserted */
122
 
        dtuple_t*       entry;  /*!< NULL, or entry to insert in the index;
 
122
        dtuple_t*       entry;  /* NULL, or entry to insert in the index;
123
123
                                after a successful insert of the entry,
124
124
                                this should be reset to NULL */
125
125
        UT_LIST_BASE_NODE_T(dtuple_t)
126
126
                        entry_list;/* list of entries, one for each index */
127
127
        byte*           row_id_buf;/* buffer for the row id sys field in row */
128
 
        trx_id_t        trx_id; /*!< trx id or the last trx which executed the
 
128
        dulint          trx_id; /* trx id or the last trx which executed the
129
129
                                node */
130
130
        byte*           trx_id_buf;/* buffer for the trx id sys field in row */
131
131
        mem_heap_t*     entry_sys_heap;