Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add missing replacement for Firebird and SQLite
  • Loading branch information
ahmad-moussawi authored and toburger committed Sep 28, 2022
commit 159f320ad0627a43f2d42446ce36359b21d28043
6 changes: 3 additions & 3 deletions QueryBuilder/Compilers/FirebirdCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override string CompileLimit(SqlResult ctx)
ctx.Bindings.Add(offset + 1);
ctx.Bindings.Add(limit + offset);

return "ROWS ? TO ?";
return $"ROWS {parameterPlaceholder} TO {parameterPlaceholder}";
}

return null;
Expand All @@ -59,15 +59,15 @@ protected override string CompileColumns(SqlResult ctx)

ctx.Query.ClearComponent("limit");

return "SELECT FIRST ?" + compiled.Substring(6);
return $"SELECT FIRST {parameterPlaceholder}" + compiled.Substring(6);
}
else if (limit == 0 && offset > 0)
{
ctx.Bindings.Insert(0, offset);

ctx.Query.ClearComponent("offset");

return "SELECT SKIP ?" + compiled.Substring(6);
return $"SELECT SKIP {parameterPlaceholder}" + compiled.Substring(6);
}

return compiled;
Expand Down
4 changes: 1 addition & 3 deletions QueryBuilder/Compilers/SqliteCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace SqlKata.Compilers
public class SqliteCompiler : Compiler
{
public override string EngineCode { get; } = EngineCodes.Sqlite;
protected override string parameterPlaceholder { get; set; } = "?";
protected override string parameterPrefix { get; set; } = "@p";
protected override string OpeningIdentifier { get; set; } = "\"";
protected override string ClosingIdentifier { get; set; } = "\"";
protected override string LastId { get; set; } = "select last_insert_rowid() as id";
Expand All @@ -31,7 +29,7 @@ public override string CompileLimit(SqlResult ctx)
if (limit == 0 && offset > 0)
{
ctx.Bindings.Add(offset);
return "LIMIT -1 OFFSET ?";
return $"LIMIT -1 OFFSET {parameterPlaceholder}";
}

return base.CompileLimit(ctx);
Expand Down