~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

  • Committer: Stewart Smith
  • Date: 2008-11-21 16:06:07 UTC
  • mto: This revision was merged to the branch mainline in revision 593.
  • Revision ID: stewart@flamingspork.com-20081121160607-n6gdlt013spuo54r
remove mysql_frm_type
and fix engines to return correct value from delete_table when table doesn't exist.
(it should be ENOENT).

Also fix up some tests that manipulated frm files by hand. These tests are no longer valid and will need to be rewritten in the not too distant future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3550
3550
  return length;
3551
3551
}
3552
3552
 
3553
 
/*
3554
 
  Check type of .frm if we are not going to parse it
3555
 
 
3556
 
  SYNOPSIS
3557
 
  mysql_frm_type()
3558
 
  path        path to file
3559
 
 
3560
 
  RETURN
3561
 
  false       error
3562
 
  true       table
3563
 
*/
3564
 
 
3565
 
bool mysql_frm_type(Session *, char *path, enum legacy_db_type *dbt)
3566
 
{
3567
 
  File file;
3568
 
  unsigned char header[10];     /* This should be optimized */
3569
 
  int error;
3570
 
 
3571
 
  *dbt= DB_TYPE_UNKNOWN;
3572
 
 
3573
 
  if ((file= open(path, O_RDONLY)) < 0)
3574
 
    return false;
3575
 
  error= my_read(file, (unsigned char*) header, sizeof(header), MYF(MY_NABP));
3576
 
  my_close(file, MYF(MY_WME));
3577
 
 
3578
 
  if (error)
3579
 
    return false;
3580
 
 
3581
 
  /*  
3582
 
    This is just a check for DB_TYPE. We'll return default unknown type
3583
 
    if the following test is true (arg #3). This should not have effect
3584
 
    on return value from this function (default FRMTYPE_TABLE)
3585
 
   */  
3586
 
  if (header[0] != (unsigned char) 254 || header[1] != 1 ||
3587
 
      (header[2] != FRM_VER && header[2] != FRM_VER+1 &&
3588
 
       (header[2] < FRM_VER+3 || header[2] > FRM_VER+4)))
3589
 
    return true;
3590
 
 
3591
 
  *dbt= (enum legacy_db_type) (uint) *(header + 3);
3592
 
  return true;                   // Is probably a .frm table
3593
 
}
3594
 
 
3595
3553
/****************************************************************************
3596
3554
 Functions for creating temporary tables.
3597
3555
****************************************************************************/