We have a internal wrapper, The problem is that doesn't work with
Oracle ;) I'm implementing it now.

Oracle madness

Best Regards
Marcos Rebelo

On Thu, Apr 7, 2011 at 11:57, Rob Coops <rco...@gmail.com> wrote:
> Even if it is not possible at the moment you could always overwrite this
> function and make it work this way... I suspect it might be quite a bit of
> work, but certainly not impossible. After all you are programming anything
> you can think of can be done the only question is if it is worth the effort
> to do this.
> Personally I would simply create a function for this:
> sub insert {
>  my ( $query, $bind_params ) = @_;
>  my $sth = $dbh->prepare( $query );
>  $sth->bind_param( @{$bind_params} );
>  $sth->execute
>  .....
>  Return the results to the caller
> }
> Something like that should do the trick (the code above will most likely not
> work but I assume you will understand where I am going with this...
> Working with Perl in companies you will often see wrappers for DBI that do
> things like what you are looking for or that provide other methods of
> returning result sets (XML or JSON rather then Perl data structures) stuff
> like that. I my self like to use a wrapper that simplifies the DBI interface
> a bit so I basically create a DB object that offers me things like insert,
> delete, update, execute, select, etc. This wrapper offers log4perl logging
> capability and allows me to debug specific statements which means I can by
> simply switching on tracing see exactly what query is being send to the
> database. That helps a lot certainly if you are dealing with MySQL and their
> rather useless way of reporting errors in a query. It also is a great way of
> preventing SQL injection issues as you only need to deal with those kinds of
> troubles once in the wrapper.
> Personally I can say that a good wrapper around a relatively complex module
> such as DBI can help a lot in saving time when you end up working with it
> over and over again in different projects. The only thing is that if you are
> going to be working in a larger team make sure that all team members buy
> into the same wrapper and you do not end up with 12 implementations of a DBI
> wrapper that all do slightly different things as you all optimized a
> slightly different bit of your daily work. ;-)
> Regards,
> Rob
> On Thu, Apr 7, 2011 at 11:01 AM, marcos rebelo <ole...@gmail.com> wrote:
>>
>> Probably it is impossible, but it would be really usefull.
>>
>> I'm doing something like:
>>
>> my $sth = $dbh->prepare('INSERT INTO my_table(field_1) VALUES (?)');
>> $sth->bind_param( 1, 'pippo', { 'ora_type' => SQLT_BIN } );
>> $sth->execute;
>>
>> since I need to pass a parameter in the bind_param
>>
>> I would really like to do something like:
>>
>> $dbh->do( 'INSERT INTO my_table(field_1) VALUES (?)', [ 'pippo', {
>> 'ora_type' => SQLT_BIN } ] )
>>
>> is there a way to do this?
>>
>> maybe with some DBIx
>>
>> Best Regards
>> Marcos Rebelo
>>
>> --
>> Marcos Rebelo
>> http://www.oleber.com/
>> Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
>> Webmaster of http://perl5notebook.oleber.com
>>
>> --
>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>> For additional commands, e-mail: beginners-h...@perl.org
>> http://learn.perl.org/
>>
>>
>
>



-- 
Marcos Rebelo
http://www.oleber.com/
Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
Webmaster of http://perl5notebook.oleber.com

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to