public FNodeDynamicRef(FNode Parent, FNode Index, CellAffinity Affinity, Register MemoryRef) : base(Parent, FNodeAffinity.FieldRefNode) { this._idx = Index; this._affinity = Affinity; this._memory = MemoryRef; }
/// <summary> /// Creates a 32 bit numeric cell /// </summary> /// <param name="AWValue">A .Net double or Double</param> public Cell(float Value) : this() { this.SINGLE = Value; this.AFFINITY = CellAffinity.SINGLE; this.NULL = 0; }
public static FNode Generate(FNode Parent, Func<Cell[], Cell> Delegate, int Parameters, CellAffinity ReturnAffinity, string ToString) { CellFunction f = new CellFunction(ToString, Parameters, Delegate, ReturnAffinity, (x,y) => { return ToString; }); return new FNodeResult(Parent, f); }
/// <summary> /// Creates a boolean cell /// </summary> /// <param name="AWValue">A .Net bool</param> public Cell(bool Value) : this() { this.BOOL = Value; this.AFFINITY = CellAffinity.BOOL; this.NULL = 0; }
/// <summary> /// Creates a 8 bit integer cell /// </summary> /// <param name="AWValue">A .Net long or int8</param> public Cell(byte Value) : this() { this.BYTE = Value; this.AFFINITY = CellAffinity.BYTE; this.NULL = 0; }
/// <summary> /// Creates a 64 bit date-time cell /// </summary> /// <param name="AWValue">A .Net DateTime</param> public Cell(DateTime Value) : this() { this.DATE = Value; this.AFFINITY = CellAffinity.DATE_TIME; this.NULL = 0; }
/// <summary> /// /// </summary> /// <param name="AWValue"></param> /// <param name="Affinity"></param> internal Cell(ulong Value, CellAffinity Affinity) : this() { this.AFFINITY = Affinity; this.ULONG = Value; this.NULL = 0; }
/// <summary> /// Creates a 16 bit integer cell /// </summary> /// <param name="AWValue">A .Net long or int16</param> public Cell(short Value) : this() { this.SHORT = Value; this.AFFINITY = CellAffinity.SHORT; this.NULL = 0; }
/// <summary> /// /// </summary> /// <param name="AWValue"></param> public Cell(string Value) : this() { // Set the affinity // this.AFFINITY = CellAffinity.CSTRING; // Handle null strings // if (Value == null) { this.CSTRING = "\0"; this.NULL = 1; return; } // Fix the values if (Value.Length == 0) // fix instances that are zero length { Value = "\0"; } else if (Value.Length >= MAX_STRING_LENGTH) // Fix strings that are too long { Value = Value.Substring(0, MAX_STRING_LENGTH); } this.CSTRING = Value; this.NULL = 0; this.INT_A = Value.GetHashCode(); this.INT_B = Value.Length; }
/// <summary> /// Creates a 64 bit integer cell /// </summary> /// <param name="AWValue">A .Net long or int64</param> public Cell(long Value) : this() { this.LONG = Value; this.AFFINITY = CellAffinity.LONG; this.NULL = 0; }
/// <summary> /// Creates a 64 bit numeric cell /// </summary> /// <param name="AWValue">A .Net double or Double</param> public Cell(double Value) : this() { this.DOUBLE = Value; this.AFFINITY = CellAffinity.DOUBLE; this.NULL = 0; }
/// <summary> /// Creates a 32 bit integer cell /// </summary> /// <param name="AWValue">A .Net long or int32</param> public Cell(int Value) : this() { this.INT = Value; this.AFFINITY = CellAffinity.INT; this.NULL = 0; }
public override Expression VisitEXPR_ExpressionType([NotNull] S_ScriptParser.EXPR_ExpressionTypeContext context) { CellAffinity a = CellAffinity.VARIANT; if (context.type().T_BOOL() != null) { a = CellAffinity.BOOL; } else if (context.type().T_DATE() != null) { a = CellAffinity.DATE_TIME; } else if (context.type().T_BYTE() != null) { a = CellAffinity.BYTE; } else if (context.type().T_SHORT() != null) { a = CellAffinity.SHORT; } else if (context.type().T_INT() != null) { a = CellAffinity.INT; } else if (context.type().T_LONG() != null) { a = CellAffinity.LONG; } else if (context.type().T_SINGLE() != null) { a = CellAffinity.SINGLE; } else if (context.type().T_DOUBLE() != null) { a = CellAffinity.DOUBLE; } else if (context.type().T_BINARY() != null) { a = CellAffinity.BINARY; } else if (context.type().T_BSTRING() != null) { a = CellAffinity.BSTRING; } else if (context.type().T_CSTRING() != null) { a = CellAffinity.CSTRING; } else if (context.type().T_TABLE() != null) { a = CellAffinity.TREF; } else if (context.type().T_ARRAY() != null) { a = CellAffinity.ARRAY; } return(new Expression.Literal(this._Host, this._Master, new Cell((int)a))); }
public FNodeFieldRef(FNode Parent, int Index, CellAffinity Affinity, int FSize, Register MemoryRef) : base(Parent, FNodeAffinity.FieldRefNode) { this._idx = Index; this._affinity = Affinity; this._memory = MemoryRef; this._size = FSize; }
public FNodePointer(FNode Parent, string RefName, CellAffinity Type, int Size) : base(Parent, FNodeAffinity.PointerNode) { this._Type = Type; this._NameID = RefName; this._name = RefName; this._Size = Schema.FixSize(Type, Size); }
public FNodeHeapRef(FNode Parent, MemoryStruct Heap, int DirectRef, CellAffinity ReturnType) : base(Parent, FNodeAffinity.HeapRefNode) { this._Pointer = DirectRef; this._Heap = Heap; this._ReturnType = ReturnType; this._name = Heap.Scalars.Name(DirectRef); }
// -- Auto Casts -- // /// <summary> /// Creates a 64 bit integer cell /// </summary> /// <param name="ValueA">A .Net 32 bit integer that will make up the first 4 bytes of integer</param> /// <param name="ValueB"></param> internal Cell(int ValueA, int ValueB) : this() { // Set these values // this.INT_A = ValueA; this.INT_B = ValueB; this.AFFINITY = CellAffinity.LONG; this.NULL = 0; }
public override Cell Evaluate(SpoolSpace Memory) { this.CheckParameters(); Cell c = this._Children[0].Evaluate(Memory); Cell d = this._Children[1].Evaluate(Memory); CellAffinity a = (CellAffinity)d.BYTE; return(CellConverter.Cast(c, a)); }
public override CellAffinity TypeOf() { CellAffinity x = this.Children[0].TypeOf(); if (x == CellAffinity.ARRAY) { return(CellAffinity.VARIANT); } return(x); }
public override int SizeOf() { CellAffinity x = this.Children[0].TypeOf(); if (x == CellAffinity.ARRAY) { return(base.SizeOf()); } return(this.Children[0].SizeOf()); }
/// <summary> /// Creats a BINARY cell /// </summary> /// <param name="AWValue">A .Net array of bytes</param> public Cell(byte[] Value) : this() { this.BINARY = Value; this.NULL = 0; this.AFFINITY = CellAffinity.BINARY; for (int i = 0; i < Value.Length; i++) { this.INT_A += Value[i] * i; } this.INT_A = this.INT_A ^ Value.Length; this.INT_B = Value.Length; }
public static Cell Max(CellAffinity Affinty) { if (Affinty == CellAffinity.VARIANT) { throw new Exception("The variant affinity is invalid"); } switch (Affinty) { case CellAffinity.BOOL: return(MaxBOOL); case CellAffinity.DATE_TIME: return(MaxDATE); case CellAffinity.BYTE: return(MaxBYTE); case CellAffinity.SHORT: return(MaxSHORT); case CellAffinity.INT: return(MaxINT); case CellAffinity.LONG: return(MaxLONG); case CellAffinity.SINGLE: return(MaxSINGLE); case CellAffinity.DOUBLE: return(MaxDOUBLE); case CellAffinity.BINARY: return(MaxBLOB); case CellAffinity.BSTRING: return(MaxBSTRING); case CellAffinity.CSTRING: return(MaxCSTRING); case CellAffinity.TREF: return(MaxTREF); case CellAffinity.ARRAY: return(MaxARRAY); } throw new Exception(string.Format("Affinity '{0}' is invalid", Affinty)); }
/// <summary> /// /// </summary> /// <param name="Value"></param> /// <param name="Affinity"></param> /// <returns></returns> public static Cell Parse(string Value, CellAffinity Affinity) { if (Affinity == CellAffinity.VARIANT) { throw new Exception("The variant affinity is invalid"); } if (Value == null || string.Compare(Cell.NULL_STRING_TEXT, Value, true) == 0) { return(CellValues.Null(Affinity)); } switch (Affinity) { case CellAffinity.BOOL: return(ParseBOOL(Value)); case CellAffinity.DATE_TIME: return(ParseDATE(Value)); case CellAffinity.BYTE: return(ParseBYTE(Value)); case CellAffinity.SHORT: return(ParseSHORT(Value)); case CellAffinity.INT: return(ParseINT(Value)); case CellAffinity.LONG: return(ParseLONG(Value)); case CellAffinity.SINGLE: return(ParseSINGLE(Value)); case CellAffinity.DOUBLE: return(ParseDOUBLE(Value)); case CellAffinity.BINARY: return(ParseBINARY(Value)); case CellAffinity.BSTRING: return(ParseBSTRING(Value)); case CellAffinity.CSTRING: return(ParseCSTRING(Value)); } throw new Exception(string.Format("Affinity '{0}' is invalid", Affinity)); }
/// <summary> /// Create a cell matrix from another matrix, effectively cloning the matrix /// </summary> /// <param name="A"></param> public CellMatrix(CellMatrix A) { // Build Matrix // this._Rows = A._Rows; this._Columns = A._Columns; this._Data = new Cell[this._Rows, this._Columns]; for (int i = 0; i < this._Rows; i++) for (int j = 0; j < this._Columns; j++) this._Data[i, j] = A[i, j]; this._Affinity = A.Affinity; }
/// <summary> /// /// </summary> /// <param name="Value"></param> public Cell(Expression Value) : this() { this.AFFINITY = CellAffinity.EQUATION; // Handle nulls // if (Value == null) { this.NULL = 1; this.EQUATION = null; return; } this.EQUATION = Value; }
/// <summary> /// /// </summary> /// <param name="AWValue"></param> public Cell(CellArray Value) : this() { // Set the affinity // this.AFFINITY = CellAffinity.ARRAY; // Handle null strings // if (Value == null) { this.NULL = 1; this.ARRAY = new CellArray(); return; } this.ARRAY = Value; }
public static Cell Zero(CellAffinity Affinty) { if (Affinty == CellAffinity.VARIANT) { throw new Exception("The variant affinity is invalid"); } switch (Affinty) { case CellAffinity.BYTE: return(ZeroBYTE); case CellAffinity.SHORT: return(ZeroSHORT); case CellAffinity.INT: return(ZeroINT); case CellAffinity.LONG: return(ZeroLONG); case CellAffinity.SINGLE: return(ZeroSINGLE); case CellAffinity.DOUBLE: return(ZeroDOUBLE); case CellAffinity.DATE_TIME: return(ZeroDATE); case CellAffinity.BINARY: return(ZeroBLOB); case CellAffinity.BSTRING: return(ZeroBSTRING); case CellAffinity.CSTRING: return(ZeroCSTRING); case CellAffinity.TREF: return(ZeroTREF); case CellAffinity.ARRAY: return(ZeroARRAY); } throw new Exception(string.Format("Affinity '{0}' is invalid", Affinty)); }
/// <summary> /// Casts a cell to a given affinity /// </summary> /// <param name="AWValue"></param> /// <param name="Affinity"></param> /// <returns></returns> public static Cell Cast(Cell Value, CellAffinity Affinity) { if (Affinity == CellAffinity.VARIANT) { throw new Exception("Cannot cast to a variant"); } switch (Affinity) { case CellAffinity.BOOL: return(ToBOOL(Value)); case CellAffinity.DATE_TIME: return(ToDATE_TIME(Value)); case CellAffinity.BYTE: return(ToBYTE(Value)); case CellAffinity.SHORT: return(ToSHORT(Value)); case CellAffinity.INT: return(ToINT(Value)); case CellAffinity.LONG: return(ToLONG(Value)); case CellAffinity.SINGLE: return(ToFLOAT(Value)); case CellAffinity.DOUBLE: return(ToDOUBLE(Value)); case CellAffinity.BINARY: return(ToBINARY(Value)); case CellAffinity.BSTRING: return(ToBSTRING(Value)); case CellAffinity.CSTRING: return(ToCSTRING(Value)); case CellAffinity.EQUATION: return(ToEQUATION(Value)); } throw new Exception(string.Format("Affinity '{0}' is invalid", Affinity)); }
/// <summary> /// Returns the highest precedence data type /// </summary> /// <param name="A1">First type to compare</param> /// <param name="A2">Second type to compare</param> /// <returns>The highest cell precedence</returns> public static CellAffinity Highest(CellAffinity A1, CellAffinity A2) { if (A1 == CellAffinity.STRING || A2 == CellAffinity.STRING) return CellAffinity.STRING; else if (A1 == CellAffinity.BLOB || A2 == CellAffinity.BLOB) return CellAffinity.BLOB; else if (A1 == CellAffinity.DOUBLE || A2 == CellAffinity.DOUBLE) return CellAffinity.DOUBLE; else if (A1 == CellAffinity.INT || A2 == CellAffinity.INT) return CellAffinity.INT; else if (A1 == CellAffinity.DATE_TIME || A2 == CellAffinity.DATE_TIME) return CellAffinity.DATE_TIME; else return CellAffinity.BOOL; }
/// <summary> /// /// </summary> /// <param name="Affinity"></param> /// <param name="Length"></param> /// <returns></returns> public static int FixLength(CellAffinity Affinity, int Length) { switch (Affinity) { case CellAffinity.BOOL: return(BOOL_SIZE); case CellAffinity.BYTE: return(BYTE_SIZE); case CellAffinity.SHORT: return(SHORT_SIZE); case CellAffinity.INT: return(INT_SIZE); case CellAffinity.SINGLE: return(FLOAT_SIZE); case CellAffinity.LONG: return(LONG_SIZE); case CellAffinity.DOUBLE: return(DOUBLE_SIZE); case CellAffinity.DATE_TIME: return(DATE_SIZE); case CellAffinity.BINARY: return(Math.Min(Length, MAX_BINARY_LEN)); case CellAffinity.BSTRING: return(Math.Min(Length, MAX_BSTRING_LEN)); case CellAffinity.CSTRING: case CellAffinity.TREF: case CellAffinity.VARIANT: return(Math.Min(Length, MAX_CSTRING_LEN)); case CellAffinity.ARRAY: return(Math.Min(Length, MAX_ARRAY_LEN)); default: throw new Exception(); } }
// Protected // protected Tuple <CellAffinity, int> SizeTypeOf(List <Expression> Xs) { int MaxSize = -1; CellAffinity MaxAffinity = CellAffinity.BOOL; foreach (Expression x in Xs) { CellAffinity ca = x.TypeOf(); MaxAffinity = CellAffinityHelper.Highest(MaxAffinity, ca); if (MaxAffinity == ca) { MaxSize = Math.Max(MaxSize, x.SizeOf()); } } return(new Tuple <CellAffinity, int>(MaxAffinity, MaxSize)); }
/// <summary> /// Returns the lowest precedence data type /// </summary> /// <param name="Affinity">A collection of cell afffinities</param> /// <returns>The lowest cell precedence</returns> public static CellAffinity Lowest(IEnumerable <CellAffinity> Affinity) { if (Affinity.Count() == 0) { return(CellAffinity.CSTRING); } else if (Affinity.Count() == 1) { return(Affinity.First()); } CellAffinity a = CellAffinity.CSTRING; foreach (CellAffinity b in Affinity) { a = CellAffinityHelper.Lowest(a, b); } return(a); }
/// <summary> /// Returns the highest precedence data type /// </summary> /// <param name="Affinity">A collection of cell afffinities</param> /// <returns>The highest cell precedence</returns> public static CellAffinity Highest(IEnumerable <CellAffinity> Affinity) { if (Affinity.Count() == 0) { return(CellAffinity.BOOL); } else if (Affinity.Count() == 1) { return(Affinity.First()); } CellAffinity a = CellAffinity.BOOL; foreach (CellAffinity b in Affinity) { a = CellAffinityHelper.Highest(a, b); } return(a); }
// Constructors // /// <summary> /// Create a matrix with a default value /// </summary> /// <param name="Rows"></param> /// <param name="Columns"></param> /// <param name="Value"></param> public CellMatrix(int Rows, int Columns, Cell Value) { // Check to see if the rows and columns are valid // if (Rows < 1 || Columns < 1) { throw new Exception("Row " + Rows.ToString() + " or column " + Columns.ToString() + " submitted is invalid"); } // Build Matrix // this._Rows = Rows; this._Columns = Columns; this._Data = new Cell[this._Rows, this._Columns]; for (int i = 0; i < this._Rows; i++) for (int j = 0; j < this._Columns; j++) this._Data[i, j] = Value; this._Affinity = Value.AFFINITY; }
/// <summary> /// /// </summary> /// <param name="Affinity"></param> /// <param name="Length"></param> /// <returns></returns> public static int Length(CellAffinity Affinity, int Length) { switch (Affinity) { case CellAffinity.BOOL: return(BOOL_SIZE); case CellAffinity.BYTE: return(BYTE_SIZE); case CellAffinity.SHORT: return(SHORT_SIZE); case CellAffinity.INT: return(INT_SIZE); case CellAffinity.SINGLE: return(FLOAT_SIZE); case CellAffinity.LONG: return(LONG_SIZE); case CellAffinity.DOUBLE: return(DOUBLE_SIZE); case CellAffinity.DATE_TIME: return(DATE_SIZE); case CellAffinity.BINARY: case CellAffinity.BSTRING: case CellAffinity.CSTRING: case CellAffinity.ARRAY: case CellAffinity.TREF: case CellAffinity.EQUATION: return(Length); default: throw new Exception(); } }
/// <summary> /// /// </summary> /// <param name="Names"></param> /// <param name="Types"></param> /// <returns></returns> public static Schema FromString(string Names, string Types) { string[] NameArray = Names.Split(','); string[] TypeArray = Types.Split(','); if (NameArray.Length != TypeArray.Length) { throw new ArgumentException("The name and type tags have different counts"); } Schema columns = new Schema(); for (int i = 0; i < NameArray.Length; i++) { string[] x = TypeArray[i].Split('.'); CellAffinity t = CellAffinityHelper.Parse(x[0]); int size = 8; if (t == CellAffinity.CSTRING && x.Length == 2) { size = int.Parse(x[1]); } else if (t == CellAffinity.CSTRING) { size = Schema.DEFAULT_STRING_SIZE; } else if (t == CellAffinity.BINARY && x.Length == 2) { size = int.Parse(x[1]); } else if (t == CellAffinity.BINARY) { size = Schema.DEFAULT_BLOB_SIZE; } columns.Add(NameArray[i], t, size); } return(columns); }
public static CellArray Identity(int Dimension, CellAffinity Type) { if (!CellAffinityHelper.IsNumeric(Type)) { return(new CellArray()); } Cell zero = CellValues.Zero(Type); Cell one = CellValues.One(Type); CellArray x = CellArray.Matrix(Dimension, Dimension); for (int i = 0; i < Dimension; i++) { for (int j = 0; j < Dimension; j++) { x[i].ARRAY[j] = (i == j ? one : zero); } } return(x); }
// Adds // /// <summary> /// Adds a column to the schema; will throw an exception if a column name passed already exists in the schema /// </summary> /// <param name="Alias">The column name</param> /// <param name="Affinity">The column affinity</param> /// <param name="Nullable">A boolean, true means the column can be nulls, false means the column cannot be null</param> /// <param name="PageSize">The size in bytes; this will be ignored if the affinity is not variable (not string or blob)</param> public void Add(string Name, CellAffinity Affinity, int Size, bool Nullable) { // Check the name size // if (Name.Length > MAX_COLUMN_NAME_LEN) { Name = Name.Substring(0, MAX_COLUMN_NAME_LEN); } // Check the size // if (CellAffinityHelper.IsVariableLength(Affinity) && Size == 0) { throw new Exception("Variable length types must have a size greater than zero"); } // Check if exists // if (this.Contains(Name)) { throw new Exception("Column already exists: " + Name); } // Check for capacity // if (this.Count >= MAX_COLUMNS) { throw new Exception("Schema cannot accept any more columns"); } // Get the size // int v = CellSerializer.FixLength(Affinity, Size); // Build record // Record r = Record.Stitch(new Cell(Name), new Cell((byte)Affinity), new Cell(Nullable), new Cell(v)); // Accumulate record // this._Cache.Allocate(Name, r); // Hash code // this._HashCode += r.GetHashCode(new Key(1, 2)) * this.Count; }
public static CellVector Parse(string Text, CellAffinity Affinity) { string[] values = Text.Split(','); CellVector v = new CellVector(values.Length, Affinity); for (int i = 0; i < values.Length; i++) { v[i] = Cell.Parse(values[i], Affinity); } return v; }
public CellVector(int RowCount, CellAffinity Affinity) : base(RowCount, COLUMN_COUNT, Affinity) { }
public static FNode Value(CellAffinity Value) { return new FNodeValue(null, new Cell(Value)); }
// Fields // public static FNode Field(int Index, CellAffinity Type, int Size, Register Memory) { return new FNodeFieldRef(null, Index, Type, Size, Memory); }
public MNodeIdentity(MNode Parent, int Size, CellAffinity Type) : base(Parent) { this._Size = Size; this._Type = Type; }
/// <summary> /// Adds a column to the schema; will throw an exception if a column name passed already exists in the schema; assumes the column is nullable; assumes a default type size /// </summary> /// <param name="Name">The column name</param> /// <param name="Affinity">The column affinity</param> public void Add(string Name, CellAffinity Affinity) { this.Add(Name, Affinity, true, -1); }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return Sizes.First(); // 1 byte = 1 chars for utf 8 }
public CellFuncFixedKnown(string Name, int Params, CellAffinity RType) : base(Name, Params, null, RType, CellFunction.FunctionStringBuilder(Name)) { }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return 6; // DOUBLE is the longest type name }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return Sizes.First() / 2; // divide by 2 because two bytes == 1 char }
// Adds // /// <summary> /// Adds a column to the schema; will throw an exception if a column name passed already exists in the schema /// </summary> /// <param name="Name">The column name</param> /// <param name="Affinity">The column affinity</param> /// <param name="Nullable">A boolean, true means the column can be nulls, false means the column cannot be null</param> /// <param name="Size">The size in bytes; this will be ignored if the affinity is not variable (not string or blob)</param> public void Add(string Name, CellAffinity Affinity, bool Nullable, int Size) { // Check if exists // if (this.Contains(Name)) throw new Exception("Column already exists: " + Name); // Get the size // Size = FixSize(Affinity, Size); // Build record // Record r = Record.Stitch(new Cell(Name), new Cell((byte)Affinity), new Cell(Nullable), new Cell(Size)); // Add record // this._Cache.Add(r); // Hash code // this._HashCode += r.GetHashCode(new Key(1,2)) * this.Count; }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return Sizes.First() * 2; // 1 byte = 2 chars }
public virtual int ReturnSize(CellAffinity Type, params int[] Sizes) { if (Type == CellAffinity.BOOL) return 1; if (Type == CellAffinity.DATE_TIME || Type == CellAffinity.DOUBLE || Type == CellAffinity.INT) return 8; if (this._size != -1) return this._size; return Sizes.Length == 0 ? Schema.FixSize(Type,-1) : Sizes.First(); }
public static CellVector ForEach(CellVector A, Func<Cell, Cell> Delegate, CellAffinity ReturnType) { CellVector B = new CellVector(A.Count, ReturnType); for (int i = 0; i < A.Count; i++) { B[i] = Delegate(A[i]); } return B; }
public CellFunction(string Sig, int Params, Func<Cell[], Cell> Action, CellAffinity RType, Func<string[], Schema, string> SBuilder) : this(Sig, Params, Action, CellFunction.FuncHierValue(RType), SBuilder) { }
public CellFunction(string Sig, int Params, Func<Cell[], Cell> Action, CellAffinity RType) : this(Sig, Params, Action, CellFunction.FuncHierValue(RType)) { }
/// <summary> /// Fixes a (potentially) invalid column size passed /// </summary> /// <param name="Affinity">The desired affinity</param> /// <param name="Size">The initial size</param> /// <returns>The fixed size</returns> public static int FixSize(CellAffinity Affinity, int Size) { if (Affinity == CellAffinity.BOOL) Size = 1; else if (Affinity == CellAffinity.DATE_TIME || Affinity == CellAffinity.DOUBLE || Affinity == CellAffinity.INT) Size = 8; else if (Size < 0 && Affinity == CellAffinity.STRING) Size = DEFAULT_STRING_SIZE; else if (Size < 0 && Affinity == CellAffinity.BLOB) Size = DEFAULT_BLOB_SIZE; else if (Size > MAX_VARIABLE_SIZE) Size = MAX_VARIABLE_SIZE; return Size; }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return base.ReturnSize(Type, Sizes); }
/// <summary> /// Adds a column to the schema; will throw an exception if a column name passed already exists in the schema; assumes the column is nullable /// </summary> /// <param name="Name">The column name</param> /// <param name="Affinity">The column affinity</param> /// <param name="Size">The size in bytes; this will be ignored if the affinity is not variable (not string or blob)</param> public void Add(string Name, CellAffinity Affinity, int Size) { this.Add(Name, Affinity, false, Size); }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return 16; // GUIDs are 16 bytes }
public override int ReturnSize(CellAffinity Type, params int[] Sizes) { return Sizes.First(); }
public static FNode Field(int Index, CellAffinity Type) { return Field(Index, Type, Schema.FixSize(Type, -1), null); }