text: -- --------------------------------------------------------
  -- Host:                         184.164.146.210
  -- Server version:               5.6.11 - MySQL Community Server (GPL)
  -- Server OS:                    Win64
  -- HeidiSQL version:             7.0.0.4053
  -- Date/time:                    2014-06-23 08:38:24
  -- --------------------------------------------------------
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET NAMES utf8 */;
  /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
  
  -- Dumping structure for procedure dayzhivemind.pCleanupOOB
  DELIMITER //
  CREATE DEFINER=`dayzhivemind`@`%` PROCEDURE `pCleanupOOB`()
  BEGIN
  
  	DECLARE intLineCount	INT DEFAULT 0;
  	DECLARE intDummyCount	INT DEFAULT 0;
  	DECLARE intDoLine			INT DEFAULT 0;
  	DECLARE intWest				INT DEFAULT 0;
  	DECLARE intNorth			INT DEFAULT 0;
  
  	SELECT COUNT(*)
  		INTO intLineCount
  		FROM Object_DATA;
  
  	SELECT COUNT(*)
  		INTO intDummyCount
  		FROM Object_DATA
  		WHERE Classname = 'dummy';
  
  	WHILE (intLineCount > intDummyCount) DO
  	
  		SET intDoLine = intLineCount - 1;
  
  		SELECT ObjectUID, Worldspace
  			INTO @rsObjectUID, @rsWorldspace
  			FROM Object_DATA
  			LIMIT intDoLine, 1;
  
  		SELECT REPLACE(@rsWorldspace, '[', '') INTO @rsWorldspace;
  		SELECT REPLACE(@rsWorldspace, ']', '') INTO @rsWorldspace;
  		SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(@rsWorldspace, ',', 2), LENGTH(SUBSTRING_INDEX(@rsWorldspace, ',', 2 -1)) + 2), ',', '') INTO @West;
  		SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(@rsWorldspace, ',', 3), LENGTH(SUBSTRING_INDEX(@rsWorldspace, ',', 3 -1)) + 2), ',', '') INTO @North;
  
  		SELECT INSTR(@West, '-') INTO intWest;
  		SELECT INSTR(@North, '-') INTO intNorth;
  
  		IF (intNorth = 0) THEN
  			SELECT CONVERT(@North, DECIMAL(16,8)) INTO intNorth;
  		END IF;
  
  # Check for NSEW boundaries
  		IF (intWest < 0 OR intWest > 15360 OR intNorth > 15360 OR intNorth < 750) THEN
  			DELETE FROM Object_DATA
  				WHERE ObjectUID = @rsObjectUID;
  		END IF;
  			
  		SET intLineCount = intLineCount - 1;
  
  	END WHILE;
  
  END//
  DELIMITER ;
  /*!40014 SET FOREIGN_KEY_CHECKS=1 */;
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  