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

Prefix added to join aliases #163

Open
m-mohr opened this issue Apr 29, 2017 · 1 comment
Open

Prefix added to join aliases #163

m-mohr opened this issue Apr 29, 2017 · 1 comment

Comments

@m-mohr
Copy link

m-mohr commented Apr 29, 2017

When using a table prefix and join aliases, the prefix gets added to the aliases. I think this is a bug.

This example code:

$dbConfig = array(
	'driver'    => $config['dbsystem'],
	'host'      => $config['host'],
	'database'  => $config['database'],
	'username'  => $config['dbuser'],
	'password'  => $config['dbpw'],
	'charset'   => 'utf8mb4',
	'collation' => 'utf8mb4_unicode_ci',
	'prefix'    => $config['dbprefix'] // This is 'v_'
);
$db = new \Pixie\Connection($config['dbsystem'], $dbConfig, 'SQL');
\SQL::table(array('messages' => 'messages'))->leftJoin(array('user', 'alias'), "alias.id", '=', "messages.user_id")->get();

would generate something like this:
SELECT * FROM v_messages AS messages LEFT JOIN v_user AS v_alias ON v_alias.id = v_messages.user_id
but I think
SELECT * FROM v_messages AS messages LEFT JOIN v_user AS alias ON alias.id = messages.user_id
would be the logically expected version.

@aliakbarazizi
Copy link

i use db::raw for solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants