Hi,

sorry for the late answer, but I was on the travel to the ApacheCon and did
had a chance to check my email before...

>
>I just see the article on DBIx::Recordset and have the following question:
>How would one build these SQL statements with DBIx::Recordset?
>
>    INSERT INTO t1 VALUES (pkg_foo.get_bar, ?, ?, NULL, ?, ?, SYSDATE, ?,
>seq_suck.nextval)
>


Assuming you have already setup a DBIx::Recordset object, it would look like
this:

$set -> Insert ({'\f1' => 'pkg_foo.get_bar', 'f2' => $f2, 'f3' => $f3 , 'f4'
=> undef, ...

DBIx::Recordset takes always the names of the fields. So for the above
example I have assumed your fieldnames are f1, f2, f3 etc. The backslash
before the fieldname tell DBIx::Recordset to insert that piece of data
literaly instead of using it as a value to bind to a placeholder.

>    UPDATE t2 SET c1 = c1 + 1, c2 = c3 + 2, c3 = c1 + 3 WHERE c4 = ?
>


$set -> Update ({'\c1' = 'c1 + 1', '\c2' => 'c3 + 2', '\c3' => 'c1 + 3'},
 c4 => $c4}) ;


>Also, how does DBIx::Recordset deal with stored-procedures and cursors?
>


It doesn't currently has any special functions for stored-procedures and
cursors, but there should be no problem with using them together with
DBIx::Recordset

>I never use this module before, and it seems to me that when the SQL
becomes
>more complicated,
>the call to DBIx::Recordset->new() is as obfucated as the DBI call!


DBIx::Recordset provides you abstraction from SQL for the main area, it
doesn't covers all aspects, but it often does a lot of things for you, that
you otherwise have to do manualy in multiple DBI calls.

Gerald



Reply via email to