Subject | FLAP (FirebirdSS-2.1.2+CentOS-5.3+Apache-2.2.3+PHP-5.3) |
---|---|
Author | lee_domain |
Post date | 2009-06-25T04:59:01Z |
Hi, all of you,
the bird-watchers and bird-lovers ( and bird-catchers ?)
wondering between clouds and ground.
I have just tested FirebirdSS-2.1.2 with PHP-5.3
It works, and works well.
Most cheerful for me is that it seems having
overcome the numeric/decimal difficulties
which have been trapping PHP a long time.
Following is the script to do this test:
<?php
echo "
Following is a PHP script to test the FirebirdSS-2.1.2 <br>
to see if the decimal function has been improved on PHP-5.3.<br>
Folowing functions require that the database is on the connection <br>
Here is it, test it, and expecting your reply. <br> " ;
// Global Variables
// set this var to 1 will set a silent mode
$tmpsilent = 0;
// 1) connect to a database server
$srv_db = 'localhost:/home/ltm/employee.fdb';
$usrname = 'sysdba';
$pswd = 'masterkey';
echo "<br> trying to connect the database...<br>" ;
// get and report connection result
$conn = fbird_connect($srv_db, $usrname, $pswd);
if (!$conn ) {
echo "database connection failed <br>";
exit;
}
echo "database connection OK <br><br>";
// create a new table for testing
$sql = "CREATE TABLE PHP53(
d1 decimal(4,2),
d2 decimal(6,3),
d3 decimal(8,4),
d4 decimal(10,5),
d5 decimal(14,7),
d6 decimal(16,8),
dd double precision,
df float)";
if ( $tmpsilent == 0)
echo $sql."<br>";
// process the query to retrieve the table
$res = fbird_query($conn, $sql);
if ( res == TRUE )
echo "create table OK"."<br><br>" ;
if ( res == FALSE )
echo "create table failed"."<br><br>" ;
fbird_commit();
$sql_up = "insert into PHP53 (d1,d2,d3,d4,d5,d6,dd,df) values (
12.52, 918.812, 1234.8765, 54321.06789,6543210.1234567,
87654321.01234567, 1234.5678, 1234.56) ";
if ( $tmpsilent == 0)
echo $sql_up."<br>";
// process the query to insert testing data into the table
$res1 = fbird_query($conn, $sql_up);
if ( $res1 >= 1 )
echo "insert table OK"."<br><br>" ;
else
echo "insert table failed"."<br><br>" ;
fbird_commit();
echo "select * from PHP53"."<br><br>";
// process the query to retrieve the data
$res2 = fbird_query($conn, "select * from PHP53");
while ( $row = fbird_fetch_object($res2) )
{
$d1 = "D1"; //
$d1_rtn = ($row->$d1);
echo "<br> 12.52 = : ".$d1_rtn."<br>";
$d2 = "D2"; //
$d2_rtn = trim($row->$d2);
echo "<br> 918.812 = : ".$d2_rtn."<br>";
$d3 = "D3"; //
$d3_rtn = trim($row->$d3);
echo "<br> 1234.8765 = : ".$d3_rtn."<br>";
$d4 = "D4"; //
$d4_rtn = trim($row->$d4);
echo "<br> 54321.06789 = : ".$d4_rtn."<br>";
$d5 = "D5"; //
$d5_rtn = trim($row->$d5);
echo "<br> 6543210.1234567 = : ".$d5_rtn."<br>";
$d6 = "D6"; //
$d6_rtn = trim($row->$d6);
echo "<br> 87654321.01234567 = : ".$d6_rtn."<br>";
$d7 = "DD"; //
$d7_rtn = trim($row->$d7);
echo "<br> 1234.5678 = : ".$d7_rtn."<br>";
$d8 = "DF"; //
$d8_rtn = trim($row->$d8);
echo "<br> 1234.56 = : ".$d8_rtn."<br>";
}
// relaese the results
fbird_free_result($res2);
// drop the newly ctreated table
echo "<br> DROP TABLE PHP53 <br>";
// process the query to drop the table
$res3 = fbird_query($conn, "DROP TABLE PHP53");
if ( $res3 == TRUE )
echo "drop table OK"."<br>" ;
if ( $res3 == FALSE )
echo "drop table failed"."<br>" ;
fbird_commit();
// release the results
fbird_free_result($res3);
// close the connected database, and report result
$closedb = fbird_close($conn);
if ($closedb == 1)
{
echo "<br> disconnect from database OK ! <br>";
} else {
echo "<br> disconnect from database failed ! <br>";
}
?>
I really hope you can also test it to see if the result is correct.
There is also a graphic prove.
That's all for now.
Yours
Old-Bird
http://sites.google.com/site/firebirdarchitect/Home/flap/fb212-php53
the bird-watchers and bird-lovers ( and bird-catchers ?)
wondering between clouds and ground.
I have just tested FirebirdSS-2.1.2 with PHP-5.3
It works, and works well.
Most cheerful for me is that it seems having
overcome the numeric/decimal difficulties
which have been trapping PHP a long time.
Following is the script to do this test:
<?php
echo "
Following is a PHP script to test the FirebirdSS-2.1.2 <br>
to see if the decimal function has been improved on PHP-5.3.<br>
Folowing functions require that the database is on the connection <br>
Here is it, test it, and expecting your reply. <br> " ;
// Global Variables
// set this var to 1 will set a silent mode
$tmpsilent = 0;
// 1) connect to a database server
$srv_db = 'localhost:/home/ltm/employee.fdb';
$usrname = 'sysdba';
$pswd = 'masterkey';
echo "<br> trying to connect the database...<br>" ;
// get and report connection result
$conn = fbird_connect($srv_db, $usrname, $pswd);
if (!$conn ) {
echo "database connection failed <br>";
exit;
}
echo "database connection OK <br><br>";
// create a new table for testing
$sql = "CREATE TABLE PHP53(
d1 decimal(4,2),
d2 decimal(6,3),
d3 decimal(8,4),
d4 decimal(10,5),
d5 decimal(14,7),
d6 decimal(16,8),
dd double precision,
df float)";
if ( $tmpsilent == 0)
echo $sql."<br>";
// process the query to retrieve the table
$res = fbird_query($conn, $sql);
if ( res == TRUE )
echo "create table OK"."<br><br>" ;
if ( res == FALSE )
echo "create table failed"."<br><br>" ;
fbird_commit();
$sql_up = "insert into PHP53 (d1,d2,d3,d4,d5,d6,dd,df) values (
12.52, 918.812, 1234.8765, 54321.06789,6543210.1234567,
87654321.01234567, 1234.5678, 1234.56) ";
if ( $tmpsilent == 0)
echo $sql_up."<br>";
// process the query to insert testing data into the table
$res1 = fbird_query($conn, $sql_up);
if ( $res1 >= 1 )
echo "insert table OK"."<br><br>" ;
else
echo "insert table failed"."<br><br>" ;
fbird_commit();
echo "select * from PHP53"."<br><br>";
// process the query to retrieve the data
$res2 = fbird_query($conn, "select * from PHP53");
while ( $row = fbird_fetch_object($res2) )
{
$d1 = "D1"; //
$d1_rtn = ($row->$d1);
echo "<br> 12.52 = : ".$d1_rtn."<br>";
$d2 = "D2"; //
$d2_rtn = trim($row->$d2);
echo "<br> 918.812 = : ".$d2_rtn."<br>";
$d3 = "D3"; //
$d3_rtn = trim($row->$d3);
echo "<br> 1234.8765 = : ".$d3_rtn."<br>";
$d4 = "D4"; //
$d4_rtn = trim($row->$d4);
echo "<br> 54321.06789 = : ".$d4_rtn."<br>";
$d5 = "D5"; //
$d5_rtn = trim($row->$d5);
echo "<br> 6543210.1234567 = : ".$d5_rtn."<br>";
$d6 = "D6"; //
$d6_rtn = trim($row->$d6);
echo "<br> 87654321.01234567 = : ".$d6_rtn."<br>";
$d7 = "DD"; //
$d7_rtn = trim($row->$d7);
echo "<br> 1234.5678 = : ".$d7_rtn."<br>";
$d8 = "DF"; //
$d8_rtn = trim($row->$d8);
echo "<br> 1234.56 = : ".$d8_rtn."<br>";
}
// relaese the results
fbird_free_result($res2);
// drop the newly ctreated table
echo "<br> DROP TABLE PHP53 <br>";
// process the query to drop the table
$res3 = fbird_query($conn, "DROP TABLE PHP53");
if ( $res3 == TRUE )
echo "drop table OK"."<br>" ;
if ( $res3 == FALSE )
echo "drop table failed"."<br>" ;
fbird_commit();
// release the results
fbird_free_result($res3);
// close the connected database, and report result
$closedb = fbird_close($conn);
if ($closedb == 1)
{
echo "<br> disconnect from database OK ! <br>";
} else {
echo "<br> disconnect from database failed ! <br>";
}
?>
I really hope you can also test it to see if the result is correct.
There is also a graphic prove.
That's all for now.
Yours
Old-Bird
http://sites.google.com/site/firebirdarchitect/Home/flap/fb212-php53