GitHub pages
technicalguru / php-database Goto Github PK
View Code? Open in Web Editor NEWA PHP library for accessing databases easily
License: GNU Lesser General Public License v3.0
A PHP library for accessing databases easily
License: GNU Lesser General Public License v3.0
On configuration (in constructor) or by request, a DAO shall check existance of table and create table if required.
a newInstance()
method that returns a new instance of the model class.
The current where clause definition is not flexible enough. It is required to have the where clause generation delegated to specific Criteria
and Criterion
objects which - in long-term strategy - will handle even count, sum and other projections.
The idea is based on Hibernate.
return the connect error string before the normal error string on error()
method
The method can be required outside.
The documentation needs an update how DAO uses the Criteria API
Allow DataModel
to defer DAO
creation until it is requested. Intriduce a DaoFactory
interface for this that can be part of the model.
The automatic JSON-encoding of objects has a flaw when the value itself has some attributes that are not meant to be encoded. TgUtils has a new interface that cabn be used (SelfJsonEncoder
) that can be used in sich cases.
Allow Order
objects in Database
and DAO
objects where ordering is involved
A general method shall be introduced to check whether a specific table exists.
Restriction objects shall be allowed in all methods of Database
and DAO
where a WHERE
clause is involved.
There is currently only error()
which checks $con->error
but not $con->connect_errno
Provide a method to get the description of a table
Use the Criteria
object internally in Database
and DAO
when querying objects.
Newer MariaDB versions do not accept ORDER BY
clauses when the property is not in GROUP BY
or SELECT
clause. The order of the query needs to be removed.
The current delete method allows only deletion of given objects. A criteria-based delete is required
Symptom: a value like '036876' that shall be saved as string in database is saved as '36876' (leading zero stripped off).
Reason: TgDatabase\Database
class method prepareValue()
decides on is_numeric()
only whether the value needs quoting or not. Leading zeros are stripped of then when saving to database because the quotes are missing.
Database::getNextUid()
can return the wrong next auto_increment value when there is another table of the same name in a different table schema. The WHERE clause needs to incorporate the table schema.
The method creates a WHERE clause which already contains the WHERE
keywords which will be again added by the Database::delete()
method
if ($this->con->connect_errno) {
error_log('Failed to connect to MySQL: '.$this->con->connect_errno);
} else {
$this->configureConnection();
}
The DAO does not deliver the underlying database error. Add error()
method to achieve this
Provide a method for retrieving the next auto_increment in a table (mariadb and mysql only) to base some pre-calculations before actually storing something
Criteria
has no proper error handling. It shall throw exceptions when appropriate while keeping backward compatibility.
The Restrictions::or()
and Restrictions::and()
methods cannot accept arrays of criterions. This shall be possible to allow an easy compositions such as
Restrictions::or($myConditions);
Also enable LogicalExpression
behind to add more criterions dynamically.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.