Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 553 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"where 1=1" statement

#11
`1=1` will always be true, so the `value="TOYOTA"` bit is the important one.

You get this in a few scenarios including:

Generated SQL: It's easier to create a generate a complex `where` statement if you don't have to work out if you're adding the first condition or not, so often a `1=1` is put at the beginning, and all other conditions can be appended with an `And`

Debugging: Sometimes you see people put in a `1=1` at the top of a where condition as it enables them to freely chop and change the rest of the conditions when debugging a query. e.g.

select * from car_table
where 1=1
--and value="TOYOTA"
AND color="BLUE"
--AND wheels=4

It has to be said that it isn't particularly good practice and normally shouldn't occur in production code. It may even not help the optimization of the query very much.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through