[Catalyst] [newbie]How to call stored procedure?
---BeginMessage--- Hi, all! I've stored procedures defined in my database schema, and I need to call them in my code. The arbitrary-sql approach won't help since it writes sql statements in source code to act as stored procedures. So could I do that in DBIx? Thank you! ---End Message--- ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] More unicode problems (uri_for)
On Monday 24 December 2007 07:58:34 am Knut-Olav Hoven wrote: I wasn't very clear on this, sorry. Check my å is not inside the code, it comes from my po/mo-files (i18n). It looks actually more like this: $c-redirect( $c-uri_for( '/login', {error_msg = $c-loc(Check my magic)} ); ); po-file (utf8 encoded): msgid Check my magic msgstr Check my å pofiles have a Content-Type header/declaration/whatever. Does your .po file declare itself as Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ? Andrew ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [newbie]How to call stored procedure?
On Fri, 28 Dec 2007, Jason Kohles wrote: On Dec 28, 2007, at 8:19 AM, Tony Winslow wrote: I've stored procedures defined in my database schema, and I need to call them in my code. The arbitrary-sql approach won't help since it writes sql statements in source code to act as stored procedures. So could I do that in DBIx? You were probably looking in the Catalyst docs rather than the DBIx::Class (I'm assuming because you asked the Catalyst mailing list, rather than the DBIx::Class mailing list, which would have been more appropriate. Had you checked the DBIx::Class documentation, you probably would have found this in the cookbook... The DBIx::Class documentation wasn't very helpful to me when I was looking for the same solution. I suspect that most new users, such as myself, would want their model schemas generated for them, and so will fall for the DBIC::Schema approach as I did. If, having done that, you try to follow the recipes in the DBIx cookbook without complete understanding of what they intend to do, you will be breaking the invisible under-the-hood stuff created by the schema generator. I think it will be well for the Catalyst docs to mention that, perhaps in the form of a recipe -- something that you can follow right through. To answer the original question: you can do everything you want with arbitrary SQL in Catalyst: stored procedures, views, or whatever -- and that's not a bad way of doing things, as long as you are aware of the portability issues introduced by SQL (if that matters to you at all). Please see my posting at perlmonks explaining this: http://www.perlmonks.org/?node_id=658193 To elaborate a little bit on what I've written there, I think you will walk away with a complete understanding of what's going on with arbitrary SQL if you consider that most SQL dialects allow you to put any query (in parentheses) wherever a table name is allowed. That's why all the arbitrary SQL recipes for DBIx::Class will advise you about the parentheses (without mentioning why, because it's obvious), and they will show you how to stash your SQL query into the name attribute, perhaps leaving you wondering why something you think of as a code is strangely referred to as name. That's because it's hack -- the one exploiting SQL's recursiveness. It will work if your backend supports subselects and will fail otherwise. --Gene ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Re: [newbie]How to call stored procedure?
* Gene Selkov [EMAIL PROTECTED] [2007-12-28 18:40]: It will work if your backend supports subselects and will fail otherwise. Let’s not pussyfoot around: there’s only one SQL DBMS which doesn’t support subselects at all… Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] More unicode problems (uri_for)
On Friday 28 December 2007 17:56:45 Andrew Rodland wrote: On Monday 24 December 2007 07:58:34 am Knut-Olav Hoven wrote: I wasn't very clear on this, sorry. Check my å is not inside the code, it comes from my po/mo-files (i18n). It looks actually more like this: $c-redirect( $c-uri_for( '/login', {error_msg = $c-loc(Check my magic)} ); ); po-file (utf8 encoded): msgid Check my magic msgstr Check my å pofiles have a Content-Type header/declaration/whatever. Does your .po file declare itself as Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ? Here is my po header (used poEdit): msgid msgstr Project-Id-Version: Followme\n POT-Creation-Date: \n PO-Revision-Date: 2007-12-21 19:23+0100\n Last-Translator: Knut-Olav Hoven [EMAIL PROTECTED]\n Language-Team: Linpro\n MIME-Version: 1.0\n Content-Type: text/plain; charset=utf-8\n Content-Transfer-Encoding: 8bit\n X-Poedit-Language: Norwegian Bokmal\n X-Poedit-Country: NORWAY\n X-Poedit-SourceCharset: utf-8\n Andrew ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- Knut-Olav Hoven Systemutvikler mob: +47 986 71 700 Linpro AShttp://www.linpro.no/ signature.asc Description: This is a digitally signed message part. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/