~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_rnext.c

code clean move Item_func_abs, Item_func_int_exp, Item_func_ln, Item_func_log to functions directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "myisam_priv.h"
17
 
 
18
 
using namespace drizzled;
 
16
#include "myisamdef.h"
19
17
 
20
18
        /*
21
19
           Read next row with the same key as previous read
31
29
  int res= 0;
32
30
 
33
31
  if ((inx = _mi_check_index(info,inx)) < 0)
34
 
    return(errno);
 
32
    return(my_errno);
35
33
  flag=SEARCH_BIGGER;                           /* Read next */
36
34
  if (info->lastpos == HA_OFFSET_ERROR && info->update & HA_STATE_PREV_FOUND)
37
35
    flag=0;                                     /* Read first */
38
36
 
39
37
  if (fast_mi_readinfo(info))
40
 
    return(errno);
 
38
    return(my_errno);
41
39
  if (info->s->concurrent_insert)
42
 
    pthread_rwlock_rdlock(&info->s->key_root_lock[inx]);
 
40
    rw_rdlock(&info->s->key_root_lock[inx]);
43
41
  changed=_mi_test_if_changed(info);
44
42
  if (!flag)
45
43
  {
84
82
    if (!error && res == 2)
85
83
    {
86
84
      if (info->s->concurrent_insert)
87
 
        pthread_rwlock_unlock(&info->s->key_root_lock[inx]);
 
85
        rw_unlock(&info->s->key_root_lock[inx]);
88
86
      info->lastpos= HA_OFFSET_ERROR;
89
 
      return(errno= HA_ERR_END_OF_FILE);
 
87
      return(my_errno= HA_ERR_END_OF_FILE);
90
88
    }
91
89
  }
92
 
 
 
90
  
93
91
  if (info->s->concurrent_insert)
94
 
    pthread_rwlock_unlock(&info->s->key_root_lock[inx]);
 
92
    rw_unlock(&info->s->key_root_lock[inx]);
95
93
 
96
94
        /* Don't clear if database-changed */
97
95
  info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
99
97
 
100
98
  if (error)
101
99
  {
102
 
    if (errno == HA_ERR_KEY_NOT_FOUND)
103
 
      errno=HA_ERR_END_OF_FILE;
 
100
    if (my_errno == HA_ERR_KEY_NOT_FOUND)
 
101
      my_errno=HA_ERR_END_OF_FILE;
104
102
  }
105
103
  else if (!buf)
106
104
  {
107
 
    return(info->lastpos==HA_OFFSET_ERROR ? errno : 0);
 
105
    return(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
108
106
  }
109
107
  else if (!(*info->read_record)(info,info->lastpos,buf))
110
108
  {
111
109
    info->update|= HA_STATE_AKTIV;              /* Record is read */
112
110
    return(0);
113
111
  }
114
 
  return(errno);
 
112
  return(my_errno);
115
113
} /* mi_rnext */