Well Marcos, if you could help even just for a week to my CPAN project I would be really advantaged :)
it is PNI and PNI::GUI on CPAN ________________________________ Da: marcos rebelo <ole...@gmail.com> A: milan...@pm.org; nl...@amsterdam.pm.org; perl-reci...@googlegroups.com; p...@lisbon.pm.org; Perl Begginers <beginners@perl.org> Inviato: Gio 7 ottobre 2010, 14:28:11 Oggetto: Re: [Milan-pm] New note on page5notebook My idea is to throw away the SQL almost completely to 90% of the queries. When the queries are a little bit more complex, I'd prefer to create a View and use a simple interface. I never did a Project to CPAN, but If someone is interested in growing up the code I may help as much as I can +- 5 hours/week. Best Regards Marcos Rebelo On Thu, Oct 7, 2010 at 12:08 PM, Oha <o...@oha.it> wrote: > On 10/07/2010 11:27 AM, marcos rebelo wrote: >> >> but for such a simple query, I would prefer >> >> eval { >> my $ss = SmartSelect->new($dsn, $user, $password); >> my $hash = $ss->select_document_by_id($id)->[0]; >> ... >> }; >> if ($@) { >> ... >> } >> > > it's about 6 months i'm working on something like this, here a quick > example: > > # obtain a single row from db > my %row = select_uniq 'select * from foo where id = ?', $id; > > # when needed you may open a transaction > tx_new > { > # if not differently specified, the default conenction will > be used > my %codes = select_map { $_{id} => $_{code} } 'SELECT * FROM > codes'; > > if($code{0}) { > tx_db 'master'; # going to use a specific connection > > my $new = select_uniq 'SELECT max(id)+1 FROM codes'; > tx_do 'UPDATE codes SET id = ? WHERE id = 0', $new; > } > # now the connection is again the default, cauz tx_db got out > of scope > > # transaction may be nested, connection will be kept > separated > tx_new > { > # if more then 1 rows is fetched, the following will > confess > my %foo = select_uniq 'SELECT * FROM codes WHERE id = > ?', 'foo'; > } > } # connection will be committed and released, or rollbacked if an > error is passing thru > > It is somewhat stable and i will probably put it on CPAN, but if you are > interested i can share the code > > I'll gladly ear your thoughts about it. > > Oha > _______________________________________________ > Milan-pm mailing list > milan...@pm.org > http://mail.pm.org/mailman/listinfo/milan-pm > -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org Webmaster of http://perl5notebook.oleber.com _______________________________________________ Milan-pm mailing list milan...@pm.org http://mail.pm.org/mailman/listinfo/milan-pm