Insert the usual "Bobby Tables" reply here
https://xkcd.com/327/

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)
databaseConnection.commit()

-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Markos
Sent: Sunday, April 08, 2018 6:54 AM
To: sqlite-users@mailinglists.sqlite.org
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,
Markos

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to