Skip to content

Commit

Permalink
complete step 20
Browse files Browse the repository at this point in the history
  • Loading branch information
sourav-sm committed Apr 18, 2024
1 parent 49777ba commit df274f1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ rl.on('line', async (line) => {
}

try {
// Execute the query - do your own implementation
if (line.toLowerCase().startsWith('select')) {
const result = await executeSELECTQuery(line);
console.log('Result:', result);
} else if (line.toLowerCase().startsWith('insert into')) {
const result = await executeINSERTQuery(line);
console.log(result.message);
} else if (line.toLowerCase().startsWith('delete from')) {
const result = await executeDELETEQuery(line);
console.log(result.message);
} else {
console.log('Unsupported command');
}
}catch (error) {
console.error('Error:', error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/step-20/deleteExecutor.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { executeDELETEQuery } = require('../../src/queryExecutor');
const { executeDELETEQuery } = require('../../src/index');
const { readCSV, writeCSV } = require('../../src/csvReader');
const fs = require('fs');

Expand Down
2 changes: 1 addition & 1 deletion tests/step-20/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {readCSV} = require('../../src/csvReader');
const {executeSELECTQuery } = require('../../src/queryExecutor');
const {executeSELECTQuery } = require('../../src/index');
const { parseJoinClause, parseSelectQuery } = require('../../src/queryParser');

test('Read CSV File', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/step-20/insertExecuter.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { executeINSERTQuery } = require('../../src/queryExecutor');
const { executeINSERTQuery } = require('../../src/index');
const { readCSV, writeCSV } = require('../../src/csvReader');
const fs = require('fs');

Expand Down

0 comments on commit df274f1

Please sign in to comment.