[Dbix-class] Does DBIC support ->create() with more clob fields?

Peter Rabbitson rabbit+dbic at rabbit.us
Sun Jan 29 16:42:08 GMT 2012


Octavian Rasnita wrote:
> Hi all,
> 
> I have an Oracle table with 2 clob columns and I am trying to add a new record in it, using:
> 
> my $row = $schema->resultset( 'TblName' )->create( {
>     question => 'This is the first question',
>     answer => 'Answer 1',
>     date_time_q => '2012-01-01 00:00:00',
>     date_time_a => '2012-01-01 10:00:00',
> } );
> 
> my $result = $schema->resultset( 'Sugestii' )->find( $row->id );
> 
> print 'question: ', $result->question, "\n";
> print 'answer: ', $result->answer, "\n";
> 
> The result is:
> 
> question: Answer 1the first question
> answer:  
> 
> It seems that the data is broken. The values for both clob columns are stored in the first clob column in the table, or better said, the value of the second column overwrites the value of the first column, so if the value of the second column is longer than the value of the first column, the first column will contain just the value of the second column.
> And the second column is always empty.
> 
> I have searched a lot for helpful information on the net, and I found more web pages telling very explicitly that an Oracle table can contain just a single clob column, and many other pages telling also explicitly that an Oracle table can contain more clob column (and just a single long column...), so I don't know what's the truth or if it matters.
> 
> This code was working before with DBIC but now it is not working anymore...
> I am using Perl 5.14.2, DBIC 0.08196, DBD::Oracle 1.38, Oracle 11G under Ubuntu 11.
> 
> Do you have any idea what could be the problem? Any solution or workaround?

Crap! I would hazard a guess this is some subtle behavior change in
DBD::Oracle. In any case DBIC needs to move away from using the buggy
blob support in DBD::Oracle, and use the blob OCI calls directly.

Can you please augment the oracle blob test[1] to work with 2 columns
at the time instead of 1 as it is now? Better test coverage (I expect
the tests to fail) will make it easier to implement the necessary
changes.

Thanks!

[1] http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git;a=blob;f=t/73oracle.t;h=907c278cd229ab2a58c28b665ca3f356c2471810;hb=HEAD#l374



More information about the DBIx-Class mailing list