For example, for a double quote enclosing character, if the data field contains a
double quote, it must be expressed as "some data \" some other data".
For Lines terminated by, recent versions of phpMyAdmin offer the auto choice,
which should be tried first as it automatically detects the end-of-line character. We
can also specify manually what characters terminate the lines. The usual choice is \n
for UNIX-based systems, \r\n for DOS or Windows systems, and \r for Mac-based
systems (up to Mac OS 9). If in doubt, we can use a hexadecimal file editor on our
client computer (not part of phpMyAdmin) to examine the exact codes.
By default, phpMyAdmin expects a CSV file with the same number of fields and
the same field order as the target table, but this can be changed by entering a
comma-separated list of column names in Column names, respecting the source file
format. For example, let's say our source file only contains the author ID and author
name information:
"1","John Smith"
"2","Maria Sunshine"
We'd have to put id, name in Column names to match the source file.
When we click Go, the import is executed and we get a confirmation. We might also
see the actual INSERT queries generated if the total size of the file is not too big.
Importing Structure and Data
[ 146 ]
CSV Using LOAD DATA
With this method, phpMyAdmin relies on the server's LOAD DATA INFILE or LOAD
DATA LOCAL INFILE mechanisms to do the actual import, instead of processing the
data internally.
Pages:
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152