Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
poll.module
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Anonymous (not verified)
Created:
26 Feb 2008 at 08:24 UTC
Updated:
3 Nov 2022 at 19:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hswong3i commentedThis issue is strict forward and simple, +1. BTW, it is duplicated with http://drupal.org/node/199101.
Tested with MySQL and PostgreSQL, pass.
Comment #2
obsidiandesign commentedRerolled against latest head. Applies & works correctly with both MySQL and PostgreSQL. Simpletests run successfully for poll module. +1
Comment #3
hswong3i commentedPatch reroll via CVS HEAD, test with MySQL and PostgreSQL.
Comment #4
damien tournoud commentedPlease rewrite this one to use proper placeholders.
Comment #5
hswong3i commented@Damien: Sorry that I can't find any placeholders used within this issue. May you give a kindly review again?
Comment #6
damien tournoud commentedThere are no placeholders, that's precisely the issue.
Comment #7
hswong3i commentedThis issue is about the syntax cleanup of
!=with<>based on ANSI standard, but not legacy placeholder update... Am I correct?Comment #8
damien tournoud commentedOk, not it's both.
Comment #9
hswong3i commentedSo in this way? Update both db_query(), fetchField() and db_update().
Tested with MySQL, cron run correctly where outdated post inactive correctly, too.
Comment #10
lilou commentedMaybe #299176: Replace db_rewrite_sql() with hook_query_alter(). ??
Comment #11
hswong3i commentedSorry that I am so fool and not really understand the needs of this issue: the original goal is about
!==><>conversion, but now seems talking about TNG DB standard. I need some clear instruction about the requirement of change, and may someone give me a hand?Comment #12
c960657 commentedPatch no longer applies to HEAD.
Comment #13
dave reidHere's a patch to bring the entire poll module in line with DBTNG and includes the ANSI != fix as well. Passed all poll tests 100%.
Comment #14
Crell commentedSubscribing, need to review this...
Comment #16
Crell commentedProbably the recent bot bug...
Comment #18
dave reidThat exception is for dblog.test. All the poll tests passed and this should be good.
Comment #19
dave reidOk so I need to figure out how to do the following without errors:
Comment #20
dave reidForgot to set as code needs work.
Comment #21
Crell commentedUh. fields() with an empty array? Does not compute. What are you trying to do there?
Comment #22
dave reidIt is replacing: db_query("UPDATE {poll_choices} SET chvotes = chvotes + 1 WHERE chid = %d", $node->vote)
Comment #23
Crell commentedJust leave off fields() entirely then. If that doesn't work, that's a bug in DBTNG.
Comment #24
dave reidWithout the fields() I get:
* Warning: Invalid argument supplied for foreach() in UpdateQuery->execute() (line 916 of /home/davereid/Projects/drupal-head/includes/database/query.inc).
* Warning: Invalid argument supplied for foreach() in UpdateQuery->__toString() (line 939 of /home/davereid/Projects/drupal-head/includes/database/query.inc).
For some reason the db_and() isn't working correctly: when that code is called I get:
Fatal error: Call to undefined function db_and() in /home/davereid/Projects/drupal-head/modules/poll/poll.module on line 871
Comment #25
dave reidI got everything working. To get the update query working, just had to set the UpdateQuery class variable to a default array: "protected $fields = array();"
Comment #27
dave reidPostponed until #343620: db_update() fails on expression-only SQL gets in to fix the UpdateQuery in DBTNG.
Comment #28
dave reidComment #29
dave reidNow that #343620: db_update() fails on expression-only SQL is in, I figured my way around the multiple-node-load changes, and I was got bit by the table name changes, revised DBTNG patch ready for review. Passes all tests.
Comment #31
dave reidI'm simply puzzled as to why changes to poll.module are causing exceptions in dblog.module.
Comment #32
dave reidFound the issue... there was an error in the poll_cron, since dblog invokes cron on all modules...
Comment #33
catchThis all looks good - although why explicitly use fetchObject() instead of fetch()?
Comment #34
dave reidI thought I read somewhere that it is preferred to use fetchObject() and over fetch() since it is easier for anyone else to understand what type of data the results will be. I cannot find anything right now to back me up, so it very well might have been my own theory,
Comment #35
catchIt's probably more self-documenting that way. We should decide on a standard and stick to it either way.
Comment #36
Crell commentedWe've informally decided on fetchObject() and fetchAssoc() for cases when you need to specify it directly. I need to update the docs to reflect that better. fetch() should be used when you need some other fetch mode than those two easy ones.
Comment #38
dave reidAdding tags.
Comment #39
csevb10 commentedRe-assigning for work at Drupalcon DC Code-Sprint.
Comment #40
dave reidCool. :) Most of your work is already done in #32, but just needs a quick update.
Comment #41
csevb10 commentedThe biggest pain in this seems to be related to the PagerDefault queries. I've replaced all of the pager queries and db_rewrite_sql queries, and everything passes the provided simpletests. Time to get someone else's eyes on this thing.
Comment #42
csevb10 commentedWhoops, changing status.
Comment #44
csevb10 commentedRe-rolling from the root directory.
Comment #45
chx commentedThe bot likes it, I read the code and I like that too. So... go :)
Comment #46
dave reidPlease check trailing whitespace in the patch.
p.runtime != :runtimeshould be changed top.runtime <> :runtimefor ANSI compatibility.Comment #47
csevb10 commentedRe-rolled with those fixes. Nice catch on the whitespace.
Comment #48
csevb10 commentedCleaning up an issue with poll_cron.
Comment #49
dave reidActually for poll_cron, instead of
Let's do:
Comment #50
csevb10 commentedTheoretically, I could see that leading to a rather cumbersome update clause. Practically, I don't really see that happening, though, so I went ahead and changed it. The only addition I made other than that was to protect against returning no results.
Comment #51
dries commentedCommitted to CVS HEAD. Thanks.
Comment #52
Crell commentedOne advantage of the new syntax is that we don't care how cumbersome a long list of ints in an IN clause is, because it's handled for us automatically. :-) The change from #49 reduces the task to only 2 queries ever, which is great.
Thanks everyone!
Comment #53
csevb10 commentedGood to know. Thanks for the info, and all the help at the sprint.
REALLY liking the new DB layer. :-)