-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Establish initial protocol and database table for derby-timer.jar to …
…send flag settings to server.
- Loading branch information
1 parent
adbf507
commit 4c7fa4c
Showing
12 changed files
with
564 additions
and
255 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
|
||
require_once('inc/sql-script.inc'); | ||
|
||
// If we're working with an unmigrated GPRM database, we may need to create a | ||
// kiosk table. | ||
function create_timer_settings_table() { | ||
run_sql_script('timer-settings'); | ||
} | ||
|
||
|
||
function decode_timer_flags($params) { | ||
global $db; | ||
@create_timer_settings_table(); // Drop and recreate the table each time | ||
foreach ($params as $p => $v) { | ||
if (substr($p, 0, 5) == "flag-") { | ||
$vv = explode(':', $v, 2); | ||
read_single_value('INSERT INTO TimerSettings(kind, key, type, value)' | ||
.' VALUES(:kind, :key, :type, :value)', | ||
array(':kind' => 'flag', | ||
':key' => substr($p, 5), | ||
':type' => $vv[0], | ||
':value' => $vv[1])); | ||
} else if (substr($p, 0, 5) == "desc-") { | ||
read_single_value('UPDATE TimerSettings SET description = :desc' | ||
.' WHERE kind = :kind AND key = :key', | ||
array(':kind' => 'flag', | ||
':key' => substr($p, 5), | ||
':desc' => $v)); | ||
} else if ($p == "ports") { | ||
read_single_value('INSERT INTO TimerSettings(kind, key, value)' | ||
.' VALUES(:kind, :key, :value)', | ||
array(':kind' => 'ports', | ||
':key' => $p, | ||
':value' => $v)); | ||
} else if (substr($p, 0, 7) == "device-") { | ||
read_single_value('INSERT INTO TimerSettings(kind, key, description)' | ||
.' VALUES(:kind, :key, :desc)', | ||
array(':kind' => 'device', | ||
':key' => substr($p, 7), | ||
':desc' => $v)); | ||
} | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
return array( | ||
|
||
"DROP TABLE IF EXISTS TimerSettings", | ||
|
||
"CREATE TABLE TimerSettings (" | ||
." settingid COUNTER," | ||
." kind VARCHAR(20)," // flag, device, or ports | ||
." key VARCHAR(100)," | ||
." type VARCHAR(10)," | ||
." value VARCHAR(100)," | ||
." description VARCHAR(500)," | ||
." pending VARCHAR(100)" // Value change requested | ||
." )", | ||
|
||
"CREATE UNIQUE INDEX PrimaryKey ON TimerSettings(settingid)" | ||
|
||
); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
return array( | ||
|
||
"DROP TABLE IF EXISTS TimerSettings", | ||
|
||
"CREATE TABLE TimerSettings (" | ||
." settingid INTEGER PRIMARY KEY," | ||
." kind VARCHAR(20)," // flag, device, or ports | ||
." key VARCHAR(100)," | ||
." type VARCHAR(10)," | ||
." value VARCHAR(100)," | ||
." description VARCHAR(500)," | ||
." pending VARCHAR(100)" // Value change requested | ||
." )", | ||
|
||
); | ||
|
||
?> |