Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  Buy Now
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT Text - booleans
Gregory Dubois
2008-04-22 00:16:09.0

We purchased your HXTT Text and it works very well, thanks.

My DBA asked me to get "1" for "true" and "0" for "false". Can I change it?
I tried to change the "open source" dialect :

public abstract class HxttDialect extends Dialect

public final String toBooleanValueString(final boolean bool) {
// *WAS* return bool ? "true" : "false";
return bool ? "1" : "0";

(this method is not overridden in the class HxttTextDialect which is the one I use to generate my data through Hibernate)

But I always get "true" or "false" in my files...
Have you got an idea?

Thank you in advance
G. Dubois
Re:HXTT Text - booleans
HXTT Support
2008-04-22 23:44:22.0
I guess toBooleanValueString should be used for sql generation in Hibernate. If you wish to get 1, and 0, you can use ResultSet.getInt(), not ResultSet.getBoolean() method to fetch data.
Re:Re:HXTT Text - booleans
Gregory Dubois
2008-04-23 01:13:37.0

Maybe I wasn't clear : I talked about the data that is written in the CSV file. I need to get 0 or 1, but I always get "true" or "false".

I never read the data, I only write it to through HXTT in the CSV files. Afterwards, the generated (random) data that is in the CSV files is read by a DB script to inject the data in Oracle.

Can you help me get the right values written in the CSV files?

Many thanks
G. Dubois
Re:Re:Re:HXTT Text - booleans
HXTT Support
2008-04-23 02:02:10.0
You can define that boolean column as int column through CREATE TABLE sql, then all true/false value will be written as 1 and 0.
Re:HXTT Text - booleans
Gregory Dubois
2008-04-23 02:07:26.0
Thank you for your answer.

Unfortunately, I never use CREATE TABLE sql... I generate blank CSV files and their header on-the-fly using Hibernate's mappings. So I don't have to worry about DB changes as long as these are mapped in Hibernate.

Isn't there a way to always have booleans as int values?
Well, I think I will try through Hibernate mapping and I tell you if this is OK ;o)
Re:Re:Re:Re:Re:HXTT Text - booleans
HXTT Support
2008-04-23 02:14:58.0
If your data contains only 1 and 0, HXTT Text will think it's an int type.
HXTT Text - string treated as int loses zero's
Gregory Dubois
2008-04-24 04:54:34.0

It's me again ;o)

Well, for the booleans I'll find a way...

But I have a strange behaviour :
I have fields mapped as String, where I put codes (e.g. : "00001" or "01"). It works for some records and then the zero's are trimmed(!!!). As some are foreign keys, it it a huge and super-urgent problem!

Any idea?
Appearently, it happens on all varchar columns at once

e.g. (2 records inserted; last and before-last coloms should contain zero's as on first record shown; separator is semi-colon):

203;90;305;1995-12-03 07:45:13.049;1995-12-03 07:45:13.049;;3;01;204;25;01;0009
212;91;316;1993-02-10 12:08:21;1998-12-13 04:16:14;;20;1;;25;1;6

Added : appearently the dates are also shortened!!!

I also tried with separator comma, but it is the same.

This is a huge bug (I insert records through Hibernate, so I never change the data pamming nor the way it is recorded).

I need to get the code working by tomorrow.

Can you help me?
Thank you
Re:Re:Re:Re:Re:Re:Re:HXTT Text - booleans
HXTT Support
2008-04-24 06:24:27.0
maxScanRows: Indicates how many rows should be scanned when determining the column types. If you set maxScanRows to 0, the entire file is scanned. If you set maxScanRows to a negative value, the file won't be scanned. For those tables with predefined table structure, that option will be ignored.
You can try maxScanRows=-1 connection property.
Gregory Dubois
2008-04-24 06:40:18.0
It is exactly what I needed...

Many thanks for your quick answers!

Search Key   Search by Last 50 Questions


Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap