~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_rnext_same.cc

Merge Revision revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

Post-merge fixes: Remove the MYSQL_VERSION_ID checks, because they only
apply to the InnoDB Plugin. Fix potential race condition accessing
trx->op_info and trx->detailed_error.
------------------------------------------------------------
revno: 3466
revision-id: marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
parent: marko.makela@oracle.com-20100514130228-n3n42nw7ht78k0wn
committer: Marko Mkel <marko.makela@oracle.com>
branch nick: mysql-5.1-innodb2
timestamp: Fri 2010-05-14 16:08:15 +0300
message:
  Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
  Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

  This fixes the bugs in the InnoDB Plugin.

  ha_innodb.h: Use trx_query_string() instead of trx_query() when
  available (MySQL 5.1.42 or later).

  innobase_get_stmt(): New function, to retrieve the currently running
  SQL statement.

  struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

  dict_strip_comments(): Add and observe the parameter sql_length. Treat
  /*/ as the start of a comment.

  dict_create_foreign_constraints(), row_table_add_foreign_constraints():
  Add the parameter sql_length.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#include "myisamdef.h"
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
15
 
 
16
#include "myisam_priv.h"
 
17
 
 
18
using namespace drizzled;
17
19
 
18
20
        /*
19
21
           Read next row with the same key as previous read, but abort if
30
32
  MI_KEYDEF *keyinfo;
31
33
 
32
34
  if ((int) (inx=info->lastinx) < 0 || info->lastpos == HA_OFFSET_ERROR)
33
 
    return(my_errno=HA_ERR_WRONG_INDEX);
 
35
    return(errno=HA_ERR_WRONG_INDEX);
34
36
  keyinfo=info->s->keyinfo+inx;
35
37
  if (fast_mi_readinfo(info))
36
 
    return(my_errno);
37
 
 
38
 
  if (info->s->concurrent_insert)
39
 
    rw_rdlock(&info->s->key_root_lock[inx]);
 
38
    return(errno);
40
39
 
41
40
  switch (keyinfo->key_alg)
42
41
  {
57
56
                       info->last_rkey_length, SEARCH_FIND, not_used))
58
57
        {
59
58
          error=1;
60
 
          my_errno=HA_ERR_END_OF_FILE;
 
59
          errno=HA_ERR_END_OF_FILE;
61
60
          info->lastpos= HA_OFFSET_ERROR;
62
61
          break;
63
62
        }
64
63
        /* Skip rows that are inserted by other threads since we got a lock */
65
 
        if (info->lastpos < info->state->data_file_length && 
 
64
        if (info->lastpos < info->state->data_file_length &&
66
65
            (!info->index_cond_func || mi_check_index_cond(info, inx, buf)))
67
66
          break;
68
67
      }
69
68
  }
70
 
  if (info->s->concurrent_insert)
71
 
    rw_unlock(&info->s->key_root_lock[inx]);
72
 
        /* Don't clear if database-changed */
 
69
  /* Don't clear if database-changed */
73
70
  info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
74
71
  info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME;
75
72
 
76
73
  if (error)
77
74
  {
78
 
    if (my_errno == HA_ERR_KEY_NOT_FOUND)
79
 
      my_errno=HA_ERR_END_OF_FILE;
 
75
    if (errno == HA_ERR_KEY_NOT_FOUND)
 
76
      errno=HA_ERR_END_OF_FILE;
80
77
  }
81
78
  else if (!buf)
82
79
  {
83
 
    return(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
 
80
    return(info->lastpos==HA_OFFSET_ERROR ? errno : 0);
84
81
  }
85
82
  else if (!(*info->read_record)(info,info->lastpos,buf))
86
83
  {
87
84
    info->update|= HA_STATE_AKTIV;              /* Record is read */
88
85
    return(0);
89
86
  }
90
 
  return(my_errno);
 
87
  return(errno);
91
88
} /* mi_rnext_same */