diff options
Diffstat (limited to 'ext/interbase/tests')
-rw-r--r-- | ext/interbase/tests/001.phpt | 39 | ||||
-rw-r--r-- | ext/interbase/tests/002.phpt | 35 | ||||
-rw-r--r-- | ext/interbase/tests/003.phpt | 93 | ||||
-rw-r--r-- | ext/interbase/tests/004.phpt | 179 | ||||
-rw-r--r-- | ext/interbase/tests/005.phpt | 274 | ||||
-rw-r--r-- | ext/interbase/tests/006.phpt | 227 | ||||
-rwxr-xr-x | ext/interbase/tests/extension | 1 | ||||
-rwxr-xr-x | ext/interbase/tests/interbase.inc | 77 |
8 files changed, 0 insertions, 925 deletions
diff --git a/ext/interbase/tests/001.phpt b/ext/interbase/tests/001.phpt deleted file mode 100644 index 6d221d04c0..0000000000 --- a/ext/interbase/tests/001.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -InterBase: create test database ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - // remember to give write permission to the ext/ibase/tests directory - // to the user running interbase, otherwise db creation/deletion will fail - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - $name = tempnam("","CREATEDB"); - $ftmp = fopen($name,"w"); - if (is_file($test_base)) - fwrite($ftmp, - "connect \"$test_base\"; - drop database;\n" - ); - fwrite($ftmp, - "create database \"$test_base\"; - create table test1 ( - i integer, - c varchar(100) - ); - commit; - insert into test1(i, c) values(1, 'test table created with isql'); - exit;\n" - ); - fclose($ftmp); - // passthru gives us some output, allowing the test to pass - // (actually, it passes after the first run when the db gets deleted/recreated) - passthru("isql -i $name 2>&1"); - unlink($name); -?> ---EXPECT-- -Use CONNECT or CREATE DATABASE to specify a database -Database: "ext/interbase/tests/ibase_test.tmp" diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt deleted file mode 100644 index d240e82e81..0000000000 --- a/ext/interbase/tests/002.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -InterBase: connect, close and pconnect ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - - ibase_connect($test_base); - out_table("test1"); - ibase_close(); - - $con = ibase_connect($test_base); - $pcon1 = ibase_pconnect($test_base); - $pcon2 = ibase_pconnect($test_base); - ibase_close($con); - ibase_close($pcon1); - - out_table("test1"); - - ibase_close($pcon2); -?> ---EXPECT-- ---- test1 --- -1 test table created with isql ---- ---- test1 --- -1 test table created with isql ---- diff --git a/ext/interbase/tests/003.phpt b/ext/interbase/tests/003.phpt deleted file mode 100644 index 4afee04cad..0000000000 --- a/ext/interbase/tests/003.phpt +++ /dev/null @@ -1,93 +0,0 @@ ---TEST-- -InterBase: misc sql types (may take a while) ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - - ibase_connect($test_base); - - ibase_query( - "create table test3 ( - iter integer, - v_char char(1000), - v_date timestamp, - v_decimal decimal(12,3), - v_double double precision, - v_float float, - v_integer integer, - v_numeric numeric(4,2), - v_smallint smallint, - v_varchar varchar(10000) - )"); - ibase_commit(); - - /* if timefmt is not supported, suppress error here*/ - @ibase_timefmt("%m/%d/%Y %H:%M:%S"); - - for($iter = 0; $iter < 10; $iter++){ - /* prepare data */ - $v_char = rand_str(1000); - $v_date = rand_datetime(); - $v_decimal = rand_number(12,3); - $v_double = rand_number(18); - $v_float = rand_number(7); - $v_integer = rand_number(9,0); - $v_numeric = rand_number(4,2); - $v_smallint = rand_number(5) % 32767; - $v_varchar = rand_str(10000); - - ibase_query( - "insert into test3 (iter, v_char,v_date,v_decimal,v_double,v_float,v_integer,v_numeric,v_smallint,v_varchar) - values ($iter, '$v_char','$v_date',$v_decimal,$v_double,$v_float,$v_integer,$v_numeric,$v_smallint,'$v_varchar')"); - $sel = ibase_query("select * from test3 where iter = $iter"); - $sel = ibase_query("select * from test3 where iter = $iter"); - $row = ibase_fetch_object($sel); - if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){ - echo " CHAR fail:\n"; - echo " in: $v_char\n"; - echo " out: $row->V_CHAR\n"; - } - if($row->V_DATE != $v_date){ - echo " DATE fail\n"; - echo " in: $v_date\n"; - echo " out: $row->V_DATE\n"; - } - if($row->V_DECIMAL != $v_decimal){ - echo " DECIMAL fail\n"; - echo " in: $v_decimal\n"; - echo " out: $row->V_DECIMAL\n"; - } - if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){ - echo " DOUBLE fail\n"; - echo " in: $v_double\n"; - echo " out: $row->V_DOUBLE\n"; - } - if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){ - echo " FLOAT fail\n"; - echo " in: $v_float\n"; - echo " out: $row->V_FLOAT\n"; - } - if($row->V_INTEGER != $v_integer){ - echo " INTEGER fail\n"; - echo " in: $v_integer\n"; - echo " out: $row->V_INTEGER\n"; - } - ibase_free_result($sel); - }/* for($iter)*/ - - ibase_close(); - echo "end of test\n"; -?> ---EXPECT-- - -end of test - - diff --git a/ext/interbase/tests/004.phpt b/ext/interbase/tests/004.phpt deleted file mode 100644 index 01e18e1a50..0000000000 --- a/ext/interbase/tests/004.phpt +++ /dev/null @@ -1,179 +0,0 @@ ---TEST-- -InterBase: BLOB test ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - - ibase_connect($test_base); - - ibase_query( - "create table test4 ( - v_integer integer, - v_blob blob)"); - ibase_commit(); - - /* create 10k blob file */ - $blob_str = rand_binstr(10*1024); - - $name = tempnam("","blob.tmp"); - $name = "blob.tmp"; - $ftmp = fopen($name,"w"); - fwrite($ftmp,$blob_str); - fclose($ftmp); - - echo "import blob 1\n"; - $ftmp = fopen($name,"r"); - $bl_s = ibase_blob_import($ftmp); - ibase_query("insert into test4 (v_integer, v_blob) values (1, ?)", $bl_s); - - echo "test blob 1\n"; - $q = ibase_query("select v_blob from test4 where v_integer = 1"); - $row = ibase_fetch_object($q); - $bl_h = ibase_blob_open($row->V_BLOB); - - while($piece = ibase_blob_get($bl_h, rand() % 1024)) - $blob .= $piece; - if($blob != $blob_str) - echo " BLOB 1 fail\n"; - ibase_blob_close($bl_h); - ibase_free_result($q); - unset($blob); - - echo "create blob 2\n"; - - $bl_h = ibase_blob_create(); - $ftmp = fopen($name,"r"); - while($piece = fread($ftmp, rand() % 1024)){ - ibase_blob_add($bl_h, $piece); - } - fclose($ftmp); - $bl_s = ibase_blob_close($bl_h); - ibase_query("insert into test4 (v_integer, v_blob) values (2, ?)", $bl_s); - - echo "test blob 2\n"; - - $q = ibase_query("select v_blob from test4 where v_integer = 2"); - $row = ibase_fetch_object($q); - $bl_h = ibase_blob_open($row->V_BLOB); - while($piece = ibase_blob_get($bl_h, rand() % 1024)) - $blob .= $piece; - if($blob != $blob_str) - echo " BLOB 2 fail\n"; - ibase_blob_close($bl_h); - ibase_free_result($q); - unset($blob); - - - echo "create blob 3\n"; - - $bl_h = ibase_blob_create(); - - ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n"); - ibase_blob_add($bl_h, "| PHP HTML Embedded Scripting Language Version 3.0 |\n"); - ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n"); - ibase_blob_add($bl_h, "| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |\n"); - ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n"); - ibase_blob_add($bl_h, "| This program is free software; you can redistribute it and/or modify |\n"); - ibase_blob_add($bl_h, "| it under the terms of one of the following licenses: |\n"); - ibase_blob_add($bl_h, "| |\n"); - ibase_blob_add($bl_h, "| A) the GNU General Public License as published by the Free Software |\n"); - ibase_blob_add($bl_h, "| Foundation; either version 2 of the License, or (at your option) |\n"); - ibase_blob_add($bl_h, "| any later version. |\n"); - ibase_blob_add($bl_h, "| |\n"); - ibase_blob_add($bl_h, "| B) the PHP License as published by the PHP Development Team and |\n"); - ibase_blob_add($bl_h, "| included in the distribution in the file: LICENSE |\n"); - ibase_blob_add($bl_h, "| |\n"); - ibase_blob_add($bl_h, "| This program is distributed in the hope that it will be useful, |\n"); - ibase_blob_add($bl_h, "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n"); - ibase_blob_add($bl_h, "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n"); - ibase_blob_add($bl_h, "| GNU General Public License for more details. |\n"); - ibase_blob_add($bl_h, "| |\n"); - ibase_blob_add($bl_h, "| You should have received a copy of both licenses referred to here. |\n"); - ibase_blob_add($bl_h, "| If you did not, or have any questions about PHP licensing, please |\n"); - ibase_blob_add($bl_h, "| contact core@php.net. |\n"); - ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n"); - $bl_s = ibase_blob_close($bl_h); - ibase_query("insert into test4 (v_integer, v_blob) values (3, ?)", $bl_s); - - echo "echo blob 3\n"; - - $q = ibase_query("select v_blob from test4 where v_integer = 3"); - $row = ibase_fetch_object($q); - ibase_blob_echo($row->V_BLOB); - ibase_free_result($q); - - echo "fetch blob 3\n"; - $q = ibase_query("select v_blob from test4 where v_integer = 3"); - $row = ibase_fetch_object($q,IBASE_TEXT); - echo $row->V_BLOB; - ibase_free_result($q); - - ibase_close(); - unlink($name); - echo "end of test\n"; -?> ---EXPECT-- -import blob 1 -test blob 1 -create blob 2 -test blob 2 -create blob 3 -echo blob 3 -+----------------------------------------------------------------------+ -| PHP HTML Embedded Scripting Language Version 3.0 | -+----------------------------------------------------------------------+ -| Copyright (c) 1997-2000 PHP Development Team (See Credits file) | -+----------------------------------------------------------------------+ -| This program is free software; you can redistribute it and/or modify | -| it under the terms of one of the following licenses: | -| | -| A) the GNU General Public License as published by the Free Software | -| Foundation; either version 2 of the License, or (at your option) | -| any later version. | -| | -| B) the PHP License as published by the PHP Development Team and | -| included in the distribution in the file: LICENSE | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY; without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU General Public License for more details. | -| | -| You should have received a copy of both licenses referred to here. | -| If you did not, or have any questions about PHP licensing, please | -| contact core@php.net. | -+----------------------------------------------------------------------+ -fetch blob 3 -+----------------------------------------------------------------------+ -| PHP HTML Embedded Scripting Language Version 3.0 | -+----------------------------------------------------------------------+ -| Copyright (c) 1997-2000 PHP Development Team (See Credits file) | -+----------------------------------------------------------------------+ -| This program is free software; you can redistribute it and/or modify | -| it under the terms of one of the following licenses: | -| | -| A) the GNU General Public License as published by the Free Software | -| Foundation; either version 2 of the License, or (at your option) | -| any later version. | -| | -| B) the PHP License as published by the PHP Development Team and | -| included in the distribution in the file: LICENSE | -| | -| This program is distributed in the hope that it will be useful, | -| but WITHOUT ANY WARRANTY; without even the implied warranty of | -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | -| GNU General Public License for more details. | -| | -| You should have received a copy of both licenses referred to here. | -| If you did not, or have any questions about PHP licensing, please | -| contact core@php.net. | -+----------------------------------------------------------------------+ -end of test diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt deleted file mode 100644 index 43b60d8bb0..0000000000 --- a/ext/interbase/tests/005.phpt +++ /dev/null @@ -1,274 +0,0 @@ ---TEST-- -InterBase: transactions ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - - ibase_connect($test_base); - - @ibase_query("create table test5 (i integer)"); - @ibase_query("delete from test5"); - ibase_close(); - - - echo "default transaction:\n"; - -/* -Difference between default and other transactions: -default commited when you call ibase_close(). -Other transaction doing rollback. - -If you not open default transaction with -ibase_trans, default transaction open -when you call ibase_query(), ibase_prepare(), -ibase_blob_create(), ibase_blob_import() first time. -*/ - -/* -simple default transaction test without ibase_trans() -*/ - - ibase_connect($test_base); - - echo "empty table\n"; - - /* out_table call ibase_query() - and ibase_query() start default transaction */ - out_table("test5"); - - /* in default transaction context */ - ibase_query("insert into test5 (i) values (1)"); - - echo "one row\n"; - out_table("test5"); - - ibase_rollback(); /* default rolled */ - - echo "after rollback table empty again\n"; - out_table("test5"); /* started new default transaction */ - - ibase_query("insert into test5 (i) values (2)"); - - ibase_close(); /* commit here! */ - - ibase_connect($test_base); - - echo "one row\n"; - out_table("test5"); - ibase_close(); - -/* -default transaction on default link -First open transaction on link will be default. -$tr_def_l1 may be ommited. All queryes without link and trans -parameters run in this context -*/ - - $link_def = ibase_connect($test_base); - - $tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */ - - /* all default */ - $res = ibase_query("select * from test5"); - - echo "one row\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - /* specify transaction context... */ - $res = ibase_query($tr_def_l1, "select * from test5"); - - echo "one row... again.\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - /* specify default transaction on link */ - $res = ibase_query($link_def, "select * from test5"); - - echo "one row.\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - ibase_rollback($link_def); /* just for example */ - - ibase_close(); - -/* -three transaction on default link -*/ - ibase_connect($test_base); - - $tr_1 = ibase_trans(); /* this default transaction also */ - $tr_2 = ibase_trans(IBASE_READ); - $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED); - - $res = ibase_query("select * from test5"); - - echo "one row\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - /* insert in first transaction context... */ - /* as default */ - ibase_query("insert into test5 (i) values (3)"); - /* specify context */ - ibase_query($tr_1, "insert into test5 (i) values (4)"); - - $res = ibase_query("select * from test5"); - - echo "three rows\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - $res = ibase_query($tr_1, "select * from test5"); - - echo "three rows again\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - ibase_commit($tr_1); - - $res = ibase_query($tr_2, "select * from test5"); - - echo "one row in second transaction\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - $res = ibase_query($tr_3, "select * from test5"); - - echo "three rows in third transaction\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - ibase_close(); -/* -transactions on second link -*/ - $link_1 = ibase_pconnect($test_base); - $link_2 = ibase_pconnect($test_base); - - $tr_1 = ibase_trans(IBASE_DEFAULT, $link_2); /* this default transaction also */ - $tr_2 = ibase_trans(IBASE_COMMITTED, $link_2); - - $res = ibase_query($tr_1, "select * from test5"); - - echo "three rows\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - ibase_query($tr_1, "insert into test5 (i) values (5)"); - - $res = ibase_query($tr_1, "select * from test5"); - - echo "four rows\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - ibase_commit($tr_1); - - $res = ibase_query($tr_2, "select * from test5"); - - echo "four rows again\n"; - out_result($res,"test5"); - - ibase_free_result($res); - - ibase_close($link_1); - ibase_close($link_2); - - echo "end of test\n"; -?> ---EXPECT-- -default transaction: -empty table ---- test5 --- ---- -one row ---- test5 --- -1 ---- -after rollback table empty again ---- test5 --- ---- -one row ---- test5 --- -2 ---- -one row ---- test5 --- -2 ---- -one row... again. ---- test5 --- -2 ---- -one row. ---- test5 --- -2 ---- -one row ---- test5 --- -2 ---- -three rows ---- test5 --- -2 -3 -4 ---- -three rows again ---- test5 --- -2 -3 -4 ---- -one row in second transaction ---- test5 --- -2 ---- -three rows in third transaction ---- test5 --- -2 -3 -4 ---- -three rows ---- test5 --- -2 -3 -4 ---- -four rows ---- test5 --- -2 -3 -4 -5 ---- -four rows again ---- test5 --- -2 -3 -4 -5 ---- -end of test - diff --git a/ext/interbase/tests/006.phpt b/ext/interbase/tests/006.phpt deleted file mode 100644 index 2472a2ac2f..0000000000 --- a/ext/interbase/tests/006.phpt +++ /dev/null @@ -1,227 +0,0 @@ ---TEST-- -InterBase: binding (may take a while) ---SKIPIF-- -<?php if (!extension_loaded("interbase")) print "skip"; ?> ---POST-- ---GET-- ---FILE-- -<? -/* $Id$ */ - - require(dirname(__FILE__)."/interbase.inc"); - - $test_base = dirname(__FILE__)."/ibase_test.tmp"; - - ibase_connect($test_base); - - ibase_query( - "create table test6 ( - iter integer, - v_char char(1000), - v_date timestamp, - v_decimal decimal(12,3), - v_double double precision, - v_float float, - v_integer integer, - v_numeric numeric(4,2), - v_smallint smallint, - v_varchar varchar(10000) - )"); - ibase_commit(); - - /* if timefmt not supported, hide error */ - @ibase_timefmt("%m/%d/%Y %H:%M:%S"); - - echo "insert\n"; - - for($iter = 0; $iter < 3; $iter++){ - /* prepare data */ - $v_char = rand_str(1000); - $v_date = rand_datetime(); - $v_decimal = rand_number(12,3); - $v_double = rand_number(20); - $v_float = rand_number(7); - $v_integer = rand_number(9,0); - $v_numeric = rand_number(4,2); - $v_smallint = rand_number(5) % 32767; - $v_varchar = rand_str(10000); - - ibase_query("insert into test6 - (iter,v_char,v_date,v_decimal,v_double,v_float, - v_integer,v_numeric,v_smallint,v_varchar) - values (?,?,?,?,?,?,?,?,?,?)", - $iter, $v_char, $v_date, $v_decimal, $v_double, $v_float, - $v_integer, $v_numeric, $v_smallint, $v_varchar); - $sel = ibase_query("select * from test6 where iter = $iter"); - - $row = ibase_fetch_object($sel); - if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){ - echo " CHAR fail:\n"; - echo " in: $v_char\n"; - echo " out: $row->V_CHAR\n"; - } - if($row->V_DATE != $v_date){ - echo " DATE fail\n"; - echo " in: $v_date\n"; - echo " out: $row->V_DATE\n"; - } - if($row->V_DECIMAL != $v_decimal){ - echo " DECIMAL fail\n"; - echo " in: $v_decimal\n"; - echo " out: $row->V_DECIMAL\n"; - } - if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){ - echo " DOUBLE fail\n"; - echo " in: $v_double\n"; - echo " out: $row->V_DOUBLE\n"; - } - if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){ - echo " FLOAT fail\n"; - echo " in: $v_float\n"; - echo " out: $row->V_FLOAT\n"; - } - if($row->V_INTEGER != $v_integer){ - echo " INTEGER fail\n"; - echo " in: $v_integer\n"; - echo " out: $row->V_INTEGER\n"; - } - ibase_free_result($sel); - }/* for($iter)*/ - - echo "select\n"; - for($iter = 0; $iter < 3; $iter++){ - /* prepare data */ - $v_char = rand_str(1000); - $v_date = rand_datetime(); - $v_decimal = rand_number(12,3); - $v_double = rand_number(20); - $v_float = rand_number(7); - $v_integer = rand_number(9,0); - $v_numeric = rand_number(4,2); - $v_smallint = rand_number(5) % 32767; - $v_varchar = rand_str(10000); - - /* clear table*/ - ibase_query("delete from test6"); - - /* make one record */ - ibase_query("insert into test6 - (iter, v_char,v_date,v_decimal, - v_integer,v_numeric,v_smallint,v_varchar) - values (666, '$v_char','$v_date',$v_decimal, $v_integer, - $v_numeric, $v_smallint, '$v_varchar')"); - - /* test all types */ - if(!($sel = ibase_query( - "select iter from test6 where v_char = ?", $v_char))) - echo "CHAR fail\n"; - ibase_free_result($sel); - if(!($sel = ibase_query( - "select iter from test6 where v_date = ?", $v_date))) - echo "DATE fail\n"; - ibase_free_result($sel); - if(!($sel = ibase_query( - "select iter from test6 where v_decimal = ?", $v_decimal))) - echo "DECIMAL fail\n"; - ibase_free_result($sel); - if(!($sel = ibase_query( - "select iter from test6 where v_integer = ?", $v_integer))) - echo "INTEGER fail\n"; - ibase_free_result($sel); - if(!($sel = ibase_query( - "select iter from test6 where v_numeric = ?", $v_numeric))) - echo "NUMERIC fail\n"; - ibase_free_result($sel); - if(!($sel = ibase_query( - "select iter from test6 where v_smallint = ?", $v_smallint))) - echo "SMALLINT fail\n"; - ibase_free_result($sel); - if(!($sel = ibase_query( - "select iter from test6 where v_varchar = ?", $v_varchar))) - echo "VARCHAR fail\n"; - ibase_free_result($sel); - - }/*for iter*/ - - echo "prepare and exec insert\n"; - - /* prepare table */ - ibase_query("delete from test6"); - - /* prepare query */ - $query = ibase_prepare( - "insert into test6 (v_integer) values (?)"); - - for($i = 0; $i < 10; $i++) - ibase_execute($query, $i); - - out_table("test6"); - - ibase_free_query($query); - - - echo "prepare and exec select\n"; - - /* prepare query */ - $query = ibase_prepare("select * from test6 - where v_integer between ? and ?"); - - $low_border = 2; - $high_border = 6; - - $res = ibase_execute($query, $low_border, $high_border); - out_result($res, "test6"); - ibase_free_result($res); - - $low_border = 0; - $high_border = 4; - $res = ibase_execute($query, $low_border, $high_border); - out_result($res, "test6"); - ibase_free_result($res); - - $res = ibase_execute($query, "5", 7.5); - out_result($res, "test6"); - ibase_free_result($res); - - ibase_free_query($query); - ibase_close(); - echo "end of test\n"; -?> ---EXPECT-- -insert -select -prepare and exec insert ---- test6 --- - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 ---- -prepare and exec select ---- test6 --- - 2 - 3 - 4 - 5 - 6 ---- ---- test6 --- - 0 - 1 - 2 - 3 - 4 ---- ---- test6 --- - 5 - 6 - 7 ---- -end of test - diff --git a/ext/interbase/tests/extension b/ext/interbase/tests/extension deleted file mode 100755 index 3b561c46a9..0000000000 --- a/ext/interbase/tests/extension +++ /dev/null @@ -1 +0,0 @@ -InterBase diff --git a/ext/interbase/tests/interbase.inc b/ext/interbase/tests/interbase.inc deleted file mode 100755 index f261cb01b5..0000000000 --- a/ext/interbase/tests/interbase.inc +++ /dev/null @@ -1,77 +0,0 @@ -<? -/* $Id$ */ -/* used in tests */ - -srand((double)microtime()*1000000); - -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"; - } - ibase_free_result($res); - echo "---\n"; -} - -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"; - } - 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); -} - -/* random binary string */ -function rand_binstr($max_len) -{ - $len = rand() % $max_len; - $s = ""; - while($len--) - $s .= sprintf("%c", rand() % 256); - return $s; -} - -function rand_str($max_len) -{ - $len = rand() % $max_len; - $s = ""; - while($len--) - $s .= sprintf("%c", rand() % 26 + 65);; - return $s; -} - -function rand_number($len , $prec = -1, $sign = 1) -{ - if($prec == -1){ - $n = substr(rand() . rand(), 0, rand() % $len + 1); - if(strlen($n) < $len) - $n .= "." . substr(rand(), 0, rand() % ($len - strlen($n)) + 1); - }elseif ($prec == 0){ - $n = substr(rand() . rand(), 0, rand() % $len + 1); - }else{ - $n = substr(rand() . rand(), 0, rand() % ($len - $prec) + 1); - $n .= "." . substr(rand(), 0, $prec); - } - if($sign && (rand() % 3 == 0)) - $n = "-" .$n; - return $n; -} - -?>
\ No newline at end of file |