/// <summary> /// Creates a new instance of the <see cref="SqlClientInputStream" /> class for the specified connection string, table /// data field, and where criteria. /// </summary> /// <param name="connectionString">The connection string of the database to use.</param> /// <param name="table">The table in which the data is stored.</param> /// <param name="dataField">The field in which the data is stored</param> /// <param name="whereCriteria">The where criteria that identifies the record.</param> public OracleBlobOutputStream(string connectionString, string table, string dataField, string whereCriteria) { // TODO: add buffering _cn = OracleBlobUploadStreamProvider.CreateConnection(connectionString); _cmd = _cn.CreateCommand(); _cmd.CommandText = "SELECT " + dataField + " FROM " + table + " WHERE " + whereCriteria; try { _cn.Open(); IDataReader rd = _cmd.ExecuteReader(CommandBehavior.SingleRow); rd.Read(); object blob = rd.GetType().InvokeMember("GetOracleBlob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, rd, new object[] { 0 }); _blob = new ReflectWrapper(blob); } catch { _cn.Close(); } }
/// <summary> /// Creates a new instance of the <see cref="SqlClientInputStream" /> class for the specified connection string, table /// data field, and where criteria. /// </summary> /// <param name="connectionString">The connection string of the database to use.</param> /// <param name="table">The table in which the data is stored.</param> /// <param name="dataField">The field in which the data is stored</param> /// <param name="whereCriteria">The where criteria that identifies the record.</param> public OracleBlobOutputStream(string connectionString, string table, string dataField, string whereCriteria) { // TODO: add buffering _cn = OracleBlobUploadStreamProvider.CreateConnection(connectionString); _cmd = _cn.CreateCommand(); _cmd.CommandText = "SELECT " + dataField + " FROM " + table + " WHERE " + whereCriteria; try { _cn.Open(); IDataReader rd = _cmd.ExecuteReader(CommandBehavior.SingleRow); rd.Read(); object blob = rd.GetType().InvokeMember("GetOracleBlob", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, rd, new object[] {0}); _blob = new ReflectWrapper(blob); } catch { _cn.Close(); } }
/// <summary> /// Creates a new instance of the <see cref="SqlClientInputStream" /> class for the specified connection string, table /// data field, id field, and id value. /// </summary> /// <param name="connectionString">The connection string of the database to use.</param> /// <param name="table">The table in which the data is stored.</param> /// <param name="dataField">The field in which the data is stored</param> /// <param name="idField">The field which identifies the record.</param> /// <param name="idValue">The value which identifies the record.</param> /*public SqlClientInputStream(string connectionString, string table, string dataField, string idField, int idValue) : this(connectionString, table, dataField, idField + "=" + idValue.ToString()) {}*/ /// <summary> /// Creates a new instance of the <see cref="SqlClientInputStream" /> class for the specified connection string, table /// data field, and where criteria. /// </summary> /// <param name="connectionString">The connection string of the database to use.</param> /// <param name="table">The table in which the data is stored.</param> /// <param name="dataField">The field in which the data is stored</param> /// <param name="whereCriteria">The where criteria that identifies the record.</param> public OracleBlobInputStream(string connectionString, string table, string dataField, string whereCriteria) { // TODO: add buffering _cn = OracleBlobUploadStreamProvider.CreateConnection(connectionString); _cmd = _cn.CreateCommand(); _cmd.CommandText = "UPDATE " + table + " SET " + dataField + "=:blob WHERE " + whereCriteria; _cn.Open(); object blob = TypeCache.CreateInstance("Oracle.DataAccess.Types.OracleBlob, " + OracleBlobUploadStreamProvider._odpAssembly, new object[] { _cn }); _blob = new ReflectWrapper(blob); _blob.InvokeVoid("BeginChunkWrite"); }
/// <summary> /// Creates a new instance of the <see cref="SqlClientInputStream" /> class for the specified connection string, table /// data field, id field, and id value. /// </summary> /// <param name="connectionString">The connection string of the database to use.</param> /// <param name="table">The table in which the data is stored.</param> /// <param name="dataField">The field in which the data is stored</param> /// <param name="idField">The field which identifies the record.</param> /// <param name="idValue">The value which identifies the record.</param> /*public SqlClientInputStream(string connectionString, string table, string dataField, string idField, int idValue) : * this(connectionString, table, dataField, idField + "=" + idValue.ToString()) * {}*/ /// <summary> /// Creates a new instance of the <see cref="SqlClientInputStream" /> class for the specified connection string, table /// data field, and where criteria. /// </summary> /// <param name="connectionString">The connection string of the database to use.</param> /// <param name="table">The table in which the data is stored.</param> /// <param name="dataField">The field in which the data is stored</param> /// <param name="whereCriteria">The where criteria that identifies the record.</param> public OracleBlobInputStream(string connectionString, string table, string dataField, string whereCriteria) { // TODO: add buffering _cn = OracleBlobUploadStreamProvider.CreateConnection(connectionString); _cmd = _cn.CreateCommand(); _cmd.CommandText = "UPDATE " + table + " SET " + dataField + "=:blob WHERE " + whereCriteria; _cn.Open(); object blob = TypeCache.CreateInstance("Oracle.DataAccess.Types.OracleBlob, " + OracleBlobUploadStreamProvider._odpAssembly, new object[] { _cn }); _blob = new ReflectWrapper(blob); _blob.InvokeVoid("BeginChunkWrite"); }