TDbException

Description

TDbCommand failed to execute the query SQL "SELECT sp.*, spd.title, spd.short_description, spd.description, spd.warranty, CONCAT_WS('; ', LOWER(sp.code), LOWER(spd.title), LOWER(spd.short_description), LOWER(spd.description)) AS keywords, CAST(REPLACE(REPLACE(REPLACE(sptp_wys.property_value, ",", "."), "cm", ""), " ", "") as DECIMAL(11,2)) as wysokosc, CAST(REPLACE(REPLACE(REPLACE(sptp_szer.property_value, ",", "."), "cm", ""), " ", "") as DECIMAL(11,2)) as szerokosc, IF(new_price = 0, price, new_price) as cena, CAST(REPLACE(REPLACE(REPLACE(sptp_dl.property_value, ",", "."), "cm", ""), " ", "") as DECIMAL(11,2)) as dlugosc, IF(sptp_dl.property_value IS NULL, 1, 0) as sold_for_pieces, (SELECT spc1.category FROM shop_product_categories spc1 INNER JOIN shop_category_to_product sctp1 ON sctp1.id_category = spc1.id_category WHERE spc1.parent_category = 0 AND sctp1.id_product = sp.id_product LIMIT 1) as main_category, (SELECT spc2.category FROM shop_product_categories spc2 INNER JOIN shop_category_to_product sctp2 ON sctp2.id_category = spc2.id_category WHERE spc2.parent_category != 0 AND sctp2.id_product = sp.id_product LIMIT 1) as subcategory, spp.name as producer_name, spp.priority as producer_priority FROM shop_products sp LEFT JOIN shop_product_details spd ON sp.id_product=spd.id_product LEFT JOIN shop_product_producers spp ON sp.producer=spp.producer_id LEFT JOIN shop_property_to_product sptp_dl ON sptp_dl.id_product=sp.id_product AND sptp_dl.id_p_property = 1 LEFT JOIN shop_property_to_product sptp_wys ON sptp_wys.id_product=sp.id_product AND sptp_wys.id_p_property = 2 LEFT JOIN shop_property_to_product sptp_szer ON sptp_szer.id_product=sp.id_product AND sptp_szer.id_p_property = 3 WHERE trash!='y' AND producer = ORDER BY (spp.priority) DESC,(code) ASC LIMIT 75": SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY (spp.priority) DESC,(code) ASC LIMIT 75' at line 20

Source File

/home/web/sites/gzyms.pl/framework_3_1_10/Data/TDbCommand.php (230)

0219:         try
0220:         {
0221:             // Prado::trace('Query: '.$this->getDebugStatementText(), 'System.Data');
0222:             if($this->_statement instanceof PDOStatement)
0223:                 $this->_statement->execute();
0224:             else
0225:                 $this->_statement=$this->getConnection()->getPdoInstance()->query($this->getText());
0226:             return new TDbDataReader($this);
0227:         }
0228:         catch(Exception $e)
0229:         {
0230: throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText());
0231: } 0232: } 0233: 0234: /** 0235: * Executes the SQL statement and returns the first row of the result. 0236: * This is a convenient method of {@link query} when only the first row of data is needed. 0237: * @param boolean whether the row should be returned as an associated array with 0238: * column names as the keys or the array keys are column indexes (0-based). 0239: * @return array the first row of the query result, false if no result. 0240: * @throws TDbException execution failed 0241: */ 0242: public function queryRow($fetchAssociative=true)

Stack Trace

#0 /home/web/sites/gzyms.pl/framework_3_1_10/Data/DataGateway/TDataGatewayCommand.php(304): TDbCommand->query()
#1 /home/web/sites/gzyms.pl/framework_3_1_10/Data/ActiveRecord/TActiveRecordGateway.php(247): TDataGatewayCommand->findAllBySql(Object(TActiveRecordCriteria))
#2 /home/web/sites/gzyms.pl/framework_3_1_10/Data/ActiveRecord/TActiveRecord.php(678): TActiveRecordGateway->findRecordsBySql(Object(ShopProductsRecord), Object(TActiveRecordCriteria))
#3 /home/web/sites/gzyms.pl/protected/Pages/Produkty.php(184): TActiveRecord->findAllBySql('SELECT\n\t\t\t\t\tsp....')
#4 /home/web/sites/gzyms.pl/protected/Pages/Produkty.php(50): Produkty->productsList()
#5 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TControl.php(1313): Produkty->onPreRender(NULL)
#6 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TPage.php(220): TControl->preRenderRecursive()
#7 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TPage.php(198): TPage->processNormalRequest(Object(THtmlWriter))
#8 /home/web/sites/gzyms.pl/framework_3_1_10/Web/Services/TPageService.php(498): TPage->run(Object(THtmlWriter))
#9 /home/web/sites/gzyms.pl/framework_3_1_10/Web/Services/TPageService.php(444): TPageService->runPage(Object(Produkty), Array)
#10 /home/web/sites/gzyms.pl/framework_3_1_10/TApplication.php(1095): TPageService->run()
#11 /home/web/sites/gzyms.pl/framework_3_1_10/TApplication.php(382): TApplication->runService()
#12 /home/web/sites/gzyms.pl/index.php(49): TApplication->run()
#13 {main}
2019-10-18 09:54 Apache/2.4.39 (BrainyCP - Sasha Bury) OpenSSL/1.0.2r-fips PHP/7.2.19 PRADO/3.1.10