TDB or Totoye DataBase is a small JavaScript database created to arrange data during web programming. We can use it to display data inside a table on a web page or to simply save temporarily data or permanent ones as cookie. You can use it in a HTML5 game for data manipulation.
Syntax: new TDB.Table("COUNTRY", columns, rows);
Syntax #2 : new TDB.Table("COUNTRY");
Columns and rows are objects or arrays containing the different columns and the rows within the table.
Syntax: .addColumn("Column1");
addColum is a method from the Table class.
Syntax: .addRow("row1, row2, row3, row4, row5");
addRow is a method from the table class by which you can add row to the table.
Syntax: .getSize()
It's a method from the Table class that returns the current size of the table.
Syntax: .updateAt(row_id, column_id, new_Data)
Example: country.updateAt(1, 0, "Asia")
You're updating the first column of the second row with the data "new_Data".
Example 2: country.updateAt("Continent = Asia", "Position", "East")
You're updating the column "Position" at row where the data in column "Continent" is "Asia"
Syntax: .getData(row_id, column_id)
Syntax 2: country.getData("Countries = China", "Languages")
Get data in column "Languages" from the row where the data from column "Countries" is "China".
Syntax: .removeRow(row_id)
Syntax 2: country.removeRow("Countries = China")
Remove the row where the data from column "Countries" is "China"
Syntax: .removeColumn(column_id)
Syntax 2: .removeColumn(column_name)
Syntax: .removeData(row_id,row_id)
Syntax 2: .removeData("Countries = Russia", "Continent");
Remove the data from the column "Continent" where the column "Countries" has data "Russia".
Syntax: .getName()
The method returns the name of your table.
Syntax: .Display(table_width, table_height)
Syntax 2: .Display()
This method returns a HTML table element so that you can use it anywhere you want on your page.
Syntax: .getColumns();
Return a String value with names of all the columns.
a) Create a storage space:
Syntax: new TDB.Storage("MyStorage_name")
b) Add table to your storage:
Syntax: .insertTable(your_table_element)
c) Get a table from your storage as a Table(TDB table) element:
Syntax: .selectTable("table_name")
After using this method, you can use the result as a Table object. All the TDB.Table object can then be used.
d) Know how many tables is inside your storage:
Syntax: .size()
14) Get and use a TDB storage space that you saved before, but not in your file or created long time ago.
Syntax: new TDB.getStorage("storage_name")
This method returns a TDB.Storage object which means that it can use all the TDB.Storage object's methods.