Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Datatypes and Database Abstraction

Quote Reply
Datatypes and Database Abstraction
I'm creating a plugin that requires a large text field. In MySQL, this will be TINYTEXT, in Oracle, a VARCHAR(2000) will suffice.

What datatype should I specify in the plugin installation definition to ensure database independence?
Quote Reply
Re: [paulj] Datatypes and Database Abstraction In reply to
TEXT?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Datatypes and Database Abstraction In reply to
I though of that. It's supported on MySQL, SQL Server and PostgreSQL, but not Oracle.

I guess my real question is: "do the Plugin installer modules do any intelligent conversion depending on which database driver is being used". If it simply passes the datatype through unchanged then I need to find a common datatype that will support large text columns. As far as I can see, there is no such thing.

How do the initial main installers handle it?
Quote Reply
Re: [paulj] Datatypes and Database Abstraction In reply to
In case anyone's interested:

I just tested it on an Oracle installation and the plugin installation modules magically converts the MySQL datatypes TEXT TINYTEXT MEDIUMTEXT etc to CLOBS.

I don't have access to SQL Server ot PostgreSQL, but I'm guessing it will work the same.

Very clever... makes it nice and easy for me. :)

Last edited by:

paulj: Nov 16, 2004, 6:42 PM
Quote Reply
Re: [paulj] Datatypes and Database Abstraction In reply to
Hi,

Yes, the GT::SQL libs will automatically select the most appropriate type depending on the database. You can see what it will pick by looking at GT/SQL/Driver/*.pm.

Cheers,

Alex
--
Gossamer Threads Inc.