<h1>Firebird Testing</h1>
<hr><b>NOTE:</b><br>
You must set the database and table to something which exists on your system<br>
or create a database and run the next command:<br>
CREATE TABLE TEST1(<br>
FIRST_NAME VARCHAR(100) NOT NULL,<br>
LAST_NAME VARCHAR(100),<br>
PRIMARY KEY(FIRST_NAME) )<br>
<hr>
[-
$table = 'AGENDA' ;
use DBI ;
# Connecting to database
$dbh = DBI->connect("DBI:InterBase:database=C:\CKGTEST.GDB;host=localhost","ckg", "kassab") or die "Cannot connect to '$DSN'" ;
#Insert Data
$dbh->do("INSERT INTO $table VALUES ('first name to be deleted','last name to be deleted')");
#Insert Data again
$dbh->do("INSERT INTO $table VALUES ('first name will not be deleted','last name will not be deleted')");
#Delete Data
$dbh->do("DELETE FROM AGENDA WHERE FIRST_NAME = 'first name to be deleted'");
#$dbh->do("DELETE FROM AGENDA WHERE FIRST_NAME = 'first name will not be deleted'");
# Get Data
$sth = $dbh -> prepare ("SELECT FIRST_NAME, LAST_NAME FROM $table") or die "Cannot SELECT from '$table'" ;
$sth -> execute or die "Cannot execute SELECT from '$table'";
$sth -> bind_columns(undef, \$first_name, \$last_name);
Hi:
I have been testing DBD::Interbase and it works great woth embperl.
here my testing file:
<html>
<head>
<title>Firebird Testing</title>
</head>
<body>
<h1>Firebird Testing</h1>
<hr><b>NOTE:</b><br>
You must set the database and table to something which exists on your system<br>
or create a database and run the next command:<br>
CREATE TABLE TEST1(<br>
FIRST_NAME VARCHAR(100) NOT NULL,<br>
LAST_NAME VARCHAR(100),<br>
PRIMARY KEY(FIRST_NAME) )<br>
<hr>
[-
$table = 'AGENDA' ;
use DBI ;
# Connecting to database
$dbh = DBI->connect("DBI:InterBase:database=C:\CKGTEST.GDB;host=localhost","ckg", "kassab") or die "Cannot connect to '$DSN'" ;
#Insert Data
$dbh->do("INSERT INTO $table VALUES ('first name to be deleted','last name to be deleted')");
#Insert Data again
$dbh->do("INSERT INTO $table VALUES ('first name will not be deleted','last name will not be deleted')");
#Delete Data
$dbh->do("DELETE FROM AGENDA WHERE FIRST_NAME = 'first name to be deleted'");
#$dbh->do("DELETE FROM AGENDA WHERE FIRST_NAME = 'first name will not be deleted'");
# Get Data
$sth = $dbh -> prepare ("SELECT FIRST_NAME, LAST_NAME FROM $table") or die "Cannot SELECT from '$table'" ;
$sth -> execute or die "Cannot execute SELECT from '$table'";
$sth -> bind_columns(undef, \$first_name, \$last_name);
-]
<table border=1>
<tr>
<th>First Name</th><th>Last Name</th>
</tr>
[$ while $sth -> fetchrow_arrayref $]
<tr>
<td>[+ $first_name +]</td><td>[+ $last_name +]</td>
</tr>
[$ endwhile $]
[-
$sth->finish();
$dbh->disconnect();
-]
</table>
</body>
</html>