Eric DayThoughts, code, and other oddments. |
Dark | Light |
|
|
|
< Drizzle Client & Protocol Library 0.1 Released! || libdrizzle + SQLite hack > Drizzle PHP Extension 0.1 Released!February 10th, 2009Building on top of my last post, the PHP extension for the new client and protocol library is ready as well! You can download the tarball on the Launchpad download page. The PHP extension exposes the same set of client functions that the C library provides currently, and is mostly just a wrapper to provide the PHP specific handling. To install, you’ll need the PHP development packages installed (if you have ‘phpize’ command you’re all set). After extracting the tarball, just run: phpize And then add the following line to your php.ini: extension=”drizzle.so” I realize there is no documentation at this point, we’re working on that (please get in touch if you want to get involved in any way). The provided ‘drizzle.php’ file has examples in many of the ways you can access the database, but here are a couple examples to get you started (error checking omitted for brevity):
# Simple query to a Drizzle server
$drizzle= drizzle_create();
$con= drizzle_con_add_tcp($drizzle, "127.0.0.1", 0, "root", NULL, "sakila", 0);
$result= drizzle_query($con, "SELECT * FROM film LIMIT 3");
drizzle_result_buffer($result);
while (($row= drizzle_row_next($result)) != NULL)
print implode(':', $row) . "\n";
# Simple query to a MySQL server using the OO interface
$drizzle= new drizzle();
$con= $drizzle->add_tcp("127.0.0.1", 0, "root", NULL, "sakila", DRIZZLE_CON_MYSQL);
$result= $con->query("SELECT * FROM film LIMIT 3");
$result->buffer();
while (($row= $result->row_next()) != NULL)
print implode(':', $row) . "\n";
# Three concurrent queries to a MySQL server using Unix Domain Sockets
$drizzle= new drizzle();
for ($x= 0; $x < 3; $x++) {
$con= $drizzle->add_uds("/tmp/mysql.sock", "root", NULL, "sakila", DRIZZLE_CON_MYSQL);
$drizzle->query_add($con, "SELECT * FROM film LIMIT 3", 0, $x);
}
while (1) {
list($ret, $q)= $drizzle->run();
if (!$q)
break;
$data= $q->data();
$result= $q->result();
while (($row= $result->row_next()) != NULL)
print "$data " . implode(':', $row) . "\n";
}
Posted in Drizzle, Main, MySQL
One Response to "Drizzle PHP Extension 0.1 Released!"Leave a Reply< Drizzle Client & Protocol Library 0.1 Released! || libdrizzle + SQLite hack > |
Blog Wiki About Resume RSS Comments Launchpad identi.ca OpenStack Scale Stack Gearman NW Veg Veg Food & Fit |
|
Copyright (C) Eric Day - eday@oddments.org All content licensed under the Creative Commons Attribution 3.0 License. Hosted by Rackspace Cloud |
|
[...] Drizzle PHP Extension 0.1 Released! – De MySQL Fork Drizzle heeft natuurlijk wel de steun van de verschillende programmeer talen nodig. Inmiddels is de eerste test versie van een PHP extensie beschikbaar. [...]