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
constconfig=require(`./config.json`).db;constmaria=require(`mariadb/callback`);globalThis.sql=maria.createPool({host: config.host,user: config.user,password: config.pass,database: `debug`,})// DROP TABLE IF EXISTS tab; CREATE TABLE tab (a JSON, b JSON, c LONGTEXT);letvals=require(`./data.json`)console.log(vals.flatMap(x=>Buffer.from(x).byteLength));// with query it works, but not with batch :)sql.batch(`INSERT INTO tab (a,b,c) VALUES (?,?,?)`,vals,async(err,res)=>{if(err)throwerr;console.log(res);process.exit(0);})
data.json is 19MB so you'll have to increase max_allowed_packet from it's default 16MB
node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/cmd/batch-bulk.js:74
const val = value[i];
^
TypeError: Cannot read properties of undefined (reading '0')
at BatchBulk.parameterHeaderFromValue (node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/cmd/batch-bulk.js:74:24)
at BatchBulk.sendComStmtBulkExecute (node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/cmd/batch-bulk.js:306:38)
at BatchBulk.start (node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/cmd/batch-bulk.js:60:10)
at Connection.addCommandEnablePipeline (node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/connection.js:1151:11)
at Connection.executeBulkPromise (node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/connection.js:290:10)
at new Promise (<anonymous>)
at node_modules/.pnpm/mariadb@3.4.0/node_modules/mariadb/lib/connection.js:214:16
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Node.js v23.1.0
server version: 11.5.2-1
connector: 3.4.0
data.json is 19MB so you'll have to increase max_allowed_packet from it's default 16MB
For me, removing the "!" here fixed it.
The text was updated successfully, but these errors were encountered: