Skip to content

Commit

Permalink
Fix copy local reject files larger than buffer size (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
sitingren authored May 29, 2024
1 parent 7af0dd0 commit ab2c8aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vertica-nodejs/lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class Query extends EventEmitter {
if (msg.fileName.length === 0) { //using returnrejected, fileContents is an array of row numbers, not a string
this._result._setRejectedRows(msg.fileContents)
} else { // future enhancement, move file IO to util
fs.appendFile(msg.fileName, msg.fileContents, (err) => {
fs.appendFileSync(msg.fileName, msg.fileContents, (err) => {
if (err) {
console.error('Error writing to file:', err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ describe('Running Copy From Local File Commands', function () {

fs.stat('rejects-large.txt', (statErr, stats) => {
assert.equal(statErr, null);
assert.equal(stats.size, 98894);
});
var inputBuf = fs.readFileSync('large-copy-bad.dat');
var rejectBuf = fs.readFileSync('rejects-large.txt');
assert(inputBuf.equals(rejectBuf), 'content in rejected data file is not the same as the input file')
} finally {
fs.unlink('large-copy-bad.dat', () => {
fs.unlink('rejects-large.txt', done)
Expand Down

0 comments on commit ab2c8aa

Please sign in to comment.