Skip to content

General Guide

Ashenguard edited this page May 9, 2022 · 3 revisions

How to get the code started

To start using the library you need to initialize some basic variables.
The first thing you need is an EasyDatabase which you can find how to use on the related page.
Note:

This library requires you to have a database created as it will only connect directly to the database which most hosts provide directly on request.

The second step is defining your table or tables. To define a table first you need to define what columns it will have. You need to define the columns using EasyColumn. You find any information needed on how to define an EasyColumn on the related page. Keep in mind that you need these columns variables both on initializing the table and working with data in it, So make sure you define them globally.
Note:

EasyColumns has a built-in caster that will cast data to their proper format. Integers-based data to int, Floats-based ones to float, etc...

After defining all the columns, Go ahead and define the EasyTable using the columns you defined. Have a look at its page as it describes everything you might need.
Note:

EasyTable is a fully automated process that might raise several exceptions based on how you might use it. So check the EasyTable page as it describes every possible exception it might return in the process.

How to manage data

After setting the table you can now use it to manage your database.

Selecting data

To select/get data you can use the Select method of the table as explained there. Also, have a look at Where Clauses as you need them to specify what data you need.

Inserting and updating data

SQL is a bit annoying based on if data exists or not. EasyTable has 2 basic methods called Insert and Update that will do the job as SQL intended to, But there is an extra method called Set that will Insert or Update based on if data exists or not.
Have a look at related pages and select(!) where(!) it suits you.

Remove data

If you add data, You should be able to remove it as well! EasyTable has a method for it as well which is called Delete.

Clone this wiki locally