Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 80f250ca376f4be3d6aca282eafc86a6 > files > 6

php-drizzle-0.4.1-2mdv2010.0.i586.rpm

Hi!

This 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 libdrizzle
C library and the PHP development packages installed (if you have
'phpize' command you’re all set).

REQUIRES libdrizzle >= v0.4

For the libdrizzle C library, download and install the latest from:

https://launchpad.net/libdrizzle/+download

Instructions can be found in the README file.

Once this is installed and you've verified you have the PHP development
packages, extract the Drizzle PHP module tarball and run:

phpize
./configure
make
make install

And then add the following line to your php.ini:

extension="drizzle.so"

I realize there is not much for 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 object oriented interface
$drizzle= new Drizzle();
$con= $drizzle->addTcp("127.0.0.1", 0, "root", NULL, "sakila",
                        DRIZZLE_CON_MYSQL);
$result= $con->query("SELECT * FROM film LIMIT 3");
$result->buffer();
while (($row= $result->rowNext()) != 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->addUds("/tmp/mysql.sock", "root", NULL, "sakila",
                          DRIZZLE_CON_MYSQL);
  $drizzle->queryAdd($con, "SELECT * FROM film LIMIT 3", 0, $x);
}

while ($q = $drizzle->run())
{
  $ret= $q->returnCode();
  if (!$q)
    break;

  $data= $q->data();
  $result= $q->result();
  while (($row= $result->rowNext()) != NULL)
    print "$data " . implode(':', $row) . "\n";
}


Enjoy!
-Eric, James
eday@oddments.org
contact@jluedke.com