internal void GetOutputValue(CNativeBuffer parameterBuffer) { if (!this._hasChanged && ((this._bindtype != null) && (this._internalDirection != ParameterDirection.Input))) { TypeMap map = this._bindtype; this._bindtype = null; int cb = (int)parameterBuffer.ReadIntPtr(this._preparedIntOffset); if (-1 == cb) { this.Value = DBNull.Value; } else if ((0 <= cb) || (cb == -3)) { this.Value = parameterBuffer.MarshalToManaged(this._preparedValueOffset, this._boundSqlCType, cb); if (((this._boundSqlCType == ODBC32.SQL_C.CHAR) && (this.Value != null)) && !Convert.IsDBNull(this.Value)) { CultureInfo info = new CultureInfo(CultureInfo.CurrentCulture.LCID); this.Value = Encoding.GetEncoding(info.TextInfo.ANSICodePage).GetString((byte[])this.Value); } if (((map != this._typemap) && (this.Value != null)) && (!Convert.IsDBNull(this.Value) && (this.Value.GetType() != this._typemap._type))) { this.Value = decimal.Parse((string)this.Value, CultureInfo.CurrentCulture); } } } }
internal void GetOutputValue(CNativeBuffer parameterBuffer) { //Handle any output params // No value is available if the user fiddles with the parameters properties // if (_hasChanged) { return; } if ((null != _bindtype) && (_internalDirection != ParameterDirection.Input)) { TypeMap typemap = _bindtype; _bindtype = null; int cbActual = (int)parameterBuffer.ReadIntPtr(_preparedIntOffset); if (ODBC32.SQL_NULL_DATA == cbActual) { Value = DBNull.Value; } else if ((0 <= cbActual) || (cbActual == ODBC32.SQL_NTS)) { // safeguard Value = parameterBuffer.MarshalToManaged(_preparedValueOffset, _boundSqlCType, cbActual); if (_boundSqlCType == ODBC32.SQL_C.CHAR) { if ((null != Value) && !Convert.IsDBNull(Value)) { int lcid = System.Globalization.CultureInfo.CurrentCulture.LCID; CultureInfo culInfo = new CultureInfo(lcid); Encoding cpe = System.Text.Encoding.GetEncoding(culInfo.TextInfo.ANSICodePage); Value = cpe.GetString((byte[])Value); } } if ((typemap != _typemap) && (null != Value) && !Convert.IsDBNull(Value) && (Value.GetType() != _typemap._type)) { Debug.Assert(ODBC32.SQL_C.NUMERIC == _typemap._sql_c, "unexpected"); Value = decimal.Parse((string)Value, System.Globalization.CultureInfo.CurrentCulture); } } } }
internal void GetOutputValue(CNativeBuffer parameterBuffer) { //Handle any output params // No value is available if the user fiddles with the parameters properties // if (_hasChanged) return; if ((null != _bindtype) && (_internalDirection != ParameterDirection.Input)) { TypeMap typemap = _bindtype; _bindtype = null; int cbActual = (int)parameterBuffer.ReadIntPtr(_preparedIntOffset); if (ODBC32.SQL_NULL_DATA == cbActual) { Value = DBNull.Value; } else if ((0 <= cbActual) || (cbActual == ODBC32.SQL_NTS)){ // safeguard Value = parameterBuffer.MarshalToManaged(_preparedValueOffset, _boundSqlCType, cbActual); if (_boundSqlCType== ODBC32.SQL_C.CHAR) { if ((null != Value) && !Convert.IsDBNull(Value)) { int lcid = System.Globalization.CultureInfo.CurrentCulture.LCID; CultureInfo culInfo = new CultureInfo(lcid); Encoding cpe = System.Text.Encoding.GetEncoding(culInfo.TextInfo.ANSICodePage); Value = cpe.GetString((Byte[])Value); } } if ((typemap != _typemap) && (null != Value) && !Convert.IsDBNull(Value) && (Value.GetType() != _typemap._type)) { Debug.Assert(ODBC32.SQL_C.NUMERIC == _typemap._sql_c, "unexpected"); Value = Decimal.Parse((string)Value, System.Globalization.CultureInfo.CurrentCulture); } } } }
internal void GetOutputValue(CNativeBuffer parameterBuffer) { if (!this._hasChanged && ((this._bindtype != null) && (this._internalDirection != ParameterDirection.Input))) { TypeMap map = this._bindtype; this._bindtype = null; int cb = (int) parameterBuffer.ReadIntPtr(this._preparedIntOffset); if (-1 == cb) { this.Value = DBNull.Value; } else if ((0 <= cb) || (cb == -3)) { this.Value = parameterBuffer.MarshalToManaged(this._preparedValueOffset, this._boundSqlCType, cb); if (((this._boundSqlCType == ODBC32.SQL_C.CHAR) && (this.Value != null)) && !Convert.IsDBNull(this.Value)) { CultureInfo info = new CultureInfo(CultureInfo.CurrentCulture.LCID); this.Value = Encoding.GetEncoding(info.TextInfo.ANSICodePage).GetString((byte[]) this.Value); } if (((map != this._typemap) && (this.Value != null)) && (!Convert.IsDBNull(this.Value) && (this.Value.GetType() != this._typemap._type))) { this.Value = decimal.Parse((string) this.Value, CultureInfo.CurrentCulture); } } } }