public override string GetTypeName(RDBMSCompiler compiler) { string t; if (Size < 2) { t = "TINYINT"; } else if (Size < 4) { t = "SMALLINT"; } else if (Size < 8) { t = "INT"; } else { t = "BIGINT"; } var u = ""; if (Unsigned) { u += " UNSIGNED"; } return("{0}({1}){2}".Args(t, Size, u)); }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { var enumLine = string.Join(", ", Values.Select(v => compiler.EscapeString(v.Trim()))); return(compiler.TransformKeywordCase("check ({0} in ({1}))") .Args( compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName), enumLine )); }
public override string GetTypeName(RDBMSCompiler compiler) { switch (compiler.Target) { case TargetType.PostgreSQL: return("DOUBLE"); case TargetType.Oracle: return("BINARY_DOUBLE"); case TargetType.MsSQLServer: return("DOUBLE"); default: return("NUMERIC(18,6)"); } }
public override string GetTypeName(RDBMSCompiler compiler) { switch (compiler.Target) { case TargetType.PostgreSQL: return("money"); case TargetType.Oracle: return("NUMBER(12,4)"); case TargetType.MsSQLServer: return("MONEY"); default: return("DECIMAL(12,4)"); } }
public override string GetTypeName(RDBMSCompiler compiler) { switch (compiler.Target) { case TargetType.MySQL: return("tinyint(1)"); case TargetType.PostgreSQL: return("boolean"); case TargetType.Oracle: return("char(1)"); case TargetType.MsSQLServer: return("bit"); default: return("char(1)"); } }
public override string GetColumnAutoGeneratedScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { switch (compiler.Target) { case TargetType.MySQL: return("AUTO_INCREMENT"); case TargetType.PostgreSQL: { var seq = "SEQ_{0}_{1}".Args(column.ParentEntity.TransformedShortName, column.TransformedShortName); outputs[RDBMSCompiler.SEQUENCES_OUTPUT].AppendLine("CREATE SEQUENCE {0} START 0;".Args(seq)); return("default nextval('{0}')".Args(seq)); } case TargetType.MsSQLServer: return("IDENTITY(1,1)"); default: return(string.Empty); } }
public const int MAX_LEN = 8; // So we can pack in ulong public override string GetTypeName(RDBMSCompiler compiler) { return("char({0})".Args(MAX_LEN)); }
public override string GetTypeName(RDBMSCompiler compiler) { return(Required ? "BINARY({0})".Args(MAX_LEN) : "VARBINARY({0})".Args(MAX_LEN)); }
public override string GetTypeName(RDBMSCompiler compiler) { return("int"); }
public override string GetTypeName(RDBMSCompiler compiler) { return "NUMBER({0},{1})".Args(Scale+4, Scale); }
public override string GetTypeName(RDBMSCompiler compiler) { return("INT({0})".Args(Size)); }
/// <summary> /// Returns true to indicate that column of this type is always required /// </summary> /// <param name="compiler">The context that the result depends on </param> public virtual bool?GetColumnRequirement(RDBMSCompiler compiler) => null;
public override string GetTypeName(RDBMSCompiler compiler) => "CHAR({0})".Args(Size);
public override string GetTypeName(RDBMSCompiler compiler) { return Required ? "BINARY(12)" : "VARBINARY(12)"; }
public override void TransformColumnName(RDBMSCompiler compiler, RDBMSEntity column) { column.TransformedName = "G_{0}".Args(column.TransformedName); }
public override string GetTypeName(RDBMSCompiler compiler) { return "BIGINT UNSIGNED"; }
public override string GetColumnAutoGeneratedScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { switch(compiler.Target) { case TargetType.MySQL: return "AUTO_INCREMENT"; case TargetType.PostgreSQL: { var seq = "SEQ_{0}_{1}".Args(column.ParentEntity.TransformedShortName, column.TransformedShortName); outputs[RDBMSCompiler.SEQUENCES_OUTPUT].AppendLine("CREATE SEQUENCE {0} START 0;".Args(seq)); return "default nextval('{0}')".Args(seq); } case TargetType.MsSQLServer: return "IDENTITY(1,1)"; default: return string.Empty; } }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { var enumLine = string.Join(", ", Values.Select(v => compiler.EscapeString( v.Trim() )) ); return compiler.TransformKeywordCase("check ({0} in ({1}))") .Args( compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName), enumLine ); }
public override string GetTypeName(RDBMSCompiler compiler) { return Type==DBCharType.Varchar ? "VARCHAR({0})".Args(Size) : "CHAR({0})".Args(Size); }
public override string GetTypeName(RDBMSCompiler compiler) { switch (compiler.Target) { case TargetType.PostgreSQL: return "DOUBLE"; case TargetType.Oracle: return "BINARY_DOUBLE"; case TargetType.MsSQLServer: return "DOUBLE"; default: return "NUMERIC(18,6)"; } }
/// <summary> /// Changes column name, i.e. adds prefix /// </summary> public virtual void TransformColumnName(RDBMSCompiler compiler, RDBMSEntity column) { }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return(compiler.TransformKeywordCase("check ({0} > 0 and {0} < 200)").Args(compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName))); }
/// <summary> /// Returns script for default values, may also emit compiler-specific object like sequence or generator or insert rows in some other table /// </summary> public virtual string GetColumnDefaultScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return(string.Empty); }
public override string GetTypeName(RDBMSCompiler compiler) { return("DATETIME"); }
/// <summary> /// Returns script for auto-generated values, may also emit compiler-specific object like sequence or generator /// </summary> public virtual string GetColumnAutoGeneratedScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) => string.Empty;
/////////// <summary> /////////// Returns true to indicate that column of this type is unique /////////// </summary> /////////// <param name="context">The context that the result depends on </param> ////////public abstract bool? GetColumnUniqueConstraint(Compiler compiler); /// <summary> /// Returns script for check constraint on column level /// </summary> public virtual string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return string.Empty; }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return compiler.TransformKeywordCase("check ({0} > 0 and {0} < 200)").Args( compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName) ); }
/// <summary> /// Returns the name of the resulting type that this domain maps to /// </summary> /// <param name="compiler">The context that the result depends on </param> /// <returns>Target type name, i.e. BIGINT, DECIMAL(8,2) etc...</returns> public abstract string GetTypeName(RDBMSCompiler compiler);
public override string GetTypeName(RDBMSCompiler compiler) { return("VARCHAR(25)"); }
public override string GetTypeName(RDBMSCompiler compiler) { return "VARCHAR(25)"; }
public override bool? GetColumnRequirement(RDBMSCompiler compiler) { return null; }
public override string GetTypeName(RDBMSCompiler compiler) { return "DATETIME"; }
public override string GetTypeName(RDBMSCompiler compiler) { return("char(10)"); }
public override string GetTypeName(RDBMSCompiler compiler) { switch(compiler.Target) { case TargetType.PostgreSQL: return "money"; case TargetType.Oracle: return "NUMBER(12,4)"; case TargetType.MsSQLServer: return "MONEY"; default: return "DECIMAL(12,4)"; } }
public override string GetTypeName(RDBMSCompiler compiler) { return("datetime(0)"); }
public override string GetTypeName(RDBMSCompiler compiler) { return "TEXT"; }
public override string GetTypeName(RDBMSCompiler compiler) { return("BIGINT(8) UNSIGNED"); }
public override bool?GetColumnRequirement(RDBMSCompiler compiler) { return(Required); }
public override string GetTypeName(RDBMSCompiler compiler) { return(Type == DBCharType.Varchar ? "VARCHAR({0})".Args(Size) : "CHAR({0})".Args(Size)); }
public override void TransformColumnName(RDBMSCompiler compiler, RDBMSEntity column) { column.TransformedName = "G_{0}".Args(column.TransformedName); }
public override string GetTypeName(RDBMSCompiler compiler) { switch(compiler.Target) { case TargetType.MySQL: return "tinyint(1)"; case TargetType.PostgreSQL: return "boolean"; case TargetType.Oracle: return "char(1)"; case TargetType.MsSQLServer: return "bit"; default: return "char(1)"; } }
/// <summary> /// Returns true to indicate that column of this type is always required /// </summary> /// <param name="compiler">The context that the result depends on </param> public virtual bool? GetColumnRequirement(RDBMSCompiler compiler) { return null; }
public override string GetTypeName(RDBMSCompiler compiler) { return(Required ? "BINARY(12)" : "VARBINARY(12)"); }
public override string GetTypeName(RDBMSCompiler compiler) { return "char(10)"; }
/// <summary> /// Returns true to indicate that column of this type is always required /// </summary> /// <param name="compiler">The context that the result depends on </param> public virtual bool?GetColumnRequirement(RDBMSCompiler compiler) { return(null); }
public override string GetTypeName(RDBMSCompiler compiler) { return "CHAR({0})".Args(Size); }
/// <summary> /// Returns the name of the resulting type that this domain maps to /// </summary> /// <param name="compiler">The context that the result depends on </param> /// <returns>Target type name, i.e. BIGINT, DECIMAL(8,2) etc...</returns> public abstract string GetTypeName(RDBMSCompiler compiler);
public override string GetTypeName(RDBMSCompiler compiler) { string t; if (Size<2) t = "TINYINT"; else if (Size<4) t = "SMALLINT"; else if (Size<8) t = "INT"; else t = "BIGINT"; var u = ""; if (Unsigned) u += " UNSIGNED"; return "{0}({1}){2}".Args(t, Size, u); }
/// <summary> /// Changes column name, i.e. adds prefix /// </summary> public virtual void TransformColumnName(RDBMSCompiler compiler, RDBMSEntity column) { }
public override string GetTypeName(RDBMSCompiler compiler) { return("NUMBER({0},{1})".Args(Scale + 4, Scale)); }
/////////// <summary> /////////// Returns true to indicate that column of this type is unique /////////// </summary> /////////// <param name="context">The context that the result depends on </param> ////////public abstract bool? GetColumnUniqueConstraint(Compiler compiler); /// <summary> /// Returns script for check constraint on column level /// </summary> public virtual string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) => string.Empty;
public override string GetTypeName(RDBMSCompiler compiler) => "char(10)";