public int selectCount(string tableName, string column, SelectOptions options) { //return (int)select(tableName, String.Format("COUNT({0})", column), options); return 0; }
public bool tableExists(string tableName) { SelectOptions options = new SelectOptions(); options.where = String.Format("type='table' and name='{0}'", tableName); try { string name = tableGetString(select("sqlite_master", "name", options, true), "name"); return true; } catch { return false; } }
public DataTable selectColumns(string tableName, string[] columns, SelectOptions options) { return select(tableName, String.Join(", ", columns), options); }
public DataTable selectColumn(string tableName, string column, SelectOptions options) { return select(tableName, column, options); }
public DataTable selectAll(string tableName, SelectOptions options) { return select(tableName, "*", options); }
/* * SELECT methods. */ public DataTable select(string tableName, string columns, SelectOptions options, bool skipExistCheck = false) { if (!skipExistCheck && !tableExists(tableName)) throw new InvalidOperationException(String.Format("Table '{0}' does not exist", tableName)); string commandText = String.Format("SELECT {0} FROM {1} {2};", columns, tableName, options.toString()); /*DataTable result = new DataTable(); using (SQLiteCommand command = conn.CreateCommand()) { command.CommandText = commandText; SQLiteDataReader reader = command.ExecuteReader(); result.Load(reader); } return result;*/ return executeSQLString(commandText); }
public Migration(string type, string tableName, string[] fields, object[] values, SelectOptions selectoptions = null, string where = "") { this.type = type; this.tableName = tableName; if (fields != null) this.fields = new List<string>(fields); if (values != null) this.values = new List<object>(values); this.selectoptions = selectoptions; this.where = where; }