Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 11 to 14 of 14 total |
How do you all access byte fields? |
Mon, Aug 20 2012 10:56 AM | Permanent Link |
Dominique Willems | Roy Lambert wrote:
> There may be a specific version for ansichar or you may have to > explicity cast your data to ansichar to trigger overloading in the > standard version. In any case, it's big hoops to jump through to represent the most basic of types. A little bit shaking head that in 2012 we don't have an elegant way to store a byte in a database! (or at least store and retrieve it elegantly) Switched to SmallInt so that I don't have to do a "WTF!" when I look at the code in a couple of months. |
Wed, Sep 5 2012 8:59 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Dom,
<< A truly humongously stupid question, I am sure, but I am curious as to how you access your one-byte fields? >> What version of Delphi are you using ? There is less support for byte array columns in older versions of Delphi, and more support now in XE and above. In older versions like D7, you can use the following: procedure TForm1.Button1Click(Sender: TObject); var TempByte: Byte; begin EDBTable1.FieldByName('ByteField').GetData(@TempByte,True); ShowMessage(Chr(TempByte)); end; In newer versions, you can just use: procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(Chr(EDBTable1.FieldByName('ByteField').AsBytes[0])); end; If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
Wed, Sep 5 2012 9:01 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Dom,
<< Switched to SmallInt so that I don't have to do a "WTF!" when I look at the code in a couple of months. >> You're not really saving much space by going with a Byte or VarByte column when you only want to store a single byte and manipulate it like an integer. The Byte/VarByte column types are primarily *array of byte* column types and are more geared toward storing binary structures, arrays, etc. Tim Young Elevate Software www.elevatesoft.com |
Mon, Sep 17 2012 5:54 AM | Permanent Link |
Dominique Willems | Tim Young [Elevate Software] wrote:
> You're not really saving much space by going with a Byte or VarByte > column when you only want to store a single byte and manipulate it > like an integer. The Byte/VarByte column types are primarily *array > of byte* column types and are more geared toward storing binary > structures, arrays, etc. Okido, thanks for the info! |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |