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

« back to all changes in this revision

Viewing changes to ndb/tools/restore/consumer_restore.cpp

  • 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:
205
205
  BaseString tmp(name);
206
206
  Vector<BaseString> split;
207
207
  if(tmp.split(split, "/") != 3){
208
 
    err << "Invalid table name format " << name << endl;
 
208
    err << "Invalid table name format `" << name << "`" << endl;
209
209
    return false;
210
210
  }
211
211
 
230
230
 
231
231
    if (dict->createTable(copy) == -1) 
232
232
    {
233
 
      err << "Create table " << table.getTableName() << " failed: "
 
233
      err << "Create table `" << table.getTableName() << "` failed: "
234
234
          << dict->getNdbError() << endl;
235
235
      return false;
236
236
    }
237
 
    info << "Successfully restored table " << table.getTableName()<< endl ;
 
237
    info << "Successfully restored table `"
 
238
         << table.getTableName() << "`" << endl;
238
239
  }  
239
240
  
240
241
  const NdbDictionary::Table* tab = dict->getTable(split[2].c_str());
241
242
  if(tab == 0){
242
 
    err << "Unable to find table: " << split[2].c_str() << endl;
 
243
    err << "Unable to find table: `" << split[2].c_str() << "`" << endl;
243
244
    return false;
244
245
  }
245
246
  const NdbDictionary::Table* null = 0;
257
258
  for(size_t i = 0; i<m_indexes.size(); i++){
258
259
    NdbTableImpl & indtab = NdbTableImpl::getImpl(* m_indexes[i]);
259
260
 
260
 
    BaseString tmp(indtab.m_primaryTable.c_str());
261
261
    Vector<BaseString> split;
262
 
    if(tmp.split(split, "/") != 3){
263
 
      err << "Invalid table name format " << indtab.m_primaryTable.c_str()
264
 
          << endl;
265
 
      return false;
 
262
    {
 
263
      BaseString tmp(indtab.m_primaryTable.c_str());
 
264
      if (tmp.split(split, "/") != 3)
 
265
      {
 
266
        err << "Invalid table name format `" << indtab.m_primaryTable.c_str()
 
267
            << "`" << endl;
 
268
        return false;
 
269
      }
266
270
    }
267
271
    
268
272
    m_ndb->setDatabaseName(split[0].c_str());
270
274
    
271
275
    const NdbDictionary::Table * prim = dict->getTable(split[2].c_str());
272
276
    if(prim == 0){
273
 
      err << "Unable to find base table \"" << split[2].c_str() 
274
 
          << "\" for index "
275
 
          << indtab.getName() << endl;
 
277
      err << "Unable to find base table `" << split[2].c_str() 
 
278
          << "` for index `"
 
279
          << indtab.getName() << "`" << endl;
276
280
      return false;
277
281
    }
278
282
    NdbTableImpl& base = NdbTableImpl::getImpl(*prim);
279
283
    NdbIndexImpl* idx;
280
 
    int id;
281
 
    char idxName[255], buf[255];
282
 
    if(sscanf(indtab.getName(), "%[^/]/%[^/]/%d/%s",
283
 
              buf, buf, &id, idxName) != 4){
284
 
      err << "Invalid index name format " << indtab.getName() << endl;
285
 
      return false;
 
284
    Vector<BaseString> split_idx;
 
285
    {
 
286
      BaseString tmp(indtab.getName());
 
287
      if (tmp.split(split_idx, "/") != 4)
 
288
      {
 
289
        err << "Invalid index name format `" << indtab.getName() << "`" << endl;
 
290
        return false;
 
291
      }
286
292
    }
287
293
    if(NdbDictInterface::create_index_obj_from_table(&idx, &indtab, &base))
288
294
    {
289
 
      err << "Failed to create index " << idxName
290
 
          << " on " << split[2].c_str() << endl;
 
295
      err << "Failed to create index `" << split_idx[3]
 
296
          << "` on " << split[2].c_str() << endl;
291
297
        return false;
292
298
    }
293
 
    idx->setName(idxName);
 
299
    idx->setName(split_idx[3].c_str());
294
300
    if(dict->createIndex(* idx) != 0)
295
301
    {
296
302
      delete idx;
297
 
      err << "Failed to create index " << idxName
298
 
          << " on " << split[2].c_str() << endl
 
303
      err << "Failed to create index `" << split_idx[3].c_str()
 
304
          << "` on `" << split[2].c_str() << "`" << endl
299
305
          << dict->getNdbError() << endl;
300
306
 
301
307
      return false;
302
308
    }
303
309
    delete idx;
304
 
    info << "Successfully created index " << idxName
305
 
         << " on " << split[2].c_str() << endl;
 
310
    info << "Successfully created index `" << split_idx[3].c_str()
 
311
         << "` on `" << split[2].c_str() << "`" << endl;
306
312
  }
307
313
  return true;
308
314
}
382
388
        Uint32 length = (size * arraySize) / 8;
383
389
 
384
390
        if (j == 0 && tup.getTable()->have_auto_inc(i))
385
 
          tup.getTable()->update_max_auto_val(dataPtr,size);
 
391
          tup.getTable()->update_max_auto_val(dataPtr,size*arraySize);
386
392
 
387
393
        if (attr_desc->m_column->getPrimaryKey())
388
394
        {
596
602
    const char * dataPtr = attr->Data.string_value;
597
603
    
598
604
    if (tup.m_table->have_auto_inc(attr->Desc->attrId))
599
 
      tup.m_table->update_max_auto_val(dataPtr,size);
 
605
      tup.m_table->update_max_auto_val(dataPtr,size*arraySize);
600
606
 
601
607
    const Uint32 length = (size / 8) * arraySize;
602
608
    if (attr->Desc->m_column->getPrimaryKey())