Okay
  Public Ticket #2451976
Column error with Integer numbers
Closed

Comments

  • Marlon Rebello Viana started the conversation

    I configured one of my columns as "Integer", but whenever I add a new entry, it turns any value into: 2147483647.

    This is Mersenne's 8th prime number, this is also the limit value for 32-bit "Integer", I don't think it's a coincidence.
    Note: This value is not entered when I edit the column

    Thank you for app, Marlon Rebello Viana

  •  2,572
    Aleksandar replied

    Hello Marlon.

    Thank you for your purchase.

    The import will not work with numbers this big because the int in MySQL is 4 bytes long so the maximum values are -2.147.483.648 and 2.147.483.647. If you have values below 2.147.483.647, you can see in your table that numbers below that are inserted correctly. This is the INT limitation of your database, and technically it is linked to wpDataTables as well, because we're telling the code to insert the data as INT, not BIGINT.

    You can take a look at the limits here.

    Here's what you can do:

    Go to ../wp-content/plugins/wpdatatables/source/class.constructor.php and around line 117 you'll see this:

    if ($isMySql) {
                $columnCollate = '';
                $columnTextType = 'TEXT';
                $columnIntType = 'INT(11)';
                $columnDateTimeType = 'DATETIME';
                $nullable = '';
            }
    

    Change 'INT(11)' to 'BIGINT', so it looks like this:

    5615180710.png

    and after that you will be able to use large numbers.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables