Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Where is where
Where is where [message #2229] Sat, 18 July 2009 04:22 Go to next message
edortizq is currently offline  edortizq
Messages: 82
Registered: August 2008
Location: Ecuador
Member

I've created a new class (with no phisycal file on db), this class have a select from 4 tables (files .class and .dict attached); when I instance the class the fields in where clause requires must be qualificated, if not, it gives an error on the SQL sentence execution; when the fields are qualificated the where clause of the query dissapears.
That's the query
$object =& singleton::getInstance('evento_informe_resumen_q1');
$_idevento = $fieldarray['idevento'];
$object->sql_orderby = 'descripcionlocalidad';
$object->sql_where .= 'ti.idevento= '.$_idevento.' and tm.idtipomovimiento = 1';
$outarray = $object->getData();

And the sql log records this:
SELECT SQL_CALC_FOUND_ROWS lo.idlocalidad, lo.descripcionlocalidad, ti.idevento, lt.idtipomovimiento, tm.descripciontipomovimiento, count(*) as ingresos FROM localidad lo left join tarifa ta on lo.idlocalidad = ta.idlocalidad left join ticket ti on ta.idtarifa = ti.idtarifa left join logticket lt on ti.idticket = lt.idticket right join tipomovimiento tm on lt.idtipomovimiento = tm.idtipomovimiento GROUP BY lo.idlocalidad, lt.idtipomovimiento ORDER BY descripcionlocalidad

As you see there in no where clause. Please you help
Re: Where is where [message #2230 is a reply to message #2229] Sat, 18 July 2009 04:55 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
You say that you have created a new class with no physical file on the database, so how come you are trying to generate an sql SELECT statement within this class?

If the WHERE string is empty it means that whatever was in it has been filtered out because the field name(s) cannot be found on any table in the FROM clause. I notice that you are using alias names for your table names, but you are not using the 'AS' word in front of the alias name. You should write them as 'tablename AS alias' and not the shortened 'tablename alias'. The framework specifically looks for ' AS ' (case insensitive) in order to identify alias names.

This is documented in Using Parent Relations to construct sql JOINs .


Re: Where is where [message #2231 is a reply to message #2230] Sat, 18 July 2009 12:15 Go to previous message
edortizq is currently offline  edortizq
Messages: 82
Registered: August 2008
Location: Ecuador
Member

Excellent!! Thanks for you answer, all is working now
Previous Topic: SQL Syntax error
Next Topic: isnull clause being filtered out of $where with scriptNext()
Goto Forum:
  


Current Time: Thu Mar 28 20:52:10 EDT 2024

Total time taken to generate the page: 0.03317 seconds