Mephisto et SQL Server

Salut,

Je suis en train de mettre en place un blog sous Mephisto mais je
dois utilisé SQL Server. C’est mon deuxième projet avec comme bdd SQL
Server mais j’ai un soucis je n’arrive pas à ajouter des articles.
voici le message d’erreur quand je clique sur l’onglet articles dans
la section admin

Processing ArticlesController#index (for 192.168.1.147 at 2007-02-19
10:39:27) [GET]
Session ID: fd986c11be208088d5b704a915e2158e
Parameters: {“action”=>“index”, “controller”=>“admin/articles”}

ActiveRecord::StatementInvalid (DBI::DatabaseError: (102) [FreeTDS]
[SQL Server]Incorrect syntax near ‘.’.: SELECT * FROM (SELECT TOP 0 *
FROM (SELECT TOP 0 contents.* FROM contents WHERE (contents.site_id =

  1. AND ( (contents.[type] = ‘Article’ ) ) ORDER BY
    contents.published_at DESC) AS tmp1 ORDER BY contents.[published_at
    ] ASC) AS tmp2 ORDER BY contents.[published_at] DESC):
    /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
    connection_adapters/abstract_adapter.rb:128:in log' /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ connection_adapters/sqlserver_adapter.rb:318:inexecute’
    /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
    connection_adapters/sqlserver_adapter.rb:502:in select' /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ connection_adapters/abstract/database_statements.rb:7:inselect_all’
    /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
    base.rb:427:in find_by_sql' /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ base.rb:997:infind_every’
    /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/
    base.rb:418:in find' /var/lib/gems/1.8/gems/activerecord-1.15.2/lib/active_record/ associations/has_many_association.rb:91:infind’
    /app/controllers/admin/articles_controller.rb:18:in index' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ base.rb:1095:insend’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    base.rb:1095:in perform_action_without_filters' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:632:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:634:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:638:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:438:in call' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:637:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:634:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:638:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:438:in call' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:637:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:638:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:438:incall’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:637:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:638:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:438:in call' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:637:incall_filter’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    filters.rb:619:in perform_action_without_benchmark' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
    /usr/lib/ruby/1.8/benchmark.rb:293:in measure' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    rescue.rb:83:in perform_action' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ base.rb:430:insend’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    base.rb:430:in process_without_filters' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ filters.rb:624:inprocess_without_session_management_support’
    /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/
    session_management.rb:114:in process' /var/lib/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/ base.rb:330:inprocess’
    /var/lib/gems/1.8/gems/rails-1.2.2/lib/dispatcher.rb:41:in
    dispatch' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:84:inprocess’
    /usr/lib/ruby/1.8/sync.rb:229:in synchronize' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:83:inprocess’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in
    process_client' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:ineach’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in
    process_client' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:inrun’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
    initialize' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:innew’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
    run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:ininitialize’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
    new' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:inrun’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
    configurator.rb:267:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/ configurator.rb:266:ineach’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
    configurator.rb:266:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:inrun’
    /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:
    211:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231 /var/lib/gems/1.8/bin/mongrel_rails:18:inload’
    /var/lib/gems/1.8/bin/mongrel_rails:18

Rendering /var/www/apps/blog/current/config/…/public/500.html (500
Error)

Merci_______________________________________________
Railsfrance mailing list
[email protected]
http://lists.rubyonrails.fr/mailman/listinfo/railsfrance

Bolo :

Je suis en train de mettre en place un blog sous Mephisto mais
je dois utilisé SQL Server. C’est mon deuxième projet avec
comme bdd SQL Server mais j’ai un soucis je n’arrive pas à ajouter
des articles. voici le message d’erreur quand je clique sur l’onglet
articles dans la section admin

Quelles versions de Rails / Mephisto ?

ActiveRecord::StatementInvalid (DBI::DatabaseError: (102)
[FreeTDS] [SQL Server]Incorrect syntax near ‘.’.: SELECT *
FROM (SELECT TOP 0 * FROM (SELECT TOP 0 contents.*
FROM contents WHERE (contents.site_id =

  1. AND ( (contents.[type] = ‘Article’ ) ) ORDER BY
    contents.published_at DESC) AS tmp1 ORDER BY
    contents.[published_at ] ASC) AS tmp2 ORDER BY
    contents.[published_at] DESC):

Je ne connais rien à SQL Server, je suppose que la syntaxe
correcte serait avec des contents.[published_at] ?
Autrement dit, l’adaptateur SQL Server escape le nom de la
colonne alors qu’il faudrait pas ?

ça pourrait être un pb du même genre que celui-là :
http://lists.rubyonrails.org/pipermail/rails/2006-July/056214.html

donc à voir du très appétissant SQLServerAdapter#add_limit_offset!

je te laisse investiguer.

Entre parenthèses, c’est intéressant de voir que Ryan T.
un ancien mainteneur de l’adaptateur SQL Server, ait déclaré :

“I’m currently in the process of making sure I never have to
deal with SQL Server ever again so I hardly make for an ideal
maintainer.”

  -- Jean-François.

Salut
Le 21 févr. 07 à 10:05, Jean-François Trân a écrit :

Bolo :

Je suis en train de mettre en place un blog sous Mephisto mais
je dois utilisé SQL Server. C’est mon deuxième projet avec
comme bdd SQL Server mais j’ai un soucis je n’arrive pas à ajouter
des articles. voici le message d’erreur quand je clique sur l’onglet
articles dans la section admin

Quelles versions de Rails / Mephisto ?

pour rails 1.2.2
Mephisto 0.7.3

Je ne connais rien à SQL Server, je suppose que la syntaxe
correcte serait avec des contents.[published_at] ?
Autrement dit, l’adaptateur SQL Server escape le nom de la
colonne alors qu’il faudrait pas ?
Oui avec SQL Lite j’obtiens dans les log quand je clique sur le
bouton “Article”
Processing ArticlesController#index (for 127.0.0.1 at 2007-02-22
10:11:25) [GET]
Session ID: 79b5caea4e259a25fdc125a5593bbaac
Parameters: {“action”=>“index”, “controller”=>“admin/articles”}
e[4;35;1mSQL (0.003474)e[0m e[0mPRAGMA table_info(sites)e[0m
e[4;36;1mSite Load (0.000344)e[0m e[0;1mSELECT * FROM sites
WHERE (sites.“host” = ‘localhost’) LIMIT 1e[0m
e[4;35;1mSite Load (0.000706)e[0m e[0mSELECT * FROM sites ORDER
BY id LIMIT 1e[0m
e[4;36;1mUser Load (0.117852)e[0m e[0;1mSELECT distinct users.,
memberships.admin as site_admin FROM users left outer join
memberships on users.id = memberships.user_id WHERE (users.deleted_at
IS NULL OR users.deleted_at > ‘2007-02-22 14:11:25’) AND (users.id =
1 and (memberships.site_id = 1 or users.admin = ‘t’)) ORDER BY
users.login LIMIT 1e[0m
e[4;35;1mSQL (0.003003)e[0m e[0mPRAGMA table_info(users)e[0m
e[4;36;1mSQL (0.004290)e[0m e[0;1mPRAGMA table_info(contents)e[0m
e[4;35;1mSQL (0.000562)e[0m e[0mSELECT count(
) AS count_all
FROM contents WHERE (contents.site_id = 1) AND ( (contents.“type” =
‘Article’ ) ) e[0m
e[4;36;1mArticle Load (0.397098)e[0m e[0;1mSELECT contents.*
FROM contents WHERE (contents.site_id = 1) AND ( (contents.“type” =
‘Article’ ) ) ORDER BY contents.published_at DESC LIMIT 30 OFFSET 0e[0m
e[4;35;1mSQL (0.004867)e[0m e[0mPRAGMA table_info(contents)e[0m
e[4;36;1mSQL (0.320179)e[0m e[0;1mSELECT count(*) AS count_all,
article_id AS article_id FROM contents WHERE (contents.site_id = 1
AND (contents.approved = ‘f’ or contents.approved is null)) AND
( (contents.“type” = ‘Comment’ ) ) GROUP BY article_id ORDER BY 1
desc e[0m
e[4;35;1mSQL (0.181373)e[0m e[0mPRAGMA table_info(contents)e[0m
e[4;36;1mContent Load (0.001029)e[0m e[0;1mSELECT * FROM
contents WHERE (contents.id = 1) e[0m
e[4;35;1mSection Load (0.001295)e[0m e[0mSELECT * FROM sections
WHERE (sections.site_id = 1) ORDER BY positione[0m
Rendering within layouts/application
Rendering admin/articles/index
e[4;36;1mSQL (0.002768)e[0m e[0;1mPRAGMA table_info(sections)e[0m
Rendered admin/articles/_article (0.01160)
Completed in 1.18645 (0 reqs/sec) | Rendering: 0.06664 (5%) | DB:
1.03884 (87%) | 200 OK [http://localhost/admin/articles]

ça pourrait être un pb du même genre que celui-là :
http://lists.rubyonrails.org/pipermail/rails/2006-July/056214.html

donc à voir du très appétissant SQLServerAdapter#add_limit_offset!

J’ai cru comprendre que SQL Server ne supporte pass limit et offser.
J’ai modifié mon fichier sqlserver_adapter. J’ai une nouvelle erreur

TypeError (can’t dup Fixnum):
/vendor/rails/activerecord/lib/active_record/query_cache.rb:
62:in dup' /vendor/rails/activerecord/lib/active_record/query_cache.rb: 62:incache’
/vendor/rails/activerecord/lib/active_record/query_cache.rb:
25:in select_value' /vendor/rails/activerecord/lib/active_record/calculations.rb: 216:inexecute_simple_calculation’
/vendor/rails/activerecord/lib/active_record/calculations.rb:
121:in calculate' /vendor/rails/activerecord/lib/active_record/calculations.rb: 117:incatch’
/vendor/rails/activerecord/lib/active_record/calculations.rb:
117:in calculate' /vendor/rails/activerecord/lib/active_record/calculations.rb: 45:incount’
/vendor/rails/activerecord/lib/active_record/associations/
has_many_association.rb:55:in count' /app/controllers/admin/articles_controller.rb:17:inindex’
/vendor/rails/actionpack/lib/action_controller/base.rb:1147:in
send' /vendor/rails/actionpack/lib/action_controller/base.rb:1147:inperform_action_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:632:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:634:incall_filter’
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:438:incall’
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:634:incall_filter’
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:438:incall’
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:638:incall_filter’
/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in
call' /vendor/rails/actionpack/lib/action_controller/filters.rb:637:incall_filter’
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:438:incall’
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in
call_filter' /vendor/rails/actionpack/lib/action_controller/filters.rb:619:inperform_action_without_benchmark’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:
66:in perform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:
66:in perform_action_without_rescue' /vendor/rails/actionpack/lib/action_controller/rescue.rb:125:inperform_action_without_caching’
/vendor/rails/actionpack/lib/action_controller/caching.rb:625:in
perform_action' /vendor/rails/activerecord/lib/active_record/query_cache.rb: 99:incache’
/vendor/rails/actionpack/lib/action_controller/caching.rb:624:in
perform_action' /vendor/rails/actionpack/lib/action_controller/base.rb:473:insend’
/vendor/rails/actionpack/lib/action_controller/base.rb:473:in
process_without_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:624:inprocess_without_session_management_support’
/vendor/rails/actionpack/lib/action_controller/
session_management.rb:122:in process' /vendor/rails/actionpack/lib/action_controller/base.rb:326:inprocess’
/vendor/rails/railties/lib/dispatcher.rb:39:in dispatch' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb: 84:inprocess’
/usr/lib/ruby/1.8/sync.rb:229:in synchronize' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb: 83:inprocess’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in
process_client' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:ineach’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in
process_client' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:inrun’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
initialize' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:innew’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:ininitialize’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in new' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:inrun’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:267:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/ configurator.rb:266:ineach’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:266:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:inrun’
/var/lib/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:
211:in run' /var/lib/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231 /var/lib/gems/1.8/bin/mongrel_rails:18:inload’
/var/lib/gems/1.8/bin/mongrel_rails:18

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs