261 |
|
|
262 |
|
procedure TTest17.RunTest(CharSet: AnsiString; SQLDialect: integer); |
263 |
|
var lastKey: integer; |
264 |
+ |
i: integer; |
265 |
+ |
B: TBookmark; |
266 |
|
begin |
267 |
|
IBDatabase.CreateDatabase; |
268 |
|
try |
288 |
|
FieldByName('PlainText').AsString := 'This is the update test'; |
289 |
|
Post; |
290 |
|
PrintDataSetRow(FIBDataSet1); |
291 |
< |
writeln(OutFile,'Now delete the first row'); |
291 |
> |
writeln(Outfile,'Show whole Dataset'); |
292 |
|
PrintDataSet(FIBDataSet1); |
293 |
+ |
writeln(OutFile,'Now delete the first row'); |
294 |
|
First; |
295 |
|
Delete; |
296 |
|
PrintDataSet(FIBDataSet1); |
337 |
|
Active := true; |
338 |
|
PrintDataSet(FIBDataSet1); |
339 |
|
|
340 |
< |
{See https://bugs.freepascal.org/view.php?id=37900} |
338 |
< |
|
339 |
< |
(* IBTransaction.Rollback; |
340 |
> |
IBTransaction.Rollback; |
341 |
|
IBTransaction.Active := true; |
342 |
|
writeln(Outfile); |
343 |
|
writeln(Outfile,'Unidirectional editing'); |
354 |
|
Refresh; |
355 |
|
writeln(OutFile,'After Refresh - unidirectional'); |
356 |
|
PrintDataSetRow(FIBDataSet1); |
357 |
< |
writeln(OutFile,'Append and Update'); |
357 |
> |
writeln(OutFile,' Record Count = ',FIBDataSet1.RecordCount); |
358 |
> |
writeln(OutFile,'Insert and Update'); |
359 |
|
Insert; |
360 |
|
FieldByName('PlainText').AsString := 'This is another test - unidirectional'; |
361 |
|
Post; |
364 |
|
FieldByName('PlainText').AsString := 'This is the update test - unidirectional'; |
365 |
|
Post; |
366 |
|
PrintDataSetRow(FIBDataSet1); |
367 |
< |
writeln(OutFile,'Now delete the first row - unidirectional'); |
368 |
< |
PrintDataSet(FIBDataSet1); |
369 |
< |
First; |
367 |
> |
writeln(OutFile,'Now delete the first row - unidirectional with Record Count = ',FIBDataSet1.RecordCount); |
368 |
> |
Active := false; |
369 |
> |
Active := true; |
370 |
|
Delete; |
371 |
< |
PrintDataSet(FIBDataSet1); |
371 |
> |
writeln(OutFile,'Show Current Row'); |
372 |
> |
PrintDataSetRow(FIBDataSet1); |
373 |
> |
writeln(OutFile,' Record Count = ',FIBDataSet1.RecordCount); |
374 |
|
writeln(Outfile,'Ensure dataset saved to database'); |
375 |
|
Active := false; |
376 |
|
Active := true; |
377 |
< |
PrintDataSet(FIBDataSet1); *) |
377 |
> |
PrintDataSet(FIBDataSet1); |
378 |
|
|
379 |
|
end; |
380 |
|
writeln(Outfile,'=================================='); |
381 |
|
IBTransaction.Rollback; |
382 |
|
IBTransaction.Active := true; |
383 |
|
with FIBDataSet2 do |
384 |
< |
begin |
384 |
> |
try |
385 |
|
Active := true; |
386 |
|
writeln(OutFile,'FIBDataSet2: Simple Append'); |
387 |
|
Append; |
424 |
|
FieldByName('PlainText').AsString := 'This is a test'; |
425 |
|
Post; |
426 |
|
PrintDataSetRow(FIBDataSet2); |
427 |
< |
|
427 |
> |
except on E: Exception do |
428 |
> |
writeln(Outfile,E.Message); |
429 |
> |
end; |
430 |
> |
IBTransaction.Rollback; |
431 |
> |
IBTransaction.Active := true; |
432 |
> |
with FIBDataSet1 do |
433 |
> |
try |
434 |
> |
Unidirectional := false; |
435 |
> |
Active := true; |
436 |
> |
writeln(outfile,'----------------------------------------------'); |
437 |
> |
writeln(OutFile,'FIBDataSet1: Insert at start'); |
438 |
> |
for i := 1 to 2 do |
439 |
> |
begin |
440 |
> |
Append; |
441 |
> |
FieldByName('PlainText').AsString := 'Row ' + IntToStr(i); |
442 |
> |
Post; |
443 |
> |
end; |
444 |
> |
First; |
445 |
> |
Insert; |
446 |
> |
FieldByName('PlainText').AsString := 'This is an insert test'; |
447 |
> |
Post; |
448 |
> |
B := Bookmark; |
449 |
> |
PrintDataSet(FIBDataSet1); |
450 |
> |
writeln(outfile,'Delete inserted row'); |
451 |
> |
Bookmark := B; |
452 |
> |
Delete; |
453 |
> |
PrintDataSet(FIBDataSet1); |
454 |
> |
writeln(outfile,'Repeat'); |
455 |
> |
First; |
456 |
> |
Insert; |
457 |
> |
FieldByName('PlainText').AsString := 'This is an insert test #1'; |
458 |
> |
Post; |
459 |
> |
B := Bookmark; |
460 |
> |
PrintDataSet(FIBDataSet1); |
461 |
> |
writeln(outfile,'Delete inserted row'); |
462 |
> |
Bookmark := B; |
463 |
> |
Delete; |
464 |
> |
PrintDataSet(FIBDataSet1); |
465 |
> |
writeln(outfile,'Insert/Delete after first row'); |
466 |
> |
Next; |
467 |
> |
Insert; |
468 |
> |
FieldByName('PlainText').AsString := 'This is an insert test #2'; |
469 |
> |
Post; |
470 |
> |
B := Bookmark; |
471 |
> |
PrintDataSet(FIBDataSet1); |
472 |
> |
writeln(outfile,'Delete inserted row'); |
473 |
> |
Bookmark := B; |
474 |
> |
Delete; |
475 |
> |
PrintDataSet(FIBDataSet1); |
476 |
> |
writeln(outfile,'Insert/Delete at last row'); |
477 |
> |
Last; |
478 |
> |
Insert; |
479 |
> |
FieldByName('PlainText').AsString := 'This is an insert test #3'; |
480 |
> |
Post; |
481 |
> |
B := Bookmark; |
482 |
> |
PrintDataSet(FIBDataSet1); |
483 |
> |
writeln(outfile,'Delete inserted row'); |
484 |
> |
Bookmark := B; |
485 |
> |
Delete; |
486 |
> |
PrintDataSet(FIBDataSet1); |
487 |
> |
except on E: Exception do |
488 |
> |
writeln(Outfile,E.Message); |
489 |
|
end; |
490 |
+ |
|
491 |
|
finally |
492 |
|
IBDatabase.DropDatabase; |
493 |
|
end; |