Okay
  Public Ticket #1523134
handling errors
Closed

Comments

  • danbarejr started the conversation

    Simple to reproduce.

    I have a Mysql table, two columns.  One column integer.  The second column VARCHAR(50).

    I have one row.  With valid data in it.

    Using wpDataTables, I created a wp-table.

    Click allow Editing.

    The table has the one row and displays it correctly.

    I click the row, then EDIT.

    On purpose, I enter a value that is longer than 50 characters.  I want to see if it truncates, or throws an error.

    The response is "Success! Data has been saved".

    However, the data did not change.

    Attached is a word doc with images.

  •  1,689
    Miloš replied

    HI danbarejr,
    Thank you for your purchase.

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.

    Also point me to the table ID so I can take a look.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [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

  •   danbarejr replied privately
  •  1,689
    Miloš replied

    HI Daniel,

    This is the error that I get when i enter more then 50 characters in the first column. (attachment) 

    Can you please send me the screenshot from the phymyadmin database so I can see for how many characters are set for the first column, by default if should be 255.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [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

  • danbarejr replied

    I found the insert throws an error when MailingAddressLine1 is longer than 50 characters.  (Good)

    But the EDIT does not throw an error.  Click "edit" and change the first col... so anything longer than 50 characters, and it says "Success", but doesn't actually change the data in MySql.

    Try it again with an "edit".

    The data in the table is all test data, so feel free to change the row that comes up (it is dependent on VAR1) and defaults to 1.  

    I don't want to make address line 1 255 characters - as that would be too long for an address.  On that note, I haven't figured out how and where to do custom validation of fields prior to insert/change.   Any suggestions?  

    FYI - the MySql DDL is:

    CREATE TABLE IF NOT EXISTS `Customer` ( 

    `idCustomer` INT NOT NULL AUTO_INCREMENT,
    `Name` VARCHAR(50) NULL,
    `MailingAddressLine1` VARCHAR(50) NULL,
    `MailingAddressLine2` VARCHAR(50) NULL,
    `MailingAddressCity` VARCHAR(50) NULL,
    `MailingAddressState` VARCHAR(50) NULL,
    `MailingAddressZip` VARCHAR(20) NULL,
    `PhysicalAddress1` VARCHAR(50) NULL,
    `PhysicalAddress2` VARCHAR(50) NULL,
    `PhysicalAddressCity` VARCHAR(50) NULL,
    `PhysicalAddressState` VARCHAR(50) NULL,
    `PhysicalAddressZip` VARCHAR(20) NULL,
    `PhysicalAddressPhone` VARCHAR(50) NULL,
    `FrequencyFacilityInspections` VARCHAR(50) NULL,
    `FrequencyInvoicing` VARCHAR(50) NULL,
    `LUSR` BIGINT NULL,
    `LUDT` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`idCustomer`))
    ENGINE = InnoDB
    COMMENT = ' ';

    Thanks for your help.

  •  1,689
    Miloš replied

    HI Daniel,

    The issue can be in the query then.

    Our suggestion when you have a queries like this is to make a VIEW in phpmyadmin or any other database management system and see if the query is returning the right results.

    If the results are good you can use that query as an input ( SELECT * FROM VIEW_name) when creating tables with add from data source option.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [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

  • danbarejr replied

    created view.  Same results.

    This is such a simple problem.  Let's create it on your end.

    CREATE TABLE Customer 
    ( `idCustomer` INT NOT NULL AUTO_INCREMENT, 

    `Name` VARCHAR(50) NULL
    PRIMARY KEY (`idCustomer`))
    ENGINE = InnoDB
    COMMENT = ' ';

    In wpDataTables, create a wpDataTable from SQL table Customer.  

    • Make it edittable.  
    • Use the idCustomer as the id column.
    • Click on the column settings for Name, make it String , and editable One-line-edit.
    • No need to see the id column, as it's auto-increment.  I leave it as Integer, and under EDIT - none.

    1)  Now, add a row with a Name.

    2) click on the row, click on Edit.  On purpose, enter a name with a length longer than 50 characters.

    When I do this, I get "Success", but nothing happened.  The update did not occur in the database.

    note: I'm using wpDataTables with a database that is pre-defined.  The solution is not to make every text field unlimited length so that it works with wpDataTables.

    Bottom line: even if I do something wrong in setup, wpDataTables should NEVER give a "success" return status, when it was not.


  • danbarejr replied

    corrected SQL in response below (missing a comma):

    CREATE TABLE Customer  ( `idCustomer` INT NOT NULL AUTO_INCREMENT, 

    `Name` VARCHAR(50) NULL, PRIMARY KEY (`idCustomer`)) ENGINE = InnoDB COMMENT = ' ';

  •  1,689
    Miloš replied

    HI Daniel,

    Sorry for late response but we did not work in past 4 days due to national holidays.


    Can you please tell me did you try to make a VIEW from this query.

    Also if you can send me the Customer table ( zipped or as sql file) so I can upload it to my database and make a table from your query.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [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

  • danbarejr replied

    Yes, I tried the view.  Same problem.

    Did you try the simple CREATE TABLE with a varchar(50) and test it yourself on your platform?  Details below with instructions on how to exactly recreate this problem.

    What i have learned so far is that inserts (click NEW) show an error when MySQL throws an error (when given a string too long).

    However, it appears that errors thrown during the update (EDIT) always say "Success", even when not.  I'd guess the UPDATE source code isn't checking the MySQL return code correctly...

    Thanks - Dan


  •  1,689
    Miloš replied

    HI Daniel,

    I recreated the issue on my side, my results are the same as yours.

    If I try to add a new row with more than 50 characters and I get the error that table can not be saved.

    When I edit the row and enter more then 50 characters I get Table is saved message.

    I will forward this to my team and hopefully we can find some proper solution for this.

    In a mean time if it is possible for you of course can you change the length to 255 ( as it is default) until i get an answer.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [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

  • danbarejr replied

    Thanks for recreating this.  

    I suspect the problem is the MySql return code isn't being checked properly on return from an "update".  

    Other scenarios that probably have the same problem are:

    • What if the table is locked on the update and the update can't be performed?
    • What if a referential integrity error was triggered, and the update wasn't performed?
    • Try to change a field to null, when null is not allowed.

    Thanks for looking into this, and I look forward to it's resolution.

    Dan

  •  1,689
    Miloš replied

    HI Dan,

    I forwarded this to my team as long as your scenarios below so hopefully we can find a solution for this.

    Sorry for any inconvenience and thank you for understanding.



    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [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