本文整理汇总了C#中SqlType类的典型用法代码示例。如果您正苦于以下问题:C# SqlType类的具体用法?C# SqlType怎么用?C# SqlType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlType类属于命名空间,在下文中一共展示了SqlType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FunctionInfo
public FunctionInfo(ObjectName routineName, SqlType returnType, FunctionType functionType)
: base(routineName)
{
ReturnType = returnType;
FunctionType = functionType;
AssertUnboundAtEnd();
}
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:FunctionInfo.cs
示例2: Table
public Table(string schema, string table, string alias, SqlType sqlType = SqlType.SqlServer)
{
this.SchemaName = schema;
this.TableName = table;
this.Alias = alias;
this.formatModel = sqlType.BuildFormatSystemModel();
}
开发者ID:roylanceMichael,项目名称:ObjectToSqlMapper,代码行数:7,代码来源:Table.cs
示例3: ColumnAttribute
public ColumnAttribute(string name, SqlType type, int size, int scale)
{
this.name = name;
this.type = type;
this.size = size;
this.scale = scale;
}
开发者ID:prepare,项目名称:deveeldb,代码行数:7,代码来源:ColumnAttribute.cs
示例4: IsPrimitive
public static bool IsPrimitive(SqlType sqlType)
{
if (sqlType == SqlType.Numeric ||
sqlType == SqlType.TinyInt ||
sqlType == SqlType.SmallInt ||
sqlType == SqlType.Integer ||
sqlType == SqlType.BigInt ||
sqlType == SqlType.Real ||
sqlType == SqlType.Double ||
sqlType == SqlType.Float ||
sqlType == SqlType.Decimal)
return true;
if (sqlType == SqlType.BigInt ||
sqlType == SqlType.Boolean)
return true;
if (sqlType == SqlType.Char ||
sqlType == SqlType.VarChar ||
sqlType == SqlType.LongVarChar ||
sqlType == SqlType.String ||
sqlType == SqlType.Clob)
return true;
if (sqlType == SqlType.Binary ||
sqlType == SqlType.VarBinary ||
sqlType == SqlType.LongVarBinary ||
sqlType == SqlType.Blob)
return true;
return false;
}
开发者ID:kaktusan,项目名称:plsqlparser,代码行数:32,代码来源:PrimitiveTypes.cs
示例5: Add
public virtual TableColumn Add(string columnName, SqlType columnType, bool notNull)
{
CheckNotReadOnly();
TableColumn column = new TableColumn(table, -1, columnName, columnType, notNull);
columns.Add(column);
return column;
}
开发者ID:ikvm,项目名称:deveelsql,代码行数:7,代码来源:ColumnCollection.cs
示例6: RunTableDdl
public bool RunTableDdl(DirectoryInfo directory, SqlType dialect)
{
var tg = new DdlGeneratorFactory(dialect).AllTablesGenerator(_databaseSchema);
tg.IncludeSchema = false;
string txt;
try
{
txt = tg.Write();
}
catch (Exception exception)
{
Message =
@"An error occurred while creating the script.\n" + exception.Message;
return false;
}
try
{
var path = Path.Combine(directory.FullName, "table.sql");
File.WriteAllText(path, txt);
Message = @"Wrote " + path;
return true;
}
catch (Exception exception)
{
Message =
@"An IO error occurred while writing the file.\n" + exception.Message;
}
return false;
}
开发者ID:Petran15,项目名称:dbschemareader,代码行数:29,代码来源:TaskRunner.cs
示例7: RunSprocs
public bool RunSprocs(DirectoryInfo directory, SqlType dialect, DatabaseTable table)
{
if (table == null)
{
Message = "No table";
return false;
}
var gen = new DdlGeneratorFactory(dialect).ProcedureGenerator(table);
if (gen == null)
{
//there is no sproc provider (SQLite)
Message = @"There is no sproc generator";
return false;
}
var path = Path.Combine(directory.FullName, table.Name + "_sprocs.sql");
try
{
gen.WriteToScript(path);
Message = @"Wrote " + path;
return true;
}
catch (Exception exception)
{
Message =
@"An error occurred while creating the script.\n" + exception.Message;
}
return false;
}
开发者ID:Petran15,项目名称:dbschemareader,代码行数:29,代码来源:TaskRunner.cs
示例8: Create
public static SchemaExtendedReader Create(string connectionString, SqlType sqlType)
{
SchemaExtendedReader schemaReader;
switch (sqlType)
{
case SqlType.Oracle:
schemaReader = new OracleSchemaReader(connectionString, "System.Data.OracleClient");
break;
case SqlType.SqlServer:
schemaReader = new SqlAzureOrSqlServerSchemaReader(connectionString, "System.Data.SqlClient");
break;
case SqlType.SqlServerCe:
schemaReader = new SqlServerCeSchemaReader(connectionString, "System.Data.SqlServerCe.4.0");
break;
case SqlType.MySql:
schemaReader = new MySqlSchemaReader(connectionString, "MySql.Data.MySqlClient");
break;
case SqlType.PostgreSql:
schemaReader = new PostgreSqlSchemaReader(connectionString, "Npgsql");
break;
case SqlType.Db2:
schemaReader = new Db2SchemaReader(connectionString, "IBM.Data.DB2");
break;
case SqlType.SQLite:
schemaReader = new SchemaExtendedReader(connectionString, "System.Data.SQLite");
break;
default:
throw new ArgumentOutOfRangeException("sqlType", "Not a recognized SqlType");
}
return schemaReader;
}
开发者ID:Petran15,项目名称:dbschemareader,代码行数:31,代码来源:SchemaReaderFactory.cs
示例9: DatabaseSchema
/// <summary>
/// Initializes a new instance of the <see cref="DatabaseSchema"/> class.
/// </summary>
/// <param name="connectionString">The connection string.</param>
/// <param name="sqlType">Type of the provider</param>
public DatabaseSchema(string connectionString, SqlType sqlType)
:this(connectionString, null)
{
switch (sqlType)
{
case SqlType.SqlServer:
Provider = "System.Data.SqlClient";
break;
case SqlType.Oracle:
Provider = "System.Data.OracleClient";
break;
case SqlType.MySql:
Provider = "MySql.Data.MySqlClient";
break;
case SqlType.SQLite:
Provider = "System.Data.SQLite";
break;
case SqlType.SqlServerCe:
Provider = "System.Data.SqlServerCe.4.0";
break;
case SqlType.PostgreSql:
Provider = "Npgsql";
break;
case SqlType.Db2:
Provider = "IBM.Data.DB2";
break;
default:
throw new ArgumentOutOfRangeException("sqlType");
}
}
开发者ID:Petran15,项目名称:dbschemareader,代码行数:35,代码来源:DatabaseSchema.cs
示例10: GetBuilderName
public static string GetBuilderName(SqlType sql, string tableName)
{
string result = GetModel(sql, tableName) ?? tableName;
result = result.Substring(0, 1).ToLower() + result.Substring(1);
result += "Builder";
return result;
}
开发者ID:koksaver,项目名称:CodeHelper,代码行数:7,代码来源:GenSqlDALBase.cs
示例11: IndexCollation
public IndexCollation(SqlType type, CollationColumn[] columns, string function)
{
if (columns.Length == 0)
throw new ArgumentException("Cannot create an empty collation.", "columns");
if (columns.Length > 1) {
if (!(type is SqlCompositeType))
throw new ArgumentException("Composite indexes must be represented by composite-type");
SqlCompositeType ctype = (SqlCompositeType) type;
if (ctype.PartCount != columns.Length)
throw new ArgumentException("Composite type size different to the number of columns given", "columns");
}
// Can't contain identical columns
for (int i = 0; i < columns.Length; ++i) {
for (int n = 0; n < columns.Length; ++n) {
if (i != n && columns[i].ColumnName.Equals(columns[n].ColumnName))
throw new ArgumentException("Repeat column '" + columns[i] +"' name");
}
}
this.type = type;
this.function = function;
this.columns = (CollationColumn[]) columns.Clone();
}
开发者ID:ikvm,项目名称:deveelsql,代码行数:26,代码来源:IndexCollation.cs
示例12: SqlWriterCommonTest
public SqlWriterCommonTest(SqlType sqlType, DatabaseTable table, DbProviderFactory factory, string connectionString)
{
_connectionString = connectionString;
_factory = factory;
_table = table;
_sqlType = sqlType;
}
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:7,代码来源:SqlWriterCommonTest.cs
示例13: CommandTransaction
/// <summary>
/// トランザクション付きコマンドの取得
/// </summary>
/// <param name="dao"></param>
/// <param name="tx"></param>
/// <param name="serverType"></param>
/// <returns></returns>
public static DbCommand CommandTransaction(this IDao dao, DbTransaction tx, SqlType serverType)
{
switch (serverType)
{
case SqlType.SqlServer:
{
var command = new SqlCommand();
command.Connection = (SqlConnection)dao.Con;
command.Transaction = (SqlTransaction)tx;
if (log.IsInfoEnabled)
{
log.Info("command type is SqlCommand.");
}
return command;
}
default:
{
if (log.IsErrorEnabled)
{
log.Error("Don't supported command type. Type is " + Enum.GetName(typeof(SqlType), serverType));
}
return null;
}
}
}
开发者ID:KuriharaJun,项目名称:MvcDI,代码行数:32,代码来源:DaoExtensions.cs
示例14: CastTo
public override DataObject CastTo(DataObject value, SqlType destType)
{
var bValue = ((SqlBoolean) value.Value);
if (destType is StringType) {
var s = Convert.ToString(bValue);
// TODO: Provide a method in StringType to build a string specific to the type
return new DataObject(destType, new SqlString(s));
}
if (destType is NumericType) {
SqlNumber num;
if (bValue == SqlBoolean.Null) {
num = SqlNumber.Null;
} else if (bValue) {
num = SqlNumber.One;
} else {
num = SqlNumber.Zero;
}
return new DataObject(destType, num);
}
if (destType is BinaryType) {
var bytes = (byte[]) Convert.ChangeType(bValue, typeof (byte[]), CultureInfo.InvariantCulture);
return new DataObject(destType, new SqlBinary(bytes));
}
if (destType is BooleanType)
return value;
return base.CastTo(value, destType);
}
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:29,代码来源:BooleanType.cs
示例15: CanCastTo
public override bool CanCastTo(SqlType destType)
{
return destType is StringType ||
destType is NumericType ||
destType is BinaryType ||
destType is BooleanType;
}
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:BooleanType.cs
示例16: RoutineParameter
public RoutineParameter(string name, SqlType type, ParameterDirection direction, ParameterAttributes attributes)
{
Attributes = attributes;
Direction = direction;
Type = type;
Name = name;
}
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:RoutineParameter.cs
示例17: MemberMapping
internal MemberMapping(TypeMapping typeMapping, string memberName, string columnName, SqlType columnType, bool notNull)
{
TypeMapping = typeMapping;
MemberName = memberName;
ColumnName = columnName;
ColumnType = columnType;
NotNull = notNull;
}
开发者ID:furesoft,项目名称:deveeldb,代码行数:8,代码来源:MemberMapping.cs
示例18: IsComparableTo
public override bool IsComparableTo(SqlType type)
{
SqlUserType userType = (SqlUserType) type;
if (userType == null)
return false;
return comparable && typeName.Equals(userType.typeName);
}
开发者ID:ikvm,项目名称:deveelsql,代码行数:8,代码来源:SqlUserType.cs
示例19: CreateInstance
public static GenSqlDALBase CreateInstance(SqlType sql)
{
if (GlobalService.DbType == DatabaseType.SqlServer)
{
return new SqlServer.SqlGenSqlDAL(sql);
}
return null;
}
开发者ID:koksaver,项目名称:CodeHelper,代码行数:8,代码来源:GenSqlDALBase.cs
示例20: OfType
public IColumnBuilder OfType(SqlType type)
{
if (type == null)
throw new ArgumentNullException("type");
columnType = type;
return this;
}
开发者ID:deveel,项目名称:deveeldb,代码行数:8,代码来源:ColumnBuilder.cs
注:本文中的SqlType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论