2. Overview
Objectives
Learn about some of the miscellaneous features that
PVDatabase has to offer.
Requirements
Knowledge of PVDatabase basic functions.
Estimated Time
5 minutes
3. Random
At points you may want to query data by at random.
Databases have the random function built in. To utilize
that random function, we can use
PVDatabase::getSQLRandomOperator().
4. Average
The average function is used for finding the average value
of data in a database. We leverage the average function
in ProdigyView like so:
5. Database Type
Prodigyview supports multiple database types and
connections to a database can be switched at any
moment. To get what database you are connectioned to,
you can use the PVDatabase::getDatabaseType
method.
6. Schema
Some database, such as postgresql, generally are used
with schemas. To get the schema that is currently in use,
the getSchema() method can be utilized.
7. Table Formatting
When writing an application that is be distributed, you will not
know the prefix of database used. PVDatabase::formatTable()
will add the prefix set for the current database connection in
front of the table. If the prefix set as ‘pv_’, the code below will
output ‘pv_template’.
8. Predefined Tables
ProdigyView stores data in predefined tables for features such
applications, plugins, cms, menus, etc. PVDatabase can retrieve the
names of those tables in the correct format of the database being
used.
Example: If the database set has the prefix of pv_ and schema of
production, PVDatabase::getApplicationTableName() will return
production.pv_applications.
The following areas have predefined tables:
CMS Modules Subscriptions
Applications Containers Points
Plugins Pages MVC
Users Templates Roles
Menus Template Positions
9. API Reference
For a better understanding of the database, visit the api
by clicking on the link below.
PVDatabase
More Tutorials
For more tutorials, please visit:
http://www.prodigyview.com/tutorials
www.prodigyview.com