You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kaare Rasmussen <ka...@kakidata.dk> on 2003/12/29 13:13:17 UTC

DBIx::Recordset andLongNames error

I've run into an error with DBIx::Recordset and !LongNames. My query involves 
several tables:

so_invoicebatch LEFT JOIN so_invoice USING (batchnr)
      LEFT JOIN so_orderhead ON (so_invoice.ordernr=so_orderhead.ordernr)
      LEFT JOIN co_custaddr_v USING (contact_id)
      LEFT JOIN co_country USING (country_id)

and there are duplicated column names between the tables. So I turn !LongNames 
on, but then the values don't match the columns!! E.g. order total ends up as 
status!
With LongNames turned off, the values match. I've tried both the CPAN version 
and 0.25 from Terence Brannon.

I'd really like to be able to use table aliases, will this be in the future 
path for DBIx::Recordset ?

Also, will the above query be updatable with DBIx::Recordset ?

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: DBIx::Recordset andLongNames error

Posted by Terrence Brannon <me...@urth.org>.
Kaare Rasmussen wrote:

>>I think the big problem with doing something like this is that updates
>>to multiple tables should be wrapped in a transaction.
>>    
>>
>
>Well, I'd leave that for the user to decide.
>
>  
>
>>And I certainly don't think Recordset can do this at the moment.
>>    
>>
>
>There's a $set -> Begin. Not sure how to use it though as I'd prefer to begin 
>my transaction before any read, but I guess it's like this
>
>  my $set = DBIx::Recordset -> Search ({ %search });
>  $$set -> Begin;
>updates, deletes and inserts
> $$set -> Commit;
>
>  
>
In the version I will release to CPAN today those functions are 
implemented and
should be useable.




Re: DBIx::Recordset andLongNames error

Posted by Kaare Rasmussen <ka...@kakidata.dk>.
> I think the big problem with doing something like this is that updates
> to multiple tables should be wrapped in a transaction.

Well, I'd leave that for the user to decide.

> And I certainly don't think Recordset can do this at the moment.

There's a $set -> Begin. Not sure how to use it though as I'd prefer to begin 
my transaction before any read, but I guess it's like this

  my $set = DBIx::Recordset -> Search ({ %search });
  $$set -> Begin;
updates, deletes and inserts
 $$set -> Commit;

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: DBIx::Recordset andLongNames error

Posted by Terrence Brannon <me...@urth.org>.
Kaare Rasmussen wrote:

>
>
>  
>
>>do you mean will recordset update across multiple tables? I can't remember.
>>    
>>
>
>Also this. Would be something of a dream, though I'm not sure its doable.
>
>  
>

I think the big problem with doing something like this is that updates 
to multiple tables should be wrapped in a transaction.

And I certainly don't think Recordset can do this at the moment.


Re: DBIx::Recordset andLongNames error

Posted by Kaare Rasmussen <ka...@kakidata.dk>.
Hi

> Can I run it somehow?

I will compile a test case and send it to you.

> I think Angus Lees creates such a patch... I think I missed when
> upgrading Recordset though... Angus?

This would add miles to the usability of DBIx::Recordset

> do you mean will recordset update across multiple tables? I can't remember.

Also this. Would be something of a dream, though I'm not sure its doable.

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Email: kar@kakidata.dk
2000 Frederiksberg        Lørdag 12.00-16.00       Web:      www.suse.dk


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: DBIx::Recordset andLongNames error

Posted by Terrence Brannon <me...@urth.org>.
Kaare Rasmussen wrote:

>I've run into an error with DBIx::Recordset and !LongNames. My query involves 
>several tables:
>
>so_invoicebatch LEFT JOIN so_invoice USING (batchnr)
>      LEFT JOIN so_orderhead ON (so_invoice.ordernr=so_orderhead.ordernr)
>      LEFT JOIN co_custaddr_v USING (contact_id)
>      LEFT JOIN co_country USING (country_id)
>  
>

Do you have the SQL that created these tables?.
Do you have any sample data?
Did you set $DBIx::Recordset::Debug to 4 and log the output?

    *DBIx::Recordset::LOG = \*LOG ;
    $DBIx::Recordset::Debug = 5 ;

Are you using the new !Query method of inputting full SQL or are you 
!TabJoin or !TabRelation? Where is your code?
Can I run it somehow?

>and there are duplicated column names between the tables. So I turn !LongNames 
>on, but then the values don't match the columns!! E.g. order total ends up as 
>status!
>With LongNames turned off, the values match. I've tried both the CPAN version 
>and 0.25 from Terence Brannon.
>
>I'd really like to be able to use table aliases, will this be in the future 
>path for DBIx::Recordset ?
>  
>

I think Angus Lees creates such a patch... I think I missed when 
upgrading Recordset though... Angus?

>Also, will the above query be updatable with DBIx::Recordset ?
>
>  
>
do you mean will recordset update across multiple tables? I can't remember.

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org