Description
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.