Пример #1
0
if (!$host) {
    trigger_error("Specify Database Host");
    return;
}
if (!$user) {
    trigger_error("Specify Database User");
    return;
}
//if ( !$password ) { trigger_error ( "Specify Database Type" ); return; }
if (!$baseurl) {
    trigger_error("Specify Base URL");
    return;
}
global $g_debug_mode;
$g_debug_mode = true;
$test = new reportico_datasource();
$test->driver = $type;
$test->user_name = $user;
$test->password = $password;
$test->host_name = $host;
$test->database = $name;
$test->server = $server;
$test->protocol = $protocol;
$test->connect(true);
if ($test->connected) {
    handle_debug("Connection to Database succeeded", 0);
} else {
    trigger_error("Connection to Database failed");
}
$proj_parent = find_best_location_in_include_path("projects");
$proj_dir = $proj_parent . "/{$project}";
Пример #2
0
	function fetch_column_attributes()
	{
		$conn = $this->datasource->ado_connection; 
		//$a = new reportico($this->datasource);
		//$old_database = $a->database;

		$datadict = false;
		reset($this->columns);
		$lasttab = "";
		while ( $d = key($this->columns) )
		{
			$value =& $this->columns[$d];

			if ( array_key_exists( $value->query_name, $this->clone_columns ) )
			{
				$value->column_type = 
					$this->clone_columns[$value->query_name][0];
				$value->column_length = 
					$this->clone_columns[$value->query_name][1];
				
			}
			else if ( $value->table_name )
			{
				if ( $lasttab != $value->table_name )
				{
					$datadict = $this->datasource->ado_connection->MetaColumns($value->table_name);
					if ( !$datadict )
					{
						// echo "Data Dictionary Attack Failed Table $value->table_name\n";
						// echo "Error ".$this->datasource->ado_connection->ErrorMsg()."<br>";
						//die;
					}
				}
				foreach ( $datadict as $k => $v )
				{

					if ( strtoupper(trim($k)) == strtoupper($value->column_name ) )
					{
						//$coldets = $datadict[strtoupper($value->column_name)];
						$coldets = $datadict[$k];
						$value->column_type = 
								reportico_datasource::map_column_type(
										$this->datasource->driver, 
										$datadict[$k]->type);

						if ( strtoupper($value->column_type) == "INTEGER" )
							$value->column_length = 0;
						else if ( strtoupper($value->column_type) == "SMALLINT" )
							$value->column_length = 0;
						else
							$value->column_length = (int)$datadict[$k]->max_length;
						break;
					}
				}
			}
			$lasttab = $value->table_name;
			next($this->columns);
		}
	}
Пример #3
0
            find_file_to_include("config.php", $configfile);
            if ($configfile) {
                include_once $configfile;
            }
            $g_project = false;
            $g_menu = false;
            $g_menu_title = "";
            $old_error_handler = set_error_handler("ErrorHandler");
            handle_error("Configuration Definition file config.php not found in project {$project}", E_USER_ERROR);
        }
        $g_project = $project;
        $g_menu = $menu;
        $g_menu_title = $menu_title;
        return $project;
    }
}
set_project_environment();
$datasource = new reportico_datasource();
$datasource->connect();
$imagesql = $_REQUEST["imagesql"];
if (!preg_match("/^select/i", $imagesql)) {
    return false;
}
$rs = $datasource->ado_connection->Execute($imagesql) or die("Query failed : " . $ado_connection->ErrorMsg());
$line = $rs->FetchRow();
//header('Content-Type: image/gif');
foreach ($line as $col) {
    $data = $col;
    break;
}
echo $data;