Changes between Version 1 and Version 2 of rfc54_dataset_transactions
- Timestamp:
- Feb 24, 2015, 1:33:15 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
rfc54_dataset_transactions
v1 v2 378 378 reading from the beginning. 379 379 380 As calling SetAttributeFilter() or SetSpatialFilter() implies an implicit 381 ResetReading(), they have the same effect as ResetReading(). That is to say, 382 while an implict transaction is in progress, the transaction will be committed 383 (if no other layer is being read), and a new one will be started again at the next 384 GetNextFeature() call. On the contrary, if they are called within an explicit 385 transaction, the transaction is maintained. 386 380 387 With the above rules, the below examples show the SQL instructions that are 381 388 run when using the OGR API in different scenarios. … … 386 393 FETCH 1 IN cur1 387 394 395 lyr1->SetAttributeFilter('xxx') 396 --> lyr1->ResetReading() CLOSE cur1 397 COMMIT (implicit) 398 399 lyr1->GetNextFeature() BEGIN (implict) 400 DECLARE cur1 CURSOR FOR SELECT * FROM lyr1 WHERE xxx 401 FETCH 1 IN cur1 402 388 403 lyr2->GetNextFeature() DECLARE cur2 CURSOR FOR SELECT * FROM lyr2 389 404 FETCH 1 IN cur2 … … 395 410 lyr1->CreateFeature(f) INSERT INTO cur1 ... 396 411 412 lyr1->SetAttributeFilter('xxx') 413 --> lyr1->ResetReading() CLOSE cur1 414 COMMIT (implicit) 415 416 lyr1->GetNextFeature() DECLARE cur1 CURSOR FOR SELECT * FROM lyr1 WHERE xxx 417 FETCH 1 IN cur1 418 397 419 lyr1->ResetReading() CLOSE cur1 398 420 … … 400 422 COMMIT (implicit) 401 423 402 424 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 425 404 426 ds->StartTransaction() BEGIN … … 412 434 lyr1->CreateFeature(f) INSERT INTO cur1 ... 413 435 436 lyr1->SetAttributeFilter('xxx') 437 --> lyr1->ResetReading() CLOSE cur1 438 COMMIT (implicit) 439 440 lyr1->GetNextFeature() DECLARE cur1 CURSOR FOR SELECT * FROM lyr1 WHERE xxx 441 FETCH 1 IN cur1 442 414 443 lyr1->ResetReading() CLOSE cur1 415 444 … … 418 447 ds->CommitTransaction() COMMIT 419 448 420 449 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 450 422 451 ds->StartTransaction() BEGIN … … 432 461 lyr1->GetNextFeature() FETCH 1 IN cur1 ==> Error since the cursor was closed with the commit. Explicit ResetReading() required before 433 462 434 463 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 435 464 436 465 lyr1->GetNextFeature() BEGIN (implicit)