Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public SQLiteData(object value, string columnName, SQLiteDataType type) : this(value, new SQLiteColumn(columnName, type))
 {
 }