jsbase

1.1.1 • Public • Published

TOTAL PROTOTYPE DON"T USE FOR REAL APPLICATIONS JUST YET, CAN BUG A LOT OR EVEN CRASH

UPDATE 1.1

  • Multiple row editing,retrieving,deleting !!!!!
  • Optimized code a little bit
  • Bug fixes and performance improvements

TO DO LIST:

  1. 10% DONE Review code for like 100times because it might just be broken everywhere
  2. 100% DONE Handle situations when retrieve/edit/deleterow functions select more than one row
  3. 5% DONE TEST TEST TEST

PLEASE SEND ME ALL BUGS YOU ENCOUNTER TO MY EMAIL deivistilindis@gmail.com

THANK YOU FOR ALPHA TESTING MY PROJECT

**USAGE EXAMPLE : ** enter image description here


var JSbase = require("./JSbase");


Create new database

JSbase.newDB(name,location)
  • name - name of the database
  • location - location format : C:\blalala\bababa\asdasd if you want it in the same folder you can use __dirname

Create new Object that you will control database with

JSbase.controlDB(name,location,function(controlObjectName){
    Here goes all the code to control database
});
  • name - name of the database
  • location - location format : C:\blalala\bababa\asdasd if you want it in the same folder you can use __dirname
  • controlObjectName - Name of the object you will be controlling database with

Database control methods(functions)


delete() 

Delete database with all data


newTB(name,columnNames)

Create a new table in database

  • name - name of the table
  • columnNames - table's column names in array

controlTB(name,function(function(controlObjectName){
    Here goes all the code to control table
});

Create a new Object that you will control table with

  • name - name of the table
  • controlObjectName - Name of the object you will be controlling table with

Table control methods(functions)


delete()

Delete table with all data


insert(data,columns)

Insert data into table

  • data - data in array form

  • !!! if columns parameter is not given, functions expects that you insert all columns and that they are in sequence

  • columns - OPTIONAL columns that you want to insert data to in array form

  • data and columns array elements sequence has to match for succesful insert


retrieve(selector,selector_value,columns)
  • Get data from table

  • selector - column name of the column you will be selecting row based on

  • selector_value - selector value

for example :

var data = retrieve(selector = "name", selector_value ="Peter");
  • columns - OPTIONAL columns that you want to retrieve data from in array form
  • if columns is not given you will recieve all column data

deleteRow(selector,selector_value)

Delete selected row

  • selector - column name of the column you will be selecting row based on
  • selector_value - selector value

edit(selector,selector_value,data,columns)

Edit selected row

  • selector - column name of the column you will be selecting row based on
  • selector_value - selector value

for example :

(selector = "Vardas", selector_value ="Petras")
  • data - data in array form that will be replacement
  • !!! if columns parameter is not given, functions expects that you edit all columns and they are in sequence
  • columns - OPTIONAL columns in array form that you want to change
  • data and columns array elements sequence has to match for succesful insert

save();

Save your table edits into txt file

  • A MUST FUNCTION if you want to save all table changes done with other functions to static txt file for later use
  • Always do this after finishing editing, !!!!!!
  • you don't have to do it after every function

Package Sidebar

Install

npm i jsbase

Weekly Downloads

15

Version

1.1.1

License

none

Last publish

Collaborators

  • de1xs