Hello,
I have tried to setup the new version of Twitter module (7.x-5.4) few times, but every time there is the error:
PDOException: SQLSTATE[07002]: [Microsoft][SQL Server Native Client 10.0]COUNT field incorrect or syntax error: SELECT * FROM {twitter_account} WHERE twitter_uid = :id OR screen_name = :id; Array ( [:id] => ) in twitter_account_load() (line 83 of ...\sites\all\modules\twitter\twitter.inc).
The error is coming up after filling the twitter settings and trying to ad twitter account. If I don't fill the settings there is not error.
I use Sql Server database.
I have changed again to 7.x-3.3 and the module works perfect. But there is a notice that we have to update to 7.x-5.4 sooner or later.
Thank you for your help.
Comment | File | Size | Author |
---|---|---|---|
#4 | duplicate_placeholders-1905324-4.patch | 895 bytes | omegamonk |
Comments
Comment #1
juampynr CreditAttribution: juampynr commentedI have no clue why you are getting that error. SqlServer seems to choke at this query:
I can only suggest you to debug the error further.
Comment #2
kimberlydb CreditAttribution: kimberlydb commentedI too got this error when first setting up twitter, after a bit of debugging, the query dies because $id is empty and the ms sql query doesn't know what to do with this since it thinks we are asking
Select * FROM {twitter_account} WHERE twitter_uid = OR screen_name =;
I fixed it by changing the following:
EDIT: I am then able to add my twitter accounts. However when it returned back I got another error, which I realized is that the replacement of :id doesn't seem to be working for mssql at all, so I then changed it to:
which, while far uglier, gets the job done.
EDIT: So upon more investigation, it dies because we are using $id as both possibly numeric or a string, because it is either the twitter_uid or the screen_name when calling this function. So I changed it a bit more to appease mssql...
If there's a better solution, let me know.
Comment #3
david_garcia CreditAttribution: david_garcia commentedHi I was just reviewing this to turn it into a patch and since then found something that my be a hint on what the original error is really about:
https://drupal.org/node/2009886
and
https://drupal.org/node/1598924
It looks as though you cannot use the same placeholder more than once in a query.
Comment #4
omegamonk CreditAttribution: omegamonk commentedAfter some digging in to this issue a bit....
Per the Drupal database placeholder documentation, "A query may have any number of placeholders, but all must have unique names even if they have the same value.".
I included a patch to change the placeholder names in the affected code, but I didn't have a chance to test it out.
Comment #5
juampynr CreditAttribution: juampynr commentedMade a small change to the patch format and committed it. Thanks!
http://drupalcode.org/project/twitter.git/commit/1b91dfa