Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread table password
Thu, Feb 26 2009 4:18 PMPermanent Link

andrej
I would like to lock my table. I create and alter table trough the following code. What
sould I change to set a password for a table?
 
       with TableToUpdate do begin
         if ProgressBar <> nil then begin
           dShopOsnova.AdvProgressBar1.Position := + 1;
         end;
         if StatusLabel <> nil then begin
           StatusLabel.Caption := 'Sestavnice.dat';
           StatusLabel.Refresh;
         end;
         DatabaseName := DatabasePath;
         TableName := 'Sestavnice.dat';
         Exclusive := True;
         with FieldDefs do begin
           Clear;
           Add('Zapst', ftAutoInc, 0, False );
           Add('Sifra', ftString, 13, False);
           Add('SifraMateriala', ftString, 13, False);
           Add('Kolicina', ftFloat, 0, False, '0');
           Add('Kreirano', ftDateTime, 0, False);
           Add('Modificirano', ftDateTime, 0, False);
           Add('Status', ftInteger, 0, False, '0');
          end;
         with IndexDefs do begin
           Clear;
           Add('Prvi', 'Zapst', [ixPrimary,ixUnique], '',icFull);
           Add('Sifra', 'Sifra', [], '', icFull);
           Add('Material', 'SifraMateriala', [], '', icFull);
         end;
         if not Exists then begin
            CreateTable;
         end;
         AlterTable(KodaJezika);
         //CreateTable(1060,0,0,False,'','',4096,512,0)
       end;
Thu, Feb 26 2009 4:59 PMPermanent Link

Jan Ferguson

Data Software Solutions, Inc.

Team Elevate Team Elevate

Andrej,

For creating the table with a password, see the following in help:

"Table Encryption

Use the ENCRYPTED WITH clause to specify whether the table should be
encrypted with a password. The syntax is as follows:

ENCRYPTED WITH passwordTable encryption is optional and the password
for this clause should be specified as a string constant enclosed in
single quotes (''). Please see the Encryption topic for more
information."

http://www.elevatesoft.com/manual?action=mantopic&id=dbisam4&product=r&v
ersion=2007&category=3&topic=13

For altering the table with a password, see the following in help:

"These properties can be read from the exising table without requiring
the table to be opened first. However, in order for DBISAM to read the
Password property of an encrypted DBISAM table or alter the structure
of an encrypted DBISAM table in general, the password for the encrypted
table must already be defined for the current session or else it must
be provided via an event handler assigned to the TDBISAMSession
OnPassword event or by the user via the dialog that will be displayed
by DBISAM if an event handler is not assigned to this event for the
current session. Please see the Opening Tables topic for more
information."

http://www.elevatesoft.com/manual?action=mantopic&id=dbisam4&product=r&v
ersion=2007&category=1&topic=15

--
Regards,
Jan Ferguson [Team Elevate]


andrej wrote:

<<I would like to lock my table. I create and alter table trough the
<<following code. What sould I change to set a password for a table?
Thu, Feb 26 2009 5:15 PMPermanent Link

"Iztok Lajovic"
Andrej,

instead of first 'create' statement put following create statement:

createTable(kodaJezika,0,0,false,<password>,4096,512,0);

where <password> stands for password value you want to use. Further, you can
omit the 'AlterTable' statement

Iztok Lajovic
KreS, Kreativni sistemi



"andrej" <andrej.bivic@abitrade.si> je napisal v sporočilo
news:12A58026-1762-436C-98CD-8439DA664035@news.elevatesoft.com ...
>I would like to lock my table. I create and alter table trough the
>following code. What
> sould I change to set a password for a table?
>
>        with TableToUpdate do begin
>          if ProgressBar <> nil then begin
>            dShopOsnova.AdvProgressBar1.Position := + 1;
>          end;
>          if StatusLabel <> nil then begin
>            StatusLabel.Caption := 'Sestavnice.dat';
>            StatusLabel.Refresh;
>          end;
>          DatabaseName := DatabasePath;
>          TableName := 'Sestavnice.dat';
>          Exclusive := True;
>          with FieldDefs do begin
>            Clear;
>            Add('Zapst', ftAutoInc, 0, False );
>            Add('Sifra', ftString, 13, False);
>            Add('SifraMateriala', ftString, 13, False);
>            Add('Kolicina', ftFloat, 0, False, '0');
>            Add('Kreirano', ftDateTime, 0, False);
>            Add('Modificirano', ftDateTime, 0, False);
>            Add('Status', ftInteger, 0, False, '0');
>           end;
>          with IndexDefs do begin
>            Clear;
>            Add('Prvi', 'Zapst', [ixPrimary,ixUnique], '',icFull);
>            Add('Sifra', 'Sifra', [], '', icFull);
>            Add('Material', 'SifraMateriala', [], '', icFull);
>          end;
>          if not Exists then begin
>          CreateTable;
>          end;
>          AlterTable(KodaJezika);
>          //CreateTable(1060,0,0,False,'','',4096,512,0)
>        end;
>
Thu, Feb 26 2009 5:21 PMPermanent Link

"Rita"
I'am assuming its a local Table if so.
Set the table or tables as encrypted in Dbsys
with your password.
Drop a session on your form then add the password
before u open the tables I did it like below

procedure TForm1.FormCreate(Sender: TObject);
begin
MySession.AddPassword('MyPassword');
Table1.Active := true;
Table2.Active := true;
end;


Fri, Feb 27 2009 3:59 PMPermanent Link

andrej bivic
Thank you Iztok... this will work even with already existing tables? Or I should use Altertable ...?

"Iztok Lajovic" wrote:

Andrej,

instead of first 'create' statement put following create statement:

createTable(kodaJezika,0,0,false,<password>,4096,512,0);

where <password> stands for password value you want to use. Further, you can
omit the 'AlterTable' statement

Iztok Lajovic
KreS, Kreativni sistemi



"andrej" <andrej.bivic@abitrade.si> je napisal v sporočilo
news:12A58026-1762-436C-98CD-8439DA664035@news.elevatesoft.com ...
>I would like to lock my table. I create and alter table trough the
>following code. What
> sould I change to set a password for a table?
>
>        with TableToUpdate do begin
>          if ProgressBar <> nil then begin
>            dShopOsnova.AdvProgressBar1.Position := + 1;
>          end;
>          if StatusLabel <> nil then begin
>            StatusLabel.Caption := 'Sestavnice.dat';
>            StatusLabel.Refresh;
>          end;
>          DatabaseName := DatabasePath;
>          TableName := 'Sestavnice.dat';
>          Exclusive := True;
>          with FieldDefs do begin
>            Clear;
>            Add('Zapst', ftAutoInc, 0, False );
>            Add('Sifra', ftString, 13, False);
>            Add('SifraMateriala', ftString, 13, False);
>            Add('Kolicina', ftFloat, 0, False, '0');
>            Add('Kreirano', ftDateTime, 0, False);
>            Add('Modificirano', ftDateTime, 0, False);
>            Add('Status', ftInteger, 0, False, '0');
>           end;
>          with IndexDefs do begin
>            Clear;
>            Add('Prvi', 'Zapst', [ixPrimary,ixUnique], '',icFull);
>            Add('Sifra', 'Sifra', [], '', icFull);
>            Add('Material', 'SifraMateriala', [], '', icFull);
>          end;
>          if not Exists then begin
>          CreateTable;
>          end;
>          AlterTable(KodaJezika);
>          //CreateTable(1060,0,0,False,'','',4096,512,0)
>        end;
>
Image