Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB Binaries » View Thread |
Messages 1 to 3 of 3 total |
TBytes to VarBytes |
Sun, Sep 13 2020 2:32 PM | Permanent Link |
Carl | I have some raw data in a TBytes variable, with 64 bytes as markers to be stored for later use. For normal strings, I am using Unicode. The database is Unicode. I am not clear on the restrictions of having an AnsiString in a Unicode database. What is the best practice column data type for this data? A) VARCHAR(64) with ANSI collation (AnsiString?) B) VARBYTES(64) C) BLOB My usual practice is to insert/update a row using a procedure, passing params for each related table column. So I have a Delphi TBytes variable called MyBytes, and a procedure parameter P_MAPPER VARBYTE(64) or VARCHAR(64) To set the P_MAPPER parameter of the procedure, do I use AsString? ParamByName('P_MAPPER').AsString := MyBytes; Do I need to convert MyBytes using an TEDBEngine method? \ Any suggestions would be helpful. Thanks. |
Mon, Sep 14 2020 6:11 AM | Permanent Link |
Fernando Dias Team Elevate | Carl,
Use VARBYTE(64) or BYTE(64) for the parameter type. To assign the values you don't have to convert anything: var MyBytes: TBytes; begin SetLength(MyBytes, 16); (...) EDBStoredProc1.ParamByName('P_MAPPER').AsBytes := MyBytes; EDBStoredProc1.ExecProc; (...) Inside the stored procedure you also don't have to convert the value: CREATE PROCEDURE "Proc1" (IN "P_MAPPER" VARBYTE(64)) BEGIN EXECUTE IMMEDIATE 'UPDATE Tbl1 SET A64VBin = ?' USING P_MAPPER; END -- Fernando Dias [Team Elevate] |
Mon, Sep 14 2020 6:15 AM | Permanent Link |
Fernando Dias Team Elevate | I meant SetLength(MyBytes, 64) instead of SetLength(MyBytes, 16) -- Fernando Dias [Team Elevate] |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |