Subject Re: [firebird-php] FireBird/ADODB
Author Lester Caine
Alan McDonald wrote:
>> Alan McDonald wrote:
>>>> Alan McDonald wrote:
>>>>>>> Now for the generators!
>>>>>> try that on the datadict-firebird and see if it builds the
>> triggers :)
>>>>> got them all ok now
>>>> Can you copy me back your changes :)
>>>> It would be nice to get it working here as well ;)
>>> you're more familiar with ADODB...
>>> where would a query such as
>>> SELECT pref_name, pref_value FROM {prefs} ...
>>> get transformed into
>>> SELECT pref_name, pref_value FROM "FS_prefs" ...
>>>
>>> ad how do I (if there's away) turn off the double quoted object names?
>> Sorry been tied up
>>
>> DEFAULT should be NULL for Firebird ( and Oracle )
>>
>> The prefix will be added by flyspray
>>
>> $nameQuote = '';
>> Should switch off the double quotes. I'm suprised it's not off,
>> so flyspray
>> may actually be switching it ON.
>> I noble NameQuote() in the firebird driver to prevent them being added.
>>
>> bw runs totally without double quoting ;)
>>
>> --
>> Lester Caine - G8HFL
>
> it was set in adodb.inc.php as
> var $nameQuote = '"'; /// string to use to quote identifiers and names
>
> it is not included in adodb-firebird.inc.php
> so I've placed it there and now it works OK
>
> Next problem is soting thru all the SQL which doesn't make sense
>
> e.g.
>
> SELECT t.*, p.project_title, p.project_is_active, lst.status_name AS
> status_name,
> lt.tasktype_name AS task_type, lr.resolution_name
> FROM FS_tasks t
> LEFT JOIN FS_projects p ON t.project_id = p.project_id
> LEFT JOIN FS_list_tasktype lt ON t.task_type = lt.tasktype_id
> LEFT JOIN FS_list_status lst ON t.item_status = lst.status_id
> LEFT JOIN FS_list_resolution lr ON t.resolution_reason = lr.resolution_id
> LEFT JOIN FS_assigned ass ON t.task_id = ass.task_id
> LEFT JOIN FS_users u ON ass.user_id = u.user_id
> WHERE ( is_closed <> '1' )
> GROUP BY t.task_id
> ORDER BY task_severity desc, t.task_id desc, t.task_id ASC
>
> no idea why anyone thinks the GROUP BY clause makes any sense... (apart from
> being illegal)..
> what, if anything, do you think the writers of this query were trying to do
> with the GROUP BY which the ORDER BY alone doesn't do?

I've seen some strange stuff.
As you say - t.task_id is not being used to consolidate anything, so the GROUP
BY is irrelevant - but I'd need a closer look to see if they have something
selectable that MIGHT need it - but I doubt it.
Is the ORDER BY correct? can you have desc and asc on the same field?

The other one that can be fun is the JOIN order, but that is usually just bad
table design and these look OK.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird Foundation Inc. - http://www.firebirdsql.org/index.php