예제 #1
0
 private void EnsureArray()
 {
     if (!IsArray())
     {
         throw IscException.ForStrParam("Field is not an array type.");
     }
 }
예제 #2
0
        public void FixNull()
        {
            if (NullFlag == -1 && _dbValue.IsDBNull())
            {
                switch (DbDataType)
                {
                case DbDataType.Char:
                case DbDataType.VarChar:
                    DbValue.SetValue(string.Empty);
                    break;

                case DbDataType.Guid:
                    DbValue.SetValue(Guid.Empty);
                    break;

                case DbDataType.SmallInt:
                    DbValue.SetValue((short)0);
                    break;

                case DbDataType.Integer:
                    DbValue.SetValue((int)0);
                    break;

                case DbDataType.BigInt:
                case DbDataType.Binary:
                case DbDataType.Array:
                case DbDataType.Text:
                    DbValue.SetValue((long)0);
                    break;

                case DbDataType.Numeric:
                case DbDataType.Decimal:
                    DbValue.SetValue((decimal)0);
                    break;

                case DbDataType.Float:
                    DbValue.SetValue((float)0);
                    break;

                case DbDataType.Double:
                    DbValue.SetValue((double)0);
                    break;

                case DbDataType.Date:
                case DbDataType.TimeStamp:
                    DbValue.SetValue(DateTime2.UnixEpoch);
                    break;

                case DbDataType.Time:
                    DbValue.SetValue(TimeSpan.Zero);
                    break;

                case DbDataType.Boolean:
                    DbValue.SetValue(false);
                    break;

                case DbDataType.TimeStampTZ:
                case DbDataType.TimeStampTZEx:
                    DbValue.SetValue(new FbZonedDateTime(DateTime2.UnixEpoch, TimeZoneMapping.DefaultTimeZoneName));
                    break;

                case DbDataType.TimeTZ:
                case DbDataType.TimeTZEx:
                    DbValue.SetValue(new FbZonedTime(TimeSpan.Zero, TimeZoneMapping.DefaultTimeZoneName));
                    break;

                case DbDataType.Dec16:
                case DbDataType.Dec34:
                    DbValue.SetValue(new FbDecFloat(0, 0));
                    break;

                case DbDataType.Int128:
                    DbValue.SetValue((BigInteger)0);
                    break;

                default:
                    throw IscException.ForStrParam($"Unknown sql data type: {DataType}.");
                }
            }
        }
예제 #3
0
        public void FixNull()
        {
            if (NullFlag == -1 && _dbValue.IsDBNull())
            {
                switch (DbDataType)
                {
                case DbDataType.Char:
                case DbDataType.VarChar:
                    Value = string.Empty;
                    break;

                case DbDataType.Guid:
                    Value = Guid.Empty;
                    break;

                case DbDataType.SmallInt:
                    Value = (short)0;
                    break;

                case DbDataType.Integer:
                    Value = (int)0;
                    break;

                case DbDataType.BigInt:
                case DbDataType.Binary:
                case DbDataType.Array:
                case DbDataType.Text:
                    Value = (long)0;
                    break;

                case DbDataType.Numeric:
                case DbDataType.Decimal:
                    Value = (decimal)0;
                    break;

                case DbDataType.Float:
                    Value = (float)0;
                    break;

                case DbDataType.Double:
                    Value = (double)0;
                    break;

                case DbDataType.Date:
                case DbDataType.TimeStamp:
                    Value = new DateTime(0 * 10000L + 621355968000000000);
                    break;

                case DbDataType.Time:
                    Value = TimeSpan.Zero;
                    break;

                case DbDataType.Boolean:
                    Value = false;
                    break;

                default:
                    throw IscException.ForStrParam($"Unknown sql data type: {DataType}.");
                }
            }
        }
        public async Task FixNull(AsyncWrappingCommonArgs async)
        {
            if (NullFlag == -1 && await _dbValue.IsDBNull(async).ConfigureAwait(false))
            {
                switch (DbDataType)
                {
                case DbDataType.Char:
                case DbDataType.VarChar:
                    DbValue.SetValue(string.Empty);
                    break;

                case DbDataType.Guid:
                    DbValue.SetValue(Guid.Empty);
                    break;

                case DbDataType.SmallInt:
                    DbValue.SetValue((short)0);
                    break;

                case DbDataType.Integer:
                    DbValue.SetValue((int)0);
                    break;

                case DbDataType.BigInt:
                case DbDataType.Binary:
                case DbDataType.Array:
                case DbDataType.Text:
                    DbValue.SetValue((long)0);
                    break;

                case DbDataType.Numeric:
                case DbDataType.Decimal:
                    DbValue.SetValue((decimal)0);
                    break;

                case DbDataType.Float:
                    DbValue.SetValue((float)0);
                    break;

                case DbDataType.Double:
                    DbValue.SetValue((double)0);
                    break;

                case DbDataType.Date:
                case DbDataType.TimeStamp:
                    DbValue.SetValue(new DateTime(0 * 10000L + 621355968000000000));
                    break;

                case DbDataType.Time:
                    DbValue.SetValue(TimeSpan.Zero);
                    break;

                case DbDataType.Boolean:
                    DbValue.SetValue(false);
                    break;

                case DbDataType.TimeStampTZ:
                case DbDataType.TimeStampTZEx:
                    DbValue.SetValue(new FbZonedDateTime(new DateTime(0 * 10000L + 621355968000000000), TimeZoneMapping.DefaultTimeZoneName));
                    break;

                case DbDataType.TimeTZ:
                case DbDataType.TimeTZEx:
                    DbValue.SetValue(new FbZonedTime(TimeSpan.Zero, TimeZoneMapping.DefaultTimeZoneName));
                    break;

                case DbDataType.Dec16:
                case DbDataType.Dec34:
                    DbValue.SetValue(new FbDecFloat(0, 0));
                    break;

                case DbDataType.Int128:
                    DbValue.SetValue((BigInteger)0);
                    break;

                default:
                    throw IscException.ForStrParam($"Unknown sql data type: {DataType}.");
                }
            }
        }