Re: Good SQL builder class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I actually spent a great deal of time trying to make purely array based query 
builders, and came to the conclusion that it's not possible to make a really 
robust one.  However, you can do it with OO and arrays.

Have a look at Drupal 7 (current development version of the Drupal CMS).  It 
includes a new DB layer totally rewritten to use PDO and includes a series of 
robust SQL builders.  It's also really easy to separate from Drupal; you need 
to comment out 2, perhaps 3 lines of code total.  At some point I want to spin 
it off as a stand-alone project, but for now it's easy to rip out.  In fact 
it's already been ripped out and backported to Drupal 6, so you can grab the 
code from there (GPL) and tweak as needed.

http://drupal.org/project/dbtng

On Friday 04 December 2009 7:09:55 am Anton Heuschen wrote:
> Good day.
>
> I'm looking for a good class to handle building dynamically from and
> array (and if it is good it will automatically determine / or even
> have different methods) to handle mutli-dimensional arrays or simple
> associative arrays ... and build the SQL statement :
>
> for example I have an array :
>
> $home[$suburb]["street"] = test1;
> $home[$suburb]["housenr"] =2;
>
>
> Ok to keep it simple to 2, then I want to build the SQL like
>
> insert into homes (STREET, HOUSENR) VALUES ($val1,$val2);
>
>
> something like that, but I could also pass some array like :
>
> $home["street"] = test2;
> $home["housenr"] = 2;
>
>
> but the idea stays the same = the index is the name of the DB fields
> and the assigned value the element
>
>
>
> I have looked on hotscripts and phpclasses but I have no idea how good
> the solutions are that I have found thus far - therefor need some
> recommendation from someone else past experience of this

-- 
Larry Garfield
larry@xxxxxxxxxxxxxxxx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux