[DUG] Why InterBase

Kyley Harris kyley at harrissoftware.com
Thu Jun 1 19:14:53 NZST 2006


Sorry for a 10 hour delay. Been out all day
In simple terms.

In both databases the data is stored identically. It is only the way I
retrieve data that is different.

TEvent
  Property EventID:integer;
  Property DateCreated:TDatetime
  Property EventDescription:string
End;

TBigEvent = class(TEvent)
  Property More:string;
End;

In this case I would have two tables like so

Create table TEvent (
  ClassType Integer
  EventID
  DateCreated
  EventDescription
)
And 
Create Table TBigEvent (
  EventID
  More 
)

And View vTevent = select * from TEVent
And View vTBigEvent = select * from TBigEvent joining to TEvent

Now in interbase I would have 2 procedures for retrieving

GetTEvent(EventID) returns EventID,DateCreated,EventDescription
GetTBigEvent(EVentID) returns EventID,DateCreated,EventDescription,More

But with mssql I can do something more like (Also this is all pseudo
junk not to be taken as real code)

Stored Procedure GetTEvent(EventID)
begin
select classtype from tevent where eventide = eventide
if classtype = TEvent then
  result := select * from TEvent else
if classtype = TBigevent then
  result := select * from tvbigevent
end;

in Interbase you cannot return different resultsets which contain
different columns. So its really just a handy thing. In interbase I
would prequery the database to get the classtype, and then call the
correct procedure, so its more of less calls to the db and easier to
read code.

Now oracle may have all the same features etc of MSSQL I don't know. In
the way I retrieve objects, interbase was actually faster at retrieving
and saving my objects into the database. A MAJOR factor of this is the
speed of getting the primarykey via a generator is so much faster than
what you have to do with MSSQL.




-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Todd Martin
Sent: Thursday, 1 June 2006 10:40 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Why InterBase

So what's the difference between the MSSQL approach and submitting an
SQL 
query on any database with the same conditions?
Are you defining a table for each class in your class heirarchy?


On Wed, 31 May 2006 18:55, Kyley Harris wrote:
> In MSSQL you can return
> different rowed data based on conditions. When using the database to
> store classed data with polymorphing this is great. It means that When
I
> ask for a TClient from a stored procedure passing it a primary key, it
> can work out if the key is for a TClient, or a TBetterClient, and
return
> the correct result set to be processed. IB/FB cant do that, which
makes
> for more overhead. I've always found writing server side in IB a pain
in
> the ass.
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi





More information about the Delphi mailing list