On Aug 27, 9:37 am, rogerdpack <[EMAIL PROTECTED]> wrote: > A question on datamapper's mysql and postgres drivers: > I assume they have similar thread friendliness as the 'standard' ruby > mysql and postgres drivers, i.e. > the postgres driver is ruby thread friendly and > the mysql drivers 'stop the world' while waiting for a request to come > back?
They do now. :-) Next release to make it official. > Also another question: what are named parameters you mentioned? > -=R Named parameters are something some databases support. So instead of: SELECT * FROM users WHERE id = ? You'd have: SELECT * FROM users WHERE id = @id Then you'd execute the query with: execute_reader(:id => 1) The finer points of prepared statements I'm not 100% sure about, but in MSSQL, you don't have prepared statements. The ADO.NET library takes any query that uses named parameters and executes it through a special stored-procedure called sp_executesql. The result is that any parameterized query executed in this way has it's execution plan cached on the database server transparently. So other than some very very slight overhead in the procedure call, it's something like 98% as fast as a pure stored-procedure call. This is widely misunderstood in MS land because MS wants to promote vendor lock-in, so they tell everyone to use Stored Procedures to get the most performance because the execution plans are cached, ignoring that their own documentation explains that all parameterized queries have their execution plans cached. So there's a lot of misinformation out there. Bottom line, named parameters are just a simpler way to build queries efficiently. On the free-database side of things, named parameters are unnecessary, but to get the same effect of cached execution plans you have to use prepared statements. Except it's not handled transparently by the database server, it's handled in the client drivers. Which makes the problem a lot more complex. But either way something we can achieve. So once we have support for named parameters, sure there will be a little extra typing over simple question-mark place-holders, but I think it's better to switch over completely and keep the API consistent. So that's the plan. For databases that don't support named- parameters, the DO wrapper will substitute the simple place-holders instead before executing the query. -Sam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
