osCommerce / oscommerce2

osCommerce Online Merchant v2.x
http://www.oscommerce.com
MIT License
281 stars 222 forks source link

Professional shops could be knocked out #667

Open tgely opened 3 years ago

tgely commented 3 years ago

https://github.com/osCommerce/oscommerce2/blob/de0e97d15d43ac6a9a6cfb2847134a82a0148f2b/catalog/admin/includes/modules/dashboard/d_orders.php#L46

This query generated the folowing errors in professional shop:

[02-Mar-2021 16:11:29 Europe/Budapest] PHP Fatal error:  Uncaught PDOException: SQLSTATE[70100]: <<Unknown error>>: 1969 Query execution was interrupted (max_statement_time exceeded) in /...../includes/OSC/OM/DbStatement.php:97
Stack trace:
#0 /...../includes/OSC/OM/DbStatement.php(97): PDOStatement->execute(NULL)
#1 /...../includes/OSC/OM/Db.php(250): OSC\OM\DbStatement->execute()
#2 /...../admin/includes/modules/dashboard/d_orders.php(65): OSC\OM\Db->get(Array, Array, Array, Array, 6)
#3 /...../admin/index.php(70): d_orders->getOutput()
#4 {main}
  thrown in /...../includes/OSC/OM/DbStatement.php on line 97 

After some days research ... I have to say the Query is not partitioned and optimatized for large innoDB tables so the first life test caused disappointing experiments with the blank page result when administration tried to log in.

What else the direct query's run result was dead on PhPMyAdmin too.

#2014 - Commands out of sync; you can't run this command now
 select 
  o.orders_id,
  o.customers_name,
  greatest(o.date_purchased, ifnull(o.last_modified, 0)) as date_last_modified,
  s.orders_status_name,
  ot.text as order_total
from 
  osc_orders o,
  osc_orders_total ot,
  osc_orders_status s
where
  o.orders_id = ot.orders_id
--  and o.orders_id > partition_dinamic_limit
  and ot.class = 'ot_total'
  and o.orders_status = s.orders_status_id
  and s.language_id = '2'
  order by date_last_modified desc
  limit 6
;

I have left commented out line in the query for serious oscommercers to be able to get some inspiration for develop serious store.