2using System.Collections.Generic;
50 return "Data Source=" + m_ci.
Server +
";Initial Catalog=" + strName +
";Integrated Security=True; MultipleActiveResultSets=True;";
70 SqlDataReader reader = cmdQuery.ExecuteReader();
74 nResult = reader.GetInt32(0);
80 catch (Exception excpt)
85 bExists = (nResult == 1) ?
true :
false;
105 catch (Exception excpt)
122 SqlConnection connection;
135 throw new Exception(
"Database already exists!");
138 SqlCommand cmdCreate;
142 cmdCreate =
new SqlCommand(strCmd, connection);
143 cmdCreate.CommandTimeout = 120;
144 cmdCreate.ExecuteNonQuery();
154 catch (Exception excpt)
169 SqlConnection connection;
176 catch (Exception excpt)
178 Trace.WriteLine(
"ERROR: Creating temporal tables - " + excpt.Message);
189 protected virtual void createTables(SqlConnection connection,
bool bFullCreate,
bool bUpdateOnly,
bool bTemporalOnly =
false)
191 SqlCommand cmdCreate;
195 cmdCreate =
new SqlCommand(Properties.Resources.CreateDatasetGroupsTable, connection);
196 cmdCreate.ExecuteNonQuery();
199 cmdCreate =
new SqlCommand(Properties.Resources.CreateDatasetsTable, connection);
200 cmdCreate.ExecuteNonQuery();
203 cmdCreate =
new SqlCommand(Properties.Resources.CreateDatasetParametersTable, connection);
204 cmdCreate.ExecuteNonQuery();
207 cmdCreate =
new SqlCommand(Properties.Resources.CreateLabelsTable, connection);
208 cmdCreate.ExecuteNonQuery();
211 cmdCreate =
new SqlCommand(Properties.Resources.CreateLabelBoostsTable, connection);
212 cmdCreate.ExecuteNonQuery();
215 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImageGroupsTable, connection);
216 cmdCreate.ExecuteNonQuery();
219 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImageMeansTable, connection);
220 cmdCreate.ExecuteNonQuery();
223 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImageResultsTable, connection);
224 cmdCreate.ExecuteNonQuery();
227 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImageParametersTable, connection);
228 cmdCreate.ExecuteNonQuery();
231 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImagesTable, connection);
232 cmdCreate.ExecuteNonQuery();
235 cmdCreate =
new SqlCommand(Properties.Resources.CreateSourcesTable, connection);
236 cmdCreate.ExecuteNonQuery();
239 cmdCreate =
new SqlCommand(Properties.Resources.CreateSourceParametersTable, connection);
240 cmdCreate.ExecuteNonQuery();
243 cmdCreate =
new SqlCommand(Properties.Resources.CreateModelGroupsTable, connection);
244 cmdCreate.ExecuteNonQuery();
249 cmdCreate =
new SqlCommand(Properties.Resources.CreateDatasetCreatorsTable, connection);
250 cmdCreate.ExecuteNonQuery();
255 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawValuesTable, connection);
256 cmdCreate.ExecuteNonQuery();
259 cmdCreate =
new SqlCommand(Properties.Resources.CreateValueStreamsTable, connection);
260 cmdCreate.ExecuteNonQuery();
263 cmdCreate =
new SqlCommand(Properties.Resources.CreateValueItemsTable, connection);
264 cmdCreate.ExecuteNonQuery();
269 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImageIndex, connection);
270 cmdCreate.ExecuteNonQuery();
273 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawImageIndex2, connection);
274 cmdCreate.ExecuteNonQuery();
277 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawValuesIndex, connection);
278 cmdCreate.ExecuteNonQuery();
281 cmdCreate =
new SqlCommand(Properties.Resources.CreateRawValuesIndex2, connection);
282 cmdCreate.ExecuteNonQuery();
285 cmdCreate =
new SqlCommand(Properties.Resources.UpdateRawImageResultsTable, connection);
286 cmdCreate.ExecuteNonQuery();
289 cmdCreate =
new SqlCommand(Properties.Resources.UpdateRawImageResultsTable2, connection);
290 cmdCreate.ExecuteNonQuery();
301 SqlCommand cmdCreate;
303 cmdCreate =
new SqlCommand(
"DROP TABLE DatasetGroups", connection);
304 cmdCreate.ExecuteNonQuery();
307 cmdCreate =
new SqlCommand(
"DROP TABLE Datasets", connection);
308 cmdCreate.ExecuteNonQuery();
311 cmdCreate =
new SqlCommand(
"DROP TABLE DatasetParameters", connection);
312 cmdCreate.ExecuteNonQuery();
315 cmdCreate =
new SqlCommand(
"DROP TABLE Labels", connection);
316 cmdCreate.ExecuteNonQuery();
319 cmdCreate =
new SqlCommand(
"DROP TABLE LabelBoosts", connection);
320 cmdCreate.ExecuteNonQuery();
323 cmdCreate =
new SqlCommand(
"DROP TABLE RawImageGroups", connection);
324 cmdCreate.ExecuteNonQuery();
327 cmdCreate =
new SqlCommand(
"DROP TABLE RawImageMeans", connection);
328 cmdCreate.ExecuteNonQuery();
331 cmdCreate =
new SqlCommand(
"DROP TABLE RawImages", connection);
332 cmdCreate.ExecuteNonQuery();
335 cmdCreate =
new SqlCommand(
"DROP TABLE RawImageParameters", connection);
336 cmdCreate.ExecuteNonQuery();
339 cmdCreate =
new SqlCommand(
"DROP TABLE Sources", connection);
340 cmdCreate.ExecuteNonQuery();
343 cmdCreate =
new SqlCommand(
"DROP TABLE SourceParameters", connection);
344 cmdCreate.ExecuteNonQuery();
347 cmdCreate =
new SqlCommand(
"DROP TABLE ModelGroups", connection);
348 cmdCreate.ExecuteNonQuery();
351 cmdCreate =
new SqlCommand(
"DROP TABLE RawValues", connection);
352 cmdCreate.ExecuteNonQuery();
355 cmdCreate =
new SqlCommand(
"DROP TABLE ValueStreams", connection);
356 cmdCreate.ExecuteNonQuery();
359 cmdCreate =
new SqlCommand(
"DROP TABLE Items", connection);
360 cmdCreate.ExecuteNonQuery();
371 string strCmd = Properties.Resources.QueryDatabaseExists;
373 strCmd = strCmd.Replace(
"%DBNAME%", strName);
386 string strCmd = Properties.Resources.CreateDatabase;
388 while (strCmd.Contains(
"%DBNAME%"))
390 strCmd = strCmd.Replace(
"%DBNAME%", strName);
393 while (strCmd.Contains(
"%PATH%"))
395 strCmd = strCmd.Replace(
"%PATH%", strPath);
The ConnectInfo class specifies the server, database and username/password used to connect to a datab...
string Server
Get/set the server.
string Database
Get/set the database.
The DatabaseManagement class is used to create the image database.
string GetConnectionString(string strName)
Returns the connection string used to connect to the database named 'strName'.
string getQueryDatabaseCmd(string strName)
Returns the query database command.
Exception DatabaseExists(out bool bExists)
Queries whether or not the database exists.
void CreateTemporalTables()
Create the temporal tables.
string getCreateDatabaseCmd(string strName, string strPath)
Returns the create database command.
DatabaseManagement(ConnectInfo ci, string strPath="")
The DatabaseManagement constructor.
virtual void deleteTables(SqlConnection connection)
The deleteTables function deletes all tables except for the DatasetCreators table.
virtual void createTables(SqlConnection connection, bool bFullCreate, bool bUpdateOnly, bool bTemporalOnly=false)
The createTables function creates the tables of the database.
Exception PurgeDatabase()
The PurgeDatabase function delete the data from the database.
bool m_bUpdateDatabase
Specifies whether or not the database is just being updated or not.
Exception CreateDatabase(bool bUpdateDatabase=false)
The CreateDatabae creates a new instance of the database in Microsoft SQL.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.db.image namespace contains all image database related classes.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...