Com_fabrik_err_join_to_other_db

Status
Not open for further replies.

Fred04

Member
I use a connection to an alternative database.

when I display a list that refer to this database it is ok
when I want to display a list that includes joins and refer to this datababse then I have the error message:
COM_FABRIK_ERR_JOIN_TO_OTHER_DB

My previous githhub level was Fabrik-fabrik-3.0.5-860 (July 17) and it was ok except that I had to comment out the line starting with

USER JOIN ON NON-JOOMLA in the file com_fabrik/model/list

I no longer find this line in the current Github and instead I have the problem described before.
 
friendly bump

still impossible to edit / display a list with a join and using an alternative connection/database
 
friendly bump

can anyone help? I'm sure I'm not the only one using list pointing to an alternative connection
 
Strangely enough I had to remove this chunk of code today on my dev server as it wasn't happy about both !J and Fabrik using the identical IP Address.

Around 3221 I pulled out the If statement.

Code:
if (!($thisCn->host == $conf->get('host') .......

I only had this problem today though and haven't investigated it further yet.
 
Fred, are you talking about cross database joins, i.e. you have a list on connection A, and it tries to use a join to a table on connect B?

If so, that won't work, we don't support cross database joining yet.

-- hugh
 
What puzzles me here is that error should only be pitched if the join involves the J! users table. The code that pitches it (and the test that Felix mentioned) is inside this test:

PHP:
			if ($join->table_join == '#__users' || $join->table_join == $prefix . 'users')

Although I'm not quite sure why we only test for the users table, as we don't support cross database joining at all.

So ... do you have a user element on any of your forms which reside on your other connection? If so, that'll trigger this, because user elements are just an extension of the database join element class, that create a join to #__users on the J! site connection.

-- hugh
 
Hello Cheesegrits,

actually yes, I have a link to the J! users table but not in my list 'join' setting but in a 'user' element.

Based on my new investigation I will describe the problem as follow

I use 2 connections: connection A (default joomla/fabrik) and connection B (my personal database)

I have a list using connection B. In this list I have a 'user' element. I don't need to specify a 'connection' in this plugin since it use by defaut the default connection A.
In this scenario, I do a agree that I have a cross database join BUT it used to work very well in previous Github version.

PS: I have the same problem if instead of using the 'user' plugin I use a databasejoin element with a reference to my default connection. It also used to work before.

Can you help?
 
Workaround:
in your second database create a MySQL view pointing to db1.#_users and use this view in your dbjoin element.
 
Any idea? It used to work before

Nope, cross database joining has never worked. It might not have tossed an error if (I think) you were only displaying the ID, not (say) username or name, or not displaying the user element in the list. But if you try and display a user table field like name in your List display, it's going to barf.

As troester said, the best workaround is to have a MySQL view on your second database, which just does "SELECT * FROM your_joomla_database.jos_users" (or whatever it's called), and use a regular join element to it, with an eval'ed default of:

PHP:
$user = JFactory::getUser();
return $user->get('id');

You should be able to change your existing 'user' element to a 'join' to your view on the second connection without breaking anything.

-- hugh
 
i was not displaying the user element in the list (only in the form).
Anyway, I agree with the proposed solution, I will create the view
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top