Page 1 of 1

Whats the tinyint Form for CreateTableSQL in schema function?

Posted: 15 Nov 2018, 12:40
by Onetaluko
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

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

Posted: 17 Nov 2018, 10:24
by atrol
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.

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

Posted: 04 Jan 2019, 14:57
by Onetaluko
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.