tobiasschulz / csharp-sqlite

Automatically exported from code.google.com/p/csharp-sqlite
Other
0 stars 0 forks source link

about sql execute error again #148

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi

yesterday I propose a question by Issue 147

What steps will reproduce the problem?

I execute sql like below:
----------------------------------------------------------------------------
create table tab_orders(id INTEGER,orderDate TEXT,agencyName TEXT,prodName 
TEXT,prodNum INTEGER,prodUnit TEXT,status TEXT,remark TEXT,confirm INTEGER);

insert into tab_orders 
values(1,'2012-02-01','001-南京饭店','青岛纯生啤',2000,'12瓶一箱','�
��到货','暂未到货',0);

The insert sql execute error.

What version of the product are you using? On what operating system?

version: csharp-sqlite_3_7_7_1_64.zip.
operating system: windows phone 7.(here,I wrote wrong yesterday)

--------------------------------------------------------------------------------
but the below sql execute right.

create table tab_orders(id INTEGER,orderDate TEXT,agencyName TEXT,prodName 
TEXT);

insert into tab_orders 
values(1,'2012-02-01','001-南京饭店','青岛纯生啤');
--------------------------------------------------------------------------------
most of sql including GB2312 encoding execute well. so I think It's not because 
of encoding.

Thank you.

Original issue reported on code.google.com by wszjdn...@gmail.com on 27 Mar 2012 at 1:43

GoogleCodeExporter commented 9 years ago
Two questions:
1) What is the result of:
insert into tab_orders values(1, '2012-02-01', '001-', 'field4', 2000, '12', 
'field7', 'field8', 0);
2) What is the exact error you are getting?

Thank you

Original comment by noah.hart@gmail.com on 27 Mar 2012 at 12:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
string sql = insert into tab_orders 
values(1,'2012-02-01','001-南京饭店','纯生啤',2000,'12瓶一箱','未到�
��','暂未到货',0);
string error = "";
int result = Sqlite3.sqlite3_exec(db_, sql, null, null, ref error);
--------------------------------------------------------------------------------
---
the return "result" is 1
the error is  unrecognized token: "'12瓶一"

if I change sql to "insert into tab_orders 
values(1,'2012-02-01','001-南京饭店','纯生啤',2000,'test1','test2','test3
',0)".  
The result is Sqlite3.SQLITE_OK

Thank you

Original comment by wszjdn...@gmail.com on 28 Mar 2012 at 1:42

GoogleCodeExporter commented 9 years ago
Right, this is a UTF-8 problem, that just happened to work before.  You need to 
encode your multibyte characters into a blob before inserting.

I know others are doing this.  Please ask on the user group.  
http://groups.google.com/group/csharp-sqlite

Original comment by market.n...@gmail.com on 28 Mar 2012 at 12:10

GoogleCodeExporter commented 9 years ago
We have almost the same problem, no idea how to solve.

Original comment by meng.qin...@gmail.com on 17 Jul 2012 at 6:47