user652649
user652649

Reputation:

what is the name of this type of sql abstraction layers, and what php open source libs I can get?

I'm looking for a php lib that allows me to compile sql strings in a oop way, for example

$select->fromTable = 'test'
$select->addWhere('field', '>=', 33);
$select->groupBy...

something like this, just an example

Upvotes: 0

Views: 51

Answers (1)

socha23
socha23

Reputation: 10239

For basic, lightweight query building, I found this: http://www.phpclasses.org/package/2813-PHP-Dynamically-build-SQL-queries.html

There are some implementations of ActiveRecord pattern for PHP, for example http://www.propelorm.org/ and http://www.phpactiverecord.org/. Don't know if that's what you need, but they both look nice. They allow you to bypass SQL completely and just use generated finder methods on your domain objects.

Also look at this thread: SQL Builder for PHP, with JOIN support? Recommendations there center on web frameworks, though, and adding them to a project in late stage can be difficult.

Upvotes: 1

Related Questions