2006*1+0



  • Today, I submited a form omiting some values by mistake and forcing javascript to ignore single ' in input by accident. ;) This is the page I've seen after that:

    <font face="Arial" size="2">Microsoft JET Database Engine</font> <font face="Arial" size="2">error '80040e14'</font>

    <font face="Arial" size="2">Syntax error in string in query expression '(((table.field) = ''') AND ((table.field)=(2006 *1 + 0))) ORDER BY ...'.</font>

    table.field is anonimization of course. Funny thing is 2006*1+0. I can barely understand +0 (but form had year to choose, not offset - WTF?)  But *1? Who wants to multiplicate year? Why?

    Any ideas? :) 

    <font face="Arial" size="2"></font>


  • remove decimal numbers? could be that multiplying by int returns int value ?



  • [quote user="viraptor"]

    Today, I submited a form omiting some values by mistake and forcing javascript to ignore single ' in input by accident. ;) This is the page I've seen after that:

    <font face="Arial" size="2">Microsoft JET Database Engine</font> <font face="Arial" size="2">error '80040e14'</font>

    <font face="Arial" size="2">Syntax error in string in query expression '(((table.field) = ''') AND ((table.field)=(2006 *1 + 0))) ORDER BY ...'.</font>

    table.field is anonimization of course. Funny thing is 2006*1+0. I can barely understand +0 (but form had year to choose, not offset - WTF?)  But *1? Who wants to multiplicate year? Why?

    Any ideas? :) 

    [/quote]

    Sometimes one might do something like that to make the query optimizer (the part of the database system that decides how to process the query) choose another plan. Example: You join two tables, each of which has an indexed column which is filtered in the query.

    SELECT * FROM person, address WHERE person.address_id=address.id
      AND person.first_name='Eric' AND address.country_id=1;

    Let's say you have an index on "person.first_name" and another index on "address.country_id". Since 1 stands for your local country and (say) 30% of your addresses have address.country_id=1, it's most likely more efficient if the database engine uses the index on person.first_name first and joins the (small) subset of persons with the corresponding addresses, than the other way round. But sometimes, the database engine gets it wrong. Optimizer hints can help, but writing something like "... and address.country_id+0=1" is often enough to force the optimizer to choose the other plan.

    EDIT: I've totally missed that the *1+0 part is on the wrong side of the tyble.field=2006 equation, which most likely makes it completely useless.
     

     

     



  • A co-worker of mine had to do something like this to trick Access into using numeric comparison in a complicated query. We never did figure out why it thought the expression was a string.

     



  • [quote user="leonita79"]

    A co-worker of mine had to do something like this to trick Access into using numeric comparison in a complicated query. We never did figure out why it thought the expression was a string.

    [/quote]

    Did you coworker have to do 2 mathematical operations?  Why would you need a multiplication and an addition?



  • I've used n+0 to remove user-entered leading zeros in untyped languages, but n*1+0 looks like overkill.



  • Uh, there are quite a few braces in that query....makes the whole thing harder to read than necessary. Especially the braces around "table.field" seem superfluous.

    (Disclaimer: They might be needed in this particular case. I'm not that great with SQL. If so, ignore this post.)

     
    Edit: I just noticed that I should have started this post with "The real WTF is" since nobody did already.
     



  • [quote user="Nezzar"]

    Uh, there are quite a few braces in that
    query....makes the whole thing harder to read than necessary.
    Especially the braces around "table.field" seem superfluous.

    (Disclaimer: They might be needed in this particular case. I'm not that great with SQL. If so, ignore this post.)

     

    [/quote]

    Looks like an MS Access auto generated
    query. Access sure loves to put braces around just about anything it
    possibly can. Multiple times.

     (((((table.value)+(4))+((20)))+(1)))+(1)) is an exaggeration of the sort of thing it does, but not by much!



  • [quote user="viraptor"]

    Today, I submited a form omiting some values by mistake and forcing javascript to ignore single ' in input by accident. ;) This is the page I've seen after that:

    <font face="Arial" size="2">Microsoft JET Database Engine</font> <font face="Arial" size="2">error '80040e14'</font>

    <font face="Arial" size="2">Syntax error in string in query expression '(((table.field) = ''') AND ((table.field)=(2006 *1 + 0))) ORDER BY ...'.</font>

    table.field is anonimization of course. Funny thing is 2006*1+0. I can barely understand +0 (but form had year to choose, not offset - WTF?)  But *1? Who wants to multiplicate year? Why?

    Any ideas? :) 

    [/quote]

    The only thing I can say to this is that I think my new favorite word is "multiplicate" :)  

     


Log in to reply