Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONJ-412: tinyInt1isBit is not applied in method columnTypeClause #95

Merged
merged 2 commits into from Feb 10, 2017

Conversation

mikecelis
Copy link
Contributor

The method columnTypeClause has been modified to use the tinyInt1isBit flag. This makes sure things such as hibernate validation don't fail. It's solved by checking if the tinyInt1isBit flag is true and when it is true it will add an if to the sql each time the columnName is used to replace any occurences of 'tinyint(1)' with 'BIT'. If the flag is false the columnName will be added unmodified. This has been tested with an application using hibernate-validator-5.2.4.Final and MariaDB 10.1.2

return " UCASE(IF( " + parsedColumnName + " LIKE '%(%)%', CONCAT(SUBSTRING( " + parsedColumnName + ",1, LOCATE('(',"
+ parsedColumnName + ") - 1 ), SUBSTRING(" + parsedColumnName + ",1+locate(')'," + parsedColumnName + "))), "
+ parsedColumnName + "))";
}

Copy link
Collaborator

@rusher rusher Jan 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, but make request very big.
Would be better just to add just another IF, like :

static String columnTypeClause(int dataTypeMappingFlags, String columnName) {
    String upperCaseWithoutSize =  " UCASE(IF( " + columnName + " LIKE '%(%)%', CONCAT(SUBSTRING( " + columnName + ",1, LOCATE('(',"
            + columnName + ") - 1 ), SUBSTRING(" + columnName + ",1+locate(')'," + columnName + "))), "
            + columnName + "))";

    if ((dataTypeMappingFlags  & MariaSelectResultSet.TINYINT1_IS_BIT) > 0) {
        return " IF(" + columnName + " = 'tinyint(1)', 'BIT', " + upperCaseWithoutSize + ")";
    }
    return upperCaseWithoutSize;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've modified and pushed the code.

@rusher
Copy link
Collaborator

rusher commented Jan 30, 2017

Hi @mikecelis,

Thanks for you contribution.

Similar to other open source projects, the MariaDB Foundation needs to have shared ownership of all code that is included in the MariaDB distribution. The easiest way to achieve this is by submitting your code under the BSD-new license. (The other alternative is to sign the code contribution agreement which can be found here: https://mariadb.com/kb/en/mariadb/mca/)

Please indicate in a comment below that you are contributing your new code of the whole pull request under the BSD-new license or that you have filled out the contribution agreement and sent it.

Thanks,
diego

@mikecelis
Copy link
Contributor Author

We're contributing the code of this whole pull request under the BSD-new license.

@rusher rusher merged commit 17f7875 into mariadb-corporation:master Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants