- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:axmls:extractschema

# extractSchema

##### See Also

parseschemafile

##### Syntax

    string extractSchema (
      optional bool $includeData = false,
      optional string $indent = ' ',
      optional string $prefix = '',
      optional bool $stripprefix = false
      )

## Description

Extracts an XML schema from an existing database.

Call this method to create an XML schema string from an existing database. If the data parameter is set to TRUE, AXMLS will include the data from the database in the schema.

The method returns a generated XML schema.

## Parameters

### $includeData

Include data from the database in schema dump. There are a number of issues that affect the successful outcome of use of this option:

- The size of the tables being dumped
- The database in use
- PHP memory configuration.

Because the method results in the entire database being held in a single string variable, a good rule of thumb is that if a single table contains more than 1,000 records then it would be more appropriate to consider use of a database specific data dump utility.

### $indent

The indentation character to use. The default value is ' '(space). Other alternatives might be “\t” (tab).

### $prefix

Only match tables with this prefix. Patten match wildcards are not supported by this option.

### $stripprefix

strip prefix string when storing in XML schema. This option works in conjunction with the $prefix option. For example, if required table names were all prefixed with e.g. 'abc_', then selecting 'abc_' would only retrieve those tables, and setting this option to true would remove that option before saving the data.

## Return

The method returns a string containing the schema, and if requested, the data inside the tables.

## Database Migration

For small databases, use of this method paired with parseschemafile provides an easy to use database schema and data migration tool.

v5/axmls/extractschema.txt · Last modified: 2016/01/12 17:26 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top