scripts.carrubbers.org home scripts@carrubbers.org
*

dbutils.php Documentation

Documentation for the dbutils.php file version 2.1

Contents


Introduction

dbutils.php by Andrew Purves / Nigel Swinson.

+======================================================================================================+
|
| This file contains utility functions for manipulation of databases that conform to the
| xmldb format.  ie converting to and from the xml or dbase variants that implement this interface.
| Also contains other db related functions and utilities.
|
+-----------------------------------------------------------------------------------------------+
| Copyright:
|
| dbutils.php: Useful utilities for PhpXmlDb databases.
|
| Copyright (C) 2003 Nigel Swinson, nigelswinson@users.sourceforge.net
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of the GNU General Public License
| as published by the Free Software Foundation; either version 2
| of the License, or (at your option) any later version.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, write to the Free Software
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
|
+======================================================================================================+

File Scope Functions

Method Details: Import



function Import($Db, $TableName, $RecordName, $TemplateFileName)

Import a table into a database from a tab separated file.

Use this function to create a new database from a tab separated file.

Parameter:

string $TableName

The name of the table to import the data into

string $RecordName

The name of the records to create in the new table

string $TemplateFileName

A local file that contains tab separated values that we should use to create the database. The first non empty row will be interpreted as the field names for the database then each non empty row after that will be imported into the newly created database.

Return Value:

bool

TRUE if the database was create successfully, FALSE if failure

Line:

Defined on line 65

Method Details: Xml2dBase



function Xml2dBase($SourceFileName, $TargetFileName = '', $aOptions = array())

Converts a xml database to a dbase database.

If pathnames are not given as absolute paths, then $DOCUMENT_ROOT will be
prepended.

Parameter:

string $SourceFileName

The name of the source xml file.

string $TargetFileName

The name of the target dbase file. If not present, uses the same base name as the source file name

array $aOptions

An array of options to tweak the behaviour of this function. It is an associative array, possible values are: DebugLevel: Integer describing debug level. Range 0(none)-9(max)

Return Value:

bool

TRUE on success, FALSE on failure.

Line:

Defined on line 236

Method Details: DBase2xml



function DBase2xml($SourceFileName, $TargetFileName = NULL, $aOptions = array())

Convert a Dbase db to an xmldb.

Parameter:

string $SourceFileName

The name of the source dbase file.

string $TargetFileName

The name of the target xml file. If not present, uses the same base name as the source file name

array $aOptions

An array of options to tweak the behaviour of this function. It is an associative array, possible values are: DebugLevel: Integer describing debug level. Range 0(none)-9(max) TableName: String to use as the table name. If empty a default will be used RecordName: String to use as the record name If empty a default will be used

Return Value:

bool

TRUE on success, FALSE on failure.

Line:

Defined on line 562

Method Details: DBase2Postgres



function DBase2Postgres($SourceFileName, $TargetDb, $TargetSchema, $TargetTable, $aOptions = array())

Convert a Dbase db into a Postgres table.
This function ONLY inserts data, you need to setup the schema and table
along with the fields including a _RecordId SERIAL field.

Parameter:

string $SourceFileName

The name of the source dbase file.

string $TargetDb

The target database.

string $TargetSchema

The target schema.

string $TargetTable

The target table.

array $aOptions

An array of options to tweak the behaviour of this function. It is an associative array, possible values are: DebugLevel: Integer describing debug level. Range 0(none)-9(max)

Return Value:

bool

TRUE on success, FALSE on failure.

Line:

Defined on line 833


Last updated: 17 April 2008 02:15:13.

© 2008 Carrubbers Christian Centre | Registered Charity No. SC011455
Conditions of Use | Privacy Policy