Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
  HXTT Cobol v5.0
  HXTT DBF v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v6.1
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
  HXTT Word v1.1
  HXTT XML v4.0
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 DBF
Wrong result in select after update
Rob Gansevles
2011-11-22 07:41:25.0
Hi,

One of our tests failed with the latest DBF_JDBC30.jar (downloaded today).
I have created a small java program that shows the error.
It prints a few values, first the expected value followed by the actual value.
The last value is incorrect.

When I run the same program with an older version of the driver it works fine.

Output:
updated1 == updated1
two == two
updated1 == updated1
updated2 == two <<= should be updated2

Can you have a look at this,

Thanks in advance,

Rob Gansevles.

Test code:

public static void main(String[] args) throws Exception
{
Class.forName("com.hxtt.sql.dbf.DBFDriver");
Connection connection = DriverManager.getConnection("jdbc:dbf:////tmp/test_hxtt_dbf?lockType=VFP", "", "");
try { exec(connection, "drop table tsta"); }
catch (Exception e) { }
try { exec(connection, "drop table tstb"); }
catch (Exception e) { }

exec(connection, "create table tsta (tsta_id integer not null, tsta_a varchar(50) not null, primary key (tsta_id))");
exec(connection, "insert into tsta (tsta_id, tsta_a) values (1, 'one')");
exec(connection, "insert into tsta (tsta_id, tsta_a) values (2, 'two')");
exec(connection, "create table tstb (tstb_id integer not null, tsta_id integer not null, primary key (tstb_id))");
exec(connection, "insert into tstb (tstb_id, tsta_id) values (10, 1)");
exec(connection, "insert into tstb (tstb_id, tsta_id) values (30, 3)");
exec(connection, "update tsta set tsta_a='updated1' where exists (select 1 from tstb where tsta.tsta_id = tstb.tsta_id)");

PreparedStatement ps = connection.prepareStatement("select tsta_id, tsta_a from tsta order by tsta_id asc");
ResultSet rs = ps.executeQuery();
rs.next();
System.out.println("updated1 == " + rs.getString(2));
rs.next();
System.out.println("two == " + rs.getString(2));
rs.close(); ps.close();

exec(connection, "update tsta set tsta_a='updated2' where not exists (select 1 from tstb where tsta.tsta_id = tstb.tsta_id)");

ps = connection.prepareStatement("select tsta_id, tsta_a from tsta order by tsta_id asc");
rs = ps.executeQuery();
rs.next();
System.out.println("updated1 == " + rs.getString(2));
rs.next();
System.out.println("updated2 == " + rs.getString(2));
rs.close(); ps.close();

connection.close();
}

public static void exec(Connection connection, String sql) throws Exception
{
PreparedStatement ps = null;
try { ps = connection.prepareStatement(sql);
ps.execute();
}
finally { if (ps != null) ps.close(); }
}
Re:Wrong result in select after update
HXTT Support
2011-11-22 18:29:13.0
Passed test with the latest version:
tsta_id
tstb_id
updated1 == updated1
two == two
updated1 == updated1
updated2 == updated2(correct)

Please check that mainifest.mf file to see the version information:
Specification-Version: 5.1.014 on November 22, 2011

Re:Re:Wrong result in select after update
Rob Gansevles
2011-11-23 00:15:27.0
I still see the file from November 17 on the downloads site.

Rob
Re:Re:Re:Wrong result in select after update
HXTT Support
2011-11-23 00:25:55.0
The package on November 17, 2011 should work normal too.
Re:Re:Re:Re:Wrong result in select after update
Rob Gansevles
2011-11-29 07:51:24.0
Hi,

I just downloaded the version with version info listed below (Servoy OEM).
I still get the wrong output (updated2 == two).

What can be different with your tests?
Can you try the same test on the same file as I downloaded?

Thanks,

Rob


Specification-Title: HXTT DBF JDBC 3.0 Package
Implementation-Title: com.hxtt.sql.dbf
Specification-Version: 5.1.015 on November 23, 2011
Specification-Vendor: Hongxin Technology & Trade Ltd.
Comment: JDBC 3.0 Package for Xbase database
Implementation-Version: 5.1.015 on November 23, 2011
Re:Re:Re:Re:Re:Wrong result in select after update
HXTT Support
2011-11-29 19:14:59.0
Checked and fixed. Please download the latest package. That issue is resulted by reused the parse of "select tsta_id, tsta_a from tsta order by tsta_id asc", which has cached one column value 'two', but in fact the database is updated correctly.
Re:Re:Re:Re:Re:Re:Wrong result in select after update
Rob Gansevles
2011-12-05 08:23:36.0
Thanks, it works.
I have another,possibly related issue which I will post in a new thread.

Rob

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap