Method: ActiveOrient::OrientDB#create_database

Defined in:
lib/rest.rb

#create_database(type: 'plocal', database: @database) ⇒ Object

Creates a database with the given name and switches to this database as working-database Types are either ‘plocal’ or ‘memory’

returns the name of the working-database



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/rest.rb', line 123

def create_database type: 'plocal' , database: @database 
  logger.progname = 'OrientDB#CreateDatabase'
	  old_d = @database
	  @classes = []
	  @database = database
	  begin
      response = @res[database_uri{ type }].post  ""
	  if response.code == 200
 logger.info{ "Database #{@database} successfully created and stored as working database"}
	  else
 @database = old_d
 logger.error{ "Database #{name} was NOT created. Working Database is still #{@database} "}
	  end
	  rescue RestClient::InternalServerError => e
 @database = old_d
 logger.error{ "Database #{name} was NOT created. Working Database is still #{@database} "}
	  end
	  @database

end