https://github.com/megapixel99/sql-nodejs
An SQL Database stored in memory during runtime
https://github.com/megapixel99/sql-nodejs
database node node-js node-module nodejs nodejs-modules sql
Last synced: about 1 month ago
JSON representation
An SQL Database stored in memory during runtime
- Host: GitHub
- URL: https://github.com/megapixel99/sql-nodejs
- Owner: Megapixel99
- License: mit
- Created: 2020-02-06T03:57:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-11T06:52:03.000Z (over 6 years ago)
- Last Synced: 2025-07-01T05:05:11.266Z (11 months ago)
- Topics: database, node, node-js, node-module, nodejs, nodejs-modules, sql
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/sql-nodejs
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Overview
The purpose of this project is to create an SQL database which is stored in memory.
##### Supported Statements:
- Create
- Insert (Currently limited to only one record at a time)
- Select
- Drop
### How to use
In your Project require the module:
```javascript
const sqlMock = require('sql-mock');
```
Then write the following to create your database:
```javascript
let db = new sqlMock();
```
Logging is diabled by default, to enable logging pass `true` in as an argument to the constructor (i.e `sqlMock(true)`)
Then use the parse function and pass in an SQL statement. For example:
```javascript
db.Parse("CREATE DATABASE databasename;");
db.Parse("CREATE table tablename (test INT, test1 INT, test2 INT);");
db.Parse("INSERT INTO tablename (test, test1, test2) VALUES (" + 0 + ", " + 2 + ", " + 0 + ");")
db.Parse("INSERT INTO tablename (test, test1, test2) VALUES (" + 0 + ", " + 2 + ", " + 0 + ");")
db.Parse("INSERT INTO tablename (test, test1, test2) VALUES (" + 1 + ", " + 0 + ", " + 0 + ");")
db.Parse("Select test, test1, test2 from tablename WHERE test = " + 0 + ";");
db.Parse("Select test, test1 from tablename;");
db.Parse("Select * from tablename WHERE test = " + 1 + ";");
db.Parse("Select * from tablename;");
```
### How to test
In your Terminal or Command Prompt, run the following at the root of the
project directory:
```
$ npm test
```
### Version History
###### v0.0.5
- Added option to disable info logs
- i.e "Using database: databasename"
###### v0.0.1
- Creating databases and tables
- Switching databases
- Select statements for querying tables
### How to contribute
Contributions are appreciated, if you wish to contribute please make a pull request on the Github Repository.