Database Abstraction Layer for PHP

User Tools

Site Tools



ADOdb provides numerous methods that allow the interrogation of the structure of the database from the database level all the way down to the field object. It does so in a way that offers the following assistance:

  • Provides a simple, consistent interface to the information
  • Simplifies the procedure of adding,changing and deleting the structure of the database
  • Provides cross-database compatibility
  • Hides sometimes complex commands that allow access to database schema information.

The Meta Functions

In ADOdb, methods and objects that hide the complexity of the internals of the database are often referred to as Meta Functions and Meta Objects. These methods can be used to access and update the schema in the database.

Hiding Complexity

In the following example, we want to query the schema of a table in Microsoft SQL server to obtain a list of the columns. Firstly we do it using the native mode syntax for SQL Server:

$SQL =	"select, as type,
	c.xprec as precision,
	c.xscale as scale,
	c.isnullable as nullable,
	c.cdefault as default_value,
	t.length as type_length,
	from syscolumns c
	join systypes t on t.xusertype=c.xusertype
	join sysobjects o on
	join sys.tables st on
	join sys.columns sc on sc.object_id = st.object_id and

Next we do the same thing using the ADOdb MetaFunction, metaColumns().


The 2 previous examples return the same data, but in the case of ADOdb, the command can be issued against any supported database and the result will be the same

v5/userguide/learn_dictionary/start_lesson.txt · Last modified: 2016/03/16 01:35 by mnewnham