Bugs: Browse | Submit New | Admin

[#6913] SELECT statements lose apostrophes around VARCHAR primary key values

Date:
2006-11-27 13:14
Priority:
3
Submitted By:
Daniel Buus (danielbuus)
Assigned To:
Eric Hodel (drbrain)
Category:
cached_model
State:
Open
Summary:
SELECT statements lose apostrophes around VARCHAR primary key values

Detailed description
Hey there!

Just after installing CachedModel onto my Rail test app on a Windows server backed by a legacy MS SQL database, performance
died terribly, from about 30 pages/second to just about 0.1 pages/second.

It turns out the problem is that my ActiveRecords use VARCHAR primary keys, which need to be enclosed in apostrophes.
This works fine without CachedModel, but once it's installed and running,

    SELECT TOP 1 * FROM PolyBook.Item WHERE (PolyBook.Item.Itemnumber = '9780672328933')

becomes,

    SELECT TOP 1 * FROM PolyBook.Item WHERE (PolyBook.Item.Itemnumber = 9780672328933)

...which turns a millisecond query into a ten second one!

I don't know exactly where this happens, but I guess you might know?

Anyways, it'd be cool if it worked :)

Thanks,
Daniel Buus

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item