Re: [Dbix-class] Recursive update_or_create - RFC

2008-06-24 Thread Ovid
--- Zbigniew Lukasiak [EMAIL PROTECTED] wrote:

 On Mon, Jun 23, 2008 at 7:49 PM, luke saunders
 [EMAIL PROTECTED] wrote:
  On Mon, Jun 23, 2008 at 9:57 AM, Zbigniew Lukasiak

snipping insanely long list of so and so wrote lines

 [EMAIL PROTECTED] wrote:

  it is a base class for ResultSets and it provides just
one method:

Could we please *trim* our email replies?  Just pick out and respond to
the relevant bits.  When we're twelve levels deep in replies, it starts
to get a bit tough to follow :)

Cheers,
Ovid

--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Personal blog- http://publius-ovidius.livejournal.com/
Tech blog- http://use.perl.org/~Ovid/journal/
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6 
Official Parrot Wiki - http://www.perlfoundation.org/parrot

___
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/[EMAIL PROTECTED]


[Dbix-class] INSERT occurring on SELECT

2008-06-24 Thread Dermot
Hi,

I have been trying to get started using dbix (in a Catalyst env) and
have hit an early problem. When I call a method to list all the
entries in one table, null entries are created in a different table.
Below is the trace.

SELECT me.id, me.name, me.contrib_id FROM submissions me:
SELECT me.id, me.name, me.contrib_id FROM submissions me:
SELECT me.id, me.code FROM contributors me WHERE ( ( ( me.id = ? ) ) ): '1'
SELECT me.id, me.code FROM contributors me WHERE ( ( ( me.id = ? ) ) ): '2'
INSERT INTO contributors (id) VALUES (?): '2'
SELECT me.id, me.code FROM contributors me WHERE ( ( ( me.id = ? ) ) ): '3'
INSERT INTO contributors (id) VALUES (?): '3'


I have a small dataset. There are 2 tables. T1 has with a single entry.
sqlite3 motion.db select * from contributors
1|S6G

T2 have 3 entries. The 3rd column is the ID in T1.
sqlite3 motion.db select * from submissions
1|23|1
2|167|1
3|254|1

If I use a conventional script to list the data, all is fine.

I have traced the problem to my Template within my Catalyst app.

   [% FOREACH submission IN submissions %]
   [%# SET contributor = submission.contrib_id %]
  li
[% submission.name | html %]nbsp;[%# contributor.code | html
%]nbsp;[%# submission.contrib_id.code %]

If any of the commented lines are used I get the result below.

sqlite3 motion.db select * from contributors
1|S6G
2|
3|

I hope this isn't OT for the list. Can anyone suggest where the
problem might be?
Thanx,
Dp.

___
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/[EMAIL PROTECTED]


[Dbix-class] DBIx::Class and caching

2008-06-24 Thread Andreas Pronakis
Forgive me if this question sounds like asking for baby step instructions  but 
I hope it will benefit other DBIx::Class starters.

We have a lot of procedural code that we are looking to convert to DOM (Domain 
Object Modeling) and one of the tools we are lokoing to use is DBIx::Class 
(instead of writing our own Model which could be fun but a maintenance 
nightmare).

Anyway, the set up, we are look is mod_perl, DBIx::Class, MySQL backend, and 
some sort of MVC concept but we will not (for now) be using Catalyst (don't ask 
why).

Based on the above information my questions are:
1. ResultSet has a couple of methods related to caching, but going by the 
example given 
(http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/ResultSet.pm#cache)
  it seems like you have to turn caching on a per search()/find() call, is 
there some way of turning it on for the whole class (even better all classes) 
in one place (i.e. Parent class that all other classes inherit from)? 
1.1 Is overriding/subclass resultset/ResultSet to capture search/find request 
to add the cache parameter an options to achieve the above?
2. Is there a different way to cache objects and/or ResultSet objects?
3. Can we cache SQL natively in DBIx::Class i.e. the SQL executed by a find, 
search or manual SELECT - I guess if 1 and 1.1 are supported SQL caching might 
be redundant except from manual SELECTs?
4. If there isn't native support for the above, can someone give me any advice 
and/or examples regarding using DBIx::Class and MemCache to achieve the same 
result?
5. I came across the module DBIx::Class::Cursor::Cached but since the 
documentation is a bit on the thin side, I was wondering if someone can explain 
it in a bit more detail.  For example is it possible to use it to achieve 
points 1/1.1 and also set a default cache_for periodf for a whole class, rather 
than individual search requests? 

Thanks in advance for your patience and help

Andreas Pronakis
DBIx::Class newbie but believer


  

___
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/[EMAIL PROTECTED]


[Dbix-class] Rows as singletons

2008-06-24 Thread David Cantrell
I've been mumbling on IRC over the last week or two about rows being
singletons when they get loaded into memory.  This is mostly because,
when writing tests for a DBIx::Class based project I got irritated when
I had two references to the same row hanging around in memory, update()d
one of them, but the other still had old data in it.

Here's my fix:
  http://www.cantrell.org.uk/david/private/SingletonRows.pm

Comments would be most welcome.

Please note that it shouldn't be re-distributed yet, or used in any of
your projects, as it's not yet got a proper licence on it.

-- 
David Cantrell | top google result for internet beard fetish club

Anyone who cannot cope with mathematics is not fully human.
At best he is a tolerable subhuman who has learned to wear
shoes, bathe and not make messes in the house.
   -- Robert A Heinlein

___
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/[EMAIL PROTECTED]


Re: [Dbix-class] DBIx::Class and caching

2008-06-24 Thread David Steinbrunner
Andreas Pronakis wrote:

 4. If there isn't native support for the above, can someone give me any advice
 and/or examples regarding using DBIx::Class and MemCache to achieve the same
 result?

Data::ObjectDriver has built in support for syncing row objects with all
find, search, update and delete operations in a number of caching systems
including Memcached.  I have a side project in progress to bring this same
type of functionality DBIx:Class.  At this point it is quite rough but
supports everything but search, at least in in the basically usage I have
been testing it against so far.

If you are anyone else has interest in this let me know so that a level of
coordination might be put in place and hopefully get this into something
that is worth releasing.

Thanks,

--
David Steinbrunner



___
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/[EMAIL PROTECTED]