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
  Support
  Download
  Document
  FAQ
  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(CSV)
BINARY conversions
Martin Ross
2006-06-24 15:56:29.0
It would be nice to have support to be able to cast short binary types into primative number types.

create table test
(
test1 BINARY(2)
)

select cast(test1 as SMALLINT) from test

select cast(test1 as BIGINT) from test


I would suggest that restriction is placed on BINARY size to avoid overflows/meaningless conversions

create table test
(
test1 BINARY(8)
)

select cast(test1 as SMALLINT) from test should return an error.

Obviously endianness would be a conern so a function to reverse endianness would be helpful too. i.e. SwapBytes().

Also ability to handle BINARY of odd sizes.
e.g. create table test
(
test 1 BINARY(3)
)
select cast(test1 as BIGINT) from test from should work.
Re:BINARY conversions
HXTT Support
2006-06-24 21:49:25.0
Please download the latest package, which has provide these functions below:
BToInt_LE(binary): get int value from bytes with little-endian.
BToInt_BE(binary): get int value from bytes with big-endian.
IntToB_LE(binary): get bytes with little-endian from int value.
IntToB_BE(binary): get bytes with big-endian from int value.
BToShort_LE(binary): get short value from bytes with little-endian.
BToShort_BE(binary): get short value from bytes with big-endian.
ShortToB_LE(binary): get bytes with little-endian from short value.
ShortToB_BE(binary): get bytes with big-endian from short value.
BToLong_LE(binary): get long value from bytes with little-endian.
BToLong_BE(binary): get long value from bytes with big-endian.
LongToB_LE(binary): get bytes with little-endian from long value.
LongToB_BE(binary): get bytes with big-endian from long value.


Tested sqls:
create table test ( test1 BINARY(2) )
select btoshort_be(test1) from test

select btolong_be(test1) from test

create table test1 ( test1 BINARY(8))

select btoshort_be(test1) from test1

create table test2 ( test1 BINARY(3) );
select btolong_be(test1)from test2


Search Key   Search by Last 50 Questions




Google
 

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