PHP Classes

File: t.php

Recommend this page to a friend!
  Classes of Craig Manley   Mysql Locker   t.php   Download  
File: t.php
Role: Example script
Content type: text/plain
Description: Test script.
Class: Mysql Locker
Safely manage MySQL table locks
Author: By
Last change:
Date: 19 years ago
Size: 906 bytes
 

Contents

Class file image Download
<?php
error_reporting
(E_ALL | E_STRICT);

if (
count($argv) != 5) {
  die(
"You must specify the database arguments: host database user password\n");
}

$dbhost = $argv[1];
$dbname = $argv[2];
$dbusr = $argv[3];
$dbpwd = $argv[4];

$dbh = mysql_connect($dbhost, $dbusr, $dbpwd);
if (!(isset(
$dbh) && mysql_select_db($dbname,$dbh))) {
  throw new
Exception(mysql_errno() . ": " . mysql_error(), E_USER_ERROR);
}


// Set the private include path
$path_delimiter = PHP_OS == 'WINNT' ? ';' : ':';
ini_set('include_path','..' . $path_delimiter . ini_get('include_path'));


require_once(
'MysqlLocker.php');
$locker = new MysqlLocker($dbh, array('JunkMail' => 'READ', 'Import' => 'WRITE'), array('debug' => true));


// Simulate errors
if (false) {
  throw new
Exception('Nooooooooo!!!!');
}
if (
false) {
 
trigger_error('Oops something bad happened!', E_USER_ERROR);
}
if (
false) {
  die(
"Uuuhghhgg!\n");
}

?>