public SQLiteColumn(string name, SQLiteDataType type, bool notNull = false, object defaultValue = null) { Type = type ?? throw new ArgumentNullException(nameof(type)); Name = name ?? throw new ArgumentNullException(nameof(name)); NotNull = notNull; DefaultValue = defaultValue; }
public SQLiteTableHelper(SQLiteConnection dbConnection, string tableName) { this.DbConnection = dbConnection; TableName = tableName ?? throw new ArgumentNullException(nameof(tableName)); DataTable dt = DbConnection.Query($"Pragma Table_Info({ TableName})"); //for (int i = 0; i < 6; i++) //{ // Debug.WriteLine(dt.Rows[0].ItemArray[i].GetType()); //} Columns = dt.Rows.Cast <DataRow>() .Select(p => new SQLiteColumn(p["name"] as string, SQLiteDataType.Parse(p["type"] as string), p["notnull"].Equals(1), p["dflt_value"])).ToArray(); Rows = new SQLiteRowCollection(dbConnection, tableName, this); }
public SQLiteData(object value, string columnName, SQLiteDataType type) : this(value, new SQLiteColumn(columnName, type)) { }