Example #1
0
        public virtual string[] SqlCreateStrings(Dialect.Dialect dialect)
        {
            string createString = dialect.CreateTableString + " " + TableName
                                  + " ( "
                                  + SegmentColumnName + " " + dialect.GetTypeName(SqlTypes.SqlTypeFactory.GetAnsiString(SegmentValueLength)) + " not null, "
                                  + ValueColumnName + " " + dialect.GetTypeName(SqlTypes.SqlTypeFactory.Int64) + ", "
                                  + dialect.PrimaryKeyString + " ( " + SegmentColumnName + ") "
                                  + ")";

            return(new string[] { createString });
        }
Example #2
0
 private string GetDialectTypeName(Dialect.Dialect dialect, IMapping mapping)
 {
     if (IsCaracteristicsDefined())
     {
         // NH-1070 (the size should be 0 if the precision is defined)
         return(dialect.GetTypeName(GetSqlTypeCode(mapping), (!IsPrecisionDefined()) ? Length:0, Precision, Scale));
     }
     else
     {
         return(dialect.GetTypeName(GetSqlTypeCode(mapping)));
     }
 }
Example #3
0
 private string GetDialectTypeName(Dialect.Dialect dialect, IMapping mapping)
 {
     if (IsCaracteristicsDefined())
     {
         // NH-1070: the size should be 0 if the precision or scale is defined.
         return(dialect.GetTypeName(
                    GetSqlTypeCode(mapping),
                    IsPrecisionDefined() || IsScaleDefined() ? 0 : Length,
                    Precision, Scale));
     }
     else
     {
         return(dialect.GetTypeName(GetSqlTypeCode(mapping)));
     }
 }
Example #4
0
 public virtual string[] SqlCreateStrings(Dialect.Dialect dialect)
 {
     return(new String[]
     {
         "create table " + tableName + " ( " + valueColumnName + " " + dialect.GetTypeName(SqlTypeFactory.Int64)
         + " )", "insert into " + tableName + " values ( " + initialValue + " )"
     });
 }
Example #5
0
 /// <summary>
 /// Gets the name of the data type for the column.
 /// </summary>
 /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use to get the valid data types.</param>
 /// <param name="mapping"></param>
 /// <returns>
 /// The name of the data type for the column.
 /// </returns>
 /// <remarks>
 /// If the mapping file contains a value of the attribute <c>sql-type</c> this will
 /// return the string contained in that attribute.  Otherwise it will use the
 /// typename from the <see cref="Dialect.Dialect"/> of the <see cref="SqlType"/> object.
 /// </remarks>
 public string GetSqlType(Dialect.Dialect dialect, IMapping mapping)
 {
     if (sqlType == null)
     {
         SqlType sqlTypeObject = GetAutoSqlType(mapping);
         if (Length != DefaultPropertyLength)
         {
             return(dialect.GetTypeName(sqlTypeObject, Length));
         }
         else
         {
             return(dialect.GetTypeName(sqlTypeObject));
         }
     }
     else
     {
         return(sqlType);
     }
 }
 /// <summary>
 /// The SQL required to create the database objects for a TableGenerator.
 /// </summary>
 /// <param name="dialect">The <see cref="Dialect"/> to help with creating the sql.</param>
 /// <returns>
 /// An array of <see cref="string"/> objects that contain the Dialect specific sql to
 /// create the necessary database objects and to create the first value as <c>1</c>
 /// for the TableGenerator.
 /// </returns>
 public virtual string[] SqlCreateStrings(Dialect.Dialect dialect)
 {
     // changed the first value to be "1" by default since an uninitialized Int32 is 0 - leaving
     // it at 0 would cause problems with an unsaved-value="0" which is what most people are
     // defaulting <id>'s with Int32 types at.
     return(new[]
     {
         "create table " + tableName + " ( " + columnName + " " + dialect.GetTypeName(columnSqlType) + " )",
         "insert into " + tableName + " values ( 1 )"
     });
 }
 public bool SupportsSqlType(SqlType sqlType)
 {
     try
     {
         _dialect.GetTypeName(sqlType);
         return(true);
     }
     catch
     {
         return(false);
     }
 }