[CDBI] sql function as column

Jason Bodnar jason at shakabuku.org
Wed Feb 14 05:35:02 GMT 2007

I have a table with just two columns - id int auto_increment and name
varchar(255). I'd like to have a third "virtual" column called code. The SQL
for retrieving all three columns would be:

select id, name, conv(id,10,36) as code from table where name = ?

conv is a (possibly mysql-only) function that converts the first argument from
the base second arg to base third arg. (In this case it converts the id from
base 10 to base 36).

Is there a way to do this with CDBI?

Jason Bodnar
jason at shakabuku.org

UnWired Buyer. The best way to win on eBay. Period.

More information about the ClassDBI mailing list