? ? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
12 Feb 2015

This is related to #5144. @jaworskimatt says that he has issues with several instances of Jomsocial writing to the DB at the same time and thus messing up the user-group-mapping table. His proposal was a very complex set of several queries and comparisons. I countered that I rather want that to happen in one query and that that should be possible for our database query class.

So I looked at JDatabaseQuery and it exactly states that you can insert more than one row at a time by simply calling JDatabaseQuery::values() several times. I looked at the existing code and saw that it claims that the several different queries are due to cross-database support. I call bullocks on that one. Every serious DBMS out there supports adding more than one row at a time. If there are problems in our implementation regarding this, then it is because of the JDatabaseQuery class of that RDBMS.

If, for some strange reason, I'm actually wrong and there is a system out there that does not support several rows in one insert, then we can close this PR, but have to open a new one that changes JDatabaseQuery to make it clear that it can only do one row per insert.

In any case, for everything else I refer to #5144

avatar Hackwar Hackwar - open - 12 Feb 2015
avatar joomla-cms-bot joomla-cms-bot - change - 12 Feb 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 12 Feb 2015

The only platform I know of with limitations is SQL Server which defaults to only allowing 1000 rows to be inserted in this manner (and is hacked around in Smart Search)

avatar Hackwar
Hackwar - comment - 12 Feb 2015

First of all, why is this throwing an error in 2 PHP versions and passes in the other 2? Second: If that is the case, @mbabker, I think we are good here. If someone has a site with more than 1000 usergroups and attaches more than 1000 groups to a user, that is effectively their problem. Our system is simply not made for such a scenario. BTW: I doubt that it would work with our current implementation. That would require 1000 queries and I would expect PHP to bail out before we reach that last 1000th query.

avatar brianteeman
brianteeman - comment - 12 Feb 2015

It will work but only if you increase the php_max_vars but as you say that
is a user problem

On 12 February 2015 at 14:38, Hannes Papenberg notifications@github.com
wrote:

First of all, why is this throwing an error in 2 PHP versions and passes
in the other 2? Second: If that is the case, @mbabker
https://github.com/mbabker, I think we are good here. If someone has a
site with more than 1000 usergroups and attaches more than 1000 groups to a
user, that is effectively their problem. Our system is simply not made for
such a scenario. BTW: I doubt that it would work with our current
implementation. That would require 1000 queries and I would expect PHP to
bail out before we reach that last 1000th query.


Reply to this email directly or view it on GitHub
#6065 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar zero-24 zero-24 - change - 12 Feb 2015
Category Libraries
avatar zero-24
zero-24 - comment - 12 Feb 2015

@Hackwar Travis looks strange. It fails for PHP 5.3 and 5.4 but is success for 5.5 and 5.6: https://travis-ci.org/joomla/joomla-cms/builds/50471803

Issue for PHP 5.3 and 5.4

There was 1 error:
1) JTableUserTest::testStoreNewUser
PDOException: SQLSTATE[HY000]: General error: 1 near ",": syntax error
/home/travis/build/joomla/joomla-cms/libraries/joomla/database/driver/pdo.php:704
/home/travis/build/joomla/joomla-cms/libraries/joomla/table/user.php:340
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/joomla/table/JTableUserTest.php:58
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="http://issues.joomla.org/tracker/joomla-cms/6065">issues.joomla.org/joomla-cms/6065</a>.</sub>
avatar mbabker
mbabker - comment - 16 Feb 2015

The failure is due to SQLite < 3.7.11 not supporting multiple inserts in a single query (see http://stackoverflow.com/questions/19340535/multiple-inserts-not-working-with-sqlite-3) and per PHP's changelog (http://php.net/ChangeLog-5.php), a version of SQLite supporting it wasn't introduced until PHP 5.5.11. As our test suite is running on SQLite, the only way around the error for the moment is to just skip the test in unsupported environments. We'll need to add a workaround for this condition in JDatabaseQuerySqlite and/or JDatabaseDriverSqlite to force the library code to break the query up for environments where this feature isn't supported.

avatar fastslack
fastslack - comment - 31 Mar 2015

@test ok

I have this issue just after JomSocial installation and then go to 'home' on frontend (just after first use of jomsocial extension). Seems that the extension delete the current user groups. I compared the two databases, the first database after login, the second going to jomsocial home. This is the diff of #__user_usergroup_map table:

@@ -111497,12 +111507,7 @@
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(911, 34);
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(912, 2);
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(912, 32);
-INSERT INTO `bzjo9_user_usergroup_map` VALUES(914, 2);
-INSERT INTO `bzjo9_user_usergroup_map` VALUES(914, 8);
-INSERT INTO `bzjo9_user_usergroup_map` VALUES(914, 19);
-INSERT INTO `bzjo9_user_usergroup_map` VALUES(914, 20);
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(914, 21);
-INSERT INTO `bzjo9_user_usergroup_map` VALUES(914, 22);
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(919, 2);
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(919, 13);
 INSERT INTO `bzjo9_user_usergroup_map` VALUES(921, 10);
$ php -v
PHP 5.5.9-1ubuntu4.6 (cli) (built: Feb 13 2015 19:17:11) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0 Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
avatar roland-d roland-d - alter_testresult - 4 Sep 2015 - fastslack: Tested successfully
avatar Hackwar Hackwar - change - 6 Jan 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-01-06 11:32:45
Closed_By Hackwar
avatar Hackwar Hackwar - close - 6 Jan 2016
avatar joomla-cms-bot joomla-cms-bot - change - 6 Jan 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment