🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.databases
Article #34

Re: Really S L O o o o o o o o o o o Update SQL - Need help, please

#34
From: Jef Charlier
Date: Sat, 06 Nov 1999 00:00
121 lines
4572 bytes
If you use dbase tables and you need speed, you can do heavy actions with
the delphi pascal routines of Halcyon www.grifsolu.com.
This package has a table component with methods and property's but also pure
pascal code without using the "visual component" in gs6_shel.pas. You can
switch to the pascal code without loosing the settings of your component by
setting property active:=false;

1) Here an example with the component

HData4CR: THalcyonDataSet;
....
procedure SetIndexHData4Cr(bMessage:boolean);
var sf,sfi : shortstring;
begin
  sf:= Frm4DBF.HData4Cr.Tablename;
  sfi:=mdxFN(sf);
  if not fileexists(sfi) then
  begin
    MessageBeep($FFFFffff);
    if bMessage then
      MessageDlg('Reindexing cross , press button .. end
wait',mtInformation,[mbOK],0);
    application.processmessages;

Frm4DBF.HData4Cr.IndexOn(sfi,'ALPHA','upper(ALPHA)','',Duplicates,Ascending)
; // als de TAG nog niet bestaat
  end;

  Frm4DBF.HData4Cr.Index(sfi,'ALPHA');
end;
....
HData4Cr.TableName:=sDBcross; // als er voordien nooit een bestond
HData4Cr.IndexName:='';
HData4Cr.Active:=true;
HData4Cr.Index('','');

2) Here an example with pure pascal code

procedure transferDatafrom3Files(sdbgrif: shortstring);
begin
  sf:=sdbPB;   // fsel, skz, langtext
  sfi:=mdxFN(sf);

  TableR:= TgsDBFTable.Create(sdbPB,'',true,false); // readwrite no sharing
  with TableR do
  begin
    indexon(sfi,'ALPHA','ALPHA','',Duplicates,Ascending); // dupli !!
    index(sfi,'ALPHA');
    first;

    transfer2SKZtoGRAF(sdbgrif); // eerste voorrang hier voor ANA
  end;
  TableR.free;
.. and so on


----- Original Message -----
From: Bill Artemik <bill@droste1.com>
Newsgroups:
comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop,bor
land.public.delphi.database.sqlservers
Sent: Thursday, November 04, 1999 4:58 PM
Subject: Really S L O o o o o o o o o o o Update SQL - Need help, please


> Part of my application's SQL is to update values of a sub quers with
> zeroes where field values are null:
>
> UPDATE MyTable
> SET MyField = 0
> WHERE MyField IS NULL
>
> There are about 440,000 records in this dBase table that need to be
> checked and zeroed out if need be.
>
> This update process takes about 18 minutes in Local SQL.
>
> If I run this in Delphi as procedural code and using a TTable it takes
> less than half that time
>
> I don't recall EVER having procedural code beat a SQL statement (well,
> a well-constructed SQL statement, that is...)
>
> Is there something else I can do to speed this up?
> Bill Artemik
> Programmer / Analyst
> Droste Consultants, Inc.
> bill@droste1.com
>
>
> "There are THREE kinds of people in the world...
>       Those that can count and those that can't."
Bill Artemik <bill@droste1.com> wrote in message
news:3823ac1e.9260953@news3.newscene.com...
> Part of my application's SQL is to update values of a sub quers with
> zeroes where field values are null:
>
> UPDATE MyTable
> SET MyField = 0
> WHERE MyField IS NULL
>
> There are about 440,000 records in this dBase table that need to be
> checked and zeroed out if need be.
>
> This update process takes about 18 minutes in Local SQL.
>
> If I run this in Delphi as procedural code and using a TTable it takes
> less than half that time
>
> I don't recall EVER having procedural code beat a SQL statement (well,
> a well-constructed SQL statement, that is...)
>
> Is there something else I can do to speed this up?
> Bill Artemik
> Programmer / Analyst
> Droste Consultants, Inc.
> bill@droste1.com
>
>
> "There are THREE kinds of people in the world...
>       Those that can count and those that can't."
Technical Details
Message-ID: <800mer$kbq$1@xenon.inbe.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3823ac1e.9260953@news3.newscene.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,b32b7d909ed95344
X-Google-Attributes: gidffff5,public
X-Google-Thread: 10de66,b32b7d909ed95344
X-Google-Attributes: gid10de66,public
X-Google-Thread: ff75c,b32b7d909ed95344
X-Google-Attributes: gidff75c,public
From: "Jef Charlier" <charlijo@village.uunet.be>
Subject: Re: Really S L O o o o o o o o o o o Update SQL - Need help, please
Date: 1999/11/06
Message-ID: <800mer$kbq$1@xenon.inbe.net>
X-Deja-AN: 545121728
References: <3823ac1e.9260953@news3.newscene.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: UUNET Benelux (post does not reflect views of UUNET Benelux)
X-MSMail-Priority: Normal
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop,borland.public.delphi.database.sqlservers