15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Record locking thr ODBC

Deodatta Natekar -- dvn@surya.trddc.ernet.in
Saturday, March 08, 1997

Environment: VC++ 1.51, Win 3.1 (WG), ODBC 2.0
(back end Oracle 7.1 and SQL Server 6.5 )

Hi,
	I want to lock the records in the tables in the DB through ODBC. We are =
following optimistic locking strategy of CRecordSet. I want to update =
few rows in table A while locking some rows in base table B ( I am not =
updating table B at all. )
	In short the process is as follows.

BeginTrans
	Lock rows in table B
	update rows in Table A
		(set m_strFilter
		  open recordset.
		  edit recordset
		  change  the values.
		  Update recorset.
		  Close recordset.)
	unlock Table B
commit.

	"Update Table A" causes optimistic locking for table A. But how to =
achieve  locking for Table B ?

regards,

Deodatta Natekar=20
(dvn@surya.trddc.ernet.in )



Fernando Pereira -- morgan@cardume.com
Tuesday, March 11, 1997

The best way could be to have a CRecordset on table B with a SELECT ....
FOR UPDATE OF ... ; this will enable you just to lock the rows you desire
in B. You can create a normal CRecordset and then add this syntax to the
SQL builder or you can add it to the m_strFilter .

Fernando
CardumeSoftware

----------
From: Deodatta Natekar 
To: 'mfc-l@netcom.com'
Subject: Record locking thr ODBC
Date: Saturday, March 08, 1997 1:36 PM

Environment: VC++ 1.51, Win 3.1 (WG), ODBC 2.0
(back end Oracle 7.1 and SQL Server 6.5 )

Hi,
	I want to lock the records in the tables in the DB through ODBC. We are
following optimistic locking strategy of CRecordSet. I want to update few
rows in table A while locking some rows in base table B ( I am not updating
table B at all. )
	In short the process is as follows.

BeginTrans
	Lock rows in table B
	update rows in Table A
		(set m_strFilter
		  open recordset.
		  edit recordset
		  change  the values.
		  Update recorset.
		  Close recordset.)
	unlock Table B
commit.

	"Update Table A" causes optimistic locking for table A. But how to achieve
 locking for Table B ?

regards,

Deodatta Natekar 
(dvn@surya.trddc.ernet.in )
----------






Become an MFC-L member | Вернуться в корень Архива |