Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqliteException : SQLite Error 1: 'near ".": syntax error'. #6

Open
brusw opened this issue Apr 15, 2017 · 1 comment
Open

SqliteException : SQLite Error 1: 'near ".": syntax error'. #6

brusw opened this issue Apr 15, 2017 · 1 comment
Assignees

Comments

@brusw
Copy link

brusw commented Apr 15, 2017

使用Pomelo.EntityFrameworkCore.Lolita无法生成正确的sql更新语句:
image
通过GenerateBulkUpdateSql方法查看生成的sql语句如下:

UPDATE "Bulletin"
SET "Bulletin"."Content" = {0}
WHERE ("Bulletin"."BulletinId" = 1) AND ("Bulletin"."IsDeleted" = 0);
@atagirov
Copy link

Same problem for PostrgeSQL, i fix this by reimplementing ParseField method in IFieldParser:

public class PostgreSQLFieldParser: DefaultFieldParser
{
    private readonly ISqlGenerationHelper _sqlGenerationHelper;

    public PostgreSQLFieldParser(
            ICurrentDbContext currentDbContext, 
            ISqlGenerationHelper sqlGenerationHelper, 
            IDbSetFinder dbSetFinder)
        : base(currentDbContext, sqlGenerationHelper, dbSetFinder)
    {
        _sqlGenerationHelper = sqlGenerationHelper;
    }

    public override string ParseField(SqlFieldInfo field)
    {
        // just column name, without table name
        return _sqlGenerationHelper.DelimitIdentifier(field.Column);
    }
}

And after using this implementation instead DefaultFieldParser:

services.AddDbContext<MyDbContext>(opts =>
{
    opts.UseNpgsql(Configuration.GetConnectionString("MyDatabase"));
    opts.UsePostgreSQLLolita();
    opts.ReplaceService<IFieldParser, PostgreSQLFieldParser>(); // replace
});

I don't know, planing some changes in this library in future...

@yukozh yukozh self-assigned this Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants