public NextAsLiteralValueTestParameters( string chars, HsqlProviderType providerType, object value, int?errorCode, string errorMessage) { this.Chars = chars; this.ProviderType = providerType; this.Value = value; this.ErrorCode = errorCode; this.ErrorMessage = errorMessage; }
public HsqlParameter(string parameterName, HsqlProviderType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) : this() { ParameterName = parameterName; ProviderType = dbType; Size = size; Direction = direction; IsNullable = isNullable; Precision = precision; Scale = scale; SourceColumn = sourceColumn; SourceVersion = sourceVersion; Value = value; }
static HsqlResult NewResult() { int columnCount = columns.GetUpperBound(1); HsqlResult result = new HsqlResult(columnCount); object[] row = new object[columnCount]; int i = 0; const int TypeOrdinal = 0; const int ValueOrdinal = 1; result.add(row); foreach (object[] column in columns) { HsqlProviderType dataType = (HsqlProviderType)column[TypeOrdinal]; row[i] = column[ValueOrdinal]; int scale = 0; switch (dataType) { case HsqlProviderType.Decimal: case HsqlProviderType.Numeric: { scale = 4; break; } } int size = HsqlTypes.getPrecision((int)dataType); result.metaData.catalogNames[i] = "mem:test"; result.metaData.classNames[i] = HsqlTypes.getTypeName((int)dataType); result.metaData.colLabels[i] = "COLUMN_" + i; result.metaData.colNames[i] = "C" + i; result.metaData.colNullable[i] = (int)BaseColumnNullability.Nullable; result.metaData.colScales[i] = scale; result.metaData.colSizes[i] = size; result.metaData.colTypes[i] = (int)dataType; result.metaData.isIdentity[i] = false; result.metaData.isLabelQuoted[i] = false; result.metaData.isWritable[i] = false; result.metaData.paramMode[i] = (int)ParameterMode.Unknown; result.metaData.schemaNames[i] = "PUBLIC"; result.metaData.tableNames[i] = "ALL_COL_TYPES"; } return(result); }
public NextAsLiteralValueTestParameters( string chars, HsqlProviderType providerType, object value, int? errorCode, string errorMessage) { this.Chars = chars; this.ProviderType = providerType; this.Value = value; this.ErrorCode = errorCode; this.ErrorMessage = errorMessage; }
internal void DeriveParametersInternal() { if (CommandType != CommandType.StoredProcedure) { throw new InvalidOperationException(string.Format( "Operation not supported for CommandType: " + CommandType.ToString())); } Prepare(); HsqlStatement statement = m_statement; ParameterMetaData pmd = statement.ParameterDescriptor.metaData; string[] parameterNames = pmd.colNames; int count = parameterNames.Length; HsqlParameter[] parameters = new HsqlParameter[count]; for (int i = 0; i < count; i++) { string name = parameterNames[i]; ParameterMode mode = (ParameterMode)pmd.paramMode[i]; int type = pmd.colTypes[i]; int precision = pmd.colSizes[i]; int scale = pmd.colScales[i]; int nullability = pmd.colNullable[i]; HsqlProviderType providerType = (HsqlProviderType)type; DbType dbType = HsqlConvert.ToDbType(providerType); ParameterDirection?direction = HsqlConvert.ToParameterDirection(mode); bool?isNullable = IsNullable(nullability); bool isCharacter = IsCharacterType(type); bool isNumber = (!isCharacter) && IsNumberType(type); bool isTemporal = !(isCharacter || isNumber) && IsTemporalType(type); int size = ToBufferSize(type, precision); if (isCharacter) { precision = 0; scale = 0; } else if (isNumber || isTemporal) { if (precision == 0) { precision = ToDefaultPrecision(type); } } HsqlParameter parameter = new HsqlParameter(); parameter.DbType = dbType; if (direction != null) { parameter.Direction = direction.Value; } if (isNullable != null) { parameter.IsNullable = isNullable.Value; } parameter.ParameterName = name; parameter.Precision = (byte)Math.Min(byte.MaxValue, precision); parameter.ProviderType = providerType; parameter.Scale = (byte)Math.Min(byte.MaxValue, scale); parameter.Size = size; parameter.SourceVersion = DataRowVersion.Default; parameters[i] = parameter; } HsqlParameterCollection pc = Parameters; pc.Clear(); foreach (HsqlParameter parameter in parameters) { pc.Add(parameter); } }
/// <summary> /// Constructor setting the parameter data type. /// </summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="dbType">The <c>DbType</c> of the parameter.</param> public HsqlParameter(string parameterName, HsqlProviderType dbType) : this() { this.ParameterName = parameterName; this.ProviderType = dbType; }
/// <summary> /// Constructor setting the data type and size. /// </summary> /// <param name="parameterName">The name of the parameter to map</param> /// <param name="dbType">The <c>HsqlProviderType</c> of the parameter.</param> /// <param name="size">The length of the parameter.</param> public HsqlParameter(string parameterName, HsqlProviderType dbType, int size) : this() { ParameterName = parameterName; ProviderType = dbType; Size = size; }