🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi.bazy-danych
Article #436

Re: GetCurrentRecord

#436
From: marcin brzoza
Date: Thu, 29 Apr 1999 00:56
66 lines
3064 bytes
czesc,

Paweł Rzoska schrieb:
> Mam problem w zastosowaniu powyzszej funkcji. Muszę mieć rekord bazy danych
> a nie dostęp przez FieldByName stad caly pasztet. Nie widzialem w
> przykladach zastosowania tego a rezultat nie jest taki jak można oczekiwac.
> W sciagnietej zawartosci rekordu - glupoty. Czy nie zechcialby ktos podac
> przykladu zastosowania pobrania z bazy biezacego rekordu ???
uzywasz "TBDEDataSet"???
nie uzywam db-objektow delphi, ale w bde wyglada to mniej wiecej tak:
var
  hCur      : hDBICur;
  res       : Integer;
  props     : CURProps;
  RecBuffer : PChar;
...
begin
  // set the handle
  hCur := TwojTBDEDataSet.Handle;
  // we need the table(cursor) propertys ...
  res := DbiGetCursorProps(hCur, props);
  if (res <> DBIERR_NONE) then begin
     // somthigs goes wrong, return the errorcode ...
     Result := res;
     // ... show error ...
     ShowError('ReadTableIntoMemory', Result, ['']);
     // ... and bye, bye.
     Exit;
  end;
  // alloctate memory for buffer
  RecBuffer := StrAlloc(props.iRecBufSize + 1);
  // has windows memory for as???
  if (RecBuffer = nil) then begin
     // memory not allocated, return error ...
     Result := DBIERR_NOMEMORY;
     // ... show error ...
     ShowError('ReadTableIntoMemory', Result, ['']);
     // ... and leave the method
     Exit;
  end;
 ...
  // now we can read the record
  res := DbiGetNextRecord(hCur, dbiNOLOCK, RecBuffer, nil);
  // problems???
  if ((res <> DBIERR_NONE) and (res <> DBIERR_EOF)) then begin
     // error number
     Result := res;
     // show message
     ShowError('ReadTableIntoMemory', Result, ['']);
     // leave
     Exit;
  end;
teraz czytasz zawartosc pola uzywajac funkcji
"DbiGetField/(DbiOpenBlob+DbiGetBlobSize+DbiGetBlob+DbiFreeBlob)" 
(opis wszystkich funkcji "Dbi" jest w "bde online reference")
jest to kawalek kodu objektu czytajacego cale tabele(sql-statsmenst)
do pamieci => takie male zastepstwo dla ttable i tquery:)

po pobieznym przejrzeniu "TBDEDataSet.GetCurrentRecord" wydaje mi sie, 
ze jako parametr nalezy zapodac zarezerwowany bufor. jego wielkosc 
dostaniesz z "GetRecordSize", 'zaallocuj' pamiec i wolaj
"GetCurrentRecord".
nie probowalem czy dziala!

powodzenia
marcin
Technical Details
Message-ID: <3727AE48.A2ED1DC4@uni-duesseldorf.de>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!uw.edu.pl!not-for-mail
References: <7g6gjk$7ie$1@flis.man.torun.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!uw.edu.pl!not-for-mail
From: marcin brzoza <brzoza@uni-duesseldorf.de>
Newsgroups: pl.comp.lang.delphi.bazy-danych
Subject: Re: GetCurrentRecord
Date: Thu, 29 Apr 1999 02:56:40 +0200
Organization: A poorly-installed InterNetNews reader
Lines: 66
Message-ID: <3727AE48.A2ED1DC4@uni-duesseldorf.de>
References: <7g6gjk$7ie$1@flis.man.torun.pl>
NNTP-Posting-Host: mun-c45-017-vty14.as.wcom.net
Mime-Version: 1.0
X-Trace: h1.uw.edu.pl 925347386 26212 195.232.41.14 (29 Apr 1999 00:56:26 GMT)
X-Complaints-To: usenet@h1.uw.edu.pl
NNTP-Posting-Date: 29 Apr 1999 00:56:26 GMT
X-Mailer: Mozilla 4.05 [de]C-QXW0310a  (Win95; I)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit