~sinha/drizzle/trunk-bug-621856

« back to all changes in this revision

Viewing changes to drizzled/foreign_key.cc

  • Committer: Brian Aker
  • Date: 2011-02-27 09:35:29 UTC
  • mfrom: (2201.1.3 eol)
  • Revision ID: brian@tangent.org-20110227093529-om8rwrtv0mxl8v99
MergeĀ Olaf

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
}
80
80
 
81
 
/**
82
 
  Make a deep copy of each list element.
83
 
 
84
 
  @note A template function and not a template method of class List
85
 
  is employed because of explicit template instantiation:
86
 
  in server code there are explicit instantiations of List<T> and
87
 
  an explicit instantiation of a template requires that any method
88
 
  of the instantiated class used in the template can be resolved.
89
 
  Evidently not all template arguments have clone() method with
90
 
  the right signature.
91
 
 
92
 
  @return You must query the error state in Session for out-of-memory
93
 
  situation after calling this function.
94
 
*/
95
 
 
96
 
template <typename T>
97
 
void list_copy_and_replace_each_value(List<T> &list, memory::Root *mem_root)
98
 
{
99
 
  /* Make a deep copy of each element */
100
 
  typename List<T>::iterator it(list.begin());
101
 
  T *el;
102
 
  while ((el= it++))
103
 
    it.replace(el->clone(mem_root));
104
 
}
 
81
/**
 
82
  Make a deep copy of each list element.
 
83
 
 
84
  @note A template function and not a template method of class List
 
85
  is employed because of explicit template instantiation:
 
86
  in server code there are explicit instantiations of List<T> and
 
87
  an explicit instantiation of a template requires that any method
 
88
  of the instantiated class used in the template can be resolved.
 
89
  Evidently not all template arguments have clone() method with
 
90
  the right signature.
 
91
 
 
92
  @return You must query the error state in Session for out-of-memory
 
93
  situation after calling this function.
 
94
*/
 
95
 
 
96
template <typename T>
 
97
void list_copy_and_replace_each_value(List<T> &list, memory::Root *mem_root)
 
98
{
 
99
  /* Make a deep copy of each element */
 
100
  typename List<T>::iterator it(list.begin());
 
101
  T *el;
 
102
  while ((el= it++))
 
103
    it.replace(el->clone(mem_root));
 
104
}
105
105
 
106
106
Foreign_key::Foreign_key(const Foreign_key &rhs, memory::Root *mem_root)
107
107
  :Key(rhs),