~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_unique.cc

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

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 */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
/* Functions to check if a row is unique */
17
17
 
18
 
#include "myisamdef.h"
19
 
#include <mystrings/m_ctype.h>
20
 
 
21
 
bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, unsigned char *record,
22
 
                        ha_checksum unique_hash, my_off_t disk_pos)
 
18
#include "myisam_priv.h"
 
19
#include <drizzled/charset.h>
 
20
 
 
21
using namespace drizzled;
 
22
 
 
23
bool mi_check_unique(MI_INFO *info,
 
24
                     MI_UNIQUEDEF *def,
 
25
                     unsigned char *record,
 
26
                     ha_checksum unique_hash,
 
27
                     internal::my_off_t disk_pos)
23
28
{
24
 
  my_off_t lastpos=info->lastpos;
 
29
  internal::my_off_t lastpos=info->lastpos;
25
30
  MI_KEYDEF *key= &info->s->keyinfo[def->key];
26
31
  unsigned char *key_buff=info->lastkey2;
27
32
 
44
49
    if (info->lastpos != disk_pos &&
45
50
        !(*info->s->compare_unique)(info,def,record,info->lastpos))
46
51
    {
47
 
      my_errno=HA_ERR_FOUND_DUPP_UNIQUE;
 
52
      errno=HA_ERR_FOUND_DUPP_UNIQUE;
48
53
      info->errkey= (int) def->key;
49
54
      info->dupp_key_pos= info->lastpos;
50
55
      info->page_changed=1;                     /* Can't optimize read next */
152
157
  for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
153
158
  {
154
159
    enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type;
155
 
    uint32_t a_length, b_length;
 
160
    uint16_t a_length, b_length;
156
161
    a_length= b_length= keyseg->length;
157
162
 
158
163
    /* If part is NULL it's regarded as different */