Comments (20)
Original comment by Kerim Gueney (Bitbucket: KerimG, GitHub: KerimG).
Oh yes, I was not able to test this yet, because we used a workaround but I trust Brian's results.
Thanks a bunch!
from nodejs-idb-connector.
Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).
@TaskForce_Kerim Could we close this issue now?
from nodejs-idb-connector.
@TaskForce_Kerim have you had a chance to test your original select statement with v1.1.1 of the idb-connector?
Would like to mark this issue as resolved if all is well.
from nodejs-idb-connector.
Original comment by Brian Jerome (Bitbucket: bjerome, GitHub: brianmjerome).
@abmusse idb-pconnector tests look good on my end!
from nodejs-idb-connector.
@brianmjerome FYI v0.1.1 of idb-pconnector released.
from nodejs-idb-connector.
@brianmjerome 👍 Nice!
from nodejs-idb-connector.
Original comment by Brian Jerome (Bitbucket: bjerome, GitHub: brianmjerome).
@abmusse Was able to read from a file into a buffer and insert that buffer as the blob via your example 😃 Then I read that inserted blob and parsed the buffer with toString()
to get the file contents.
from nodejs-idb-connector.
Original comment by Brian Jerome (Bitbucket: bjerome, GitHub: brianmjerome).
@abmusse Awesome -- I'll look into testing the filesystem one as well.
from nodejs-idb-connector.
@brianmjerome Can you also try to bind a buffer to a blob field in the database. Maybe read a file from disk using fs to get a buffer.
For example:
#!js
const idb = require('idb-connector');
const fs = require('fs');
let dbconn = new idb.dbconn();
dbconn.conn('*LOCAL');
let dbStmt = new idb.dbstmt(dbconn);
let buffer = fs.readFileSync('Your File');
dbStmt.prepare('Insert Statement', (error)=>{
if (error){
throw error;
}
dbStmt.bindParam([[buffer, idb.SQL_PARAM_INPUT, idb.SQL_BLOB]], (error)=>{
if (error){
throw error;
}
dbStmt.execute( (result, error) =>{
if (error){
throw error;
}
});
});
});
from nodejs-idb-connector.
@brianmjerome Working on Pushing an update to idb-pconnector today. v0.1.1 :slight_smile:
from nodejs-idb-connector.
Original comment by Brian Jerome (Bitbucket: bjerome, GitHub: brianmjerome).
@abmusse Great! Tested it out with the idb-connector and I was able to get the Buffer values. Unrelated I updated idb-pconnector to 0.1.0 but am getting unhandled promise errors so couldn't try it with that yet.
from nodejs-idb-connector.
@brianmjerome if you run a SELECT
statement like OP you will be returned a buffer containing the blob within the result set. As of v1.1.0
from nodejs-idb-connector.
Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).
@brianmjerome idb-connector v1.1.0 is released now.
from nodejs-idb-connector.
@brianmjerome Very Soon, we have been refactoring this project to use N-API, Blobs will be part of the N-API version of idb-connector.
from nodejs-idb-connector.
Original comment by Brian Jerome (Bitbucket: bjerome, GitHub: brianmjerome).
@abmusse Any update on your BLOB implementation? Hoping to try it out soon! I see there are some new tests added.
from nodejs-idb-connector.
@dmabupt @KerimG @brianmjerome Currently working on getting BLOB implemented. The Blob would returned back in the form of a Node Buffer. Would Also be able to insert Node Buffer and bind to a BLOB field.
from nodejs-idb-connector.
Original comment by Brian Jerome (Bitbucket: bjerome, GitHub: brianmjerome).
Any ETA on when BLOB will be ready?
from nodejs-idb-connector.
Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).
@abmusse Yes, but it only supports SQL_VARBINARY / SQL_BINARY right now. BLOB/CLOB are not ready yet.
Ref-> https://bitbucket.org/litmis/nodejs-idb-connector/src/master/src/db2ia/dbstmt.h#lines-152
from nodejs-idb-connector.
@dmabupt can new version of idb 1.0.10 now return binary data?
from nodejs-idb-connector.
I also ran into this issue and spoke with @dmabupt. He is currently working on a solution.
from nodejs-idb-connector.
Related Issues (20)
- Character conversion between CCSID 1208 and CCSID 65535 not valid. HOT 7
- Set SQL_ATTR_NON_HEXCCSID CLI environment attribute by default
- Error SQLSTATE=02000 SQLCODE=100 HOT 4
- Error SQLSTATE=38501 SQLCODE=-443 does not return the true message HOT 1
- idb-connector not compatible with Node.js v16.x HOT 30
- Error SQLSTATE=02000 SQLCODE=100 HOT 1
- Error SQLSTATE=22504 SQLCODE=-191 Mixed data or UTF-8 data not properly formed. HOT 22
- Use of BINARY Parameter w/Stored Procedure Call Corrupts the Node Process HOT 3
- Handling permanent JOB... HOT 1
- Some issues when calling SP with dbstmt.bindParameters() HOT 1
- Error: SQLSTATE=22504 SQLCODE=-191 Mixed data or UTF-8 data not properly formed. HOT 1
- Not receiving output from Stored Procedure and no clear example..
- temporary memory of job increases massive when using CLOB/JSON field in SQL-request HOT 3
- Connection Pool HOT 3
- Add package-lock.json? HOT 1
- the sql state error seems to be fixed, but we have a different issue HOT 4
- idb-connector *SP calls returns invalid numeric data -- Node 18, IDB-Connector 1.2.18 HOT 21
- test: cleanup test infrastructure HOT 1
- CLOB: truncation of the last char ! HOT 6
- Fix license headers on source files
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 nodejs-idb-connector.