On 17 Jun 2005 at 14:18, Juan Luis Frances wrote:

> Hello Dan,
> 
> > Will there be different SQL for each supported database?
> 
> Yes. One example: 
> 
> if ( $dbSql->driver == "pgsql")
>                 $query = "";

OK, what about something like this.  Set up all your SQL in one 
place.

$queries[STUFF_FROM_TABLE1][POSTGRESQL] = 'select...';
$queries[STUFF_FROM_TABLE1][MYSQL] = 'select...';

Then, when you need a query, it's like this:

$query = $queries[STUFF_FROM_TABLE1][SELECTED_DRIVER];

But, hat doesn't work very well if you have parameters....

Hmmm, we could use a sprintf for parmeters.  For example:

$format = "There are %d monkeys in the %s";
printf($format, $num, $location);

So the code becomes:

$query = $queries[STUFF_FROM_TABLE1][SELECTED_DRIVER];
$query = sprintf($query, $parameter1, $parameter2);


-- 
Dan Langille : http://www.langille.org/
BSDCan - The Technical BSD Conference - http://www.bsdcan.org/




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to