~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to ndb/src/ndbapi/NdbImpl.hpp

  • Committer: Bazaar Package Importer
  • Author(s): sean finney
  • Date: 2007-05-13 12:32:45 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513123245-8c3l187dk34cz2ar
Tags: 5.0.41-2
the previous "translation changes" inadvertently introduced unrelated
changes in the package control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
  Ndb_free_list_t();
38
38
  ~Ndb_free_list_t();
39
39
  
40
 
  void fill(Ndb*, Uint32 cnt);
 
40
  int fill(Ndb*, Uint32 cnt);
41
41
  T* seize(Ndb*);
42
42
  void release(T*);
43
43
  void clear();
79
79
 
80
80
  BaseString m_prefix; // Buffer for preformatted internal name <db>/<schema>/
81
81
 
82
 
  void update_prefix()
 
82
  int update_prefix()
83
83
  {
84
 
    m_prefix.assfmt("%s%c%s%c", m_dbname.c_str(), table_name_separator,
85
 
                    m_schemaname.c_str(), table_name_separator);
 
84
    if (!m_prefix.assfmt("%s%c%s%c", m_dbname.c_str(), table_name_separator,
 
85
                         m_schemaname.c_str(), table_name_separator))
 
86
    {
 
87
      return -1;
 
88
    }
 
89
    return 0;
 
90
  }
 
91
 
 
92
/*
 
93
  We need this friend accessor function to work around a HP compiler problem,
 
94
  where template class friends are not working.
 
95
*/
 
96
  static inline void setNdbError(Ndb &ndb,int code){
 
97
    ndb.theError.code = code;
 
98
    return;
86
99
  }
87
100
 
88
101
  /**
194
207
    
195
208
template<class T>
196
209
inline
197
 
void
 
210
int
198
211
Ndb_free_list_t<T>::fill(Ndb* ndb, Uint32 cnt)
199
212
{
200
213
  if (m_free_list == 0)
202
215
    m_free_cnt++;
203
216
    m_alloc_cnt++;
204
217
    m_free_list = new T(ndb);
 
218
    if (m_free_list == 0)
 
219
    {
 
220
      NdbImpl::setNdbError(*ndb, 4000);
 
221
      assert(false);
 
222
      return -1;
 
223
    }
205
224
  }
206
225
  while(m_alloc_cnt < cnt)
207
226
  {
208
227
    T* obj= new T(ndb);
209
228
    if(obj == 0)
210
 
      return;
211
 
    
 
229
    {
 
230
      NdbImpl::setNdbError(*ndb, 4000);
 
231
      assert(false);
 
232
      return -1;
 
233
    }
212
234
    obj->next(m_free_list);
213
235
    m_free_cnt++;
214
236
    m_alloc_cnt++;
215
237
    m_free_list = obj;
216
238
  }
 
239
  return 0;
217
240
}
218
241
 
219
242
template<class T>
234
257
  {
235
258
    m_alloc_cnt++;
236
259
  }
237
 
  
 
260
  else
 
261
  {
 
262
    NdbImpl::setNdbError(*ndb, 4000);
 
263
    assert(false);
 
264
  }
238
265
  return tmp;
239
266
}
240
267