Re: [Dbix-class] How do I get DBIx::Class to quote User table and user collum in SQL Server ?
Paul, thanks a lot. after following your instruction, it works good now I found every table, every collum has been quoted with [ ] so, it works good now Hugh Wang Paul Findlay 写道: Hi Hugh You seem to be putting quote_char and name_sep into their own hash ref. You should have them directly in the connect_info hash ref: connect_info = { dsn = 'dbi:ODBC:driver={SQL Server};server=.;', user = '...', password = .', LongTruncOk=1, LongReadLen=5000, on_connect_do = q{}, quote_char = [qw/[ ]/], name_sep = q{.}, } Kind regards, Paul Findlay DISCLAIMER This email contains information that is confidential and which may be legally privileged. If you have received this email in error, please notify the sender immediately and delete the email. This email is intended solely for the use of the intended recipient and you may not use or disclose this email in any way. ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
[Dbix-class] How do I get DBIx::Class to quote User table and user collum in SQL Server ?
I am trying to use DBIx Autorization function, I have a table named User, and collumn named user since user is a reserved word, it always get error, I have added the quote_char, name_sep in the connection string but still fail. how can I make sure the generated SQL has the User been quoted ? like select [user] from ... connect_info = { dsn = 'dbi:ODBC:driver={SQL Server};server=.;', user = '...', password = .', LongTruncOk=1, LongReadLen=5000, on_connect_do = q{}, {quote_char = [qw/[ ]/],name_sep = q{.} }, } ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
Re: [Dbix-class] why the connection to database failed on the first time, success after refresh
I think I found the reason: I have following line in my DB.pm _on_connect_do_ = q{PRAGMA foreign_keys = ON}, this was copied from sqlite example the sql server can not run this command : PRAGMA foreign_keys = ON after I change to _on_connect_do_ = q{}, the error gone thanks Hugh Wang Hailin Hu : It seems the error only occurs on connection. Do you have any sql statement in on_connect_do, which SQL server can't execute correctly? On Thu, Jun 6, 2013 at 2:38 PM, Hugh Wang yow...@verizon.net wrote: I am trying to use Catalyst, with DBIx::Class to connect to a MS Sqlserver database. after I start the Catalyst server, perl script/libApp_server.pl -r I connect to a page to open a table and display it, but the first time when I open the page, such as: http://localhost:3000/admin/ticket it shows error: [error] DBIx::Class::Storage::DBI::_do_query(): DBI Exception: DBD::ODBC::db do failed: [Microsoft][ODBC SQL Server Driver][SQL Server]'=' Grammer Error nearby (SQL -42000)(DBD: Execute immediate failed err=-1) at K:\LibApp\lib/LibApp/Controller /admin.pm line 47 but after I refresh to reload the page, it works good . if I restart the server, the error will show up again for the first time I open the same web page. the refresh of the same page, will work good. what's wrong with it? any one has experience thanks Hugh Wang ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
Re: [Dbix-class] why the connection to database failed on the first time, success after refresh
Hailin, thanks for your reply. when I run : $c-stash(ages = [$c-model('DB::Age')-all]); it get error, I am run on Windows 7, with [Microsoft][ODBC SQL Server Driver][SQL Server] I tried to switch to Sqlite to do a test, it runs good. I also try to connect to another table in the same sql server database, the error came again. the strange thing is after a reload of the same page, the problem gone. but restart the Catalyst server, it show up for the first connection Hugh Wang Hailin Hu : It seems the error only occurs on connection. Do you have any sql statement in on_connect_do, which SQL server can't execute correctly? On Thu, Jun 6, 2013 at 2:38 PM, Hugh Wang yow...@verizon.net wrote: I am trying to use Catalyst, with DBIx::Class to connect to a MS Sqlserver database. after I start the Catalyst server, perl script/libApp_server.pl -r I connect to a page to open a table and display it, but the first time when I open the page, such as: http://localhost:3000/admin/ticket it shows error: [error] DBIx::Class::Storage::DBI::_do_query(): DBI Exception: DBD::ODBC::db do failed: [Microsoft][ODBC SQL Server Driver][SQL Server]'=' Grammer Error nearby (SQL -42000)(DBD: Execute immediate failed err=-1) at K:\LibApp\lib/LibApp/Controller /admin.pm line 47 but after I refresh to reload the page, it works good . if I restart the server, the error will show up again for the first time I open the same web page. the refresh of the same page, will work good. what's wrong with it? any one has experience thanks Hugh Wang ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
[Dbix-class] why the connection to database failed on the first time, success after refresh
I am trying to use Catalyst, with DBIx::Class to connect to a MS Sqlserver database. after I start the Catalyst server, perl script/libApp_server.pl -r I connect to a page to open a table and display it, but the first time when I open the page, such as: http://localhost:3000/admin/ticket it shows error: [error] DBIx::Class::Storage::DBI::_do_query(): DBI Exception: DBD::ODBC::db do failed: [Microsoft][ODBC SQL Server Driver][SQL Server]'=' Grammer Error nearby (SQL -42000)(DBD: Execute immediate failed err=-1) at K:\LibApp\lib/LibApp/Controller /admin.pm line 47 but after I refresh to reload the page, it works good . if I restart the server, the error will show up again for the first time I open the same web page. the refresh of the same page, will work good. what's wrong with it? any one has experience thanks Hugh Wang ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk