Whats the tinyint Form for CreateTableSQL in schema function?

Get help from other users here.

Moderators: Contributor, Developer

Post Reply
Onetaluko
Posts: 4
Joined: Nov 15, 2018 7:08 am

Whats the tinyint Form for CreateTableSQL in schema function?

Post by Onetaluko » Nov 15, 2018 7:40 am

Hello,

currently I'm developing my first plugin and need some MySql Tables.
I've come along with the schema function in my plugin class and have found this way to create a new table, as seen in the code block below.

My question is: What's the short form for tinyint in this CreateTableSQL Syntax?

I've searched in the documentations of mantis, in the code itself, in this forum but couldn't find a hint or answer.
I wanted the enabled field to be a tinyint field like all normal mantis-table-enable-fields are, e.g. in the table mantis_project_table.

Code: Select all

function schema()
    {
        return array(
            array( 'CreateTableSQL', array( plugin_table( 'thing' ), "
                id              I           UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
                name            C(128)      NOTNULL DEFAULT \" '' \",
                 # Whats the tinyint short form here to use?
                enabled         tinyint(4) NOT NULL DEFAULT '1',
                description     XL          DEFAULT \" '' \",
                ", array( 'mysql' => 'DEFAULT CHARSET=utf8' )
                )
            ),
...
C - Char
I - Integer
XL - Longtext
? - Tinyint

Could someone help me please?

Thanks in advance

atrol
Site Admin
Posts: 7581
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: Whats the tinyint Form for CreateTableSQL in schema function?

Post by atrol » Nov 17, 2018 5:24 am

We use ADOdb as our database abstraction layer.
http://adodb.org/dokuwiki/doku.php?id=v ... nary_index
From what I see, I2 is what you are looking for.
Please use Search before posting and read the Manual

Onetaluko
Posts: 4
Joined: Nov 15, 2018 7:08 am

Re: Whats the tinyint Form for CreateTableSQL in schema function?

Post by Onetaluko » Jan 04, 2019 9:57 am

Thank you for the ADOdb information.

Unfortunately the schema function won't work in my beginnings and I created the tables by hand.

But it is a good link to see the summary of types.

Post Reply