Consider this a testimonial. Yesterday I had to move a DotNetNuke application from one directory to another for a client. Changing directories immediately broke all the internal links in the app. Since the links are all stored in the database I thought I could run a simple SQL update and get them all adjusted.
No such luck. It turns out that the MSSQL REPLACE function doesn't work with the data type used by the column in question. What to do? Turn to DBIx::Class of course! I'm no DBIx guru but within 90 minutes of starting I had a throw away utility to fix up the DNN application. Proving I'm no guru, most of that 90 minutes was spent chasing my own errors and looking things up in the docs. Here are some notes: - tried to use Loader at first, thinking it would be the fastest way to a schema definition. Something in the way the MSSQL tables are defined kept Loader from finding a primary key on the table, even though it looks like there is one on the table. Spun my wheels on that one for a while before giving up. - decided to define the table definition by hand. Went to CPAN and opened up the Manual. Found the appropriate section and basically copied the sample code. - tried to run the utility. Weird error. Back to the docs, this time the troubleshooting section. Sure enough, there's my error message. Oops, I didn't define my module correctly. Fixed that. - At this point the connection to the database is working and I can pull out data at will. A couple rounds of testing my change logic before committing the changes to the database. Seeing the generated SQL gives me added confidence that my set up is correct. - put in an 'update' line, ran the utility, and the database is fixed. In the end there were three files totaling 27 lines, including blank lines. The main program is all of 8 lines to connect to the database, extract the right records, modify them and update. The supporting files are just definitions. This is the second time in a month that I've found DBIx::Class coming in handy for a simple, throw away, utility. It certainly makes this kind of stuff easy. Solid software and excellent documentation that makes my life easier. That's why I use DBIx::Class. - Alan _______________________________________________ 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]
