This object establishes the communication with the database in order to be able to
interact with it. It is important to note that the configuration may be distant according to the user
or control panel where it is located; being the administrative user one with all the privileges and
one restricted for users or interface of the system.
The object variable $db is reserved for it.
The system internally stores the following values
- Usually with the value of localhost. Stores the identity of the machine where the database is located.
- Database user There must be a user created for that purpose. Never use root user.
- Database name.
- Prefix of the system tables. Its value is set during installation.
The object $db, belongs to class DbConnection Is created only once per call, offering
the following methods:
- In case of error with the database, it provides information about the type of error that occurred.
- Informative. Provides information about the type of connection used and associated version.
- Connects to the database
- It receives as a parameter a query (string) and executes it. At some point it was considered
to use a universal system of parameters, but given the complexity involved and that makes the difference
between the different types of SQL calls was minimal, we chose to continue using this model.
- It receives as a parameter an array of values that it returns, replacing the values of 'and "
with a secure code, in order to prevent code injection.
- Returns a line of results. In case the indicated parameter (str) is "hash" it returns the results in that format.
By default, the results are delivered as array (array).
- According to the indicated parameter (str), you can return the number of rows,
free the contents of the result of the query (free), the entire block of results (all) or a value of -1 as error
in case of Not be any of the above options.
- Disconnect from the database.
- Returns the prefix used for tables.
Requieres loading the library debug.