From: <ch...@co...> - 2004-04-27 21:02:05
|
I've tried storing this with Firebird and it seems to work. Firebird seem to treat CHAR types as merely as an array of bytes and doesn't seem to attempt any other interpretations. With that knowledge and if you are developing a new database project make it a guideline that only GUID entities are defined as CHAR(16). With that, and using some helper UDFs -- GuidCreate, GuidIsEmpty, GuidString -- Guids can be "simulated" on Firebird. The only issue is reading from Firebird into the .NET provider as it will "think" a GUID is a Firebird TEXT type. The way for the provider to distinguish that the data coming across is a guid is for the provider to check the size. If the data is TEXT by and size is 16 then assume a GUID and convert the byte stream to a GUID -- wal-la! Writing is easier as the provider can do a GetType() on the object. Right now I've modified the provider to support this (only for sprocs) but what I'm really asking is if this make sense for community wide support. I think having some sort of GUID support would be extremely useful especially to assist and encourage SqlServer migration to Firebird. Thanks, Chris > > The question is how to use a 16-byte GUID in Firebird when the system > > itself doesn't. In the database that I'm designing with Firebird I > > decided to reserve CHAR(16) for GUID only. If I have a need for a > > 16-byte character representation then I'll use either VARCHAR(16) or > > CHAR(17). In the CHAR(17) case I'm anticipating the front end to limit user > > input. > > A column of "char(16) character set octets" should in theory hold > a binary GUID. > > But it is a field of research, whether all layers involved will gladly > handle bytes of zero in this. It's worth a try. > > A middle ground between binary and textual GUIDs would be to use base64 > encoded binary GUIDs, requiring 22 bytes. > > Regards, > Peter Jacobi > > > > ------------------------------------------------------- > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek > For a limited time only, get FREE Ground shipping on all orders of $35 > or more. Hurry up and shop folks, this offer expires April 30th! > http://www.thinkgeek.com/freeshipping/?cpg=12297 > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider |