zoukankan      html  css  js  c++  java
  • Community.CsharpSqlite.WP.dll操作 Sqlite 对部分中文支持有错误

    在 Windows Phone 7开发中使用三方库Community.CsharpSqlite.WP.dll来操作Sqlite 在对Sqlite 查询或者插入数据过程中由于编码的原因不支持部分中文,可能会出现类似的错误 如 unrecognized token 。。。需要修改Community.CsharpSqlite/src/tokenize_c.cs源码 然后重新编译DLL 用了我好长时间来找个这个解决的办法,并且用了好长时间对源码修改,特此贡献修改后的dll 点击此处下载。如果你不想自己手动修改源码的话下面的内容可以忽略。。。。

    修改的对比文件如下

     diff -r 8dca6f09ac73 Community.CsharpSqlite/src/tokenize_c.cs

    --- a/Community.CsharpSqlite/src/tokenize_c.cs    Mon Mar 05 13:37:16 2012 -0800

    +++ b/Community.CsharpSqlite/src/tokenize_c.cs    Mon Apr 09 10:30:26 2012 +0900

    @@ -126,7 +126,7 @@

    static int sqlite3GetToken( string z, int iOffset, ref int tokenType )

    {

    int i;

    - byte c = 0;

    + char c = '\0';

    switch ( z[iOffset + 0] )

    {

    case ' ':

    @@ -151,7 +151,7 @@

    if ( z.Length > iOffset + 1 && z[iOffset + 1] == '-' )

    {

    /* IMP: R-15891-05542 -- syntax diagram for comments */

    - for ( i = 2; z.Length > iOffset + i && ( c = (byte)z[iOffset + i] ) != 0 && c != '\n'; i++ )

    + for ( i = 2; z.Length > iOffset + i && ( c = z[iOffset + i] ) != 0 && c != '\n'; i++ )

    {

    }

    tokenType = TK_SPACE; /* IMP: R-22934-25134 */

    @@ -193,12 +193,12 @@

    return 1;

    }

    /* IMP: R-15891-05542 -- syntax diagram for comments */

    - for ( i = 3, c = (byte)z[iOffset + 2]; iOffset + i < z.Length && ( c != '*' || ( z[iOffset + i] != '/' ) && ( c != 0 ) ); i++ )

    + for ( i = 3, c = z[iOffset + 2]; iOffset + i < z.Length && ( c != '*' || ( z[iOffset + i] != '/' ) && ( c != 0 ) ); i++ )

    {

    - c = (byte)z[iOffset + i];

    + c = z[iOffset + i];

    }

    if ( iOffset + i == z.Length )

    - c = 0;

    + c = '\0';

    if ( c != 0 )

    i++;

    tokenType = TK_SPACE; /* IMP: R-22934-25134 */

    @@ -216,7 +216,7 @@

    }

    case '<':

    {

    - if ( ( c = (byte)z[iOffset + 1] ) == '=' )

    + if ( ( c = z[iOffset + 1] ) == '=' )

    {

    tokenType = TK_LE;

    return 2;

    @@ -239,7 +239,7 @@

    }

    case '>':

    {

    - if ( z.Length > iOffset + 1 && ( c = (byte)z[iOffset + 1] ) == '=' )

    + if ( z.Length > iOffset + 1 && ( c = z[iOffset + 1] ) == '=' )

    {

    tokenType = TK_GE;

    return 2;

    @@ -304,7 +304,7 @@

    testcase( delim == '`' );

    testcase( delim == '\'' );

    testcase( delim == '"' );

    - for ( i = 1; ( iOffset + i ) < z.Length && ( c = (byte)z[iOffset + i] ) != 0; i++ )

    + for ( i = 1; ( iOffset + i ) < z.Length && ( c = z[iOffset + i] ) != 0; i++ )

    {

    if ( c == delim )

    {

    @@ -411,7 +411,7 @@

    case '[':

    {

    - for ( i = 1, c = (byte)z[iOffset + 0]; c != ']' && ( iOffset + i ) < z.Length && ( c = (byte)z[iOffset + i] ) != 0; i++ )

    + for ( i = 1, c = z[iOffset + 0]; c != ']' && ( iOffset + i ) < z.Length && ( c = z[iOffset + i] ) != 0; i++ )

    {

    }

    tokenType = c == ']' ? TK_ID : TK_ILLEGAL;

    @@ -452,9 +452,9 @@

    testcase( z[iOffset + 0] == '@' );

    testcase( z[iOffset + 0] == ':' );

    tokenType = TK_VARIABLE;

    - for ( i = 1; z.Length > iOffset + i && ( c = (byte)z[iOffset + i] ) != 0; i++ )

    + for ( i = 1; z.Length > iOffset + i && ( c = z[iOffset + i] ) != 0; i++ )

    {

    - if ( IdChar( c ) )

    + if (IdChar((byte)c))

    {

    n++;

    #if !SQLITE_OMIT_TCL_VARIABLE

    @@ -464,7 +464,7 @@

    do

    {

    i++;

    - } while ( ( iOffset + i ) < z.Length && ( c = (byte)z[iOffset + i] ) != 0 && !sqlite3Isspace( c ) && c != ')' );

    + } while ( ( iOffset + i ) < z.Length && ( c = z[iOffset + i] ) != 0 && !sqlite3Isspace( c ) && c != ')' );

    if ( c == ')' )

    {

    i++;

    转载请注明出处http://www.cnblogs.com/dubaokun/archive/2013/01/12/2857976.html

    欢迎关注我的新浪微博 http://weibo.com/u/1821556025

  • 相关阅读:
    环境部署(八):jenkins配置邮件通知
    环境部署(七):linux下Jenkins+Git+JDK持续集成
    环境部署(六):Git关联github
    Git基础使用教程
    环境部署(五):Linux下安装Gradle
    环境部署(四):Linux下查看JDK安装路径
    从百小度看人工智能
    手游开发Android平台周边工具介绍
    移动开发工具推荐
    关于方法论的闲扯
  • 原文地址:https://www.cnblogs.com/dubaokun/p/2857976.html
Copyright © 2011-2022 走看看