deanlaw / cfcgenerator

Automatically exported from code.google.com/p/cfcgenerator
8 stars 6 forks source link

MySQL 5 CF8 (Public & GMC Release) Strang Issue in bean validate function #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the generator on a mysql 5 database with the CF8 Beta (&GMC)

What is the expected output? What do you see instead?

When I run the generator on a table in a my MySQL 5 database the validate
function does not pick up the tables (metadata) correctly. Here's what I
get back from the generator with mysql 5:

        <!--- NewsID --->

        <!--- Headline --->
        <cfif (NOT len(trim(getHeadline())))>
            <cfset val.addError("Headline", "Headline is required") />
        </cfif>

        <!--- SubHeadline --->

        <!--- Body --->
        <cfif (NOT len(trim(getBody())))>
            <cfset val.addError("Body", "Body is required") />
        </cfif>

        <!--- SpecialComment --->

        <!--- Link1 --->

        <!--- Link2 --->

        <!--- Image1 --->

        <!--- Image2 --->

        <!--- Image3 --->

        <!--- ReleaseType --->
        <cfif (NOT len(trim(getReleaseType())))>
            <cfset val.addError("ReleaseType", "ReleaseType is required") />
        </cfif>

        <!--- DateOfNews --->
        <cfif (NOT len(trim(getDateOfNews())))>
            <cfset val.addError("DateOfNews", "DateOfNews is required") />
        </cfif>

        <!--- DateCreated --->
        <cfif (NOT len(trim(getDateCreated())))>
            <cfset val.addError("DateCreated", "DateCreated is required") />
        </cfif>

        <!--- DateModified --->
        <cfif (NOT len(trim(getDateModified())))>
            <cfset val.addError("DateModified", "DateModified is required") />
        </cfif>

********** Here's what I get from the same table in MSSQL and from CF7 on
MySQL ***********

<!--- NewsID --->
        <cfif (len(trim(getNewsID())) AND NOT isNumeric(trim(getNewsID())))>
            <cfset val.addError("NewsID", "NewsID is not numeric") />
        </cfif>

        <!--- Headline --->
        <cfif (NOT len(trim(getHeadline())))>
            <cfset val.addError("Headline", "Headline is required") />
        </cfif>
        <cfif (len(trim(getHeadline())) AND NOT IsSimpleValue(trim(getHeadline())))>
            <cfset val.addError("Headline", "Headline is not a string") />
        </cfif>
        <cfif (len(trim(getHeadline())) GT 300)>
            <cfset val.addError("Headline", "Headline is too long") />
        </cfif>

        <!--- SubHeadline --->
        <cfif (len(trim(getSubHeadline())) AND NOT
IsSimpleValue(trim(getSubHeadline())))>
            <cfset val.addError("SubHeadline", "SubHeadline is not a string") />
        </cfif>
        <cfif (len(trim(getSubHeadline())) GT 350)>
            <cfset val.addError("SubHeadline", "SubHeadline is too long") />
        </cfif>

        <!--- Body --->
        <cfif (NOT len(trim(getBody())))>
            <cfset val.addError("Body", "Body is required") />
        </cfif>
        <cfif (len(trim(getBody())) AND NOT IsSimpleValue(trim(getBody())))>
            <cfset val.addError("Body", "Body is not a string") />
        </cfif>
        <cfif (len(trim(getBody())) GT -1)>
            <cfset val.addError("Body", "Body is too long") />
        </cfif>

        <!--- SpecialComment --->
        <cfif (len(trim(getSpecialComment())) AND NOT
IsSimpleValue(trim(getSpecialComment())))>
            <cfset val.addError("SpecialComment", "SpecialComment is not a string") />
        </cfif>
        <cfif (len(trim(getSpecialComment())) GT -1)>
            <cfset val.addError("SpecialComment", "SpecialComment is too long") />
        </cfif>

        <!--- Link1 --->
        <cfif (len(trim(getLink1())) AND NOT IsSimpleValue(trim(getLink1())))>
            <cfset val.addError("Link1", "Link1 is not a string") />
        </cfif>
        <cfif (len(trim(getLink1())) GT 300)>
            <cfset val.addError("Link1", "Link1 is too long") />
        </cfif>

        <!--- Link2 --->
        <cfif (len(trim(getLink2())) AND NOT IsSimpleValue(trim(getLink2())))>
            <cfset val.addError("Link2", "Link2 is not a string") />
        </cfif>
        <cfif (len(trim(getLink2())) GT 300)>
            <cfset val.addError("Link2", "Link2 is too long") />
        </cfif>

        <!--- Image1 --->
        <cfif (len(trim(getImage1())) AND NOT IsSimpleValue(trim(getImage1())))>
            <cfset val.addError("Image1", "Image1 is not a string") />
        </cfif>
        <cfif (len(trim(getImage1())) GT 255)>
            <cfset val.addError("Image1", "Image1 is too long") />
        </cfif>

        <!--- Image2 --->
        <cfif (len(trim(getImage2())) AND NOT IsSimpleValue(trim(getImage2())))>
            <cfset val.addError("Image2", "Image2 is not a string") />
        </cfif>
        <cfif (len(trim(getImage2())) GT 255)>
            <cfset val.addError("Image2", "Image2 is too long") />
        </cfif>

        <!--- ReleaseType --->
        <cfif (len(trim(getReleaseType())) AND NOT
IsSimpleValue(trim(getReleaseType())))>
            <cfset val.addError("ReleaseType", "ReleaseType is not a string") />
        </cfif>
        <cfif (len(trim(getReleaseType())) GT 10)>
            <cfset val.addError("ReleaseType", "ReleaseType is too long") />
        </cfif>

        <!--- DateOfNews --->
        <cfif (NOT len(trim(getDateOfNews())))>
            <cfset val.addError("DateOfNews", "DateOfNews is required") />
        </cfif>
        <cfif (len(trim(getDateOfNews())) AND NOT isDate(trim(getDateOfNews())))>
            <cfset val.addError("DateOfNews", "DateOfNews is not a date") />
        </cfif>

        <!--- DateCreated --->
        <cfif (len(trim(getDateCreated())) AND NOT isDate(trim(getDateCreated())))>
            <cfset val.addError("DateCreated", "DateCreated is not a date") />
        </cfif>

        <!--- DateModified --->
        <cfif (len(trim(getDateModified())) AND NOT isDate(trim(getDateModified())))>
            <cfset val.addError("DateModified", "DateModified is not a date") />
        </cfif>

Obviously the latter is what I'm looking for! Any help would be much
appreciated. I'm also using the built in CF database connector. I did
switch the over to the JDBC connector and got the same results. I don't
think that matters but I thought I'd throw it out there.

Keep up the great work... I use your generator daily.

Original issue reported on code.google.com by mitchell...@gmail.com on 14 Jul 2007 at 6:44

GoogleCodeExporter commented 9 years ago
This should have been fixed in build 12 that corrected the data type 
translations.
Please resubmit if it recurs.

Original comment by brian.ri...@gmail.com on 29 Apr 2008 at 7:52