VPS server

Stimulsoft Reports.PHP discussion
Post Reply
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: VPS server

Post by Lech Kulikowski »

Hello,

You can remove connection string from the report and set it on the server side in the handler.php

Code: Select all

$handler->onBeginProcessData = function ($event) {
  // Current database type: 'XML', 'JSON', 'MySQL', 'MS SQL', 'PostgreSQL', 'Firebird', 'Oracle'
  $database = $event->database;
  // Current connection name
  $connection = $event->connection;
  // Current data source name
  $dataSource = $event->dataSource;
  // Connection string for the current data source
  $connectionString = $event->connectionString;
  // SQL query string for the current data source
  $queryString = $event->queryString;
  
  // You can change the connection string
  //if ($connection == "MyConnectionName")
  //  $event->connectionString = "Server=localhost;Database=test;Port=3306;";
  
  // You can change the SQL query
  //if ($dataSource == "MyDataSource")
  //  $event->queryString = "SELECT * FROM MyTable";
  
  // You can replace the SQL query parameters with the required values
  // For example: SELECT * FROM {Variable1} WHERE Id={Variable2}
  // If the report contains a variable with this name, its value will be used instead of the specified value
  //$event->parameters["Variable1"] = "TableName";
  //$event->parameters["Variable2"] = 10;
  
  return StiResult::success();
  //return StiResult::error("Message for some connection error.");
};
Thank you.
Post Reply