++ed by:
PERLANCAR AWNCORP KEEDI

3 PAUSE users
7 non-PAUSE users.

Laurent Dami
and 1 contributors

NAME

DBIx::DataModel::Doc::Glossary - Terms used in DBIx::DataModel documentation

DOCUMENTATION CONTEXT

This chapter is part of the DBIx::DataModel manual.

GLOSSARY

A

anonymous role

An empty "role name" in an "association" declaration, expressed by characters -- or by the word 'none'. This tells DBIx::DataModel that no "path method" should be generated for this side of the association.

API

Application Programming Interface, the set of public attributes, methods, arguments, return values for interacting with a software compnent.

association

Relationship between tables. In "UML", an association declaration states what are the participating tables, what are the multiplicities, and optionally gives names to the association itself and to the roles of the partipating tables. An association declaration in DBIx::DataModel involves similar information, except that no more than two tables can participate, and at least one role name is mandatory.

association end

A term sometimes used in UML literature as synonym to "role name".

C

component

The second participant in a "composition" relationship, i.e. some object which "is part of" another object. A component object cannot live outside of its composite object.

compatibility layer

A module, loaded on demand, that emulates the API of former versions of DBIx::DataModel.

composite

The first participant in a "composition" relationship, i.e. some object which "contains" another object. If the composite object is deleted, all its components are also deleted.

composition

An "association" which additionally states that records of one table (components) cannot exist outside of their composite class; therefore when the composite is destroyed, the components must be destroyed as well (cascaded delete).

column

Within a "row", a column is a scalar value corresponding to a given column name. Within a "table" or "view", a column is a a list of scalar values obtained by selecting the same column name in every row of the data source. Unlike most other Perl ORMs, DBIx::DataModel has no class for representing a column: since a row is just a blessed hashref, a column is just a value in that hashref. As a matter of fact, most columns are unknown to the DBIx::DataModel layer; they are just passthrough information, directly propagated from the DBI layer to the application layer.

column type

A collection of callback functions or handlers, declared in a "schema" through the Type() method. This column type can then be associated with various column names in various tables; as a result, the from_DB and to_DB handlers will be called automatically, respectively after reading a value from the database or before writing a value to the database.

compile time

Strictly speaking, Perl is not a compiled language; but liberally speaking, the code that runs in the initial phases of a perl program (BEGIN, CHECK, INIT) can be named "compile time".

Within DBIx::DataModel, we speak of "compile-time methods" for declarations like Schema(...), Table(...), Association(...), because these declarations usually belong to a module that will be loaded through use, and therefore will be executed at compile-time.

D

database schema

A container within the database management system for holding tables and other database objects. By default, table names are looked up within the default schema of the current database session; but if multiple schemata are supported, table names may be prefixed by the name of another schema : SELECT * FROM FOREIGN_SCHEMA.TABLE_NAME WHERE ....

Not to be confounded with a "schema" at the DBIx::DataModel level.

database view

A "view" declared within the database through an SQL definition of shape CREATE VIEW view_name AS SELECT ....

DB

DataBase

DBI

The generic database-independent interface for Perl -- see DBI.

DBIC

Abreviation for DBIx::Class, another "ORM" for Perl.

DBIDM

Abreviation for DBIx::DataModel.

dbh

A DBI database handle, created by a call to "connect" in DBI.

F

fast statement

A "statement" in which each row from the database will be retrieved into the same memory location, using DBI's fetch and bind_columns methods. This is the fastest way to get data, but it requires special care to handle each row immediately, before that row gets overwritten by the next row.

foreign key

A column or set of columns that contains the primary key of another table.

I

impedance mismatch

Term used in ORM literature to express the gap between database concepts and object-oriented concepts. The challenge of ORM design is to find the best way to reduce the "impedance mismatch".

inner join

The default form of "join", that excludes null values in the join condition. Within DBIx::DataModel, inner joins are inferred automatically from the multiplicities in associations, or may be explicitly required with a bidirectional arrow: ->join(qw/table <=> role1 <=> role2/).

invocant

The subject of a method call. It can be either a Perl class or a Perl object.

J

JDBC

Standard API to access databases from Java code. Perl code can work with JDBC databases through the DBD::JDBC proxy driver.

The JDBC API is richer than standard DBI for working with result sets : for example it has methods to move the cursor; these can be exploited from DBIx::DataModel through the DBIx::DataModel::Statement::JDBC subclass.

join

A database operation which consists of taking rows from several sources and producing new data rows. The result contains columns merged from those sources, according to the "join condition". Joins are implemented as subclasses of DBIx::DataModel::Source::Join --- see the define_join() method.

join condition

A rule that states which rows from one source will be merged with which rows from another source while performing a join. A typical join condition states that the "foreign key" of the first table should match the "primary key" of the second table.

L

left join

A particular form of "join", in which a row with an empty "foreign key" participates in the final result (while a regular join would ignore that row). Within DBIx::DataModel, left joins are inferred automatically from the multiplicities in associations, or may be explicitly required with a directed arrow: ->join(qw/table => role1 => role2/).

M

many-to-many association

An association in which the maximum multiplicity is '*' on both sides. This is a conceptual notion; to be implemented in a database, a many-to-many association needs an intermediate linking table for storing pairs of keys from both sides of the association.

meta-schema

An instance of DBIx::DataModel::Meta::Schema, corresponding to a given schema subclass (a subclass of DBIx::DataModel::Schema), that holds information about the tables, associations, types, etc. defined in that schema subclass.

multiplicity

A specification on one side of an "association", which states the minimum and maximum number of times any given record may participate in the association. Typical multiplicities are 0..*, 0..1, 1..1, 1..*. * is a shorthand for 0..*, and 1 is a shorthand for 1..1.

multi-schema mode

A way of using DBIx::DataModel in which a "schema" subclass may have several instances, with different database connexions. In this mode, tables and joins are accessed through calls to a $schema object; therefore that reference must be passed around through the whole application. Multi-schema mode is triggered by the first call to "Schema::new()" in DBIx::DataModel::Doc::Reference.

The other, more simple mode is "single-schema mode".

O

OO

Object-Oriented.

ORM

Object-Relational Management system : a framework of classes and methods to encapsulate interactions with a "RDBMS". There are many ORMs for Perl; DBIx::DataModel is just one of them.

ORM view

A "view" declared within the ORM layer through a call to the View() method; such views are not known to the database.

P

path method

A method automatically installed in a "table" class when an "association" is declared. Path methods are used to get access to related records in other tables.

placeholder

In "SQL", placeholders are special marks positioned at specific places in a SQL request, to denote that these places will be replaced by actual values in a later binding operation. SQL placeholders are usually identified by a question mark '?'; their order of appearance must match the order in which values are bound.

At the DBIx::DataModel level, there is an additional mechanism of named parameters, identified by a placeholder_prefix defined in the schema, which defaults to ?:. This gives additional flexibility for binding values either before or after the statement is composed. Examples are given in the design document.

primary key

A column or set of columns that uniquely identifies any single row within a table.

R

record

Synonym to "row".

result kind

A way to transform data rows coming from the database into a datastructure suitable for user's needs. Result kinds are specified through the -result_as argument to the select() method. Each result kind is implemented by a subclass of DBIx::DataModel::Schema::ResultAs.

RDBMS

Relational DataBase Management System.

referential integrity rule

A rule declared within the "database schema" in order to ensure that the database will never contain dangling references : alteration or deletion of a "primary key" is only allowed when the system contains no "foreign key" pointing to that value.

role name

In UML notation, each side of an association may be decorated with a "role name" (also called "association end" sometimes in the literature). Role names are optional in UML, like many other modeling constructs; they are used mainly when a same class participates in several associations, in which case it helps to disambiguate the roles. However, when declaring an Association() in DBIx::DataModel, role names are mandatory, because they are used to generate path methods for navigating between classes.

row

A single data record resulting from a SELECT query to the RDBMS. Within DBIx::DataModel, rows are plain hashrefs ({ column_name => column_value }), blessed as instances of a "table" or a "view".

S

schema

An instance of a subclass of DBIx::DataModel::Schema, that encapsulates a "dbh" connexion to the database.

 When C<DBIx::DataModel> is used
in L</single-schema mode>, the term "schema" also refers to the
subclass itself, because that subclass has only one L</singleton> instance.

Not to be confounded with a "database schema". A Perl schema may switch between several database schemata through the db_schema() method.

single-schema mode

The most simple way of using DBIx::DataModel, in which the "schema" subclass has only one single instance. The advantage in that mode is that tables and joins can be accessed through class method calls, without the need to pass around a $schema reference through the whole application. The disadvantage is that it is not possible to access several database connexions simultaneously; it this is a need, then use "multi-schema mode".

singleton

In mathematics, a set with only one member. In programming, a class with only one instance.

source

Either a "table" or a "join".

SQL

An acronym for Structured Query Language, a standard adopted by most database vendors to express requests to a relational database system.

SQLA

Abreviation for SQL::Abstract, a SQL generator module used by several "ORM"s.

SQLAM

Abreviation for SQL::Abstract::More, a subclass of "SQLA" which is the SQL generator module used by DBIx::DataModel.

statement

An instance of DBIx::DataModel::Statement, that encapsulates an SQL query. See "STATEMENT METHODS" in DBIx::DataModel::Doc::Reference.

sth

A DBI statement handle, created by a call to "prepare" in DBI. DBIx::DataModel encapsulates $sth handles within "statement" objects.

T

table

A subclass of DBIx::DataModel::Source::Table, created by method "Table()" in DBIx::DataModel::Doc::Reference, that encapsulates access to a database table (or database view).

U

UML

The Unified Modeling Language, a graphical notation for modeling software system. An excellent quick reference for UML is http://www.holub.com/goodies/uml/.

Association definitions in DBIx::DataModel are closely inspired by UML associations (see "Association()" in DBIx::DataModel::Doc::Reference).

V

View

A SQL request packaged like a table, so that clients see it in the same way as regular tables in the database. Views can be either database views, declared directly within the database, or ORM views, declared within the ORM layer.