Guids in Firebird embedded through ADO/ODBC

Hello all,


I'm modifying an existing ADO based application in order to make it work with Firebird Embedded. Currently the application uses MS SQL Server and Access MDB. To make the changes in the application as small as possible, I'm going the ADO->ODBC route using the Firebird ODBC driver. I've already got the connectivity working without problems so that looks promising.

Only... The database uses GUID primary keys throughout and that can't be changed. 

How do I implement a GUID datatype in a Firebird database in such a way, that I can assign it transparently through ADO? MSSQL and Access are very transparent with guids, I can simply assign them in string form (including the curly braces).

A char(38) in Firebird would be terribly wasteful and bloat the indexes, and a "char(16) character set OCTET" that I see recommended on various web sites unfortunately isn't something that I can assign through a COM based technology like ADO. Strings in COM need to be unicode, I can't just pack binary data into them. 

Any ideas?
0
Arthur
1/6/2015 7:52:11 AM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

2 Replies
1029 Views

Similar Articles

[PageSpeed] 59

My have no idea how mssql really do a GUID, my expectation that under 
the covers they use a char(38). That is how I expect you'll have to do 
it FireBird (it is certainly the way you would have to do it with 
InterBase). The best solution to me here is have a UDF that generates 
the GUID, then insert the GUID via a before insert trigger - the same 
way you would use a generator.

This solution is connectivity driver independent, so will work if you 
you use ADO, or FireDAC or something else.

Arthur Hoornweg wrote:
> Hello all,
>
>
> I'm modifying an existing ADO based application in order to make it work with Firebird Embedded. Currently the application uses MS SQL Server and Access MDB. To make the changes in the application as small as possible, I'm going the ADO->ODBC route using the Firebird ODBC driver. I've already got the connectivity working without problems so that looks promising.
>
> Only... The database uses GUID primary keys throughout and that can't be changed.
>
> How do I implement a GUID datatype in a Firebird database in such a way, that I can assign it transparently through ADO? MSSQL and Access are very transparent with guids, I can simply assign them in string form (including the curly braces).
>
> A char(38) in Firebird would be terribly wasteful and bloat the indexes, and a "char(16) character set OCTET" that I see recommended on various web sites unfortunately isn't something that I can assign through a COM based technology like ADO. Strings in COM need to be unicode, I can't just pack binary data into them.
>
> Any ideas?
>
0
quinn
1/6/2015 5:20:16 PM
> {quote:title=quinn wildman wrote:}{quote}
> My have no idea how mssql really do a GUID,


AFAIK a GUID is simply stored as a 128-bit integer in MSSQL and Access (which makes it a very efficient data type) but they can be assigned from and to strings transparently.

A trigger isn't helpful in my case - I need to be able to evaluate and manipulate the stored GUIDs in code.
0
Arthur
1/7/2015 11:12:51 AM
Reply:

Similar Artilces:

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

ADO to ADO.NET
I'm an ASP programmer (VBScript) moving on to ASP.NET. So far I'm using:Microsoft Visual Studio 2003ASP.NET with C#I'm working on converting my code over to C#, from VBScript. Now, here is my code in VBScript (modified to better understand it, this is a edited ugly version):Function ExecuteSQL(sqlStatement)    ConnDriver = "Provider=SQLOLEDB; Data Source = " & dbIP & "; Initial Catalog = " & dbName & "; User Id = " & dbUser & "; Password=" & dbPassword     Set connTemp = Server.CreateObject("ADODB.Connection")    c...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

ADO not ADO.NET
Hi, I have to connect to a db using adodb (which i select from the references). I have to retrieve the car models from the database and bind them to a listbox. I am not sure how to proceed and I can't find any articles on ADO with .net and data binding. Here is the code that i tried but it only retrieves the car model for the specified id. If I delete the id it doesn't work. Also it writes the car model in the listbox vertically such as: B M W CODE: Imports System.Data Imports ADODB Imports System.Data.OleDb Public Class listboxADO Inherits System.Web.UI...

ADO to ADO.NET help
Hi, I am converting application ASP to ASP.NET.What is the equivalent code in ADO.NET. For each F in RS.Fields FieldName = F.Name Next Thanks, Nate If it is forward only, then you can use datareader for more info on this, check below link Datareader on MSDN Hope it helps!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

Opinions about ADO and ADO.NET
Hi everyone again!!! I´m used to develope applications with ADO, but now with .NET to develope a Web Application and a Mobile Web Application, I don't know if I have to use ADO.NET or continue using ADO. What Disadvantages has ADO to built Mobile Applications? In ADO I use ACCESS to create the .mdb files, Can I use .mdb files with ADO.NET? Thanks for all!! Go to ADO.NET NOW ! don't be late and you can use access in ado.net ADO.NET VB.NET/C#/ASP.NET/Oracle Designer 6i DotNet4Arab.com Building a custom web control(vb.net) Well, Thanks for your opinion, but I have...

Converting ADO to ADO.NET
Hi, I am trying to convert this code from ADO to ADO.NET I am very new to ADO.NET and am a bit confused on how I would convert this. Basically what I am trying to do is capture the name of the fields of a table to populate a dropdownlistbox. The table name will change every time the program is run. This is not a problem and I can code for that. Here is what I have in ADO (I have tried the wizard but it did not change the code) Dim tblFields As Object Dim myRst As New ADODB.Recordset Dim myField As ADODB.Field Dim myCnn As New ADODB.C...

ODBC with ADO
I'm trying to connect to a Sybase SQL Anywhere 5.0 database via ODBC Using Visual Basic and ADO. I am having very flaky results. The SQL statments work great with the ISQL tool, but when when I execute them from my VB app, the VB generates a Dr. Watson error log file and aborts. I do not even get a error message or code. It's not 100% of the time, either. I have a few SQL statements that work all the time and some that don't ever and some that do once and a while. I am pretty sure it's how I'm opening up the Sybase database via ADO in my VB app. MS A...

ADO.NET VS ADO
Hi I am having ADO.NET course these days. I asked the instructor that developing online system like airline reservation system needs to a connected environment to lock/Unlock the table when u read/write to it Can that be acomplished using ado.net. His answer was no ADO.NET is only for disconnected environment and it will not work with online system and i still should use the old ADO. ADO.NET is not a replacment for ADO and both will continue in paralell. IS his answer true that ADO.NET will not replace ADO and both will continue Regards Check this link. Well ADO.NET is pa...

New at ODBC ADO in Delphi, trying to locate resources [Edit]
I have an SQL database In Delphi I drop an ADOConnection1 and have no problem connecting to the table using the Browse button I can compile and run it When the form opens i want to be able to do procedure TForm1.FormCreate(Sender: TObject); begin ADOConnection1.Open; //works ADODataset1.First; //error Index := ADODataset1.RecordCount; //error Edit1.Text := IntToStr(Index); end; end. To show the number of records in the table. I know I am doing something wrong with the lines that have //error but can not locate good docs or examples for those command Maybe s...

Started a project with ADO -> MS Access, should I switch to Firebird embedded
Hello group... Looking for a little expert advise. I'm writing an application that requires a database that will be located on the client machine and only be accessed by the single person on the client machine.... so not very demanding at all from a connection standpoint. I started the app with MS Access connection via ADO and I'm wondering if I should switch to Firebird embedded instead. Are there any Pros/Cons to each... such as memory usage, speed, or any other overhead such as needed dlls to distribute with the app? To me Access might be the easiest, but I'm wo...

ADO
Hi Could some tell me where I should be looking for information on how to use the ADO Connection and RecordSet objects from Perl and the DBI? Thanks David Billingham Senior Software Developer - Poise Associates Email: db@poise.co.uk PS Why do so many people have problems unsubscribing? I run a Majordomo list and it's a comman thing for people on the list to get in a real tangle about unsubscribing.... :) This e-mail is subject to copyright and the information in it is confidential. Use of this e-mail or of any information in it other than by the addressee is un...

ADO
Does anyone have any examples of using Microsoft's ADO and powerbuilder. I am looking into ways of getting metadata of any connections I make in my Powerbuilder Application. Currently I am using the ODBC API's to achieve this. I have looked and tested some ADO calls in VB and find that it is much faster than ODBC in getting metadata. Thanks In Advance Derrick ...