FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MySQL - Recordset question
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
MySQL - Recordset question
Posted: Wed Oct 10, 2012 12:51 PM

Hi,

After the suggestion of Enrico, I now use a recordset instead of a query.
It's maybe a stupid question, but if I use a recordset and use oRs:locktype := 3, does this mean that automaticly the data of a field is updated in the SQL-database if change the content of a field?
Until now I didn' use recordset, but always query's with oSQL:execute(SELECT..), and after I changed something, I run oSQL:execute(UPDATE .. WHERE... ) to update the database.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: MySQL - Recordset question
Posted: Wed Oct 10, 2012 02:30 PM

Mark

Please review the FiveWin Wiki on ADO .. described is the definition of each of the lock type and parameters you can use to open a recordset.

http://wiki.fivetechsoft.com/doku.php?i ... ted_stuffs

Here is the official Microsoft definitions ( fairly confusing )

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

To answer your question .. no row can be saved without an explicit oRs:Update()

Here are some typical ADO methods for adding, deleting and moving through recordsets :

Append --> oRecordSet:AddNew()
Close --> oRecordSet:Close()
Commit --> oRecordSet:Update()
Delete --> oRecordSet:Delete()
Deleted() --> oRecordSet:Status == adRecDeleted
EOF() --> oRecordSet:EOF or oRecordSet:AbsolutePosition == -3
Field() --> oRecordSet:Fields( nField - 1 ):Name, :Value, :Type
FCount() --> oRecordSet:Fields:Count
GoTop --> oRecordSet:MoveFirst()
GoBottom --> oRecordSet:MoveLast()
Locate --> oRecordSet:Find( cFor, If( lContinue, 1, 0 ) )
Open --> oRecordSet:Open( cQuery, hConnection )
OrdListClear() --> oRecordSet:Index := ""
RecCount(), LastRec() --> oRecordSet:RecordCount
RecNo() --> oRecordSet:AbsolutePosition
Skip --> oRecordSet:Move( nToSkip )

Rick Lipkin

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: MySQL - Recordset question
Posted: Wed Oct 10, 2012 03:08 PM

Rick,

Thank you for the information.
This is very nice.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion