?

Steps to reproduce the issue

prepare an SQL statement like:
$query = " select TABLE_NAME as TABLENAME, COLUMN_NAME as COLUMNNAME, COLUMN_TYPE as COLUMNTYPE, COLUMN_COMMENT as COLUMNCOMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'demo_database' ORDER BY TABLE_NAME, ORDINAL_POSITION ";
use the jDatabase driver to submit it to your database (MySQL).

Expected result

returning an array of result-objects with all columns for all tables in that database (e.g. demo_database). Each object has the data (tablename, columnname, type, comment) for a specific column.

Actual result

Joomla 3.5.1 : returns as expected
Joomla 3.6.0-rc: returns an array of result-objects, but no data in each object (see output example below). There are as many result-objects as expected, but they are "only titles, no values"

System information (as much as possible)

Windows Server, Apache Server 2.4, PHP 7.0.7, MariaDB 10.0.17

Additional comments

Returning array in Joomla 3.6.0-rc:
Array (
[0] => stdClass Object (
[TABLENAME] =>
[COLUMNNAME] =>
[COLUMNTYPE] =>
[COLUMNCOMMENT] =>
)
[1] => stdClass Object (
[TABLENAME] =>
[COLUMNNAME] =>
[COLUMNTYPE] =>
[COLUMNCOMMENT] =>
)
...

avatar schultz-it-solutions schultz-it-solutions - open - 4 Jul 2016
avatar ggppdk
ggppdk - comment - 4 Jul 2016

use the jDatabase driver to submit it to your database (MySQL).
so which method did you use ?

avatar schultz-it-solutions
schultz-it-solutions - comment - 5 Jul 2016

Not fully sure what you expect as answer...

I use the following procedure (though a bit more complex in reality):

$db = JFactory::getDBO();

$query = " select TABLE_NAME as TABLENAME, COLUMN_NAME as COLUMNNAME, COLUMN_TYPE as COLUMNTYPE, COLUMN_COMMENT as COLUMNCOMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'demo_database' ORDER BY TABLE_NAME, ORDINAL_POSITION ";
$db->setQuery( $query );
$result = $db->execute();
$return = $db->loadObjectList();

avatar ggppdk
ggppdk - comment - 5 Jul 2016

I have never tried or seen such a code:

$result = $db->execute();
$return = $db->loadObjectList();

if the above code ever worked, it is a "side-effect" which you should have never relied on

your code should be:

$return = $db->loadObjectList();
  • you see loadObjectList() both executes and retrieves the data, you would use execute() only for operations such as "update" , "delete", "insert" ....

Can you provide a link to docs or to other text that suggests, using the code the way that you tried ?

  • maybe i have missed it
avatar brianteeman brianteeman - change - 5 Jul 2016
Labels Added: ?
avatar schultz-it-solutions
schultz-it-solutions - comment - 5 Jul 2016

I just checked https://docs.joomla.org/Selecting_data_using_JDatabase
and together with your comment above, I feel I understand better now (thank you) - seems like my misunderstanding of the whole thing.

However, this certainly works without issues in a Joomla 3.5 environment (in fact on a several hundred websites all over the world in most different environments - and since Joomla 2.5).
So I will try this "without" the explicit "execute" statement and get back with the results...

avatar ggppdk
ggppdk - comment - 5 Jul 2016

Looking at the bottom of the document link,

  • i see such usage as you are using originally !

So if there is a such a change,
then it is a B/C break or probably better call it a bug introduced by J3.6.0 RC

avatar ggppdk
ggppdk - comment - 5 Jul 2016

@schultz-it-solutions

But i can not replicate the issue you report

  • i tested with 2 queries

1 query a some DB table
1 query getting data from information_schema

and it worked in both cases

$result = $db->execute();
$return = $db->loadObjectList();

Are the 2 sites identical and only change is the upgrade to J3.6.0 RC?

avatar franzpeter
franzpeter - comment - 5 Jul 2016

@ggppdk: You can use that code for example to get num_rows. It is documented as regular Joomla method.
$db->setQuery($query);
$db->execute();
$num_rows = $db->getNumRows();
print_r($num_rows);
$result = $db->loadRowList();


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11024.

avatar ggppdk
ggppdk - comment - 5 Jul 2016

@franzpeter
yes, i recognized that such usage is allowed

Looking at the bottom of the document link,
i see such usage as you are using originally !

of course you don't need call getNumRows() , if you have already called loadRowList() or loadObjectList ... because you already know how many rows you have

avatar schultz-it-solutions
schultz-it-solutions - comment - 5 Jul 2016

If you like, I can send you an access to a development-site, where you can see the "wrong" behaviour of J3.6.0 (with no other changes)...
just drop me a line at it-solutions at schultz dot ch

avatar schultz-it-solutions
schultz-it-solutions - comment - 7 Jul 2016

I just installed J3.6.0-rc2 - and VOILA, everything works as expected.
So one of the bugfixes between J3.6.0-rc1 and J3.6.0-rc2 actually SOLVED the issue!

I am closing this, though I will investigate what bugfix is responsible for this ...

avatar schultz-it-solutions schultz-it-solutions - close - 7 Jul 2016

Add a Comment

Login with GitHub to post a comment