public MetaType(byte precision, byte scale, int fixedLength, bool isFixed, bool isLong, bool isPlp, byte tdsType, byte nullableTdsType, string typeName, Type classType, Type sqlType, System.Data.SqlDbType sqldbType, System.Data.DbType dbType, byte propBytes)
 {
     this.Precision = precision;
     this.Scale = scale;
     this.FixedLength = fixedLength;
     this.IsFixed = isFixed;
     this.IsLong = isLong;
     this.IsPlp = isPlp;
     this.TDSType = tdsType;
     this.NullableType = nullableTdsType;
     this.TypeName = typeName;
     this.SqlDbType = sqldbType;
     this.DbType = dbType;
     this.ClassType = classType;
     this.SqlType = sqlType;
     this.PropBytes = propBytes;
     this.IsAnsiType = _IsAnsiType(sqldbType);
     this.IsBinType = _IsBinType(sqldbType);
     this.IsCharType = _IsCharType(sqldbType);
     this.IsNCharType = _IsNCharType(sqldbType);
     this.IsSizeInCharacters = _IsSizeInCharacters(this.SqlDbType);
     this.Is70Supported = _Is70Supported(this.SqlDbType);
     this.Is80Supported = _Is80Supported(this.SqlDbType);
     this.Is90Supported = _Is90Supported(this.SqlDbType);
     this.Is100Supported = _Is100Supported(this.SqlDbType);
 }
Beispiel #2
0
        /// <summary>
        /// 添加查询参数
        /// </summary>
        /// <param name="ParamName">参数名称</param>
        /// <param name="DbType">数据类型</param>
        /// <returns></returns>
        public static IDbDataParameter MakeParam(string ParamName, System.Data.DbType DbType)
        {
            IDbDataParameter param = DBFactory.CreateParameter(ParamName, DbType);

            param.Direction = ParameterDirection.Input;
            return(param);
        }
Beispiel #3
0
        public void AddParam(string name, System.Data.DbType dbType, ParameterDirection direction)
        {
            try
            {
                if (!IsConnected && !Connect())
                {
                    return;
                }

                command.Parameters.Add(new SqlParameter()
                {
                    ParameterName = name, DbType = dbType, Direction = direction
                });
            }
            catch (SqlException dbexc)
            {
                message = dbexc.Message;
                Logger.E(dbexc);
            }
            catch (Exception exc)
            {
                message = exc.Message;
                Logger.E(exc);
            }
        }
 public int ExecSQL(string SQL, object[] ParaValue)
 {
     System.Data.DbType[] ParaType = new System.Data.DbType[ParaValue.Length];
     for (int i = 0; i < ParaValue.Length; i++)
     {
         ParaType[i] = (System.Data.DbType)DynamicUpdateSqlite.htDataType[ParaValue[i] == null ? typeof(string) : ParaValue[i].GetType()];
     }
     return ExecSQL(SQL, ParaType, ParaValue);
 }
 public DbAccessParameter()
 {
     this._DbType = System.Data.DbType.String;
     this._ProvideType = -1;
     this._Direction = ParameterDirection.Input;
     this._ParameterName = string.Empty;
     this._Size = 0;
     this._Value = null;
     this._IsNullable = false;
     this._SourceColumn = string.Empty;
     this._SourceColumnNullMapping = false;
     this._SourceVersion = DataRowVersion.Current;
     this._Precision = 0;
     this._Scale = 0;
     this.Properties = new bool[12];
 }
 public ParameterItem(Parameter p)
 {
     this._name = p.Name;
     this._dbType = p.DbType;
     this._type = p.Type;
     this._defaultValue = p.DefaultValue;
 }
		internal DataType (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType,
			BufferType bufferType,
			bool isLong)
		{
			this.typeName = typeName;
			this.vdbType = vdbType;
			this.dbType = dbType;
			this.sqlType = sqlType;
			this.bufferType = bufferType;
			this.isLong = isLong;
		}
 public int[] ExecSQL(string[] SQL, object[][] ParaValues)
 {
     System.Data.DbType[][] ParaTypes = new System.Data.DbType[ParaValues.Length][];
     for (int i = 0; i < ParaValues.Length; i++)
     {
         ParaTypes[i] = new System.Data.DbType[ParaValues[i].Length];
         for (int j = 0; j < ParaValues[i].Length; j++)
         {
             ParaTypes[i][j] = (System.Data.DbType)DynamicUpdateSqlite.htDataType[ParaValues[i][j] == null ? typeof(string) : ParaValues[i][j].GetType()];
         }
     }
     return ExecSQL(SQL, ParaTypes, ParaValues);
 }
 public System.Data.DataSet GetDatas(string[] MappingTables, string[] SQLs, object[][] ParaValues)
 {
     System.Data.DbType[][] ParaTypes = new System.Data.DbType[ParaValues.Length][];
     for (int i = 0; i < ParaValues.Length; i++)
     {
         ParaTypes[i] = new System.Data.DbType[ParaValues[i].Length];
         for (int j = 0; j < ParaValues[i].Length; j++)
         {
             ParaTypes[i][j] = (System.Data.DbType)DynamicUpdateSqlite.htDataType[ParaValues[i][j] == null ? typeof(string) : ParaValues[i][j].GetType()];
         }
     }
     return GetDatas(MappingTables, SQLs, ParaTypes, ParaValues);
 }
Beispiel #10
0
 public System.Data.DataSet GetData(string MappingTable, string SQL, object[] ParaValue)
 {
     System.Data.DbType[] ParaType = new System.Data.DbType[ParaValue.Length];
     for (int i = 0; i < ParaValue.Length; i++)
     {
         ParaType[i] = (System.Data.DbType)DynamicUpdateSqlite.htDataType[ParaValue[i] == null ? typeof(string) : ParaValue[i].GetType()];
     }
     return GetData(MappingTable, SQL, ParaType, ParaValue);
 }
Beispiel #11
0
 public Field(object parent, string name, string canonicalidentifiername, System.Data.DbType dbtype, bool _readonly)
 {
     this.Parent = parent;
     this.Name = name;
     this.CanonicalIdentifierName = canonicalidentifiername;
     this.DbType = dbtype;
     this.ReadOnly = _readonly;
 }
Beispiel #12
0
 /// <summary>
 /// Contructor con la definicion de los parametros 
 /// </summary>
 public TipoParametro()
 {
     _TipoParametroCadena = System.Data.DbType.String;
     _TipoParametroEntero = System.Data.DbType.Int32;
     _TipoParametroFecha = System.Data.DbType.DateTime;
     _TipoParametroDecimal = System.Data.DbType.Decimal;
     _TipoParametroBinario = System.Data.DbType.Binary;
     _TipoParametroXml = System.Data.DbType.Xml;
     _TipoParametroObjeto = System.Data.DbType.Object;
     _TipoParametroByte = System.Data.DbType.Byte;
 }
Beispiel #13
0
		private void SetMySqlDbType(GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType mysql_dbtype) {
			this.mySqlDbType = mysql_dbtype;
			switch (this.mySqlDbType) {
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Decimal:
					this.dbType = System.Data.DbType.Decimal;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Byte:
					this.dbType = System.Data.DbType.SByte;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int16:
					this.dbType = System.Data.DbType.Int16;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int32:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int24:
					this.dbType = System.Data.DbType.Int32;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Float:
					this.dbType = System.Data.DbType.Single;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Double:
					this.dbType = System.Data.DbType.Double;
					return;

				case (GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Float | GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int16):
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.VarString:
				case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1f8):
				case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1f9):
				case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1fa):
				case ((GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType)0x1fb):
					break;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Timestamp:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.DateTime:
					this.dbType = System.Data.DbType.DateTime;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int64:
					this.dbType = System.Data.DbType.Int64;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Date:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Year:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Newdate:
					this.dbType = System.Data.DbType.Date;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Time:
					this.dbType = System.Data.DbType.Time;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Bit:
					this.dbType = System.Data.DbType.UInt64;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Enum:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Set:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.VarChar:
					this.dbType = System.Data.DbType.String;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.TinyBlob:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.MediumBlob:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.LongBlob:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Blob:
					this.dbType = System.Data.DbType.Object;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.String:
					this.dbType = System.Data.DbType.StringFixedLength;
					break;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UByte:
					this.dbType = System.Data.DbType.Byte;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt16:
					this.dbType = System.Data.DbType.UInt16;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt32:
				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt24:
					this.dbType = System.Data.DbType.UInt32;
					return;

				case GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt64:
					this.dbType = System.Data.DbType.UInt64;
					return;

				default:
					return;
			}
		}
Beispiel #14
0
		private void SetDbType(System.Data.DbType db_type) {
			this.dbType = db_type;
			switch (this.dbType) {
				case System.Data.DbType.AnsiString:
				case System.Data.DbType.Guid:
				case System.Data.DbType.String:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.VarChar;
					return;

				case System.Data.DbType.Byte:
				case System.Data.DbType.Boolean:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UByte;
					return;

				case System.Data.DbType.Currency:
				case System.Data.DbType.Decimal:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Decimal;
					return;

				case System.Data.DbType.Date:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Date;
					return;

				case System.Data.DbType.DateTime:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.DateTime;
					return;

				case System.Data.DbType.Double:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Double;
					return;

				case System.Data.DbType.Int16:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int16;
					return;

				case System.Data.DbType.Int32:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int32;
					return;

				case System.Data.DbType.Int64:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Int64;
					return;

				case System.Data.DbType.SByte:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Byte;
					return;

				case System.Data.DbType.Single:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Float;
					return;

				case System.Data.DbType.Time:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Time;
					return;

				case System.Data.DbType.UInt16:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt16;
					return;

				case System.Data.DbType.UInt32:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt32;
					return;

				case System.Data.DbType.UInt64:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.UInt64;
					return;

				case System.Data.DbType.AnsiStringFixedLength:
				case System.Data.DbType.StringFixedLength:
					this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.String;
					return;
			}
			this.mySqlDbType = GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType.Blob;
		}
        public MetaType(System.Data.DbType dbType, System.Data.OracleClient.OracleType oracleType, OCI.DATATYPE ociType, string dataTypeName, Type convertToType, Type noConvertType, int bindSize, int maxBindSize, bool usesNationalCharacterSet)
        {
            this._dbType = dbType;
            this._oracleType = oracleType;
            this._ociType = ociType;
            this._convertToType = convertToType;
            this._noConvertType = noConvertType;
            this._bindSize = bindSize;
            this._maxBindSize = maxBindSize;
            this._dataTypeName = dataTypeName;
            this._usesNationalCharacterSet = usesNationalCharacterSet;
            switch (oracleType)
            {
                case System.Data.OracleClient.OracleType.Char:
                case System.Data.OracleClient.OracleType.Clob:
                case System.Data.OracleClient.OracleType.LongVarChar:
                case System.Data.OracleClient.OracleType.NChar:
                case System.Data.OracleClient.OracleType.NClob:
                case System.Data.OracleClient.OracleType.NVarChar:
                case System.Data.OracleClient.OracleType.VarChar:
                    this._isCharacterType = true;
                    break;
            }
            switch (oracleType)
            {
                case System.Data.OracleClient.OracleType.LongRaw:
                case System.Data.OracleClient.OracleType.LongVarChar:
                    this._isLong = true;
                    break;
            }
            switch (oracleType)
            {
                case System.Data.OracleClient.OracleType.BFile:
                case System.Data.OracleClient.OracleType.Blob:
                case System.Data.OracleClient.OracleType.Clob:
                case System.Data.OracleClient.OracleType.NClob:
                    this._isLob = true;
                    break;

                case System.Data.OracleClient.OracleType.Char:
                    break;

                default:
                    return;
            }
        }