|There's more than one way to do things|
Why not DBI and ODBC DBD?by aufrank (Pilgrim)
|on Jul 09, 2002 at 18:11 UTC||Need Help??|
This definitely applies to DBI, but looking over the win32:ODBC docs it seems applicable here too. Generally speaking, you need to execute any sql statement (and most statements can be prepared before they are executed) in order to use it. in terms of select statements, once executed you can perform a fetch to get at the data.
I guess my real question (not just for you, but for any monk with an opinion) is why to use win32::ODBC in the first place? This admittedly biased presentation makes it seem like a bad idea.
I also am quite new to perl, having started just two months ago, and the only reason I even started with perl was because I had been hired to do a bunch of database management type stuff and I saw that as an excuse to learn something new and make the process fun. and so far it has been.
I did not use the win32 module even though I also am dealing with access (and coding on an NT box). Frankly, I didn't find out about win32::ODBC until after I had already started writing using DBI and the ODBC DBD. At that point I was too lazy to go after another module when the one I had seemed to be working just fine. I must say I've been mighty pleased with my (blindly made) choice.
The best part of working with DBI, you see, has been the documentation-- it could not have been more helpful or easy to use. I mention it specifically because of its explanation of the general prepare, execute, fetch process for sql queries which might help you figure out what your win32::ODBC calls should look like.
Another option is apparently DBIx, though I know very little about it. Check out this article if you are interested, though.
If you do decide to pursue DBI at all, this article (written by chromatic) was a huge help to me and clued me in on some techniques that turned out to be really important (especially using transactions and trapping the execution of certain types of sql statements (like updates and inserts) inside eval blocks to make sure that no incorrect changes get made). Actually, all of the database Tutorials here at Perlmonks were really helpful, and that's actually how I came here in the first place.
hope this helps at all,