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

Octavian Rasnita orasnita at gmail.com
Sun Jan 29 16:27:42 GMT 2012


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?

The SQL queries generated by the code above are:

alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS': 
alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS.FF': 
alter session set nls_timestamp_tz_format='YYYY-MM-DD HH24:MI:SS.FF TZHTZM': 
alter session set NLS_COMP='LINGUISTIC': 
alter session set NLS_SORT='BINARY_AI': 

INSERT INTO sugestii ( answer, date_time_a, date_time_q, id, question) VALUES ( ?, ?, ?, ?, ? ): 'Answer 1', '2012-01-01 10:00:00', '2012-01-01
 00:00:00', '9734', 'This is the first question'

SELECT me.id, me.date_time_q, me.name_q, me.email_q, me.question, me.date_time_a, me.name_a, me.email_a, me.answer, me.markup_lang, me.active FROM sugestii me WHERE ( me.id = ? ) : '9734'

Thanks.

Octavian




More information about the DBIx-Class mailing list