TDbException

Description

TDbCommand failed to execute the query SQL " select count(Distinct(p.ProductID)) as cnt from tbl_Product as p,tbl_Parent_Child as pc where (p.CategoryID= Or pc.ChildCategoryID=) and p.CategoryID=pc.ParentCategoryID and ProductIsActive='Active' and pc.IsDeleted='No' ": SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Or pc.ChildCategoryID=) and p.CategoryID=pc.ParentCategoryID and ProductIsActive' at line 1

Source File

/home/framework/framework/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/framework/framework/Data/SqlMap/Statements/TMappedStatement.php(398): TDbCommand->query()
#1 /home/framework/framework/Data/SqlMap/Statements/TMappedStatement.php(378): TMappedStatement->runQueryForObject(Object(TDbConnection), Object(TDbCommand), NULL)
#2 /home/framework/framework/Data/SqlMap/TSqlMapGateway.php(73): TMappedStatement->executeQueryForObject(Object(TDbConnection), Array, NULL)
#3 /home/birthcards/public_html/protected/pages/ProductList.php(138): TSqlMapGateway->queryForObject('GetProducts_Cou...', Array)
#4 /home/birthcards/public_html/protected/pages/ProductList.php(31): ProductList->getCount(Array)
#5 /home/framework/framework/Web/UI/TControl.php(1286): ProductList->onLoad(NULL)
#6 /home/framework/framework/Web/UI/TPage.php(210): TControl->loadRecursive()
#7 /home/framework/framework/Web/UI/TPage.php(193): TPage->processNormalRequest(Object(THtmlWriter))
#8 /home/framework/framework/Web/Services/TPageService.php(474): TPage->run(Object(THtmlWriter))
#9 /home/framework/framework/Web/Services/TPageService.php(420): TPageService->runPage(Object(ProductList), Array)
#10 /home/framework/framework/TApplication.php(1066): TPageService->run()
#11 /home/framework/framework/TApplication.php(376): TApplication->runService()
#12 /home/birthcards/public_html/index.php(19): TApplication->run()
#13 {main}
Blog