FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Set filter for deleted in MariaSql (SOLVED)
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Set filter for deleted in MariaSql (SOLVED)
Posted: Tue May 30, 2017 09:03 PM
Hello,

How can I show the deleted records in Ors ?

Code (fw): Select all Collapse
   FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword DATABASE cDatabase

   if oCn == nil
     ? "Failed to connect"
     return nil
   endif

   oRs   := oCn:RowSet( "SELECT * FROM ploegen" )


This set a filter correct
ACTION (oRs:SetFilter( "ploeg2017 = ?", { ::cCaption } )

But I also want a button that shows de deleted records? I have SET DELETED ON on top of the program.
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Set filter for deleted in MariaSql
Posted: Tue May 30, 2017 09:20 PM

Oeps,

I just notised that when you delete a record in Xbrowse and MariaSql, the record is totaly deleted !! So it can't be shown again with a Filter.

Do I have to proceed a other way than ?

I want to deleted the records from the Browse so that they don't show up, but also that I can get them back for some actions.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Re: Set filter for deleted in MariaSql
Posted: Tue May 30, 2017 09:27 PM

First, this was the behaviour of DBF's when you mark a record for deletion, now you hace to use a field for this kind of filter or whatever, lets say a "ACTIVE" field, so you can Activate it or Deactivated as will. So when you "delete it " from xbrowse you just change "ACTIVE" to .F., and all the way around when you wanted it back.

My 2 cents.

From Chile
Adolfo

;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Set filter for deleted in MariaSql
Posted: Tue May 30, 2017 10:07 PM

Yes, I realise now that it has to be done like that.

A extra field for the deleted record set to on and off.

Thanks.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 10:30 AM

In ALL the databases in the World, except DBF, once a record is deleted it is gone.
More than 99.9% of the programmers in the world do not know DBF.
We need to start thinking like them.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 10:46 AM

I Agree.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 12:32 PM

You cann use TRIGGER before delete ( or update ) , and popolate a table .

Maurizio

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 12:36 PM
Maurizio wrote:You cann use TRIGGER before delete ( or update ) , and popolate a table .

Maurizio

This is what we do generally for highly secure software. For every deletion and also modification we create log files with userid, programid and datetime stamp
Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 03:30 PM

I did some lookups.

A trigger is a SQL command that will do a append in a file if there is a delete in a other file.

But in my specific case, (the old dbf way) I wanted to not show deleted items or show them.
I best make a fieldname with deleted, BIT 1 and than trie to make a sql filter to show or not show this.

ACTION (oRs:SetFilter( "ploeg2017 = ?", { ::cCaption } )

But than for a fieldname deleted = .t. or delted = .f. (How in SQL)

Thanks.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 03:35 PM
Add a new field
Code (fw): Select all Collapse
oCn:AddColumn( tablename, { "DELETED", "L', 1, 0 } )


Then use this
Code (fw): Select all Collapse
ACTION (oRs:SetFilter( "ploeg2017 = ? .AND. deleted = ?", { ::cCaption, .f. } )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Set filter for deleted in MariaSql
Posted: Wed May 31, 2017 07:05 PM

Thank you.

Marc Venken

Using: FWH 23.08 with Harbour

Continue the discussion