On Friday 17 June 2005 14:28, Dan Langille wrote: > 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);
I'd vote for trying to do what Bacula does -- simplify the SQL and not use any non-standard MySQL SQL unless absolutely necessary. Doing that, we should be able to keep the differences to only a few lines of SQL. If Bacula can do it, then bacula-web can too (I think). If we can accomplish that then a few lines of code as Juan Luis has shown are a good solution. If it is not possible to do what I suggest, at least, we could try to isolate the differences to one or two files, and using ./configure, we can "configure" it to avoid too many tests within the code itself. Our life would be much easier if we could exclude using MySQL < 4.1, but I don't consider that possible today. With MySQL 4.1, the SQL should work without problems on the three databases. -- Best regards, Kern ("> /\ V_V ------------------------------------------------------- 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