~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_engine/schema.cc

  • Committer: Brian Aker
  • Date: 2010-02-24 23:10:30 UTC
  • mto: (1273.13.101 build)
  • mto: This revision was merged to the branch mainline in revision 1309.
  • Revision ID: brian@gaz-20100224231030-4dwc2iwcih5cootv
createSchema() now works via SE interface.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "drizzled/db.h"
25
25
#include "drizzled/sql_table.h"
26
26
 
 
27
#include <sys/stat.h>
 
28
#include <sys/types.h>
 
29
 
27
30
#include <iostream>
28
31
#include <fstream>
29
32
#include <string>
84
87
 
85
88
  return false;
86
89
}
 
90
 
 
91
bool Schema::doCreateSchema(const drizzled::message::Schema &schema_message)
 
92
{
 
93
  char   path[FN_REFLEN+16];
 
94
  uint32_t path_len;
 
95
  int error_erno;
 
96
  path_len= drizzled::build_table_filename(path, sizeof(path), schema_message.name().c_str(), "", false);
 
97
  path[path_len-1]= 0;                    // remove last '/' from path
 
98
 
 
99
  if (mkdir(path, 0777) == -1)
 
100
    return false;
 
101
 
 
102
  error_erno= write_schema_file(path, schema_message);
 
103
  if (error_erno && error_erno != EEXIST)
 
104
  {
 
105
    rmdir(path);
 
106
 
 
107
    return false;
 
108
  }
 
109
 
 
110
  return true;
 
111
}