Hello!
Asking from the ignorance.
Why does exists the Query Type
in the named queries?
I mean, I understand what does each type, but why not simply delete the query type and make all the queries work always?
Any explanation about this would be grateful.
I repeat, asking from the ignorance, I simply wanna learn more about Ignition and how it works.
Thanks in advance!
I add screenshot for reference
Got some info:
- Query: A general-purpose query used to retrieve data from a database. This typically involves SELECT statements that return multiple rows and columns of data.
- Scalar Query: A query that returns a single value or a scalar result, usually from an aggregation or a specific field in the database. For instance, a query that returns the count of rows, the maximum value, or a single specific record falls into this category.
- Update Query: A query used to modify existing data in the database. This usually involves executing UPDATE, DELETE, or INSERT commands to change the state of the data in the database.
These options allow users to choose the appropriate type of query depending on whether they need to retrieve data, perform calculations, or update records.
For instance, retrieving a single scalar value can be optimized differently from retrieving a large dataset. The system can apply appropriate optimizations based on the type selected.
May apply stricter controls to Update Queries because they change the data. By separating them, it's easier to manage permissions and ensure that only authorized users can perform certain types of operations.
I guess having these options also is easier for the user to define what he want to archieve
2 Likes
JDBC, the Java database connection API, distinguishes between "updates" and "queries", and they must be run with different Java code "under the hood". It's difficult to reliably auto-detect whether a given bit of SQL string is an update or a query, so we don't even try, and rely on what you tell us.
4 Likes