Comments (3)
is there any API to load file (or other stream data) without loading it entirely to memory?
Yes.
Your example sends file contents to the server for each Blob::write
inside of io::copy
.
Blob::write
internally calls dpiLob_writeBytes
, which requires network round-trips as listed here. If Blob::write
stores bytes to memory, no round-trips are required.
from rust-oracle.
OK, so that's why Blob::new
requires &connection.
I did not think that was the case as I not expect anything to be sent before execute
.
Anyway, big thanks.
from rust-oracle.
io::copy
uses 8K buffer for non-specialized implementation. I think that it is too small for network I/O. It is better to use BufWriter::with_capacity()
to increase the size.
let buffer_size = 1024 * 1024; // This is by guesswork. The proper size depends on the network environment.
let mut file = File::open(&schema_file.path)?;
let mut blob = BufWriter::with_capacity(buffer_size, Blob::new(&conn)?);
io::copy(&mut file, &mut blob)?;
blob.flush()?; // Don't forget this.
stmt.execute(&[blob.get_ref()])?;
from rust-oracle.
Related Issues (20)
- Any idea why I'm getting `DPI Error: DPI-1080: connection was closed by ORA-3156` HOT 3
- Usage with asynchronous code problem - how to shut down `.connect()` call that hangs indefinitely HOT 6
- Insert null values HOT 3
- How to change the value of "oracleClientLibDir" in dpiContextCreateParams struct HOT 3
- Question - async/await stream to many users using just 1 thread HOT 2
- the `?` operator can only be used in a function that returns `Result` or `Option` HOT 1
- QUESTION the trait `ToSql` is not implemented for `SqlValue`
- Question - Calling Oracle Stored Procedures Example HOT 3
- Convert recordset to Vec of Columns HOT 1
- Question - Alter Sessions HOT 1
- A way to set path for oracle instant client HOT 2
- How to extract `Geometry` type. HOT 2
- How can I save ResultSet<'_, oracle::Row> for later access? HOT 6
- `*mut oracle::binding::binding::dpiStmt` cannot be sent between threads safely HOT 2
- Question - Trying to use like operator with wildcards within query_as HOT 5
- Ability to auto-gen structs from db HOT 1
- execute create table sql error? HOT 3
- Question about performance HOT 11
- Why the lifetime is 'static
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-oracle.