~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Brian Aker
  • Date: 2009-01-23 05:05:23 UTC
  • mto: (779.3.3 devel)
  • mto: This revision was merged to the branch mainline in revision 811.
  • Revision ID: brian@tangent.org-20090123050523-fkyc1gmddjnax173
Solaris build error fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1728
1728
}
1729
1729
 
1730
1730
 
1731
 
bool sys_var_log_state::update(Session *, set_var *var)
1732
 
{
1733
 
  bool res;
1734
 
  pthread_mutex_lock(&LOCK_global_system_variables);
1735
 
  if (!var->save_result.uint32_t_value)
1736
 
    res= false;
1737
 
  else
1738
 
    res= true;
1739
 
  pthread_mutex_unlock(&LOCK_global_system_variables);
1740
 
  return res;
1741
 
}
1742
 
 
1743
 
void sys_var_log_state::set_default(Session *, enum_var_type)
1744
 
{
1745
 
}
1746
 
 
1747
 
 
1748
 
bool update_sys_var_str_path(Session *, sys_var_str *var_str,
1749
 
                             set_var *var, const char *log_ext,
1750
 
                             bool log_state, uint32_t log_type)
1751
 
{
1752
 
  char buff[FN_REFLEN];
1753
 
  char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
1754
 
  bool result= 0;
1755
 
  uint32_t str_length= (var ? var->value->str_value.length() : 0);
1756
 
 
1757
 
  switch (log_type) {
1758
 
  default:
1759
 
    assert(0);                                  // Impossible
1760
 
  }
1761
 
 
1762
 
  if (!old_value)
1763
 
  {
1764
 
    old_value= make_default_log_name(buff, log_ext);
1765
 
    str_length= strlen(old_value);
1766
 
  }
1767
 
  res= (char *)malloc(str_length + 1);
1768
 
  if (res == NULL)
1769
 
  {
1770
 
    result= 1;
1771
 
    goto err;
1772
 
  }
1773
 
  memcpy(res, old_value, str_length);
1774
 
  res[str_length]= 0;
1775
 
 
1776
 
  pthread_mutex_lock(&LOCK_global_system_variables);
1777
 
 
1778
 
  old_value= var_str->value;
1779
 
  var_str->value= res;
1780
 
  var_str->value_length= str_length;
1781
 
  free(old_value);
1782
 
  if (log_state)
1783
 
  {
1784
 
    switch (log_type) {
1785
 
    default:
1786
 
      assert(0);
1787
 
    }
1788
 
  }
1789
 
 
1790
 
  pthread_mutex_unlock(&LOCK_global_system_variables);
1791
 
 
1792
 
err:
1793
 
  return result;
1794
 
}
1795
 
 
1796
1731
/****************************************************************************/
1797
1732
 
1798
1733
bool sys_var_timestamp::update(Session *session,  set_var *var)