3 ms·
What are "bind variables"? I'm not talking about a search API, I'm talking about code units that ask myriad questions of the database in order to implement myr
by sanderjd 8y ago
What are "bind variables"?
I'm not talking about a search API, I'm talking about code units that ask myriad questions of the database in order to implement myriad business logic. If you don't have the problem of asking myriad questions of the database, fair enough, but that is a simpler database-connected-software use case than any I've come across (including the ones I thought were pretty simple). I'm very curious now what your service does :)
- michaelt 8y agoBind variables are the ? in "SELECT fname, lname, pcode FROM cust WHERE id = ?" and they're a better choice than concatenating the ID you want into the SQL string because (a) it prevents SQL injection and (b) it lets the query optimiser cache plans. We have plenty of complicated queries - when we've got complex SQL queries, we find it valuable to have pure SQL as you can paste it into a tool that lets you execute it on the database and view the results, the explain plans, and suchlike.
- ntqz 8y agoAnother bonus - depending on your DB/driver, it may set this up as a prepared statement, so executions after the first one happen much quicker.
- gaius 8y agoWhat are "bind variables"? I’m sorry, but bind variables are Database 101. I have a hard time believing your use cases are particularly “myriad” given lack of the very basics.
- dahauns 8y agoNo. "bind variables" are Oracle 101. Everyone else calls them "query parameters".