Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Token unknown #40

Open
Cae2 opened this issue Sep 1, 2018 · 2 comments
Open

Token unknown #40

Cae2 opened this issue Sep 1, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@Cae2
Copy link

Cae2 commented Sep 1, 2018

Hello, Im trying to implement this package and when I try to return simple query it works, for example:

var result = context.Blog.Take(10).ToList();

but if I try to use the relationship with "Posts" for example:

var result = context.Blog.Include(p => p.Posts).Take(10).ToList();

I got the error:

Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 25

I searched about this Token Error and found some information about ADO FirebirdClient is only tested for FB 3.0 (and I'm using FB 2.5). This is the cause or I'm doing something wrong?

Thank you

@Andyriod
Copy link

Andyriod commented Nov 9, 2018

Same here. I try to create my database with code first migrations.

Unhandled Exception: FirebirdSql.Data.FirebirdClient.FbException: Dynamic SQL Error
SQL error code = -104
Token unknown - line 9, column 32
__EFMigrationsHistory ---> FirebirdSql.Data.Common.IscException: Dynamic SQL Error
SQL error code = -104
Token unknown - line 9, column 32

class Program
{
    static void Main(string[] args)
    {
        using (var dbcontext = new BloggingContextFb())
        {
            dbcontext.Database.Migrate();
        }
        Console.ReadLine();
    }
}
public class BloggingContextFb : BloggingContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var connectionStringBuilder = new FbConnectionStringBuilder();
        connectionStringBuilder.UserID = "SYSDBA";
        connectionStringBuilder.Password = "masterkey";
        connectionStringBuilder.Database = "d:/database/blogdb.fdb";
        connectionStringBuilder.DataSource = "localhost";
        connectionStringBuilder.Port = 3050;
        connectionStringBuilder.Pooling = true;
        connectionStringBuilder.MinPoolSize = 0;
        connectionStringBuilder.MaxPoolSize = 100;
        connectionStringBuilder.Dialect = 3;
        var connectionString = connectionStringBuilder.ConnectionString;

        optionsBuilder.UseFirebird(connectionString);
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Blog>(builder =>
        {
            builder.HasIndex(e => e.BlogId)
                .HasName("Id")
                .IsUnique();
        });
        modelBuilder.Entity<Post>(builder =>
        {
            builder.HasIndex(e => e.PostId)
                .HasName("Id")
                .IsUnique();
        });
    }
}

public class Blog
{
    public int BlogId { get; set; }
    public string Url { get; set; }
    public int Rating { get; set; }
    public List<Post> Posts { get; set; }
}

public class Post
{
    public int PostId { get; set; }
    public string Title { get; set; }
    public string Content { get; set; }

    public int BlogId { get; set; }
    public Blog Blog { get; set; }
}

The FirebirdSql.EntityFrameworkCore.Firebird from Jiri works well here, but doesn't create TRIGGERS and GENERATORS for Primary Keys.

@ralmsdeveloper ralmsdeveloper self-assigned this Nov 10, 2018
@ralmsdeveloper ralmsdeveloper added this to the 2.2 milestone Nov 10, 2018
@ralmsdeveloper
Copy link
Owner

Sorry folks I had a lot of work here in the company.

This will be corrected as soon as possible.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants