~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/filesystem_engine/filesystem_engine.cc

  • Committer: Brian Aker
  • Date: 2011-01-06 05:17:09 UTC
  • Revision ID: brian@tangent.org-20110106051709-oa0se8ur02uc6i9o
Added native functions into the function table.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 
87
87
  int doCreateTable(Session &,
88
88
                    Table &table_arg,
89
 
                    const drizzled::identifier::Table &identifier,
 
89
                    const drizzled::TableIdentifier &identifier,
90
90
                    drizzled::message::Table&);
91
91
 
92
92
  int doGetTableDefinition(Session& ,
93
 
                           const drizzled::identifier::Table &,
 
93
                           const drizzled::TableIdentifier &,
94
94
                           drizzled::message::Table &);
95
95
 
96
 
  int doDropTable(Session&, const identifier::Table &);
 
96
  int doDropTable(Session&, const TableIdentifier &);
97
97
 
98
98
  /* operations on FilesystemTableShare */
99
99
  FilesystemTableShare *findOpenTable(const string table_name);
103
103
  uint32_t max_keys()          const { return 0; }
104
104
  uint32_t max_key_parts()     const { return 0; }
105
105
  uint32_t max_key_length()    const { return 0; }
106
 
  bool doDoesTableExist(Session& , const identifier::Table &);
107
 
  int doRenameTable(Session&, const identifier::Table &, const identifier::Table &);
 
106
  bool doDoesTableExist(Session& , const TableIdentifier &);
 
107
  int doRenameTable(Session&, const TableIdentifier &, const TableIdentifier &);
108
108
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
109
 
                             const drizzled::identifier::Schema &schema_identifier,
110
 
                             drizzled::identifier::Table::vector &set_of_identifiers);
 
109
                             const drizzled::SchemaIdentifier &schema_identifier,
 
110
                             drizzled::TableIdentifier::vector &set_of_identifiers);
111
111
private:
112
112
  void getTableNamesFromFilesystem(drizzled::CachedDirectory &directory,
113
 
                                   const drizzled::identifier::Schema &schema_identifier,
 
113
                                   const drizzled::SchemaIdentifier &schema_identifier,
114
114
                                   drizzled::plugin::TableNameList *set_of_names,
115
 
                                   drizzled::identifier::Table::vector *set_of_identifiers);
 
115
                                   drizzled::TableIdentifier::vector *set_of_identifiers);
116
116
};
117
117
 
118
118
void FilesystemEngine::getTableNamesFromFilesystem(drizzled::CachedDirectory &directory,
119
 
                                                   const drizzled::identifier::Schema &schema_identifier,
 
119
                                                   const drizzled::SchemaIdentifier &schema_identifier,
120
120
                                                   drizzled::plugin::TableNameList *set_of_names,
121
 
                                                   drizzled::identifier::Table::vector *set_of_identifiers)
 
121
                                                   drizzled::TableIdentifier::vector *set_of_identifiers)
122
122
{
123
123
  drizzled::CachedDirectory::Entries entries= directory.getEntries();
124
124
 
140
140
      char uname[NAME_LEN + 1];
141
141
      uint32_t file_name_len;
142
142
 
143
 
      file_name_len= identifier::Table::filename_to_tablename(filename->c_str(), uname, sizeof(uname));
 
143
      file_name_len= TableIdentifier::filename_to_tablename(filename->c_str(), uname, sizeof(uname));
144
144
      uname[file_name_len - sizeof(FILESYSTEM_EXT) + 1]= '\0';
145
145
      if (set_of_names)
146
146
        set_of_names->insert(uname);
147
147
      if (set_of_identifiers)
148
 
        set_of_identifiers->push_back(identifier::Table(schema_identifier, uname));
 
148
        set_of_identifiers->push_back(TableIdentifier(schema_identifier, uname));
149
149
    }
150
150
  }
151
151
}
152
152
 
153
153
void FilesystemEngine::doGetTableIdentifiers(drizzled::CachedDirectory &directory,
154
 
                                             const drizzled::identifier::Schema &schema_identifier,
155
 
                                             drizzled::identifier::Table::vector &set_of_identifiers)
 
154
                                             const drizzled::SchemaIdentifier &schema_identifier,
 
155
                                             drizzled::TableIdentifier::vector &set_of_identifiers)
156
156
{
157
157
  getTableNamesFromFilesystem(directory, schema_identifier, NULL, &set_of_identifiers);
158
158
}
159
159
 
160
 
int FilesystemEngine::doDropTable(Session &, const identifier::Table &identifier)
 
160
int FilesystemEngine::doDropTable(Session &, const TableIdentifier &identifier)
161
161
{
162
162
  string new_path(identifier.getPath());
163
163
  new_path+= FILESYSTEM_EXT;
169
169
  return err;
170
170
}
171
171
 
172
 
bool FilesystemEngine::doDoesTableExist(Session &, const identifier::Table &identifier)
 
172
bool FilesystemEngine::doDoesTableExist(Session &, const TableIdentifier &identifier)
173
173
{
174
174
  string proto_path(identifier.getPath());
175
175
  proto_path.append(FILESYSTEM_EXT);
281
281
}
282
282
 
283
283
int FilesystemEngine::doGetTableDefinition(Session &,
284
 
                                           const drizzled::identifier::Table &identifier,
 
284
                                           const drizzled::TableIdentifier &identifier,
285
285
                                           drizzled::message::Table &table_proto)
286
286
{
287
287
  string new_path(identifier.getPath());
463
463
{
464
464
}
465
465
 
466
 
int FilesystemCursor::doOpen(const drizzled::identifier::Table &identifier, int, uint32_t)
 
466
int FilesystemCursor::doOpen(const drizzled::TableIdentifier &identifier, int, uint32_t)
467
467
{
468
468
  if (!(share= get_share(identifier.getPath().c_str())))
469
469
    return ENOENT;
490
490
 
491
491
int FilesystemCursor::doStartTableScan(bool)
492
492
{
493
 
  sql_command_type = getTable()->getSession()->getSqlCommand();
 
493
  sql_command_type = session_sql_command(getTable()->getSession());
494
494
 
495
495
  if (thread_locked)
496
496
    critical_section_exit();
701
701
 
702
702
int FilesystemCursor::doEndTableScan()
703
703
{
704
 
  sql_command_type = getTable->getSession()->getSqlCommand();
 
704
  sql_command_type = session_sql_command(getTable()->getSession());
705
705
 
706
706
  if (share->format.isTagFormat())
707
707
  {
822
822
  if (share->format.isTagFormat())
823
823
    return 0;
824
824
 
825
 
  sql_command_type = getTable()->getSession()->getSqlCommand();
 
825
  sql_command_type = session_sql_command(getTable()->getSession());
826
826
 
827
827
  critical_section_enter();
828
828
 
893
893
  return 0;
894
894
}
895
895
 
896
 
int FilesystemEngine::doRenameTable(Session&, const identifier::Table &from, const identifier::Table &to)
 
896
int FilesystemEngine::doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to)
897
897
{
898
898
  if (rename_file_ext(from.getPath().c_str(), to.getPath().c_str(), FILESYSTEM_EXT))
899
899
    return errno;
907
907
}
908
908
 
909
909
int FilesystemEngine::doCreateTable(Session &,
910
 
                                    Table&,
911
 
                                    const drizzled::identifier::Table &identifier,
912
 
                                    drizzled::message::Table &proto)
 
910
                        Table&,
 
911
                        const drizzled::TableIdentifier &identifier,
 
912
                        drizzled::message::Table &proto)
913
913
{
914
914
  FormatInfo format;
915
915
  format.parseFromTable(&proto);
956
956
  "Filesystem Engine",
957
957
  PLUGIN_LICENSE_GPL,
958
958
  filesystem_init_func, /* Plugin Init */
959
 
  NULL,                       /* depends */
 
959
  NULL,                       /* system variables                */
960
960
  NULL                        /* config options                  */
961
961
}
962
962
DRIZZLE_DECLARE_PLUGIN_END;