Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 20 total
Thread possibly a bug, dbisamen
Fri, Jul 10 2009 11:29 AMPermanent Link

"Lucian Radulescu"
Hi,

While I was debugging some code I was inspecting the code for
CompareDataTables, in dbisamen.pas, which looks like this:

function CompareDataTables(DataTable: TDataTable; const TableName:
ShortString): Integer;
begin
  Result :=
OSCompareFileNames(Trim(DataTable.TableName),Trim(TableName));
end;

At this point though, the DataTable.TableName does not have the
extension, while the TableName has it. I believe this code should use
similar approach of comparing the names, for example in
TDataDirectory.StartTransaction there's something like

                 if
(OSCompareFileNames(GetLeft(StripFilePathAndExtension(TablesList[J],

DataEngine.DataExtension),

MAX_TABLENAME_SIZE),TDataTable(FDataTableList[I]).TableName)=0) then
.....


So I'm thinking the code should be adjusted something like:

function CompareDataTables(DataTable: TDataTable; const TableName:
ShortString): Integer;
begin
  Result := OSCompareFileNames(
       GetLeft(StripFilePathAndExtension(DataTable.TableName,
DataEngine.DataExtension), MAX_TABLENAME_SIZE),
       GetLeft(StripFilePathAndExtension(TableName,
DataEngine.DataExtension), MAX_TABLENAME_SIZE));
end;


regards,
Lucian
Fri, Jul 10 2009 12:46 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Lucian,

<< At this point though, the DataTable.TableName does not have the
extension, while the TableName has it. >>

In what context is this call taking place ?  The file extension should be
stripped when the table name is assigned to the cursor:

procedure TDataCursor.SetTableName(const Value: ShortString);
begin
  CheckNotOpen;
  if (Value <> FTableName) then
     FTableName:=GetLeft(StripFilePathAndExtension(Value,DataEngine.DataExtension),
                         MAX_TABLENAME_SIZE);
end;

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jul 10 2009 1:03 PMPermanent Link

"Lucian Radulescu"
> In what context is this call taking place ?

I posted a screenshot, you can see the stack and the problem.

My starting code is:

     physicalTable.FieldDefs.Update;
     physicalTable.IndexDefs.Update;
     physicalTable.Active := TRUE;


regards,
Lucian
Fri, Jul 10 2009 1:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Lucian,

<< I posted a screenshot, you can see the stack and the problem. >>

Where did you post this ?  I don't see any attachments anywhere.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jul 10 2009 1:22 PMPermanent Link

"Lucian Radulescu"
Tim Young [Elevate Software] wrote:

> Lucian,
>
> << I posted a screenshot, you can see the stack and the problem. >>
>
> Where did you post this ?  I don't see any attachments anywhere.

public.binaries

In any case Tim, I wasn't having a problem with the original code. I
was after something else but that's how I noticed the weirdness.

In my opinion, all is good because one way or the other both names get
added to whatever list holds them. The fix could possible reduce a
little some memory consumption and make faster searches for people with
hundreds/thousands of tables. In my case, I can say that I don't see
any differences, but I will keep the fix in.

BTW, this is version 4 build 5, I don't want to risk upgrading to the
latest build because of that fix regarding the BLOB fields. We have
tons of BLOBS here.


thx,
Lucian
Fri, Jul 10 2009 1:38 PMPermanent Link

"Lucian Radulescu"
Tim Young [Elevate Software] wrote:

> Lucian,
>
> << I posted a screenshot, you can see the stack and the problem. >>
>
> Where did you post this ?  I don't see any attachments anywhere.

TDataDirectory.DataTableExists adds the extension (EnsureFileExt)
before calling FindDataTable:


function TDataDirectory.DataTableExists(const SearchTableName:
ShortString;
                                       OpenOnly: Boolean;
                                       IsTemporary: Boolean): Boolean;
var
  TempPos: Integer;
  TempTableName: ShortString;
begin
  if IsTemporary then

TempTableName:=EnsureFileExt(SearchTableName,DataEngine.DataExtension,
                                  DataEngine.DataTempExtension)
  else

TempTableName:=EnsureFileExt(SearchTableName,DataEngine.DataExtension,
                                  DataEngine.DataExtension);
  Result:=FindDataTable(TempTableName,TempPos);


Lucian
Fri, Jul 10 2009 1:52 PMPermanent Link

"Lucian Radulescu"
> BTW, this is version 4 build 5

As in 4.28 build 5

Lucian
Fri, Jul 10 2009 2:20 PMPermanent Link

"Lucian Radulescu"
Hi,

Bothering you with something else, I may be doing something wrong, not
sure. I am backing up a 177MB database. I tried different compression
values and my results are:

compression 1, time 33 sec (supposedly) best speed
compression 6, time 23 sec
compression 9, time 23 sec

the resulting file size is precisely the same to the byte, 177MB. I see
absolutely NO compression. Am I doing something wrong?

Lucian
Fri, Jul 10 2009 2:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Lucian,

<< TDataDirectory.DataTableExists adds the extension (EnsureFileExt) before
calling FindDataTable: >>

Got it, thanks.  I was looking at the opening code, not the Exists code.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jul 10 2009 2:43 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Lucian,

<< public.binaries >>

Hmm, for some reason it hadn't showed up yet in OE after a refresh, which is
why I couldn't see it.  Sorry about that.

<< BTW, this is version 4 build 5, I don't want to risk upgrading to the
latest build because of that fix regarding the BLOB fields. We have tons of
BLOBS here. >>

What risk are you referring to specifically - the issue with mixing versions
?  As for the issues associated with the rollout of the new BLOB block
re-use design, all of those have been resolved completely.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 2Next Page »
Jump to Page:  1 2
Image