Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access 7.1.193
  HXTT Cobol 5.0.193
  HXTT DBF 7.1.194
  HXTT Excel 6.1.197
  HXTT Json 1.0.165
  HXTT Paradox 7.1.193
  HXTT PDF 2.0.193
  HXTT Text(CSV) 7.1.193
  Buy Now
  HXTT Word 1.1.193
  HXTT XML 4.0.194
Offshore Outsourcing
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
Heng Xing Tian Tai Lab of Xi'an 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


Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap