#
/**
	This script will purge the current database,
		Just select dataase to be purged and import fruitPurege.sql

	you will need to import fruit5Tables.sql and import fruitAlter.sql
			 or just import fruit5TablesAltered.sql

                         then paste code from your two views inventoryQuantity 
                         and fruitView created for pmaView.sql
                         finally to create a restore point export this new SQL DB to your PC


	This file just call....
	call fruitShared.purgeDatabase( database() ) does a lot it...

	disables the referential integrity, drops all views and tables
        procedures are not dropped. However code to drop procedure is
	in a comment block

	@author Professor Tom DeDonno
	@version Written 01/12/2014 updated 8/2015
 */
/*
when you drop procedures, the tables don't get deleted
something strange is happening PHPMyAdmin

may have to manually deleted procedures

SET FOREIGN_KEY_CHECKS = 0;
drop function if exists getImageURL;
drop procedure if exists orderInvoiceSimple;
drop procedure if exists orderInvoice;
drop procedure if exists dropAllTables;

drop procedure if exists updateInventory;

drop event if exists oneTime;
drop function if exists testFruitExistence;
drop procedure if exists testFruitTransaction;
drop procedure if exists testTransaction;
drop procedure if exists updateShipDate;
SET FOREIGN_KEY_CHECKS = 1;
 need to put the call last something strange is happening with phpMyAdmin 
*/
drop procedure if exists `updateInventory`;

#phpMyAdmin doesn't allow me to create the five tables with a single import
# you get command out of sync
#call `fruitShared`.create5FruitTables( database() );

# your also cannot source from phpMyAdmin, 
# so this is just a purge script, reset in pma does not work
# source /home/premiere/public_html/fruit5TablesAltered.sql.html

/**  this procedure will drop all tables, views, and foreign key constraints 
     compensates if user has entered a bad table name
     but remember specifications matters, so this should not happen */
#call `fruitShared`.`purgeDatabase`( database() );