first commit
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Create MySQL Views
|
||||
* - Loads DB settings from ../xml/settings.xml
|
||||
* - Scans current dir for files named view_*.php
|
||||
* - Each view file should set: $SQL = "CREATE VIEW ...";
|
||||
* - Drops view if exists, then creates it
|
||||
*/
|
||||
define('INITIALIZATION_FILE_NAME', __DIR__ . '/../xml/settings.xml');
|
||||
|
||||
$logs = [];
|
||||
|
||||
function logLine(array &$logs, string $msg): void {
|
||||
$logs[] = $msg;
|
||||
}
|
||||
|
||||
function renderPage(array $logs, bool $ok): void {
|
||||
$status = $ok ? "✅ Done." : "❌ Stopped due to an error.";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Create Views</title>
|
||||
<style>
|
||||
body {
|
||||
background-color:#333333;
|
||||
color:#fff;
|
||||
font-family:sans-serif;
|
||||
padding:1em;
|
||||
}
|
||||
.log {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
.done {
|
||||
margin-top: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
code {
|
||||
background: rgba(255,255,255,.08);
|
||||
padding: .15em .35em;
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php foreach ($logs as $line): ?>
|
||||
<div class="log"><?= $line ?></div>
|
||||
<?php endforeach; ?>
|
||||
<div class="done"><?= $status ?></div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
function fail(array &$logs, string $msg, int $exitCode = 1): void {
|
||||
logLine($logs, "❌ {$msg}");
|
||||
renderPage($logs, false);
|
||||
exit($exitCode);
|
||||
}
|
||||
|
||||
function runSQL(PDO $db, ?string $sql, string $context, array &$logs): void {
|
||||
if ($sql === null || trim($sql) === '') {
|
||||
logLine($logs, "⚠️ <strong>{$context}</strong>: empty SQL. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$db->exec($sql);
|
||||
} catch (PDOException $e) {
|
||||
fail($logs, "{$context}: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Load App Settings
|
||||
// -----------------
|
||||
|
||||
if (!file_exists(INITIALIZATION_FILE_NAME)) {
|
||||
fail($logs, "Initialization file not found: <code>" . htmlspecialchars(INITIALIZATION_FILE_NAME, ENT_QUOTES) . "</code>");
|
||||
}
|
||||
|
||||
$applicationSettings = @simplexml_load_file(INITIALIZATION_FILE_NAME);
|
||||
if (!$applicationSettings) {
|
||||
fail($logs, "Unable to load Application Settings from <code>" . htmlspecialchars(INITIALIZATION_FILE_NAME, ENT_QUOTES) . "</code>.");
|
||||
}
|
||||
|
||||
// -------------
|
||||
// Connect to DB
|
||||
// -------------
|
||||
|
||||
$host = (string) ($applicationSettings->DatabaseServer ?? '');
|
||||
$database = (string) ($applicationSettings->DatabaseName ?? '');
|
||||
$user = (string) ($applicationSettings->DatabaseUser ?? '');
|
||||
$pass = (string) ($applicationSettings->DatabasePassword ?? '');
|
||||
|
||||
if ($host === '' || $database === '' || $user === '') {
|
||||
fail($logs, "Missing DB settings in settings.xml (DatabaseServer/DatabaseName/DatabaseUser).");
|
||||
}
|
||||
|
||||
try {
|
||||
$dsn = "mysql:host={$host};dbname={$database};charset=utf8mb4";
|
||||
$db = new PDO($dsn, $user, $pass, [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
fail($logs, "Unable to connect to the database: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
|
||||
// ---------------------
|
||||
// Find view_*.php files
|
||||
// ---------------------
|
||||
|
||||
$dirFiles = scandir(__DIR__) ?: [];
|
||||
$viewFiles = array_values(array_filter($dirFiles, function ($f) {
|
||||
if (pathinfo($f, PATHINFO_EXTENSION) !== 'php')
|
||||
return false;
|
||||
if (strpos($f, 'view_') !== 0)
|
||||
return false;
|
||||
return is_file(__DIR__ . '/' . $f);
|
||||
}));
|
||||
|
||||
if (!$viewFiles) {
|
||||
logLine($logs, "⚠️ No view definition files found (expected <code>view_*.php</code>). Nothing to do.");
|
||||
renderPage($logs, true);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ------------
|
||||
// Create views
|
||||
// ------------
|
||||
|
||||
$created = 0;
|
||||
$failed = 0;
|
||||
|
||||
foreach ($viewFiles as $file) {
|
||||
$viewName = pathinfo($file, PATHINFO_FILENAME);
|
||||
logLine($logs, "Processing <strong>" . htmlspecialchars($viewName, ENT_QUOTES) . "</strong>...");
|
||||
|
||||
$SQL = null;
|
||||
|
||||
try {
|
||||
$result = include __DIR__ . '/' . $file;
|
||||
if ($result === false) {
|
||||
$failed++;
|
||||
logLine($logs, "❌ Failed to include <code>" . htmlspecialchars($file, ENT_QUOTES) . "</code>. Skipping.");
|
||||
continue;
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
$failed++;
|
||||
logLine($logs, "❌ Exception including <code>" . htmlspecialchars($file, ENT_QUOTES) . "</code>: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Drop then create
|
||||
try {
|
||||
$db->exec("DROP VIEW IF EXISTS `{$viewName}`");
|
||||
} catch (PDOException $e) {
|
||||
// Non-fatal; keep going
|
||||
logLine($logs, "⚠️ Could not drop <code>{$viewName}</code>: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
|
||||
try {
|
||||
runSQL($db, $SQL, $viewName, $logs);
|
||||
$created++;
|
||||
logLine($logs, "✅ <code>{$viewName}</code> was created.");
|
||||
} catch (Throwable $e) {
|
||||
$failed++;
|
||||
logLine($logs, "❌ Error creating <code>{$viewName}</code>: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
}
|
||||
|
||||
logLine($logs, "<br/><strong>{$created}</strong> views created. <strong>{$failed}</strong> failed.");
|
||||
renderPage($logs, $failed === 0);
|
||||
@@ -0,0 +1,72 @@
|
||||
<style>
|
||||
body {
|
||||
background-color: #333333;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
// Simple Script to create a MySQL View.
|
||||
|
||||
define("INITIALIZATION_FILE_NAME", "../xml/settings.xml");
|
||||
|
||||
// Retrieve the View Name.
|
||||
|
||||
$view = $_GET["view"] ?? "";
|
||||
|
||||
if (empty($view)) {
|
||||
echo "No view name given. View not created.";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ((include "{$view}.php") != true) {
|
||||
echo "{$view}.php not found. View not created.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Retrieve Application Settings
|
||||
|
||||
$applicationSettings = simplexml_load_file(INITIALIZATION_FILE_NAME);
|
||||
|
||||
if (empty($applicationSettings)) {
|
||||
echo "Unable to load Application Settings." . PHP_EOL;
|
||||
exit();
|
||||
}
|
||||
|
||||
echo $applicationSettings->asXML();
|
||||
die();
|
||||
|
||||
// Connect to the Database.
|
||||
|
||||
$host = (string) $applicationSettings->DatabaseServer;
|
||||
$database = (string) $applicationSettings->DatabaseName;
|
||||
$user = (string) $applicationSettings->DatabaseUser;
|
||||
$password = (string) $applicationSettings->DatabasePassword;
|
||||
|
||||
try {
|
||||
$connection = new PDO("mysql:host={$host};dbname={$database}", $user, $password);
|
||||
} catch (PDOException | Exception $e) {
|
||||
echo "Unable to connect to the database. <br/>";
|
||||
echo "Error is: {$e->getMessage()}";
|
||||
exit();
|
||||
}
|
||||
|
||||
// Create the view.
|
||||
|
||||
$connection->exec("drop view if exists {$view}");
|
||||
|
||||
try {
|
||||
$connection->exec($SQL);
|
||||
} catch (Exception $e) {
|
||||
echo "Error creating view. <br/>";
|
||||
echo "Error is: {$e->getMessage()}";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($connection->errorCode() != 0) {
|
||||
echo "Error creating view. <br/>";
|
||||
echo "<pre>";
|
||||
print_r($connection->errorInfo());
|
||||
} else {
|
||||
echo "View {$view} was created.";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Create MySQL Views
|
||||
* - Loads DB settings from ../xml/settings.xml
|
||||
* - Scans current dir for files named view_*.php
|
||||
* - Each view file should set: $SQL = "CREATE VIEW ...";
|
||||
* - Drops view if exists, then creates it
|
||||
*/
|
||||
define('INITIALIZATION_FILE_NAME', __DIR__ . '/../../xml/settings.xml');
|
||||
|
||||
$logs = [];
|
||||
|
||||
function logLine(array &$logs, string $msg): void {
|
||||
$logs[] = $msg;
|
||||
}
|
||||
|
||||
function renderPage(array $logs, bool $ok): void {
|
||||
$status = $ok ? "✅ Done." : "❌ Stopped due to an error.";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Create Views</title>
|
||||
<style>
|
||||
body {
|
||||
background-color:#333333;
|
||||
color:#fff;
|
||||
font-family:sans-serif;
|
||||
padding:1em;
|
||||
}
|
||||
.log {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
.done {
|
||||
margin-top: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
code {
|
||||
background: rgba(255,255,255,.08);
|
||||
padding: .15em .35em;
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php foreach ($logs as $line): ?>
|
||||
<div class="log"><?= $line ?></div>
|
||||
<?php endforeach; ?>
|
||||
<div class="done"><?= $status ?></div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
function fail(array &$logs, string $msg, int $exitCode = 1): void {
|
||||
logLine($logs, "❌ {$msg}");
|
||||
renderPage($logs, false);
|
||||
exit($exitCode);
|
||||
}
|
||||
|
||||
function runSQL(PDO $db, ?string $sql, string $context, array &$logs): void {
|
||||
if ($sql === null || trim($sql) === '') {
|
||||
logLine($logs, "⚠️ <strong>{$context}</strong>: empty SQL. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$db->exec($sql);
|
||||
} catch (PDOException $e) {
|
||||
fail($logs, "{$context}: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// Load App Settings
|
||||
// --------------------
|
||||
if (!file_exists(INITIALIZATION_FILE_NAME)) {
|
||||
fail($logs, "Initialization file not found: <code>" . htmlspecialchars(INITIALIZATION_FILE_NAME, ENT_QUOTES) . "</code>");
|
||||
}
|
||||
|
||||
$applicationSettings = @simplexml_load_file(INITIALIZATION_FILE_NAME);
|
||||
if (!$applicationSettings) {
|
||||
fail($logs, "Unable to load Application Settings from <code>" . htmlspecialchars(INITIALIZATION_FILE_NAME, ENT_QUOTES) . "</code>.");
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// Connect to DB
|
||||
// --------------------
|
||||
$host = (string) ($applicationSettings->DatabaseServer ?? '');
|
||||
$database = (string) ($applicationSettings->DatabaseName ?? '');
|
||||
$user = (string) ($applicationSettings->DatabaseUser ?? '');
|
||||
$pass = (string) ($applicationSettings->DatabasePassword ?? '');
|
||||
|
||||
if ($host === '' || $database === '' || $user === '') {
|
||||
fail($logs, "Missing DB settings in settings.xml (DatabaseServer/DatabaseName/DatabaseUser).");
|
||||
}
|
||||
|
||||
try {
|
||||
$dsn = "mysql:host={$host};dbname={$database};charset=utf8mb4";
|
||||
$db = new PDO($dsn, $user, $pass, [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
fail($logs, "Unable to connect to the database: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// Find view_*.php files
|
||||
// --------------------
|
||||
$dirFiles = scandir(__DIR__) ?: [];
|
||||
$viewFiles = array_values(array_filter($dirFiles, function ($f) {
|
||||
if (pathinfo($f, PATHINFO_EXTENSION) !== 'php')
|
||||
return false;
|
||||
if (strpos($f, 'view_') !== 0)
|
||||
return false;
|
||||
return is_file(__DIR__ . '/' . $f);
|
||||
}));
|
||||
|
||||
if (!$viewFiles) {
|
||||
logLine($logs, "⚠️ No view definition files found (expected <code>view_*.php</code>). Nothing to do.");
|
||||
renderPage($logs, true);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// Create views
|
||||
// --------------------
|
||||
$created = 0;
|
||||
$failed = 0;
|
||||
|
||||
foreach ($viewFiles as $file) {
|
||||
$viewName = pathinfo($file, PATHINFO_FILENAME);
|
||||
logLine($logs, "Processing <strong>" . htmlspecialchars($viewName, ENT_QUOTES) . "</strong>...");
|
||||
|
||||
$SQL = null;
|
||||
|
||||
try {
|
||||
$result = include __DIR__ . '/' . $file;
|
||||
if ($result === false) {
|
||||
$failed++;
|
||||
logLine($logs, "❌ Failed to include <code>" . htmlspecialchars($file, ENT_QUOTES) . "</code>. Skipping.");
|
||||
continue;
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
$failed++;
|
||||
logLine($logs, "❌ Exception including <code>" . htmlspecialchars($file, ENT_QUOTES) . "</code>: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Drop then create
|
||||
try {
|
||||
$db->exec("DROP VIEW IF EXISTS `{$viewName}`");
|
||||
} catch (PDOException $e) {
|
||||
// Non-fatal; keep going
|
||||
logLine($logs, "⚠️ Could not drop <code>{$viewName}</code>: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
|
||||
try {
|
||||
runSQL($db, $SQL, $viewName, $logs);
|
||||
$created++;
|
||||
logLine($logs, "✅ <code>{$viewName}</code> was created.");
|
||||
} catch (Throwable $e) {
|
||||
$failed++;
|
||||
logLine($logs, "❌ Error creating <code>{$viewName}</code>: " . htmlspecialchars($e->getMessage(), ENT_QUOTES));
|
||||
}
|
||||
}
|
||||
|
||||
logLine($logs, "<br/><strong>{$created}</strong> views created. <strong>{$failed}</strong> failed.");
|
||||
renderPage($logs, $failed === 0);
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_dropdowns as
|
||||
|
||||
select dropdowns.*,
|
||||
date_format(dropdowntype_created, '%c/%e/%Y %l:%i %p') as dropdowntype_created_verbose,
|
||||
date_format(dropdowntype_changed, '%c/%e/%Y %l:%i %p') as dropdowntype_changed_verbose,
|
||||
dropdowntypes.*
|
||||
|
||||
from dropdowns
|
||||
|
||||
join dropdowntypes
|
||||
on dropdowntypes.dropdowntype_serial = dropdowns.dropdown_dropdowntype
|
||||
|
||||
order by dropdown_dropdowntype, dropdown_value";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_dropdowntypes as
|
||||
|
||||
select dropdowntypes.*,
|
||||
date_format(dropdowntype_created, '%c/%e/%Y %l:%i %p') as dropdowntype_created_verbose,
|
||||
date_format(dropdowntype_changed, '%c/%e/%Y %l:%i %p') as dropdowntype_changed_verbose
|
||||
|
||||
from dropdowntypes
|
||||
|
||||
order by dropdowntype_title";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_journal as
|
||||
|
||||
select journal.*,
|
||||
date_format(journal.journal_timestamp, '%m/%d/%Y %l:%i %p') as journal_timestamp_verbose
|
||||
from journal
|
||||
order by journal_timestamp desc";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_notes as
|
||||
|
||||
select notes.*,
|
||||
date_format(note_timestamp, '%c/%e/%Y %l:%i %p') as note_timestamp_verbose
|
||||
from notes
|
||||
order by note_type, note_reference, note_timestamp desc";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_popovers as
|
||||
|
||||
select popovers.*,
|
||||
|
||||
date_format(popover_created, '%c/%e/%Y %l:%i %p') as popover_created_verbose,
|
||||
date_format(popover_changed, '%c/%e/%Y %l:%i %p') as popover_changed_verbose
|
||||
|
||||
from popovers
|
||||
|
||||
order by popover_title";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_reports as
|
||||
|
||||
select reports.*,
|
||||
|
||||
date_format(report_created, '%c/%e/%Y %l:%i %p') as report_created_verbose,
|
||||
date_format(report_changed, '%c/%e/%Y %l:%i %p') as report_changed_verbose
|
||||
|
||||
from reports
|
||||
|
||||
order by report_description";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_users as
|
||||
|
||||
select users.*,
|
||||
date_format(user_login, '%c/%e/%Y %l:%i %p') as user_login_verbose,
|
||||
date_format(user_created, '%c/%e/%Y %l:%i %p') as user_created_verbose,
|
||||
date_format(user_changed, '%c/%e/%Y %l:%i %p') as user_changed_verbose
|
||||
from users
|
||||
|
||||
order by users.user_name";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_cities as
|
||||
|
||||
select cities.*,
|
||||
date_format(city_created, '%c/%e/%Y %l:%i %p') as city_created_verbose,
|
||||
date_format(city_changed, '%c/%e/%Y %l:%i %p') as city_changed_verbose
|
||||
|
||||
from cities ";
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_commercial_licenses as
|
||||
|
||||
select commercial_license_serial, commercial_license_code, commercial_license_number, commercial_license_applicant_id,
|
||||
commercial_license_florida_residency, commercial_license_issued_to, commercial_license_scope,
|
||||
commercial_license_begin_date, commercial_license_expire_date, commercial_license_company_or_last_name,
|
||||
commercial_license_county, commercial_license_endorsement_expiration_date,
|
||||
commercial_license_endorsement_number, commercial_license_total_tag_qty,
|
||||
|
||||
date_format(commercial_license_begin_date, '%c/%e/%Y') as commercial_license_begin_date_verbose,
|
||||
date_format(commercial_license_expire_date, '%c/%e/%Y') as commercial_license_expire_date_verbose,
|
||||
|
||||
counties.dropdown_serial as commercial_license_counties_serial,
|
||||
licensecodes.license_serial as commercial_license_type_serial,
|
||||
licensecodes.license_description as commercial_license_type_code_verbose
|
||||
|
||||
from fwc_commercial_licenses
|
||||
|
||||
join dropdowns as counties
|
||||
on counties.dropdown_value = fwc_commercial_licenses.commercial_license_county
|
||||
|
||||
join fwc_commercial_license_codes as licensecodes
|
||||
on licensecodes.license_code = fwc_commercial_licenses.commercial_license_code";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_countycodes as
|
||||
|
||||
select countycodes.*,
|
||||
date_format(countycode_created, '%c/%e/%Y %l:%i %p') as countycode_created_verbose,
|
||||
date_format(countycode_changed, '%c/%e/%Y %l:%i %p') as countycode_changed_verbose
|
||||
|
||||
from countycodes ";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_exportjobs as
|
||||
|
||||
select exportjobs.*,
|
||||
date_format(exportjob_created, '%c/%e/%Y %l:%i %p') as exportjob_created_verbose,
|
||||
date_format(exportjob_completed, '%c/%e/%Y %l:%i %p') as exportjob_completed_verbose
|
||||
|
||||
from exportjobs";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_historycodes as
|
||||
|
||||
select historycodes.*,
|
||||
date_format(historycode_created, '%c/%e/%Y %l:%i %p') as historycode_created_verbose,
|
||||
date_format(historycode_changed, '%c/%e/%Y %l:%i %p') as historycode_changed_verbose
|
||||
|
||||
from historycodes ";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_politicalparties as
|
||||
|
||||
select politicalparties.*,
|
||||
date_format(politicalparty_created, '%c/%e/%Y %l:%i %p') as politicalparty_created_verbose,
|
||||
date_format(politicalparty_changed, '%c/%e/%Y %l:%i %p') as politicalparty_changed_verbose
|
||||
|
||||
from politicalparties ";
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_racecodes as
|
||||
|
||||
select racecodes.*,
|
||||
date_format(racecode_created, '%c/%e/%Y %l:%i %p') as racecode_created_verbose,
|
||||
date_format(racecode_changed, '%c/%e/%Y %l:%i %p') as racecode_changed_verbose
|
||||
|
||||
from racecodes ";
|
||||
?>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_recreational_licenses as
|
||||
|
||||
select fwc_recreational_licenses.*,
|
||||
|
||||
date_format(fwc_recreational_licenses.license_start_date, '%c/%e/%Y') as license_start_date_verbose,
|
||||
date_format(fwc_recreational_licenses.license_expire_date, '%c/%e/%Y') as license_expire_date_verbose,
|
||||
|
||||
counties.dropdown_serial as license_counties_serial,
|
||||
licensetypes.dropdown_serial as license_type_serial
|
||||
|
||||
from fwc_recreational_licenses
|
||||
|
||||
join dropdowns as counties
|
||||
on counties.dropdown_value = fwc_recreational_licenses.license_county
|
||||
|
||||
join dropdowns as licensetypes
|
||||
on licensetypes.dropdown_value = fwc_recreational_licenses.license_type";
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
$SQL = "create view view_voters as
|
||||
|
||||
select voters.*,
|
||||
date_format(voters.voter_record_created, '%c/%e/%Y %l:%i %p') as voter_record_created_verbose,
|
||||
date_format(voters.voter_registration_date, '%c/%e/%Y %l:%i %p') as voter_registration_date_verbose,
|
||||
date_format(voters.voter_birth_date, '%c/%e/%Y %l:%i %p') as voter_birth_date_verbose,
|
||||
|
||||
CONCAT_WS(', ', voters.voter_residence_address_1,
|
||||
CONCAT_WS(', ', voters.voter_residence_city, voters.voter_residence_state, voters.voter_residence_zipcode ) ) as voter_address_verbose
|
||||
|
||||
-- racecodes.racecode_description as voter_race_code_verbose
|
||||
-- countycodes.countycode_name as voter_county_code_verbose
|
||||
|
||||
|
||||
from voters
|
||||
|
||||
-- left join racecodes
|
||||
-- on racecodes.racecode_serial = voters.voter_race
|
||||
|
||||
-- left join countycodes
|
||||
-- on countycodes.countycode_code = voters.voter_county_code";
|
||||
?>
|
||||
Reference in New Issue
Block a user