2 require "../../plugins/php/dbClass3.php";
\r
3 $appName="Northwind";
\r
6 function CreateDbClass() {
\r
8 $oDB = new dbClass();
\r
16 return $oDB->MySqlLogon($appDB, "userid", "password");
\r
19 //$oDB->Dialect="TSQL";
\r
20 //return $oDB->MSSqlLogon("computer/instance", $appDB, "userid", "password");
\r
23 // The connection_string can be empty to use all default parameters, or it can contain one or more parameter settings separated by whitespace. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.
\r
24 // The currently recognized parameter keywords are: host, hostaddr, port, dbname (defaults to value of user), user, password, connect_timeout, options, tty (ignored), sslmode, requiressl (deprecated in favor of sslmode), and service. Which of these arguments exist depends on your PostgreSQL version.
\r
25 //return $oDB->PostgreSqlLogon($connection_string);
\r
28 //$oDB->Dialect="Access";
\r
29 //return $oDB->OdbcLogon("northwindDSN","Northwind","userid","password");
\r
32 //$oDB->Dialect="Oracle";
\r
33 //return $oDB->OracleLogon("XE","northwind","password");
\r
37 function OpenApp($title) {
\r
42 if (!empty($title)) {
\r
43 AppHeader($GLOBALS['appName']."-".$title);
\r
45 $GLOBALS['accessRights']="rw";
\r
46 // CHECK APPLICATION SECURITY HERE (in this example, "r" gives read-only access and "rw" gives read/write access)
\r
47 if (empty($GLOBALS['accessRights']) || !isset($GLOBALS['accessRights']) || substr($GLOBALS['accessRights'],0,1) != "r") {
\r
48 echo "<p class='error'>You do not have permission to access this application";
\r
57 function OpenTableEdit($tabname) {
\r
58 $obj= new TableEditClass();
\r
59 $obj->SetTableName($tabname);
\r
60 $obj->options["XMLprovider"]="ricoQuery.php";
\r
61 $obj->convertCharSet=true; // because sample database is ISO-8859-1 encoded
\r
66 function OpenGridForm($title, $tabname) {
\r
68 if (!OpenApp($title)) {
\r
71 $GLOBALS['oForm']= OpenTableEdit($tabname);
\r
72 $CanModify=($GLOBALS['accessRights'] == "rw");
\r
73 $GLOBALS['oForm']->options["canAdd"]=$CanModify;
\r
74 $GLOBALS['oForm']->options["canEdit"]=$CanModify;
\r
75 $GLOBALS['oForm']->options["canDelete"]=$CanModify;
\r
76 session_set_cookie_params(60*60);
\r
77 $GLOBALS['sqltext']='.';
\r
82 function CloseApp() {
\r
84 if (is_object($oDB)) $oDB->dbClose();
\r
86 $GLOBALS['oForm']=NULL;
\r
90 function AppHeader($hdg) {
\r
91 echo "<h2 class='appHeader'>".str_replace("<dialect>",$GLOBALS['oDB']->Dialect,$hdg)."</h2>";
\r