Click to change color scheme

Notes on codes, projects and everything

Evil evil update

This update took me quite a bit more time than I initially expected. Anyway, I have done some refactoring work to the original code, and thought it would be nice to document the changes. Overall, most of the changes involved the refactoring of function names. I am not sure if this would stick, but I am quite satisfied for now.

What’s new?

Considering certain statements such as insert, update and delete statement should remain the same most of the time, I have made the library to generate them automatically. However, they can be rewritten for whatever reason though. For this to work properly, a new option is introduced to the schema, as shown below:

"name": {
"data_type": "character varying",
"not_null": true,
"insert": true
}

Simply add in a new option named “insert”, and set it to true, then the library will generate appropriate insert and update statement.

What’s changed?

The basic concept is still similar, however most of the function call has changed. For instance, to create a generator,

$generator = \coolsilon\database\relation_generator($pdo, json_reader());

Executing a statement is now simply

$statement = \coolsilon\database\statement_execute($statement, $data);

For form library, the init function is now

$form = \coolsilon\form\init(json_decode($file_of_form_schema, TRUE));

Reading the input is now

$input = \coolsilon\form\input_read($_POST);

Other things remains the same for now, but I probably would revise them again in future. I have tagged the current state as version 0.1. While I am sort of happy with the current state, I am working on adding new widgets to the library. After all the basic features are in place, I would probably start testing them properly.

leave your comment

name is required

email is required

have a blog?

This blog uses scripts to assist and automate comment moderation, and the author of this blog post does not hold responsibility in the content of posted comments. Please note that activities such as flaming, ungrounded accusations as well as spamming will not be entertained.

Pings