Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature/Enhancement Request: Stream data into a blob instead of having entire buffer in memory #962

Open
trsvax opened this issue Nov 4, 2023 · 1 comment

Comments

@trsvax
Copy link

trsvax commented Nov 4, 2023

Is your feature request related to a problem? Please describe.
There are times when it would be nice to stream data into a blob and not have the entire buffer in memory

Describe the solution you'd like
While looking for solutions Github co pilot generated this

const file = fs.createReadStream(path/to/${sid.trim()}_flash_notice.pdf);
const conn = ibmdb.openSync(‘DATABASE=<database_name>;HOSTNAME=;UID=;PWD=;PORT=’);
const stmt = conn.prepareSync(‘INSERT INTO foo (id, pdf) VALUES (?, ?)’);
const lob = conn.createLob(ibmdb.SQL_BLOB);
stmt.execute([sid.trim(), lob], (err) => {
if (err) {
console.error(err);
return;
}
file.on(‘data’, (chunk) => {
lob.write(chunk);
});
file.on(‘end’, () => {
lob.closeSync();
});
archive.append(lob, { name: ${sid.trim()}_flash_notice.pdf });
});
});

Describe alternatives you've considered
It's currently possible to write a file then insert that. Not sure if that just reads the file into memory and inserts it.

Additional context
I'm not an ODBC expert but the above seems possible via the C interface. It's interesting that co pilot suggested it.

@bimalkjha
Copy link
Member

Internal: Opened Epic https://jira.rocketsoftware.com/browse/DBC-14896 in Jira for this enhancement request. Currently planned for 1H2024. Thanks.

@bimalkjha bimalkjha changed the title New Feature/Enhancement Request New Feature/Enhancement Request: Stream data into a blob instead of having entire buffer in memory Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants