Login   Register  
PHP Classes
elePHPant
Icontem

File: options.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Munroe  >  SQL Data  >  options.php  >  Download  
File: options.php
Role: Auxiliary script
Content type: text/plain
Description: Common command line options handling.
Class: SQL Data
Generate classes to store objects in SQL databases
Author: By
Last change:
Date: 2006-10-20 08:02
Size: 1,078 bytes
 

Contents

Class file image Download
<?php

/**
 * @author Dick Munroe <munroe@csworks.com>
 * @copyright copyright (c) Dick Munroe, 2004-2006, All rights reserved.
 * @license http://www.csworks.com/publications/ModifiedNetBSD.html
 * @version 2.0.0
 */

//
// Edit History:
//
//  Dick Munroe munroe@csworks.com 09-Oct-2004
//      Initial Version Created.
//

include_once('dm.DB/class.factory.DB.php') ;

function 
options(&$theOptions)
{
    if (empty(
$theOptions['h']))
    {
        
$theOptions['h'] = 'localhost' ;
    }

    if (empty(
$theOptions['d']))
    {
        
$theOptions['d'] = 'MySQL' ;
    }

    if (empty(
$theOptions['p']))
    {
        
$theOptions['p'] = '' ;
    }

    
$theOptions['d'] = strtolower($theOptions['d']) ;

    if (
$theOptions['d'] == 'mysql')
    {
        
$theOptions['d'] = dmDB_MySQL ;
    }
    else if (
$theOptions['d'] == 'postgresql80')
    {
        
$theOptions['d'] = dmDB_PostgreSQL80 ;
    }
    else if (
$theOptions['d'] == 'postgresql81')
    {
        
$theOptions['d'] = dmDB_PostgreSQL81 ;
    }
    else
    {
        die(
'Invalid database type') ;
    }
}
?>