Maxscape::Database::Table Package
Synopsis
use Maxscape::Database::Table;
Description
The Maxscape::Database::Table package implements the basic functionality to work
with the application server's content databases. The class is an attempt to
provide a generic way to display and edit the various pages and forms to run and
manage a webserver. Well, a generic class needs a lot of options and parameters
to meet special requirements. Anyway, this class is fundamental of coding,
without to much of effort.
All content database tables are defined in the files:
- Maxscape generic table definition
- /maxscape/lib/WebServer-1.00/Maxscape/Database/TableDefinitions.pm
- Website global table definitions
- /maxscape/lib/perl/Maxscape/Database/SiteTableDefinitions.pm
- Website global table lable definitions
- /maxscape/lib/perl/Maxscape/Database/SiteTableColumnDescriptions.pm
- Table internal column types definitions
- /maxscape/lib/WebServer-1.00/Maxscape/Database/Base.pm
List of Member Functions
- addListToWhereClause
- AttributeParameter
- DB_QueryColumnSize
- displayColumnNames
- displayDescColumnNames
- displayDescRecord
- displayFieldAsHTML
- displayRecord
- displayRecordField
- displayTable
- Error
- FieldDescriptionToHTML
- FieldDescToHTML
- FieldToHTML
- FormSelectGroupRecordElement
- FormSelectGroupToWhereClause
- getRecordKey
- insertRecords
- isAKeyColumn
- KeyColumnsToWhereClase
- lastRowAsHash
- lookupColumnDescriptions
- new
- promptDescRecord
- promptRecord
- QueryColumnsToWhereClase
- setCGI_TableValuesByKey
- setRecordKey
- TableIsEmpty
- TableValuesAndKeyFromCGI
Member Functions
new
Synopsis
my $Table = Maxscape::Database::Table->new (%Parameter);
Description
Creates a Maxscape::Database::Table object. Have a look at the source code to figure out the various parameters.
Examples
my $where = "USER_ID = 'Max'";
my $Table = Maxscape::Database::Table->new (
Cursor => $Cursor,
TableName => 'USERS',
DisplayMode => 'horizontal',
NoRowsMessage => $NoRowsMessage,
noColumnHeaders => 1,
# ...
);
my $Text = $Table->displayTable (where => $where);
Error
Synopsis
my $ErrorText = $Table->Error ();
Description
Returns the last error.
DB_QueryColumnSize
Synopsis
my $Text = $Table->DB_QueryColumnSize ($ColumnName);
Description
Returns the size of a table column.
TableValuesAndKeyFromCGI
Synopsis
my $Text = $Table->TableValuesAndKeyFromCGI (%Parameter);
Description
Gets a tables keys and values from a HTTP post request.
setCGI_TableValuesByKey
Synopsis
my $Text = $Table->setCGI_TableValuesByKey ($FieldKey, $ColumnName, $Value);
Description
Sets the value of a table's row.
getRecordKey
Synopsis
my $Text = $Table->getRecordKey ($Value);
Description
Gets a record's key.
setRecordKey
Synopsis
my $Text = $Table->setRecordKey ($Value);
Description
Sets a record's key.
addListToWhereClause
Synopsis
my $Text = $Table->addListToWhereClause (%P);
Description
Adds
Examples
my $where = $Table->addListToWhereClause (
List => $FormSelectGroup,
ListOperator => 'or',
where => $where,
whereOperator => 'and',
);
FormSelectGroupRecordElement
Synopsis
my $Text = $Table->FormSelectGroupRecordElement ($P);
Description
Returns a select group element.
FormSelectGroupToWhereClause
Synopsis
my $Text = $Table->FormSelectGroupToWhereClause (%P);
Description
Returns an sql where clause from a select group element.
QueryColumnsToWhereClase
Synopsis
my $Text = $Table->QueryColumnsToWhereClase ();
Description
Creates a where clause from the column values.
KeyColumnsToWhereClase
Synopsis
my $where = $Table->KeyColumnsToWhereClase (%P);
Description
Returns a where clause from a table's keys.
displayTable
Synopsis
my $Text = $Table->displayTable (%P);
Description
Generates the HTML code to display a database table.
Examples
my $Text = $Page->{Object}->displayTable (
Columns => $QueryColumns,
TableType => $TableType,
KeyColumns => ['NUMBER'],
TableDescriptionKey => $TableDescriptionKey,
FieldCallback => $FieldCallback,
Action => 'display',
selectRowsWidget => 1,
selectRowsWidgetHeader => $selectRowsWidgetHeader,
selectRowsWidgetTrailor => $selectRowsWidgetTrailor,
displayColumnHeaders => $displayColumnHeaders,
ColumnHeadersHeader => $ColumnHeadersHeader,
ColumnHeadersTrailor => $ColumnHeadersTrailor,
RecordHeader => $RecordHeader,
RecordHeader2 => $RecordHeader2,
RecordTrailor => $RecordTrailor,
FieldHeader => $FieldHeader,
FieldHeader2 => $FieldHeader2,
FieldHeaderSpan2 => $FieldHeaderSpan2,
FieldHeader2Span2 => $FieldHeader2Span2,
FieldLabelTrailor => $FieldLabelTrailor,
FieldTrailor => $FieldTrailor,
where => $Page->{Object}->{CountWhere},
order => $order,
displayRowLimit => $Page->{Object}->{displayRowLimit},
);
TableIsEmpty
Synopsis
my $Text = $Table->TableIsEmpty ();
Description
Tells if a query of a table is empty.
displayRecord
Synopsis
my $Text = $Table->displayRecord ();
Description
Generates the HTML of a tables row.
displayRecordField
Synopsis
my $Text = $Table->displayRecordField ();
Description
Displays a field of a table row.
displayColumnNames
Synopsis
my $Text = $Table->displayColumnNames ();
Description
Returns the selected column names of a table.
lastRowAsHash
Synopsis
my $Text = $Table->lastRowAsHash ();
Description
Returns the last row of an sql query.
promptRecord
Synopsis
my $Text = $Table->promptRecord (%P);
Description
Prompts a for a tables row.
insertRecords
Synopsis
my $Text = $Table->insertRecords (%P);
Examples
my $Table = Maxscape::Database::Table->new (
Cursor => $self->{Cursor},
TableName => $self->{TableName},
Action => '',
TableType => 'described',
Page => $self->{Page},
TableBoarder => 1,
DisplayMode => 'horizontal'
);
$Text = $Table->insertRecords (
Columns => 'PROPERTY_KEY, PROPERTY_NUMBER, PROPERTY_NAME, PROPERTY_CONTENT',
FieldsToChangeByName => { PROPERTY_KEY => $WebServerName, },
KeyColumns => ['PROPERTY_KEY', 'PROPERTY_NAME'],
where => $self->{MainKey},
order => 'PROPERTY_NUMBER',
);
Description
Inserts rows to the table $self->{TableName}.
lookupColumnDescriptions
Synopsis
my $Text = $Table->lookupColumnDescriptions ($TableName, $TableDescriptionKey);
Description
Looks up the column descriptions in the TABLE_COLUMN_DESCRIPTION table to render the table's columns.
displayDescColumnNames
Synopsis
my $Text = $Table->displayDescColumnNames ();
Description
Returns the column names passes to the $Table->displayTable member funcion.
promptDescRecord
Synopsis
my $Text = $Table->promptDescRecord (%P);
Description
Prompts for a row described in the TABLE_COLUMN_DESCRIPTION table.
FieldToHTML
Synopsis
my $Text = $Table->FieldToHTML ();
Description
Renders a table field as described in the TABLE_COLUMN_DESCRIPTION table.
FieldDescriptionToHTML
Synopsis
my $Text = $Table->FieldDescriptionToHTML (
$CGI_Value, $FieldDescription, $ColumnDescription
);
Description
Renders a table's field to HTML.
displayDescRecord
Synopsis
my $Text = $Table->displayDescRecord (%P);
Description
Returns a rendered described record.
isAKeyColumn
Synopsis
my $Text = $Table->isAKeyColumn ();
Description
Tells if a column is a key column.
displayFieldAsHTML
Synopsis
my $Text = $Table->displayFieldAsHTML ();
Description
Renders a table's field to HTML.
FieldDescToHTML
Synopsis
my $Text = $Table->FieldDescToHTML ($P);
Description
Renders a table's field to HTML.
AttributeParameter
Synopsis
my $AttributeHash = $Table->AttributeParameter ($Attribute, $Parameter);
Description
Returns a hash of attributes.
1| Next ∙ Previous ∙ Top ∙ Join ∙ Contact | © Maxscape |
