testgenid.php 723 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. V4.50 6 July 2004
  4. Run multiple copies of this php script at the same time
  5. to test unique generation of id's in multiuser mode
  6. */
  7. include_once('../adodb.inc.php');
  8. $testaccess = true;
  9. include_once('testdatabases.inc.php');
  10. function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
  11. {
  12. $table = 'adodbseq';
  13. $db->Execute("drop table $table");
  14. //$db->debug=true;
  15. $ctr = 5000;
  16. $lastnum = 0;
  17. while (--$ctr >= 0) {
  18. $num = $db->GenID($table);
  19. if ($num === false) {
  20. print "GenID returned false";
  21. break;
  22. }
  23. if ($lastnum + 1 == $num) print " $num ";
  24. else {
  25. print " <font color=red>$num</font> ";
  26. flush();
  27. }
  28. $lastnum = $num;
  29. }
  30. }