You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: