Login   Register  
PHP Classes
elePHPant
Icontem

File: sp.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Cosmin Cristea  >  MySQL stored procedures  >  sp.php  >  Download  
File: sp.php
Role: Example script
Content type: text/plain
Description: example
Class: MySQL stored procedures
Emulation of stored procedures for MySQL databases
Author: By
Last change:
Date: 2004-05-03 06:36
Size: 697 bytes
 

Contents

Class file image Download
<?
// mysql wrapper class
require_once ('sqlLayer.php');
// stores procedure class
require_once ('STProc.php');

// instantiating new object from the wrapper class with connection parameters and database name
$mysql = new SQLLayer ("localhost""root""""test");

// instantiating new object from the stored procedure class
$sp = new ST_Proc ('default.sp');
// loading the procedures
$sp->load ();

$sp->dump ();
$sp->save_to ('test.sp');

// actual execution
$sp->set_params ('sp_example1', array ("5"));
$sp->execute ('sp_example1'$mysql);

// result can be found in the wrapper object
$row $mysql->fetch_array ();
echo 
'Returned: '.$mysql->num_rows ().' rows';
?>