Perl Rose::DB - is there any CAST or CONVERT function to use in relationship clause?

66 Views Asked by At

Is there any cast/convert function in Rose::DB e.g. to cast a varchar column to integer?

As reference: https://metacpan.org/pod/Rose::DB::Object::QueryBuilder

I need use join on two tables as below.

 ON (t1.id = t3.detail)

id column of t1 table is integer and detail column of t3 is varchar. I can not change these tables because they are in production. Is there a way in the relationship clause of Rose::DB to add typecasting like

ON (t1.id = t3.detail::int)

My relationship clause in the model of table t1 looks like below.

        t3 => {
            type  => 'one to many',
            class => 'Task::Detail',
            key_columns => {
                id => 'detail', <= Any option here to type cast?
            },
            query_args  => [ task_detail_type_id => 10 ],
        },      

Any suggestions?

0

There are 0 best solutions below