internal ProcedureParameter( DBConnection cn, string name, string dataTypeFromGetSchema, int size, ParameterDirection direction )
        {
            var table = cn.GetSchema( "DataTypes" );
            var rows = new List<DataRow>();
            foreach( DataRow r in table.Rows ) {
                if( (string)r[ "TypeName" ] == dataTypeFromGetSchema )
                    rows.Add( r );
            }
            if( rows.Count != 1 )
                throw new ApplicationException( "There must be exactly one data type row matching the specified data type name." );
            var row = rows[ 0 ];
            var dataType = Type.GetType( (string)row[ "DataType" ], true );
            var dbTypeString = cn.DatabaseInfo.GetDbTypeString( row[ "ProviderDbType" ] );
            var allowsNull = (bool)row[ "IsNullable" ];

            valueContainer = new ValueContainer( name, dataType, dbTypeString, size, allowsNull, cn.DatabaseInfo );
            this.direction = direction;
        }
Ejemplo n.º 2
0
        private Column( DataRow schemaTableRow, bool includeKeyInfo, DatabaseInfo databaseInfo )
        {
            ordinal = (int)schemaTableRow[ "ColumnOrdinal" ];

            // MySQL incorrectly uses one-based ordinals; see http://bugs.mysql.com/bug.php?id=61477.
            if( databaseInfo is MySqlInfo )
                ordinal -= 1;

            valueContainer = new ValueContainer(
                (string)schemaTableRow[ "ColumnName" ],
                (Type)schemaTableRow[ "DataType" ],
                databaseInfo.GetDbTypeString( schemaTableRow[ "ProviderType" ] ),
                (int)schemaTableRow[ "ColumnSize" ],
                (bool)schemaTableRow[ "AllowDBNull" ],
                databaseInfo );
            isIdentity = ( databaseInfo is SqlServerInfo && (bool)schemaTableRow[ "IsIdentity" ] ) ||
                         ( databaseInfo is MySqlInfo && (bool)schemaTableRow[ "IsAutoIncrement" ] );
            isRowVersion = databaseInfo is SqlServerInfo && (bool)schemaTableRow[ "IsRowVersion" ];
            if( includeKeyInfo )
                isKey = (bool)schemaTableRow[ "IsKey" ];
        }
        internal ProcedureParameter(DBConnection cn, string name, string dataTypeFromGetSchema, int size, ParameterDirection direction)
        {
            var table = cn.GetSchema("DataTypes");
            var rows  = new List <DataRow>();

            foreach (DataRow r in table.Rows)
            {
                if ((string)r["TypeName"] == dataTypeFromGetSchema)
                {
                    rows.Add(r);
                }
            }
            if (rows.Count != 1)
            {
                throw new ApplicationException("There must be exactly one data type row matching the specified data type name.");
            }
            var row          = rows[0];
            var dataType     = Type.GetType((string)row["DataType"], true);
            var dbTypeString = cn.DatabaseInfo.GetDbTypeString(row["ProviderDbType"]);
            var allowsNull   = (bool)row["IsNullable"];

            valueContainer = new ValueContainer(name, dataType, dbTypeString, size, allowsNull, cn.DatabaseInfo);
            this.direction = direction;
        }