public void CreateElementTable <T>(string tableName) where T : DatabaseItem, new() { T dt = new T(); StringBuilder sbElements = new StringBuilder(); { bool justCreated = true; foreach (sqliteBase sElement in dt.values) { if (justCreated) { justCreated = false; } else { sbElements.Append(", "); } sbElements.Append(sElement.valueName + " " + sElement.dataType); } } string sql_command = "CREATE TABLE " + tableName + " ( " + sbElements.ToString() + ")"; SQLiteCommandsExecuter.executeNonQuery(sql_command, DCore.M_dbConnection); }
public List <T> ListIOElements <T>(string tableName) where T : DatabaseItem, new() { string sql = "select * from " + tableName + " order by _rowid_ ASC"; SQLiteDataReader reader = SQLiteCommandsExecuter.executeDataReader(sql, DCore.M_dbConnection); List <T> ioElems = ReaderToElements <T>(reader, tableName); return(ioElems); }
public T GetElement <T>(int objectID, string tableName) where T : DatabaseItem, new() { string sql = "select * from " + tableName + " where (" + elementID + "=" + objectID + ") order by _rowid_ ASC LIMIT 1"; SQLiteDataReader reader = SQLiteCommandsExecuter.executeDataReader(sql, DCore.M_dbConnection); T Objects = ReaderToElement <T>(reader, tableName); return(Objects); }
public void DelTable(string tableName) { string sql = "DROP TABLE " + tableName;; SQLiteCommandsExecuter.executeNonQuery(sql, M_dbConnection); }
public void DelElement(string tableName, sqliteInt rowID) { string sql = "DELETE FROM " + tableName + " WHERE " + rowID.valueName + " = " + rowID.value; SQLiteCommandsExecuter.executeNonQuery(sql, M_dbConnection); }