declare @is_email LOGICAL;
declare @email CHAR(100);
declare @is_hosp_email LOGICAL;
declare @hosp_email CHAR(100);
declare @old cursor as select * from __old;
declare @new cursor as select * from __new;
open @old;
fetch @old;
open @new;
fetch @new;
if @new.signed = TRUE AND @old.signed = FALSE then
@is_email = ( SELECT is_email from doctors where doctors.id = @new.refer_id );
@email = ( SELECT email from doctors where doctors.id = @new.refer_id );
if @is_email = TRUE AND @email IS NOT NULL then
INSERT INTO plmail ( pathno, doc_id, send_to )
VALUES ( @new.pathno, @new.refer_id,
( SELECT email FROM doctors
WHERE doctors.id = @new.refer_id
AND doctors.is_email = TRUE
AND doctors.email IS NOT NULL) );
INSERT INTO plmail ( pathno, doc_id, send_to )
SELECT c.pathno, c.copyto, doc.email FROM copyto c
LEFT JOIN doctors doc ON doc.id = c.copyto
WHERE c.pathno = @new.pathno
AND doc.is_email = TRUE
AND doc.email IS NOT NULL ;
endif ;
if @new.facility IS NOT NULL then
@is_hosp_email = ( SELECT TOP 1 is_email from hospital where hospital.name = @new.facility );
@hosp_email = ( SELECT TOP 1 e_mail from hospital where hospital.name = @new.facility );
if @is_hosp_email = TRUE AND @hosp_email IS NOT NULL then
INSERT INTO plmail ( pathno, doc_id, send_to )
SELECT @new.pathno, h.passwd, h.e_mail from hospital h
WHERE h.name = @new.facility ;
endif;
endif;
endif;
if @new.signed = FALSE AND @old.signed = TRUE then
DELETE FROM plmail
WHERE pathno = @new.pathno
AND DateTime_Sent IS NULL ;
DELETE FROM pthreps
WHERE pathno = @new.pathno;
endif ;
if isSigned .and. !(cArea)->isSigned
(doc)->( dbseek( cid ) )
if (doc)->( found() ) .and. ( doc)->isEmail and. !empty( ( doc )->eMail )
( plMail )->( dbappend() )
( plMail )->( dbRecLock() )
( plMail )->PathNo := cPathNo
( plMail )->doc_id := cId
( plMail )->Send_to := (doc)->email
( PlMail )->( dbUnlock() )
endif
endif
if !isSigned .and. (cArea)->isSigned
( plMail )->( dbseek( cPathNo ) )
if ( PlMail )->( found() )
( PlMail )->( dbDelete() )
endif
(pthreps)->( dbseek( cPathNo ) )
if (pthreps)->( found() )
( pthreps)->( dbdelete() )
endif
endif
Adolfo wrote:My class is also available.. see on the spanish forums.
Adolfo
James Bott wrote:...With DBFs you only have to read 10 records across the network, then you can display the browse.
Adolfo wrote:Remember that DBF's are read completely from disk, so if you have a browse , you will have to read ALL the 10.000's records together with ALL its fields, and also all the supporting DBF's related with the main one.
Enrico Maria Giordano wrote:Adolfo wrote:Remember that DBF's are read completely from disk, so if you have a browse , you will have to read ALL the 10.000's records together with ALL its fields, and also all the supporting DBF's related with the main one.
Absolutely not! Sorry, but it looks like you don't know of what you're speaking of.
EMG
Adolfo wrote:SO when you use a browse to look at a DBF, YOU DONT READ THE WHOLE DBF ?
>>...With DBFs you only have to read 10 records across the network, then you can display the browse.
James.. are you absolutely sure about this.... ?
Remember that DBF's are read completely from disk, so if you have a browse , you will have to read ALL the 10.000's records together with ALL its fields, and also all the supporting DBF's related with the main one.
With SQL .. only the fields you want to show, then you can LOAD whatever you want... so NET traffic is reduced dramatically....
In the sample I do...
select rut,nombre,field1,field2,field3 from clientes
and "clientes" TABLE has 35 FIELDS, when I dobleclick the record, I do a new RECORDSET containing all the methods of the Complete recordset, but only the present record (with all its fields) to edit, append, delete... etc etc
Regarding TADOBASE...
I have implemented Paging with that, no matter if the DB has it or not. I read ::nPageSize records each time, and if you see the Methods, I can control when each "miniRecordset" ends to load another...
AS I STATED...
I CAN do incremetal searching with ADO and SQL, the TEST shows it.
>"Yes, I am positive. With DBFs you only ever have one record in memory at a time. With a browse you read each record then display it and continue until all the visible records are displayed."
SO you have to READ EVERY record ( to build a browse ), then reading the whole DBF with all its fields.. or Am i wrong. Now the size of traffic in that operation is bigger than having only the seleted fields send by the SQL server ina forma of a RECORDSET.
In mi case... for incremental searching, I already have the recordset in memory
James Bott wrote:Adolfo,>"Yes, I am positive. With DBFs you only ever have one record in memory at a time. With a browse you read each record then display it and continue until all the visible records are displayed."
SO you have to READ EVERY record ( to build a browse ), then reading the whole DBF with all its fields.. or Am i wrong. Now the size of traffic in that operation is bigger than having only the seleted fields send by the SQL server ina forma of a RECORDSET.
No, for a browse displaying 10 records, you only read those ten VISIBLE records, one at a time. Read and display the first record, then read and display the second one, etc. You stop after reading the 10th record.In mi case... for incremental searching, I already have the recordset in memory
Which recordset, the whole table?
James
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 41 guests