~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2009-05-30 22:30:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1045.
  • Revision ID: brian@gaz-20090530223005-hmylm6iywddfentm
A lot of little cleanups (most based off lcov)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1829
1829
}
1830
1830
 
1831
1831
 
1832
 
int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
1833
 
{
1834
 
  KEY *keyinfo, *keyend;
1835
 
  KEY_PART_INFO *keypart, *keypartend;
1836
 
 
1837
 
  if (!table->s->mysql_version)
1838
 
  {
1839
 
    /* check for blob-in-key error */
1840
 
    keyinfo= table->key_info;
1841
 
    keyend= table->key_info + table->s->keys;
1842
 
    for (; keyinfo < keyend; keyinfo++)
1843
 
    {
1844
 
      keypart= keyinfo->key_part;
1845
 
      keypartend= keypart + keyinfo->key_parts;
1846
 
      for (; keypart < keypartend; keypart++)
1847
 
      {
1848
 
        if (!keypart->fieldnr)
1849
 
          continue;
1850
 
        Field *field= table->field[keypart->fieldnr-1];
1851
 
        if (field->type() == DRIZZLE_TYPE_BLOB)
1852
 
        {
1853
 
          return HA_ADMIN_NEEDS_CHECK;
1854
 
        }
1855
 
      }
1856
 
    }
1857
 
  }
1858
 
  return check_for_upgrade(check_opt);
1859
 
}
1860
 
 
1861
 
 
1862
1832
/* Code left, but Drizzle has no legacy yet (while MySQL did) */
1863
1833
int handler::check_old_types()
1864
1834
{
1955
1925
  @retval
1956
1926
    HA_ADMIN_NOT_IMPLEMENTED
1957
1927
*/
1958
 
int handler::ha_check(Session *session, HA_CHECK_OPT *check_opt)
 
1928
int handler::ha_check(Session *, HA_CHECK_OPT *)
1959
1929
{
1960
 
  int error;
1961
 
 
1962
 
  if (table->s->mysql_version < DRIZZLE_VERSION_ID)
1963
 
  {
1964
 
    if ((error= check_old_types()))
1965
 
      return error;
1966
 
    error= ha_check_for_upgrade(check_opt);
1967
 
    if (error && (error != HA_ADMIN_NEEDS_CHECK))
1968
 
      return error;
1969
 
  }
1970
 
  if ((error= check(session, check_opt)))
1971
 
    return error;
1972
1930
  return HA_ADMIN_OK;
1973
1931
}
1974
1932
 
3474
3432
  - table is not mysql.event
3475
3433
*/
3476
3434
 
3477
 
static bool binlog_log_row(Table* table,
 
3435
static bool log_row_for_replication(Table* table,
3478
3436
                           const unsigned char *before_record,
3479
3437
                           const unsigned char *after_record)
3480
3438
{
3572
3530
  if (unlikely(error= write_row(buf)))
3573
3531
    return(error);
3574
3532
 
3575
 
  if (unlikely(binlog_log_row(table, 0, buf)))
 
3533
  if (unlikely(log_row_for_replication(table, 0, buf)))
3576
3534
    return HA_ERR_RBR_LOGGING_FAILED; /* purecov: inspected */
3577
3535
 
3578
3536
  DRIZZLE_INSERT_ROW_END();
3595
3553
  if (unlikely(error= update_row(old_data, new_data)))
3596
3554
    return error;
3597
3555
 
3598
 
  if (unlikely(binlog_log_row(table, old_data, new_data)))
 
3556
  if (unlikely(log_row_for_replication(table, old_data, new_data)))
3599
3557
    return HA_ERR_RBR_LOGGING_FAILED;
3600
3558
 
3601
3559
  return 0;
3610
3568
  if (unlikely(error= delete_row(buf)))
3611
3569
    return error;
3612
3570
 
3613
 
  if (unlikely(binlog_log_row(table, buf, 0)))
 
3571
  if (unlikely(log_row_for_replication(table, buf, 0)))
3614
3572
    return HA_ERR_RBR_LOGGING_FAILED;
3615
3573
 
3616
3574
  return 0;