Exemple #1
0
 public virtual string GenCreateTinyint( ColumnFieldDefinition cfd)
 {
     return GenCreateSqlByType(cfd, "tinyint", null);
 }
Exemple #2
0
 public virtual string GenCreateReal(ColumnFieldDefinition cfd)
 {
     return GenCreateSqlByType(cfd, "real", null);
 }
Exemple #3
0
 public virtual string GenCreateString(ColumnFieldDefinition cfd)
 {
     var length = string.IsNullOrEmpty(cfd.Length) ? StringDeafultLength : cfd.Length;
     return GenCreateSqlByType(cfd, "varchar",length);
 }
Exemple #4
0
 public virtual string GenCreateInteger(ColumnFieldDefinition cfd)
 {
     return GenCreateSqlByType(cfd, "INTEGER");
 }
Exemple #5
0
 public virtual string GenCreateFloat(ColumnFieldDefinition cfd)
 {
     return GenCreateSqlByType(cfd, "float", null);
 }
Exemple #6
0
 public virtual string GenCreateDateTime(ColumnFieldDefinition cfd)
 {
     return GenCreateSqlByType(cfd, "DATETIME");
 }
Exemple #7
0
 private string GenCreateSqlByType( ColumnFieldDefinition cfd,string type,string length="")
 {
     var ret = "";
     ret += " " + cfd.ColumnName + " ";
     var nullable = cfd.Nullable ? "" : "not null";
     if (string.IsNullOrEmpty(length))
     {
         ret += type + " " + nullable;
     }
     else
     {
         ret += type+"(" + length + ") " + nullable;
     }
     return ret;
 }
Exemple #8
0
 private string GenColumnCreateTableSql(ColumnFieldDefinition cfd)
 {
     string ret = null;
     switch (cfd.FieldType)
     {
         case DbType.Byte://tinyint
             ret = GenCreateTinyint( cfd);
             break;
         case DbType.SByte:
             throw new NotImplementedException();
             break;
         case DbType.Int16://smallint
             ret = GenCreateInteger(cfd);
             break;
         case DbType.Int32:
             ret = GenCreateInteger(cfd);
             break;
         case DbType.UInt16:
             throw new NotImplementedException();
             break;
         case DbType.Int64://bigint
             ret = GenCreateBigint(cfd);
             break;
         case DbType.UInt64:
             throw new NotImplementedException();
             break;
         case DbType.UInt32:
             throw new NotImplementedException();
             break;
         case DbType.Single://real
             ret = GenCreateReal(cfd);
             break;
         case DbType.Double://float
             ret = GenCreateFloat(cfd);
             break;
         case DbType.Decimal:
             ret = GenCreateDecimal(cfd);
             break;
         case DbType.Boolean:
             ret = GenCreateBit( cfd);
             break;
         case DbType.String:
             ret = GenCreateString(cfd);
             break;
         case DbType.StringFixedLength:
             throw new NotImplementedException();
             break;
         case DbType.Guid:
             throw new NotImplementedException();
             break;
         case DbType.DateTime:
             ret = GenCreateDateTime(cfd);
             break;
         case DbType.DateTimeOffset:
             throw new NotImplementedException();
             break;
         case DbType.Time://time
             ret = GenCreateTime(cfd);
             break;
         default:
             Debug.Assert(false,"not support type");
             break;
     }
     return ret;
 }