I get an error when trying to view /user/1/friends
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.uidd = '1') OR (users.uidINSELECTf.uidFROMflag_friendfWHEREf.friend_uidd = '1')' at line 2: SELECT COUNT(*) AS expression FROM (SELECT users.uid AS uid, 1 AS expression FROM {users} users LEFT JOIN {flag_friend} flag_friend ON users.uid = flag_friend.uid WHERE (( (users.status <> :db_condition_placeholder_0) )AND( (users.uidINSELECTf.friend_uidFROMflag_friendfWHEREf.uidd = :db_condition_placeholder_1) OR (users.uidINSELECTf.uidFROMflag_friendfWHEREf.friend_uidd = :db_condition_placeholder_2) )) GROUP BY uid) subquery; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2] => 1 ) in views_plugin_pager->execute_count_query() (line 141 of /Users/jbitner/Sites/drupal-7.x-dev/sites/all/modules/views/plugins/views_plugin_pager.inc).
Which totally makes no sense to me... all this debug info is crammed together...
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | updated patch | 1.9 KB | jyee |
| #2 | flag_friend_handler_argument_numeric.inc_.patch | 1.87 KB | jyee |
Comments
Comment #1
sirkitree commentedMaking it more obvious to the casual browsers of issues.
Comment #2
jyee commentedI've attached a patch to includes/flag_friend_handler_argument_numeric.inc that resolves the errors above.apparently add_where() is stripping spaces from the $field arg, so the patch simply moves the rest of the subselect to the $value arg
There's still a problem where the "View All Friends" tab doesn't display friends.The "Awaiting Friend Approvals" and "Friend Requests" tabs appear to be working as intended.
edit: see following post
Comment #3
jyee commentedah... nevermind the previous post and patch (spoke too soon).
This patch resolves the error message and also presents a working all friends view.
Edit: the patch also has a leftover comment and call to devel's dd() that should probably be removed... sorry for not cleaning up after myself.
Comment #4
jon pughWorked for me.
++
Comment #5
sirkitree commentedThank you! http://drupalcode.org/project/flag_friend.git/commitdiff/3863c323ac90c87...
Comment #6
Anonymous (not verified) commentedWell the patch does not work for me! The error message is gone, but the "View All Friends" view display is empty. I double checked that the user has friends. Digging in the query I found out that the "… users.uid = 'IN (…" does not return a value while "… users.uid IN (…" does. Getting rid of the = and the ' ' around the subselect does the trick for me. I tried to fix this in the argument_numeric.inc file, but with little luck. It seams views add_where() function puts the = and the ' ' in by default.
Comment #7
sirkitree commentedHrm, yeah - seems like we need a different way to construct this. To be clear, the way we have it now, the WHERE that is generated is this:
created by:
but what we really want is this:
which was generated in D6 by:
So how do we do this in D7?
Comment #8
sirkitree commentedLooks like we need to use add_where_expression() instead of add_where().
http://drupalcode.org/project/flag_friend.git/commitdiff/afabdd346f05170...
This may run into problems if users try to implement the OR logic in the newer views ui.
Comment #9
jyee commentedYeah, the second patch i had above ("updated patch") had the add_where_expression(). Sorry, I realize that i wasn't particularly clear about that.
Comment #10
jon pughI had been working on this problem, and a number of other ones, and have rolled them up into one big patch.
see http://drupal.org/node/1101496
Sorry for grouping them up like this, but they are all critical issues and for my current project, which has an extremely limited time budget.
Pretty heavily tested so far.
Comment #11
jon pughforgot to mark as needs work... this patch still broken for me.
Comment #12
sirkitree commentedfixed in #1101496: Mutiple fixes in 7.x branch: Views handler, flag_friend_determine_friend_status(), delete friend