/// <summary> /// Adds the specified DbTypeParameter to the DbTypeParametersCollection. /// </summary> /// <param name="a_oToAdd">The DbTypeParameter to add to the collection. </param> /// <returns>The index of the new DbTypeParameter object.</returns> /// <exception cref="ArgumentException">The column name specified by a_oToAdd.DBColumnName already exist in other DbTypeParameter in the DbTypeParametersCollection.</exception> public virtual int Add(DbTypeParameter a_oToAdd) { if (this.Contains(a_oToAdd.DbColumnName)) { throw new ArgumentException("The column name specified by DbTypeParameter.DBColumnName already exist in other DbTypeParameter in the DbTypeParametersCollection.", "a_oToAdd"); } return(List.Add(a_oToAdd)); }
/// <summary> /// Determines whether the DbTypeParametersCollection contains a specific DbTypeParameter. /// </summary> /// <param name="a_oToFind">The DbTypeParameter to locate in the DbTypeParametersCollection</param> /// <returns>true if the DbTypeParametersCollection contains the specified DbTypeParameter; otherwise, false.</returns> public virtual bool Contains( DbTypeParameter a_oToFind ) { // If a_oToFind is not of type DbTypeParameter, this will return false. return( List.Contains( a_oToFind ) ); }
/// <summary> /// Gets the location of the DbTypeParameter object in the collection. /// </summary> /// <param name="a_oToFind">The DbTypeParameter object to locate. </param> /// <returns>The zero-based location of the DbTypeParameter in the collection, if found; otherwise, -1.</returns> public virtual int IndexOf( DbTypeParameter a_oToFind) { return( List.IndexOf( a_oToFind ) ); }
/// <summary> /// Adds a DbTypeParameter with the specified data to the DbTypeParametersCollection. /// </summary> /// <param name="a_sColumnName">Specifies the initial column name for the DbTypeParameter.</param> /// <param name="a_sTypeName">Specifies the initial parameter type Name for the DbTypeParameter.</param> /// <param name="a_oValue">Specifies the initial value for the DbTypeParameter.</param> /// <param name="a_iSize">Specifies the initial size for the DbTypeParameter</param> /// <returns>The index of the new DbTypeParameter object.</returns> /// <exception cref="ArgumentException">The column name specified by a_sColumnName already exist in other DbTypeParameter in the DbTypeParametersCollection.</exception> public virtual int Add(string a_sTypeName, object a_oValue, int a_iSize) { DbTypeParameter l_oToAdd = new DbTypeParameter(a_sTypeName, a_oValue, a_iSize); return this.Add(l_oToAdd); }
/// <summary> /// Adds the specified DbTypeParameter to the DbTypeParametersCollection. /// </summary> /// <param name="a_oToAdd">The DbTypeParameter to add to the collection. </param> /// <returns>The index of the new DbTypeParameter object.</returns> /// <exception cref="ArgumentException">The column name specified by a_oToAdd.DBColumnName already exist in other DbTypeParameter in the DbTypeParametersCollection.</exception> public virtual int Add( DbTypeParameter a_oToAdd ) { if (this.Contains(a_oToAdd.DbColumnName)) { throw new ArgumentException("The column name specified by DbTypeParameter.DBColumnName already exist in other DbTypeParameter in the DbTypeParametersCollection.", "a_oToAdd"); } return( List.Add( a_oToAdd ) ); }
/// <summary> /// This is a workaround for the extra white spaces added in oracle to NCHAR & NVARCHAR values. /// The problem is a documented GH limitation, see bug #3417. /// The workaround is to trim the lemgth of the returned string to the specified length of the parameter/column. /// </summary> /// <param name="testedServer">The database server we are currently running on.</param> /// <param name="val">The value returned from the database.</param> /// <returns>The normalized value..</returns> private object WorkaroundOracleCharsPaddingLimitation(DataBaseServer testedServer, DbTypeParameter currentParam, object val) { object origVal = val; string dbTypeName = currentParam.DbTypeName.ToUpper(); if ( (testedServer == DataBaseServer.Oracle) && (dbTypeName == "CHAR" || dbTypeName == "NCHAR") ) { val = ((string)val).Substring(0, currentParam.Size); Log(string.Format("Worked around oracle chars padding limitation by triming '{0}' to '{1}'", origVal, val)); } return val; }
/// <summary> /// Determines whether the DbTypeParametersCollection contains a specific DbTypeParameter. /// </summary> /// <param name="a_oToFind">The DbTypeParameter to locate in the DbTypeParametersCollection</param> /// <returns>true if the DbTypeParametersCollection contains the specified DbTypeParameter; otherwise, false.</returns> public virtual bool Contains(DbTypeParameter a_oToFind) { // If a_oToFind is not of type DbTypeParameter, this will return false. return(List.Contains(a_oToFind)); }
/// <summary> /// Gets the location of the DbTypeParameter object in the collection. /// </summary> /// <param name="a_oToFind">The DbTypeParameter object to locate. </param> /// <returns>The zero-based location of the DbTypeParameter in the collection, if found; otherwise, -1.</returns> public virtual int IndexOf(DbTypeParameter a_oToFind) { return(List.IndexOf(a_oToFind)); }
/// <summary> /// Adds a DbTypeParameter with the specified data to the DbTypeParametersCollection. /// </summary> /// <param name="a_sColumnName">Specifies the initial column name for the DbTypeParameter.</param> /// <param name="a_sTypeName">Specifies the initial parameter type Name for the DbTypeParameter.</param> /// <param name="a_oValue">Specifies the initial value for the DbTypeParameter.</param> /// <param name="a_iSize">Specifies the initial size for the DbTypeParameter</param> /// <returns>The index of the new DbTypeParameter object.</returns> /// <exception cref="ArgumentException">The column name specified by a_sColumnName already exist in other DbTypeParameter in the DbTypeParametersCollection.</exception> public virtual int Add(string a_sTypeName, object a_oValue, int a_iSize) { DbTypeParameter l_oToAdd = new DbTypeParameter(a_sTypeName, a_oValue, a_iSize); return(this.Add(l_oToAdd)); }