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

tables in query prefixed with database name #1660

Closed
anonymous-matomo-user opened this issue Aug 30, 2010 · 4 comments
Closed

tables in query prefixed with database name #1660

anonymous-matomo-user opened this issue Aug 30, 2010 · 4 comments
Labels
Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@anonymous-matomo-user
Copy link

hello guys,

as you've seen i'm working on an integration of piwik into TYPO3.
Upto piwik 0.6.4 the i could send queries with tablenames prefixed with an different database. Since 0.9.x this is quite complex, as piwik seems to prefix the tables with the database name itself.


$beUserName = Zend_Registry::get('db')->fetchOne(
                        'SELECT username FROM `be_users` WHERE uid = ?',
                        array($beUserId)
            );

But why do i need that feature?

  • TYPO3 has a built in Tablestructure checker, which complains about the dynamically created Piwik tables. Moving these tables to a different DB would solve that.
  • I want to use the API to be compatible with future Piwik versions ;)
@anonymous-matomo-user
Copy link
Author

after taking a look into the code, i assume, that the zend db classes add the "database." before the tablename with the auto escape identifier option.

@robocoder
Copy link
Contributor

Piwik uses the table prefix defined in config.ini.php, eg "piwik_". This is done manually in the SQL using Piwik_Common::prefixTable().

Maybe it's coincidence that your database name and prefix are similar?

@anonymous-matomo-user
Copy link
Author

my settings

dbname = "t3alpha4_3"
tables_prefix = "tx_piwikintegration_"

now i tried to access otherdatabase.be_users and got the following error
table doesn't exists t3alpha4_3.otherdatabase.be_users

I will debug this further on.

Best regards
Kay

@robocoder
Copy link
Contributor

AFAICT there's nothing here to change in Piwik. I've dumped the sql before it's prepare()d in ZF, and it doesn't have the database name prefixed. And I can't find any instances in core or plugins where we explicitly prefix the dbname.

If your dbname is t3alpha4_3, then the following should work if the same dbuser has access to both databases.

Piwik_FetchAll('SELECT * from otherdatabase.tx_piwikintegration_option');

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 1.1 milestone Jul 8, 2014
@mattab mattab added the wontfix label Aug 3, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants