Subject RE: [firebird-support] binary or string?
Author Storage Box
A bigint would be overkill since it is not a 64-bit value. So, a int/bigint
field can legally store hexadecimal values?

It wouldn't be enough in and of itself as (as far as I know) a bigint isn't
automatically converted to hex, am I right? There is more to the conversion
aside from adding two integer values together...I didn't explain the whole
process for the sake of brevity.

Anyhow, that being said, I still consider this business logic and this is a
code-feature that belongs in the middle-tier (for client/server apps). If I
were to code this within the database server, I wouldn't be able to take it
with me to another database or use it elsewhere in my applications (without
round-tripping to the DB). It's just bad design.

Really what I wanted to know is how to store a 16-bit hexadecimal
string/binary value. I wanted to be sure that a char(16) would be efficient
enough to justify it (it's no integer but hey, it's more useful).

Thanks!

-v

_____

From: Lester Caine [mailto:lester@...]
Sent: Saturday, December 11, 2004 2:24 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] binary or string?


Storage Box wrote:

> Internally it is just incremented. It is the hex equivalent of the high +
> low values of a 32-bit integer. I create it and then increment one of the
> integers to guarantee each OID is unique until I run out of integers on
both
> sides (high & low). It only takes about 20 lines of code to manage this
> process.

So why not just use a BIGINT ( 64 bit ), Or even better a pair of integers?
Why not one or two generators?

> I handle the prefix and other validation in my application's data-layer as
I
> want to keep the app database-independent so really, a char(16) would work
> just fine I guess (it's always 16 characters).

If you need the 'text' version, a UDF to provide 'CAST INT TO HEX'
result in the SQL? But I would have thought a simple BIGINT would be enough?

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services


Yahoo! Groups Sponsor

ADVERTISEMENT

<http://us.ard.yahoo.com/SIG=129pfenj2/M=295196.4901138.6071305.3001176/D=gr
oups/S=1705115386:HM/EXP=1102843243/A=2128215/R=0/SIG=10se96mf6/*http://comp
anion.yahoo.com> click here

<http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
:HM/A=2128215/rand=949889029>

_____

Yahoo! Groups Links


* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/


* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>


* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .




[Non-text portions of this message have been removed]