install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file create_firebird_database.php

Documentation is available at create_firebird_database.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.   V4.22 15 Apr 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
  10.   Released under both BSD license and Lesser GPL library license.
  11.   Whenever there is any discrepancy between the two licenses,
  12.   the BSD license will take precedence.
  13.  
  14.   Set tabs to 4 for best viewing.
  15.   Added by Lester Caine to provide an in-line generation of Firebird(/Interbase) database
  16.   Firebird requires the database to exist before it can be connected to as part of it's
  17.   security system
  18.   Still need to be extended to allow selection of OS tmp directory,
  19.   and path to Firebird bin directory
  20. */
  21.     function FirebirdCreateDB($host$user$pass$dbalias$fbpath)
  22.     {
  23.         $sql 'CREATE DATABASE "'.$host.':'.$dbalias.'"';
  24.         if (strlen($user0)
  25.             $sql .= ' USER "'.$user.'"';
  26.         if (strlen($pass0)
  27.             $sql .= ' PASSWORD "'.$pass.'"';
  28.         $sql .= ' PAGE_SIZE = 16384';
  29.  
  30. //        if ($s_create_charset != 'NONE') {
  31.             // NONE is the default character set
  32. //            $sql .= ' DEFAULT CHARACTER SET '.$s_create_charset;
  33. //        }
  34.  
  35.         $sql .= ';';
  36.  
  37.         $sql str_replace("\r\n""\n"$sql);
  38.         $sql .= "\n";
  39.         ifisset($_ENV["TMP"])) {
  40.             $tmp_name $_ENV["TMP"].'/'.uniqid('').'.sql';
  41.         else {
  42.             $tmp_name '/tmp/'.uniqid('').'.sql';
  43.         }
  44.  
  45.         if ($fp fopen ($tmp_name'a')) {
  46.             fwrite($fp$sql);
  47.             fclose($fp)
  48.         }
  49.  
  50.         $command =  sprintf('"%s" -i %s'$fbpath$tmp_name );
  51.         $result exec($command);
  52.     }
  53.  
  54. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:16 +0000 by phpDocumentor 1.5.0-lsces