Closed (fixed)
Project:
Oracle Driver
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Jul 2010 at 11:27 UTC
Updated:
25 Jan 2011 at 11:42 UTC
Jump to comment: Most recent file
Comments
Comment #1
mandarmbhagwat78 commentedHey, I got the solution.
I modified oracle_escape_group_by_alias() and oracle_escape_group_by_alias_callback() functions in databases.oracle.inc file.
I also modified views/include/query.inc file to display the correct query in preview mode.
See attached files.
Comment #2
aaaristo commentedi'm going to review your code asap
Comment #3
aaaristo commentedwhich version of the oracle driver are you using?
Comment #4
mandarmbhagwat78 commented6.x-1.x-dev
Comment #5
mandarmbhagwat78 commentedAndrea I have one query.
I have migrated drupal mysql db into oracle10g using sqldeveloper tool. During migration sqldeveloper added '_' after certain tables and fields as oracle consider those as reserved words e.g. access, comment, uid getting replaced with access_, comment_, uid_.
I found that you have handled reserved words but this scenario is not handled into your code.
I have modified oracle_escape_reserved_words() function with the following code and make it working :
$query= preg_replace($search, $replace, $query);
preg_match_all("/\{(.*?)(\})/", $query, $matches, PREG_SET_ORDER);
$reserved_words = "ACCESS";
foreach ($matches as $val) {
if(preg_match("/$reserved_words/", $val[1]))
$query = preg_replace("/{$val[0]}/", "{{$val[1]}_}", $query);
}
But after that I found that oracle_bind_query_callback() function is not able to execute $stmt->bindParam() and replace parameter :d0 or :s0 with the value.
Do you have any update on this?
Comment #6
aaaristo commentedI was away for holiday.. So, the point there is that IMUO is a sqldeveloper issue not a driver issue. I would not implement a regular expression if i can rename all that tables and columns in the "" form...
So why don't you rename them?
Comment #7
aaaristo commentedThe query.inc should be modified by Views' maintainers.. But i think they are not going to change it until Drupal officially supports Oracle. Meanwhile i'm writing an integration module for Views-Oracle to stop patching Views, but actually i've little time to do that.
Comment #8
aaaristo commentedAbout the group by:
SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title
FROM {node} node
WHERE node.type in ('%s')
GROUP BY nid
This query is a none-sense query... There is no need to group by the nid column that is primary key of the table...
And including it into the select columns makes the distinct quite absurd... May be you can use this configuration in you settings.php to rewrite the query to somenthing more SQL and Oracle oriented:
$GLOBALS['oracle_exception_queries']= array(
'SELECT DISTINCT(node.nid) AS nid,
node.title AS node_title
FROM {node} node
WHERE node.type in (\'%s\')
GROUP BY nid'
=>
'SELECT node.nid AS nid,
node.title AS node_title
FROM {node} node
WHERE node.type in (\'%s\')' );
Am i missing somenthing here?
Comment #9
aaaristo commentedHi,
i've tested your code (group by) with the latest version of Views and looks good to me. I'm going to release it with the next version.
Thank you!
Comment #10
aaaristo commentedfixed in the next release
Comment #11
aaaristo commentedComment #12
mandarmbhagwat78 commentedThanks very much! If you want me to work on any fixes please send.