[ic] newlines in textfields - import export problems

Jerry Brady interchange-users@icdevgroup.org
Fri Apr 4 14:20:01 2003


I'm using 4.8.6 with a MySQL database.

In one of my catalogs, I added an admin UI combo-box that controls the
contents of a column in the userdb table.  The column is defined as a
TEXT field.

The field contains a list of which areas of the catalog a specific user
is allowed to use.  My client manages user access themselves through the
admin UI. The column inserts performed by  admin UI code delimited
entries from the combo box with newlines in the appropriate MySQL
column. 

During auto-export, however, this column gets stripped of its newlines
when the tab-delimited, userdb.txt file is created. When the data is
re-imported during a restart (after removing userdb.sql), the
carriage-returns where not translated back into newlines in the
database.

Therefore, after a re-import from the text version of the userdb table,
all functions in my catalog based on this field broke.

I looked into the export and found that the translation took place in
Data.pm's export_database() function, because you obviously can't have a
newline character in a field when the record is delimited by newlines.

I ended up patching Tables/DBI.pm by adding:

for (@fields) { s/\r/\n/g; }

in an appropriate spot in set_row().

I have a few questions:

1. Is this a an IC bug?  Shouldn't databases exported to a local text
file by Interchange and subsequently imported always be the same?

2. If it's not a bug, would a better solution have been to change the
record deliminator character for the import/export of the IC database
tables?  If so, where is this set?

Regards,
Jerry Brady
Blue Circle Technologies