MariaDB Recordset - amended

MariaDB Recordset - amended

Postby fraxzi » Mon Jun 25, 2018 8:30 am

Hi All,

How do I determine if RecordSet has been modified?

I am directly modifying oRs:field using GET or this is not the right approach?

:D
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: MariaDB Recordset - amended

Postby nageswaragunupudi » Wed Jun 27, 2018 2:42 am

Code: Select all  Expand view

aModifed := oRs:ModiCols()
xbrowser aModified
 


If you want to modify values of some fields and then save, oRs:<fieldname> := <newvalue> and then oRs:Save() is okay.
Even you can offer edit of records this way, but we recommend using Datarow, which is a lot safer and feature rich.

Code: Select all  Expand view

oRs := oCn:customer // we can quickly open a table like this also.
oRs:Edit()  // to edit current record
oRs:Edit( .t. ) // to append a new record
 


This offers edit with a default dilaog. You can have your own edit dialog this way.
Code: Select all  Expand view

oRs := oCn:customer
oRs:bEdit := { |oRec| MyEditDialog( oRec ) }
oRs:Edit()
....
...
function MyEditDialog( oRec )

   local lNew := oRec:RecNo == 0
   local oDlg

   DEFINE DIALOG oDlg ........
   <all your gets here>
   ACTIVATE DIALOG oDlg
return nil
 

I recommend this approach all through your program.
Please feel free to ask any clarifications.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: MariaDB Recordset - amended

Postby fraxzi » Wed Jun 27, 2018 3:33 am

Hi Mr. Rao,

I already started using this approach when modifying xBrowse Row (not all rows are displayed)
Code: Select all  Expand view

...
oRs:bEdit := { |oRec| MyEditDialog( oRec ) }
oRs:Edit()
...
 


Very much convenient approach.

As for oRs:Save(), which I directly edit oRs:field, use of oRec = oRs:Record() is most logical and safer.. I will revise my coding.

and by-the-way, is FWMaria RowSet Wiki aligned with FWH18.04? I couldn't find the oRs:Modicols() method..


:D


Thanks much!
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: MariaDB Recordset - amended

Postby nageswaragunupudi » Wed Jun 27, 2018 3:36 am

I will review WIKI again. Most likely early July.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: MariaDB Recordset - amended

Postby nageswaragunupudi » Wed Jun 27, 2018 3:39 am

As for oRs:Save(), which I directly edit oRs:field, use of oRec = oRs:Record() is most logical and safer.. I will revise my coding.

I suggest you follow my template given above.

Just use oRs:Edit() or oRs:Edit(.t.)
When you are in xbrowse, use oBrw:EditSource() or oBrw:EditSource(.t.)
We provided many other alternatives, but what I suggested is the best way.

Sometime today I will post a detailed template for edit dialog.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: MariaDB Recordset - amended

Postby fraxzi » Fri Jun 29, 2018 12:38 am

Thanks Mr. Rao! :wink:
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft, Google [Bot] and 80 guests