Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Memory table with unique name
Thu, Jun 21 2007 10:43 AMPermanent Link

Praveen A B
Hi,

I'm migrating from DBISAM 3.x to ElevateDB today. In DBISAM I use in-memory tables with same tablename and suffix i.e. TAB_0, TAB_1, TAB_2 etc.
I find the unique name for the table as such

repeat
 ATable.TableName := TableName+'_'+IntToStr(Suffix);
 Inc(Suffix);
until not ATable.Exists;

Any equivalent code in ElevateDB ?

Thanks
Praveen
Thu, Jun 21 2007 12:36 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Praveen


Its probably better to use the catalog eg

Num:=1;
 with SetupQuery do begin
  Close;
  SQL.Clear;
  SQL.Text := 'SELECT * FROM Information.Tables WHERE Name=' + QuotedStr('TAB_');
  Open;
  if (RecordCount > 0) then begin
   Last;
   Num:=1+StrToInt(Copy(FieldByName('Name').AsString,Length(FieldByName('Name').AsString),1);
  end;

Num will give you the suffix to use in your table create routine

Roy Lambert
Fri, Jun 22 2007 6:49 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Praveen,

<<  I'm migrating from DBISAM 3.x to ElevateDB today. In DBISAM I use
in-memory tables with same tablename and suffix i.e. TAB_0, TAB_1, TAB_2
etc. I find the unique name for the table as such >>

The easiest thing to use in ElevateDB is CREATE TEMPORARY TABLE.  That way
you don't have to worry about the actual table name, and you can just name
it whatever you want.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jun 22 2007 7:28 AMPermanent Link

"Ole Willy Tuv"
Tim,

<< The easiest thing to use in ElevateDB is CREATE TEMPORARY TABLE.  >>

This syntax seems to be missing from the documentation of the CREATE TABLE
statement.

Btw, is it possible to change a temporary table definition using the ALTER
TABLE statement ?

I tried the following:

create temporary table Temp (col1 integer)

alter table Temp
add constraint pk_Temp primary key (col1)

Error:
ElevateDB Error #401 The table Temp does not exist

Ole Willy Tuv

Fri, Jun 22 2007 8:04 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< This syntax seems to be missing from the documentation of the CREATE
TABLE statement. >>

It sure is.  I'll make sure this is fixed.

<< Btw, is it possible to change a temporary table definition using the
ALTER TABLE statement ? >>

No.  You can only create/drop indexes on a temporary table - you can't alter
them or add/drop triggers on them.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image