| Prev | Next
Menu: Products - Portfolio - Services - Download - Order - Company

 
Topic #1.1.1.1.
DB-W-HTML
   Example  
   Where it Starts  
   The Big Picture  
   DB Structure  
   AppID on the Fly  
   Hook up the DB  
   htdbwapp.pas  
   Multilingual DB  
*

  

Browsing >>htdbwapp.pas: Excerpt showing how the database is used

function ThtWebDBApp.SendBufferedChunk(Const Value:string): Boolean;
var
  a1:string;
  t:TwhList;
begin
  Result:=inherited SendBufferedChunk(Value);
  //priority is on the in-memory version of the chunks OR MACROS
  // OR whatever else this string might resolve to.
  //IF IT could not get resolved, we proceed to look it up in the database!
  if not Result
  and assigned(DataSet)
  and assigned(MemoField)
  and (DataSet is TTable)
  then begin
    if fCacheDbChunks
    and (pos('|'+uppercase(Value)+'|',fCacheDbFail)>0) then
      exit;
    Result:=TTable(DataSet).Findkey([uppercase(Value)]);
    if Result then begin
      a1:=MemoField.AsString;
      Response.Send(a1);
      if fCacheDbChunks then begin
        t:=TwhList.create;
        t.text:=a1;
        Chunks.AddObject(uppercase(Value+'='+Value),t);
        //do NOT free list. Chunks objects are freed by WebHub.
        end;
      end
    else begin
      fCacheDbFail:=fCacheDbFail+uppercase(Value)+'|';
      inc(fCacheDbFailCount);
      end;
    end;
end;

 
Path:  www.href.com to; Services to; Tech Talk Archive to; DB-W-HTML to; htdbwapp.pas

Copyright © 1995-2012 HREF Tools Corp. All Rights Reserved Worldwide.
Running: WebHub-v2.167 compiled with d16_win32 on Microsoft-IIS/7.5,
Local Time: Wed, 23 May 2012 22:29:18.
Session 2092805004, 23 pages sent to CCBot/1.0 (+http://www.commoncrawl.org/bot.html) at 38.107.179.227;
Time to produce this page: 0msec.