Search notes:

SQLite function: quote

quote(val) returns a string that, as expression, evaluates to the same value as was quoted.
For example, blobs are returned as «blob literals» (x'…').
create table tq84_quote(t);

insert into tq84_quote values ( 'foo\bar'     );
insert into tq84_quote values ( "foo\nar"     );
insert into tq84_quote values ( 'Bill O''Dill');
insert into tq84_quote values (x'deadbeef'    );

.mode column
.width 15 15
select t, quote(t) from tq84_quote;
--
-- foo\bar          'foo\bar'      
-- foo\nar          'foo\nar'      
-- Bill O'Dill      'Bill O''Dill' 
-- ��               X'DEADBEEF'


drop table tq84_quote;
Github repository about-sqlite, path: /functions/quote.sql

See also

hex(val)
functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758204033, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQLite/functions/quote(64): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78