reporting bug against csv row insertion |
Larry Brasfield |
2007-01-16 04:05:44 |
The jar MANIFEST.MF says (in part):
Name: com/hxtt/sql/text/
Specification-Title: HXTT Text (CSV) JDBC 3.0 Package For Evaluation P
urpose
Implementation-Title: com.hxtt.sql.text
Specification-Version: 3.1.003 on January 13, 2007
Specification-Vendor: Hongxin Technology & Trade Ltd.
Comment: JDBC 3.0 Package for plain text, binary file, CSV
Implementation-Version: 3.1.003 on January 13, 2007
This is the URL given to SQuirrel SQL Client:
jdbc:csv:/C:/Work/Data?_CSV_Header=true;csvfileExtension=tsv;_CSV_Separator=\t
The platform is a Windows XP box running jre1.5.0_06\bin\java.exe .
When I create a table via:
create table "Fooey" ( "nuts" varchar(50), "peanut" bit )
the result is as expected; the column names are tab separated and there is
exactly one "line" in the file, terminated by a \r\n.
When I add a row via:
insert into "Fooey" ("nuts","peanut") values ('walnut',false)
the expected values are written to the file Fooey.tsv, but the terminating
\r\n sequence is omitted. So the file characters following the header
line do not constitute what is properly called a line. This confuses
TSV processing that normally strips the trailing newline from each line
as it is read, typically before splitting based on the separator.
This deficiency remains after the driver is shutdown.
I respectfully claim this is a bug.
|
Re:reporting bug against csv row insertion |
Larry Brasfield |
2007-01-17 09:08:43 |
Here is a link showing that my notion of
text file format is not just my weird idea:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjettext_file_format.asp
|
Re:reporting bug against csv row insertion |
HXTT Support |
2007-01-17 09:35:23 |
I tested and it works fine.
The terminating \r\n sequence is witten.
Please download the latest package and try again.
Thanks.
|
Re:Re:Re:reporting bug against csv row insertion |
Larry Brasfield |
2007-01-17 10:00:28 |
I just downloaded the latest Text_JDBC30.jar, having
these lines (among others) in its MANIFEST.MF file:
Comment: JDBC 3.0 Package for plain text, binary file, CSV
Implementation-Version: 3.1.003 on January 18, 2007
After setting up an empty directory, restarting Squirrel, with this URL:
jdbc:csv:/C:/Tmp/tsvbug?_CSV_Header=true;csvfileExtension=tsv;_CSV_Separator=\t
then creating and new alias (referring to the new directory with your driver),
I executed the following SQL:
create table "Fooey" ( "nuts" varchar(50), "peanut" bit )
insert into "Fooey" ("nuts","peanut") values ('walnut',false)
Here is a screen paste of dumping the created file
[C:\Tmp\tsvbug]
> od -t x1 Fooey.tsv
0000000 6e 75 74 73 09 70 65 61 6e 75 74 0d 0a 77 61 6c
0000020 6e 75 74 09 66 61 6c 73 65
0000031
[C:\Tmp\tsvbug]
> od -c Fooey.tsv
0000000 n u t s \t p e a n u t \r \n w a l
0000020 n u t \t f a l s e
0000031
Please note that there is no terminating newline sequence.
Thanks.
|
Re:Re:Re:Re:reporting bug against csv row insertion |
HXTT Support |
2007-01-18 08:48:04 |
Here is my simple code
import java.sql.*;
public class TestTerminat{
public static void main(String[] args) throws Exception{
Class.forName("com.hxtt.sql.text.TextDriver").newInstance();
Connection aConn = DriverManager.getConnection("jdbc:csv:/C:/Work/Data?_CSV_Header=true;csvfileExtension=tsv;_CSV_Separator=\t");
Statement aStat = aConn.createStatement();
aStat.execute("create table \"Fooey\" ( \"nuts\" varchar(50), \"peanut\" bit ) ");
aStat.execute("insert into \"Fooey\" (\"nuts\",\"peanut\") values ('walnut',false) ");
aStat.close();
aConn.close();
}
}
Here is my Fooey.tsv content.
|
Re:Re:Re:Re:Re:reporting bug against csv row insertion |
HXTT Support |
2007-01-18 08:55:49 |
Oh. I have known what's your meaning.
You say that we should add a \r\n terminate after inserted new row.
We will check our code for your question.
BTW, what's your TSV processing program?
>>This confuses TSV processing that normally strips the trailing newline from each line as it is read, typically before splitting based on the separator.
|
Re^6:reporting bug against csv row insertion |
Larry Brasfield |
2007-01-23 08:25:55 |
In Perl,
$header = <>;
chop $header;
&learn_header($header);
while ($_ = <>) {
chop $_;
my @fields = split("\t", $_);
#...
}
The chop operation is not quite right for
lines without the trailing newline, losing
the last character of the last field of the
last line.
Another issue is that some version control
systems complain about files that appear to
be text but have the final newline missing.
I've used a small set TSV tables to drive
code generation that were checked in when
altered where this would matter.
|
Re:Re:Re:Re:Re:Re:Re:reporting bug against csv row insertion |
HXTT Support |
2007-01-24 19:05:54 |
>The chop operation is not quite right for lines without the trailing newline,
> losing the last character of the last field of the last line
>Another issue is that some version control systems complain about files that
> appear to be text but have the final newline missing.
HXTT Text (CSV) won't insert '\r\n' at once for the last inserted row. According to your suggestion, the next v3.1.004 will support it:) You can download it after 24 hours.
|