internal DeveelDbLob(DeveelDbConnection connection, ObjectId objId, long size) : this(objId, size, FileAccess.Read) { this.connection = connection; lobChannel = connection.OpenLargeObjectChannel(objId); readStream = new BufferedStream(new LobInputStream(this), (int)(size / 64)); }
internal DeveelDbLob(DeveelDbConnection connection, ObjectId objId, long size) : this(objId, size, FileAccess.Read) { this.connection = connection; lobChannel = connection.OpenLargeObjectChannel(objId); readStream = new BufferedStream(new LobInputStream(this), (int)(size/64)); }
internal static ObjectId Upload(DeveelDbConnection connection, DeveelDbLob lob) { if (connection == null) { throw new InvalidOperationException("An open connection is required to upload the LOB"); } var objId = connection.CreateLargeObject(lob.Length); using (var channel = connection.OpenLargeObjectChannel(objId)) { const int bufferSize = 2048; var copyBuffer = new byte[bufferSize]; int readCount; long copyOffset = 0; lob.writeStream.Seek(0, SeekOrigin.Begin); while ((readCount = lob.writeStream.Read(copyBuffer, 0, bufferSize)) > 0) { channel.PushData(copyOffset, copyBuffer, readCount); copyOffset += readCount; } } return(objId); }
internal static ObjectId Upload(DeveelDbConnection connection, DeveelDbLob lob) { if (connection == null) throw new InvalidOperationException("An open connection is required to upload the LOB"); var objId = connection.CreateLargeObject(lob.Length); using (var channel = connection.OpenLargeObjectChannel(objId)) { const int bufferSize = 2048; var copyBuffer = new byte[bufferSize]; int readCount; long copyOffset = 0; lob.writeStream.Seek(0, SeekOrigin.Begin); while ((readCount = lob.writeStream.Read(copyBuffer, 0, bufferSize)) > 0) { channel.PushData(copyOffset, copyBuffer, readCount); copyOffset += readCount; } } return objId; }