database icon indicating copy to clipboard operation
database copied to clipboard

ActiveRow: __isset 2.4.6 update masive increase DB information_schema queries count

Open spagr opened this issue 7 years ago • 2 comments

Version: 2.4.6

Bug Description

ActiveRow: __isset generate many queries from db information_schema if checked row doesn´t exist. Attached screenshot shows the difference, left side browser with NDB 2.4.5, right side NDB 2.4.6, same code.

Use case in component with two data source handling :

// Cart Items handler
/** @var ActiveRow $product */
if (isset($product->sessid)) { // Cart table structure
  $quantity = $product->quantity;
  $product = $product->ref('product');
}

Expected Behavior

In version 2.4.5 (left browser) is expected behavior

image

spagr avatar Aug 30 '18 11:08 spagr

related to #196 and @miranovy

dg avatar Aug 30 '18 11:08 dg

@spagr Could you please provide full working example?

I tried to simulate it, but everything seems to be working fine.

For example, when I run test tests/Database/Table/bugs/ActiveRow.__isset.phpt and add another two assertions like this:

test(function () use ($context) {
	$row = $context->table('book')->get(2);
	Assert::same('Jakub Vrana', $row->author->name);
	Assert::true(isset($row->author->name));
	Assert::false(isset($row->author->test));
	Assert::false(isset($row->test));
});

For example function MySqlDriver.getForeignKeys and others are called only once for each table. And the whole structure is not reloaded.

There must be something special in your use case...

EdaCZ avatar Jul 24 '19 00:07 EdaCZ