~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

Merge trunk changes and resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#include <sstream>
52
52
 
53
53
using namespace std;
54
 
using namespace drizzled;
 
54
 
 
55
namespace drizzled
 
56
{
55
57
 
56
58
extern pid_t current_pid;
57
59
 
182
184
    to[length]= hexchars[(*from) & 15];
183
185
  }
184
186
 
185
 
  if (check_if_legal_tablename(to) &&
 
187
  if (internal::check_if_legal_tablename(to) &&
186
188
      length + 4 < to_length)
187
189
  {
188
190
    memcpy(to + length, "@@@", 4);
319
321
  if (bufflen < path_str.str().length())
320
322
    length= 0;
321
323
  else
322
 
    length= unpack_filename(buff, path_str.str().c_str());
 
324
    length= internal::unpack_filename(buff, path_str.str().c_str());
323
325
 
324
326
  return length;
325
327
}
1444
1446
    return(true);
1445
1447
  }
1446
1448
  /* Sort keys in optimized order */
1447
 
  my_qsort((unsigned char*) *key_info_buffer, *key_count, sizeof(KEY),
1448
 
           (qsort_cmp) sort_keys);
 
1449
  internal::my_qsort((unsigned char*) *key_info_buffer, *key_count, sizeof(KEY),
 
1450
                     (qsort_cmp) sort_keys);
1449
1451
 
1450
1452
  /* Check fields. */
1451
1453
  it.rewind();
1564
1566
  bool          error= true;
1565
1567
  TableShare share;
1566
1568
  bool lex_identified_temp_table=
1567
 
    (table_proto->type() == drizzled::message::Table::TEMPORARY);
 
1569
    (table_proto->type() == message::Table::TEMPORARY);
1568
1570
 
1569
1571
  /* Check for duplicate fields and check type of table to create */
1570
1572
  if (!alter_info->create_list.elements)
1737
1739
  Table *name_lock= NULL;
1738
1740
  bool result;
1739
1741
  bool lex_identified_temp_table=
1740
 
    (table_proto->type() == drizzled::message::Table::TEMPORARY);
 
1742
    (table_proto->type() == message::Table::TEMPORARY);
1741
1743
 
1742
1744
  if (! lex_identified_temp_table)
1743
1745
  {
1821
1823
  for (uint32_t i=2 ; i< 100; i++)
1822
1824
  {
1823
1825
    *buff_end= '_';
1824
 
    int10_to_str(i, buff_end+1, 10);
 
1826
    internal::int10_to_str(i, buff_end+1, 10);
1825
1827
    if (!check_if_keyname_exists(buff,start,end))
1826
1828
      return memory::sql_strdup(buff);
1827
1829
  }
2213
2215
*/
2214
2216
 
2215
2217
bool mysql_create_like_table(Session* session, TableList* table, TableList* src_table,
2216
 
                             drizzled::message::Table& create_table_proto,
2217
 
                             drizzled::plugin::StorageEngine *engine_arg,
 
2218
                             message::Table& create_table_proto,
 
2219
                             plugin::StorageEngine *engine_arg,
2218
2220
                             bool is_if_not_exists,
2219
2221
                             bool is_engine_set)
2220
2222
{
2227
2229
  uint32_t not_used;
2228
2230
  message::Table src_proto;
2229
2231
  bool lex_identified_temp_table=
2230
 
    (create_table_proto.type() == drizzled::message::Table::TEMPORARY);
 
2232
    (create_table_proto.type() == message::Table::TEMPORARY);
2231
2233
 
2232
2234
  /*
2233
2235
    By opening source table we guarantee that it exists and no concurrent
2534
2536
      else
2535
2537
      {
2536
2538
        /* calculating table's checksum */
2537
 
        ha_checksum crc= 0;
 
2539
        internal::ha_checksum crc= 0;
2538
2540
        unsigned char null_mask=256 -  (1 << t->s->last_null_bit_pos);
2539
2541
 
2540
2542
        t->use_all_columns();
2545
2547
        {
2546
2548
          for (;;)
2547
2549
          {
2548
 
            ha_checksum row_crc= 0;
 
2550
            internal::ha_checksum row_crc= 0;
2549
2551
            int error= t->cursor->rnd_next(t->record[0]);
2550
2552
            if (unlikely(error))
2551
2553
            {
2560
2562
              if (!(t->s->db_create_options & HA_OPTION_PACK_RECORD))
2561
2563
                t->record[0][0] |= 1;
2562
2564
 
2563
 
              row_crc= my_checksum(row_crc, t->record[0], t->s->null_bytes);
 
2565
              row_crc= internal::my_checksum(row_crc, t->record[0], t->s->null_bytes);
2564
2566
            }
2565
2567
 
2566
2568
            for (uint32_t i= 0; i < t->s->fields; i++ )
2571
2573
              {
2572
2574
                String tmp;
2573
2575
                f->val_str(&tmp);
2574
 
                row_crc= my_checksum(row_crc, (unsigned char*) tmp.ptr(), tmp.length());
 
2576
                row_crc= internal::my_checksum(row_crc, (unsigned char*) tmp.ptr(), tmp.length());
2575
2577
              }
2576
2578
              else
2577
 
                row_crc= my_checksum(row_crc, f->ptr,
 
2579
                row_crc= internal::my_checksum(row_crc, f->ptr,
2578
2580
                                     f->pack_length());
2579
2581
            }
2580
2582
 
2601
2603
    table->table=0;
2602
2604
  return(true);
2603
2605
}
 
2606
 
 
2607
} /* namespace drizzled */