Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while using sqlite database #82

Open
sricharanchandrasekar opened this issue Aug 28, 2014 · 6 comments
Open

Error while using sqlite database #82

sricharanchandrasekar opened this issue Aug 28, 2014 · 6 comments

Comments

@sricharanchandrasekar
Copy link

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

@aik099
Copy link
Collaborator

aik099 commented Aug 28, 2014

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?

@Vidzz
Copy link

Vidzz commented Aug 28, 2014

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();
    }

@aik099
Copy link
Collaborator

aik099 commented Aug 28, 2014

@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?

@aik099
Copy link
Collaborator

aik099 commented Aug 28, 2014

I see you've made a fix, please submit it in PR (pull request) format.

@sricharanchandrasekar
Copy link
Author

@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 .

@aik099
Copy link
Collaborator

aik099 commented Jun 7, 2015

@Vidzz can you please send a PR with a fix?

killua99 pushed a commit to killua99/xhprof that referenced this issue Nov 22, 2017
killua99 pushed a commit to killua99/xhprof that referenced this issue Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants