[Dbix-class] Migration from Class::DBI: Delete all table entries?
Matt S Trout
dbix-class at trout.me.uk
Wed Jun 28 16:41:11 CEST 2006
Steven Mackenzie wrote:
> Matt S Trout wrote:
>> A. Pagaltzis wrote:
>>>> __PACKAGE__->set_sql("delete_all", <<"");
>>>> DELETE FROM __TABLE__ WHERE 1=1
>>> Note that you can omit that `WHERE` clause completely. It’s legal
>>> syntax to say `DELETE FROM $table`.
>> Which is exactly what DBIx::Class will do given the code snippet in my last
>> message :)
> Hmm -- I'm not sure if I had a good reason for the WHERE 1=1, although I
> think I tried it without first.
> Maybe it was needed to stop CDBI putting a where clause in, or maybe it
> was superstition, or I just thought it looked big and clever? Thanks for
> your input -- it's all helpful to me!
> Elsewhere, Matt S T wrote:
>> Right. DBIC makes this easier for main usage by allowing schema objects
> (multiple connections per class tree :D).
> Yup, I like that, and also the slightly more obvious class/instance
> seperation in DBIxC vs CDBI. (As much as I find any Perl "obvious", anyway.)
> Also like that I can swap between DBs (SQLite -> MSSQL) just by changing
> the DSN, in CDBI I was using a different base class to get the autoinc
> columns working.
> However, it's a bit slow joining all the DBIxC bits together in my head
> -- is there a class diagram somewhere? [not sure if I'm joking or not :-/ ]
may help as a starting point, albeit it's a bit sparse.
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class