Insert the usual "Bobby Tables" reply here

You really want to just bind the values to the insert statement, both to 
prevent issues and make things simpler. It'll look slightly different in each 
language, but it's basically 1 SQL statement text which contains placeholders. 
Then for each record you want to insert/update, etc you give it the raw values 
separate from the SQL text, and your language of choice will do the magic of 
inserting that exact value, whatever type of value that is.

So it might look something like:

myInsertStatement = "insert into foods (name, type_id) values (?, ?);"
for some looping construct:
    nameVariable = some name
    type_idVariable = some ID thing of whatever type
    databaseCursor.execute(myInsertStatement, nameVariable, type_idVariable)

-----Original Message-----
From: sqlite-users [] On 
Behalf Of Markos
Sent: Sunday, April 08, 2018 6:54 AM
Subject: [sqlite] To use or not to use single quotes with integers

I'm making this question because it is simpler to implement in my 
interface a routine to assemble a list of fields and values by inserting 
single quotation marks in all elements of the list of values.

Otherwise I would have to identify the datatype of each field to decide 
whether or not to include the quotes.

Thank you,

sqlite-users mailing list
sqlite-users mailing list

Reply via email to