From: Ard Biesheuvel Date: Thu, 1 Apr 2004 16:25:51 +0000 (+0000) Subject: Don't rely on isql anymore, as creating databases is now supported by the API X-Git-Tag: php-5.0.0RC2RC1~122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=563e9dd664c755c25c9b63e0d7e72f93d235e41b;p=php Don't rely on isql anymore, as creating databases is now supported by the API Changed tests to include ibase_query("SET TRANSACTION ...") --- diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt index 6f30fb85fd..ce0defa575 100644 --- a/ext/interbase/tests/002.phpt +++ b/ext/interbase/tests/002.phpt @@ -17,16 +17,19 @@ InterBase: connect, close and pconnect $pcon1 = ibase_pconnect($test_base); $pcon2 = ibase_pconnect($test_base); ibase_close($con); + unset($con); ibase_close($pcon1); + unset($pcon1); out_table("test1"); ibase_close($pcon2); + unset($pcon2); ?> --EXPECT-- --- test1 --- -1 test table created with isql +1 test table not created with isql --- --- test1 --- -1 test table created with isql +1 test table not created with isql --- diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt index ab2c04b66f..91e003a4ca 100644 --- a/ext/interbase/tests/005.phpt +++ b/ext/interbase/tests/005.phpt @@ -113,8 +113,8 @@ three transaction on default link ibase_free_result($res); - $tr_1 = ibase_trans(); /* this default transaction also */ - $tr_2 = ibase_trans(IBASE_READ); + $tr_1 = ibase_query("SET TRANSACTION"); + $tr_2 = ibase_query("SET TRANSACTION READ ONLY"); $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT); $tr_4 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_NO_VERSION+IBASE_NOWAIT); diff --git a/ext/interbase/tests/interbase.inc b/ext/interbase/tests/interbase.inc index 260ef00622..951835c146 100755 --- a/ext/interbase/tests/interbase.inc +++ b/ext/interbase/tests/interbase.inc @@ -1,46 +1,40 @@ -&1"); -@unlink($name); +function cleanup_db() +{ + global $test_base; + + $r = ibase_connect($test_base); + ibase_drop_db($r); +} +register_shutdown_function('cleanup_db'); +init_db(); function out_table($table_name) { echo "--- $table_name ---\n"; $res = ibase_query("select * from $table_name"); - $f = ibase_num_fields($res); - while ($r = ibase_fetch_row($res)){ - for($i = 0; $i < $f; $i++) - echo "$r[$i]\t"; - echo "\n"; + while ($r = ibase_fetch_row($res)) { + echo join("\t",$r)."\t\n"; } ibase_free_result($res); echo "---\n"; @@ -49,34 +43,28 @@ function out_table($table_name) function out_result($result, $table_name = "") { echo "--- $table_name ---\n"; - $f = ibase_num_fields($result); - while ($r = ibase_fetch_row($result)){ - for($i = 0; $i < $f; $i++) - echo "$r[$i]\t"; - echo "\n"; + while ($r = ibase_fetch_row($result)) { + echo join("\t",$r)."\t\n"; } echo "---\n"; } function out_result_trap_error($result, $table_name = "") -{ +{ echo "--- $table_name ---\n"; - while ($r = @ibase_fetch_assoc($result)){ - while (list($k, $v) = each($r) ){ - echo "$r[$k]\t"; - } - echo "\n"; + while ($r = ibase_fetch_row($result)) { + echo join("\t",$r)."\t\n"; } echo "errmsg [" . ibase_errmsg() . "]\t\n"; echo "---\n"; -} +} /* M/D/Y H:M:S */ function rand_datetime() { return sprintf("%02d/%02d/%4d %02d:%02d:%02d", - rand()%12+1, rand()%28+1, rand()%100+1910, - rand()%24, rand()%60, rand()%60); + rand()%12+1, rand()%28+1, rand()%100+1910, + rand()%24, rand()%60, rand()%60); } /* random binary string */ @@ -84,8 +72,9 @@ function rand_binstr($max_len) { $len = rand() % $max_len; $s = ""; - while($len--) + while($len--) { $s .= sprintf("%c", rand() % 256); + } return $s; } @@ -93,25 +82,28 @@ function rand_str($max_len) { $len = rand() % $max_len; $s = ""; - while($len--) - $s .= sprintf("%c", rand() % 26 + 65);; + while ($len--) { + $s .= sprintf("%c", rand() % 26 + 65); + } return $s; } function rand_number($len , $prec = -1, $sign = 1) { - if($prec == -1){ + if ($prec == -1) { $n = substr(rand() . rand(), 0, rand() % $len + 1); - if(strlen($n) < $len) + if (strlen($n) < $len) { $n .= "." . substr(rand(), 0, rand() % ($len - strlen($n)) + 1); - }elseif ($prec == 0){ + } + } else if ($prec == 0) { $n = substr(rand() . rand(), 0, rand() % $len + 1); - }else{ + } else { $n = substr(rand() . rand(), 0, rand() % ($len - $prec) + 1); $n .= "." . substr(rand(), 0, $prec); } - if($sign && (rand() % 3 == 0)) + if ($sign && (rand() % 3 == 0)) { $n = "-" .$n; + } return $n; } diff --git a/ext/interbase/tests/skipif.inc b/ext/interbase/tests/skipif.inc index 4f0395c60b..337abe7cff 100755 --- a/ext/interbase/tests/skipif.inc +++ b/ext/interbase/tests/skipif.inc @@ -1,9 +1,5 @@ -