Skip to main content
Participant
November 27, 2008
Frage

CFMX 8+mySQL5.0.67 Infile null value errors

  • November 27, 2008
  • 1 Antwort
  • 655 Ansichten
I'm moving an app from MX7 mySQL 4 to MX 8 and mySQL5.0. I have a query that does an infile insertion.
CODE:
<cfquery.....>
load data infile '#loadpath##loadfile#' replace into table #sourcetable# fields terminated by '|' Lines terminated by '\r\n' ignore 1 lines;
</cfquery>

From what I read all infile fields are processed as strings. This creates a warning when a field value is going into an integer, date etc. Under cf7/my4 the errors exist but the cfquery tag seemed to just ignore them and everything worked fine.

Under mx8/my5 the errors are throwing an exception and I have not been able to figure out how to get around it. MySQL5 by default is in strict mode which I tried removing in my.ini as well as adding "TRADITIONAL" as the mode. Neither worked.

Using a SQL client I did run the same infile commands against mySQL5 and got the expected results of errors with all the inserts completing. However when doing it through cfquery it halts on the warning.

Any ideas of how to get cfquery or the driver to ignore a warning (vs an error) in MX8? Any other ideas of things I could try?

Thanks in advance,
Greg
Dieses Thema wurde für Antworten geschlossen.

1 Antwort

Inspiring
November 27, 2008
are the field values in your data enclosed by any character?
you need to add ENCLOSED BY '[your character]' to the FIELDS clause then...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Participant
November 27, 2008
No the data is not enclosed, just delimited by a |. Like I mentioned, it worked fine with MX7/my4 (possibly using a my3 driver I think). No other changes have been made other than the minor thing of a new server..