~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2009-07-11 05:59:19 UTC
  • mfrom: (1089.1.9 merge)
  • Revision ID: brian@gaz-20090711055919-m4px3crrdgta5lie
Collection of patches from new-cleanup (includes asserts for field in debug)

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
 
82
82
void free_user_var(user_var_entry *entry)
83
83
{
84
 
  char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry));
85
 
  if (entry->value && entry->value != pos)
86
 
    free(entry->value);
87
 
  free((char*) entry);
 
84
  delete entry;
88
85
}
89
86
 
90
87
bool Key_part_spec::operator==(const Key_part_spec& other) const
95
92
}
96
93
 
97
94
Open_tables_state::Open_tables_state(ulong version_arg)
98
 
  :version(version_arg), state_flags(0U)
 
95
  :version(version_arg), backups_available(false)
99
96
{
100
97
  reset_open_tables_state();
101
98
}
1645
1642
{
1646
1643
  backup->set_open_tables_state(this);
1647
1644
  reset_open_tables_state();
1648
 
  state_flags|= Open_tables_state::BACKUPS_AVAIL;
 
1645
  backups_available= false;
1649
1646
}
1650
1647
 
1651
1648
 
1878
1875
{
1879
1876
  user_var_entry *entry= NULL;
1880
1877
 
1881
 
  assert(name.length == strlen (name.str));
1882
1878
  entry= (user_var_entry*) hash_search(&user_vars, (unsigned char*) name.str, name.length);
1883
1879
 
1884
1880
  if ((entry == NULL) && create_if_not_exists)
1885
1881
  {
1886
 
    uint32_t size=ALIGN_SIZE(sizeof(user_var_entry))+name.length+1+extra_size;
1887
1882
    if (!hash_inited(&user_vars))
1888
 
      return 0;
1889
 
    if (!(entry = (user_var_entry*) malloc(size)))
1890
 
      return 0;
1891
 
    entry->name.str=(char*) entry+ ALIGN_SIZE(sizeof(user_var_entry))+
1892
 
      extra_size;
1893
 
    entry->name.length=name.length;
1894
 
    entry->value=0;
1895
 
    entry->length=0;
1896
 
    entry->update_query_id=0;
1897
 
    entry->collation.set(NULL, DERIVATION_IMPLICIT);
1898
 
    entry->unsigned_flag= 0;
1899
 
    /*
1900
 
      If we are here, we were called from a SET or a query which sets a
1901
 
      variable. Imagine it is this:
1902
 
      INSERT INTO t SELECT @a:=10, @a:=@a+1.
1903
 
      Then when we have a Item_func_get_user_var (because of the @a+1) so we
1904
 
      think we have to write the value of @a to the binlog. But before that,
1905
 
      we have a Item_func_set_user_var to create @a (@a:=10), in this we mark
1906
 
      the variable as "already logged" (line below) so that it won't be logged
1907
 
      by Item_func_get_user_var (because that's not necessary).
1908
 
    */
1909
 
    entry->used_query_id= query_id;
1910
 
    entry->type=STRING_RESULT;
1911
 
    memcpy(entry->name.str, name.str, name.length+1);
 
1883
      return NULL;
 
1884
    entry= new (nothrow) user_var_entry(name.str, query_id);
 
1885
 
 
1886
    if (entry == NULL)
 
1887
      return NULL;
 
1888
 
1912
1889
    if (my_hash_insert(&user_vars, (unsigned char*) entry))
1913
1890
    {
1914
1891
      assert(1);
1996
1973
    does not belong to statement for which we do close_thread_tables()).
1997
1974
    TODO: This should be fixed in later releases.
1998
1975
   */
1999
 
  if (!(state_flags & Open_tables_state::BACKUPS_AVAIL))
 
1976
  if (backups_available == false)
2000
1977
  {
2001
1978
    main_da.can_overwrite_status= true;
2002
1979
    ha_autocommit_or_rollback(this, is_error());