Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Altering table in Delphi code
Sat, Dec 11 2010 11:41 AMPermanent Link

Mikko Erva

Hi,

In DBISAM 3 following code inserted new field to table but now i can't get
it work with DBISAM 4. If talble version is lower than 2 then new field wil
be added and talve version in updated to v. 2.

Any help?

with tblCustomers do
begin
   if (UserMajorVersion<2) then
       begin
           RestructureFieldDefs.Update;
           RestructureFieldDefs.Add(-1,'PhoneNumber', ftString, 0, False,
'', '', '', '', fcNoChange);
           RestructureIndexDefs.Update;
           RestructureTable(0,0,2,0,False,'','',512,-1,'',nil,'','',False);
       end;

Sun, Dec 12 2010 6:55 AMPermanent Link

Adam Brett

Orixa Systems

Hi Mikko

I can't comment about the UserVersion side of things. I would always use an EXEC script in SQL to do this:

if [conditions] then
begin
 MyDBISAMQuery.SQL.Text := 'ALTER TABLE ADD COLUMN "CustName" CHAR(40)) AT 5 DEFAULT ''-unknown-''';
 MyDBISAMQuery.Prepare;
 MyDBISAMQuery.ExecSQL;
end;
Mon, Dec 13 2010 12:17 AMPermanent Link

Gregory Sebastian

I too prefer to use SQL, its a lot easier.  SQL code to update the user
major version number is :

ALTER TABLE IF EXISTS "Customers" USER MAJOR VERSION 2

Regards
Gregory Sebastian
Mon, Dec 13 2010 3:44 AMPermanent Link

Mikko Erva

Thanks for both replys. I start using SQL also, it's easier than Delphi
code. Never thought it could be used altering table version also.

-mikko

"Gregory Sebastian" <gregorys@nospam-ezysoft-dev.com> kirjoitti
viestissä:4F06895D-4F2D-4F72-B479-5605E64C79B5@news.elevatesoft.com...
>I too prefer to use SQL, its a lot easier.  SQL code to update the user
>major version number is :
>
> ALTER TABLE IF EXISTS "Customers" USER MAJOR VERSION 2
>
> Regards
> Gregory Sebastian
>

Image