Re: [sqlite] Regarding Hebrew data in Sqlite db

2016-10-16 Thread Jens Alfke

> On Oct 15, 2016, at 9:26 AM, Vaibhav Shah  wrote:
> 
> I am using sqlite3.exe for bulk insertion in C#. I am facing issue when
> insert Hebrew data. As it contains double qoute(") as character and it does
> not support in insertion.

It’s almost always a bad idea to put variable string data directly into a SQL 
query, which is what it sounds like you’re doing. If you don’t follow the 
proper quoting rules, your code becomes vulnerable to SQL injection attacks. 
Even if you do quote correctly, you’re making SQLite parse and compile your 
query every time you run it, which is bad for performance.

Instead you should be using placeholders like “?” or “:name” in your query, 
compiling it once, then binding the values when you run it. This lets you pass 
the string in directly with no need to worry about quoting/escaping.

—Jens

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


Re: [sqlite] Regarding Hebrew data in Sqlite db

2016-10-16 Thread Simon Slavin

On 15 Oct 2016, at 5:26pm, Vaibhav Shah  wrote:

> I am using sqlite3.exe for bulk insertion in C#. I am facing issue when
> insert Hebrew data. As it contains double qoute(") as character and it does
> not support in insertion.

Dear Vaibhav,

Happy to help if you can demonstrate the problem but I think you are 
surrounding your text with double-quote instead of the single-quote character 
SQLite expects.  In SQLite text is delimited using the single quote character 
(').  The double-quote character is treated like any other character and no 
special processing is done for it.

SQLite version 3.14.0 2016-07-26 15:17:14
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE MyTable (myVar TEXT);
sqlite> INSERT INTO MyTable VALUES ('hello world');
sqlite> INSERT INTO MyTable VALUES ('hello " double-quote');
sqlite> SELECT * FROM MyTable;
hello world
hello " double-quote
sqlite> 

But I don't think you are really using that character at all.  I think you want 
the gershayim character/accent which looks like double-quote but isn't it.  I 
tried the two I found:

U+059E  D6 9E   HEBREW ACCENT GERSHAYIM
U+05F4  D7 B4   HEBREW PUNCTUATION GERSHAYIM

Again, these work without problems in SQLite.

sqlite> INSERT INTO MyTable VALUES ('hello ֞֞ gershayim accent');
sqlite> INSERT INTO MyTable VALUES ('hello ״ gershayim character');

sqlite> SELECT * FROM MyTable;
hello world
hello " double-quote
hello ֞֞ gershayim accent
hello ״ gershayim character

These tests performed on a Mac but I don't see why any other OS should do 
anything different.

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


[sqlite] Regarding Hebrew data in Sqlite db

2016-10-16 Thread Vaibhav Shah
Hello team,

I am using sqlite3.exe for bulk insertion in C#. I am facing issue when
insert Hebrew data. As it contains double qoute(") as character and it does
not support in insertion. After surfing, I came to know that I have to do
double it and append same as suffix and prefix of word then it will let you
insert. It is working but first column of first row is getting insert as
zero when that table have double qoute character.

Please help with this. And also for insertion double qoute if any easy
solution there for it as I have to handle that with code and have to
traverse whole file. Thank you.

Regards,
Vaibhav Shah
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users