Error while using sqlite database
Encountered the following errors when used sqlite database. I used the following configuration in the config:
$_xhprof['dbtype'] = 'sqlite:/path_to_folder/db_name'; $_xhprof['dbhost'] = ''; $_xhprof['dbuser'] = ''; $_xhprof['dbpass'] = ''; $_xhprof['dbname'] = 'db_name'; $_xhprof['dbadapter'] = 'Pdo';
There is no username and password for the sqlite.
The following error was returned:
Call to a member function fetch() on a non-object in xhprof_lib/utils/Db/Pdo.php
I guess there is line number too in that error message that you missed to report? While you're at it can you please link to corresponding code line on GitHub?
Actually tried modifying the Pdo.php as
public function connect()
{
if ($this->config['dbtype'] == 'sqlite')
{
$connectionString = $this->config['dbtype'] .':'.$this->config['dbname'];
}
else
{
$connectionString = $this->config['dbtype'] . ':host=' . $this->config['dbhost'] . ';dbname=' . $this->config['dbname'];
}
So that when the sqlite is required, there isn't necessity to provide the username and password. Also, the number that was linked was the return statement in the below snippet
public static function getNextAssoc($resultSet)
{
return $resultSet->fetch();
}
@Vidzz can you please use fenced blocks (see https://help.github.com/articles/github-flavored-markdown#syntax-highlighting) to enable code highlighting in your comments?
I see you've made a fix, please submit it in PR (pull request) format.
@aik099 Sorry for missing the line number. The error occurred in the module getNextAssoc of the xhprof_lib/utils/Db/Pdo.php file as mentioned by @Vidzz .
@Vidzz can you please send a PR with a fix?