function SQLX_SelectIntoTemp($cols, $from, $into) { // this is a postgres version global $dbconn; $sql = "SELECT " . $cols . " INTO TEMPORARY " . $into . " FROM " . $from; SQL2($sql, $dbconn); }
function DoTests(&$steps) { $this->error = ''; // If they manually forced a rollback to an earlier step, // we will catch it below $rb = gp('stepreset', '-1'); // look for flags that indicate manual approval of steps if (gp('pgconfig') == 1) { sessionSet('pgconfig', true); } if (gp('pgsuper') == 1) { sessionSet('pgsuper', true); } // If they provided credentials, try to post them if (gpExists('loginUID')) { if (substr(strtolower(gp('loginUID')), 0, 5) == 'andro') { ErrorAdd("Superuser account may not begin with 'andro'"); } else { SessionSet('xUID', gp('loginUID')); SessionSet('xPWD', gp('loginPWD')); } } $finished = false; foreach ($steps as $current_step => $step) { switch ($current_step) { case 0: if (!function_exists('pg_connect')) { $finished = true; } break; case 1: // If forcing rollback to here, clear user credentials if ($rb == 1) { SessionUnset('xUID'); SessionUnSet('xPWD'); } // Test if they gave us uid/pwd and if it works if (SessionGet('xUID') == '') { $finished = true; } else { $cs = SQL_ConnString(SessionGet('xUID'), SessionGet('xPWD'), 'postgres'); $this->dbx = @pg_connect($cs); if (!$this->dbx) { $this->error = "Could Not Connect with that Username/Password"; $finished = true; } } break; case 2: // Since we got a connection, try to get versions $res = SQL2("Select version()", $this->dbx); $row = SQL_Fetch_Array($res); $x = explode(' ', $row['version']); $this->pgversion = $x[0] . ' ' . $x[1]; $vers = explode('.', $x[1]); $vers = $vers[0] . '.' . $vers[1]; if ($vers < 8.1) { $finished = true; } break; case 3: if ($rb == 3) { $this->andro = 1; $finished = true; break; } $cs = SQL_ConnString(SessionGet('xUID'), SessionGet('xPWD'), 'andro'); $this->dba = @pg_connect($cs); if (!$this->dba) { $finished = true; $this->andro = 0; } else { pg_close($this->dba); $file = $GLOBALS['AG']['dirs']['generated'] . 'ddmodules.php'; if (!file_exists($file)) { $finished = true; $this->andro = 1; } } break; case 4: // Initialize the node manager SessionSet('UID', SessionGet('xUID')); SessionSet('PWD', SessionGet('xPWD')); scDBConn_Push(); $dir_pub = realpath(dirname(__FILE__) . '/../..'); if (strpos(ArraySafe($_ENV, 'OS', ''), 'indows') !== false) { $dir_pub = str_replace("\\", "\\\\", $dir_pub); } $row = array('webpath' => 'DEFAULT', 'dir_pub' => $dir_pub, 'description' => 'Default Web Path'); $table_dd = dd_TableRef('webpaths'); SQLX_UpdateorInsert($table_dd, $row); /* $table_dd=dd_TableRef('nodes'); $row=array( 'node'=>'DHOST2' ,'description'=>"Andromeda Master Node" ,'node_url'=>'dhost2.secdat.com' ); SQLX_UpdateorInsert($table_dd,$row); $row=array( 'node'=>'LOCAL' ,'description'=>"Local Node" ,'node_url'=>'localhost' ); SQLX_UpdateorInsert($table_dd,$row); */ $table_dd = dd_TableRef('applications'); $row = array('application' => 'andro', 'description' => "Andromeda Node Manager", 'appspec' => 'andro.dd.yaml', 'node' => 'LOCAL', 'webpath' => 'DEFAULT'); SQLX_UpdateorInsert($table_dd, $row); scDBConn_Pop(); SessionSet('UID', 'andro'); SessionSet('PWD', 'andro'); break; case 5: break; default: $finished = true; } // if we are clear, stop now if ($finished) { break; } } for ($x = 0; $x < $current_step; $x++) { $steps[$x][0] = true; } return $current_step; }