PHP Classes

File: sp.php

Recommend this page to a friend!
  Classes of Cosmin Cristea   MySQL stored procedures   ???   Download  
File: ???
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: 21 years ago
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';
?>