lundi 29 février 2016

How can I insert a code as a text for a column into SQLite using SQLite3 command line

How can I insert a code as a text for a column into SQLite using SQLite3 command line.

Here is the table structure:

CREATE TABLE `content` (
`id` int(11) DEFAULT NULL,
`id2` int(11) DEFAULT NULL,
`id3` int(11) DEFAULT NULL,
`value` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

I want to insert:

INSERT INTO table(`value`) VALUES(”function() {
 var obj='xxxx'
 retun results;”);

The Output I want when I perform a SELECT statement is:

value

------------------  
function(){
var obj='xxxx'
retun results;

But I am not able to succesfully insert the code inside the insert statement as a value to a column.It gives me error 1064.

Can some one help me how to insert a code as a value to a column preserving the whitespaces and end of line in the code.

Aucun commentaire:

Enregistrer un commentaire