sqlkata / querybuilder

SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
https://sqlkata.com
MIT License
3.08k stars 498 forks source link

Fix places where the parameterPlaceholder is hardcoded to a ? #616

Closed toburger closed 1 year ago

toburger commented 1 year ago

Accidentally closed the old PR #592

ahmad-moussawi commented 1 year ago

Merged now thanks!

toburger commented 1 year ago

When do you plan to release a new NuGet package?

kamisoft-fr commented 1 year ago

Hi guys, I tested the new code and unfortunately we still have a last hardcoded question mark in SqlResult

        {
            var deepParameters = Helper.Flatten(Bindings).ToList();

            return Helper.ReplaceAll(RawSql, "?", i =>
            {
                if (i >= deepParameters.Count)
                {
                    throw new Exception(
                        $"Failed to retrieve a binding at index {i}, the total bindings count is {Bindings.Count}");
                }

                var value = deepParameters[i];
                return ChangeToSqlValue(value);
            });
        }

Apparently the compiler is not saved in any of the properties or fields of SqlResult, otherwise I would have created a PR :)

ahmad-moussawi commented 1 year ago

@kamisoft-fr thanks for reporting, oops yes this still missing, we should find a way to instruct the SqlResult to copy the placeholder from the compiler, do you have any suggestion?

flookami commented 11 months ago

Hi @ahmad-moussawi, do you have the time to take a look at PR https://github.com/sqlkata/querybuilder/pull/592 ? it's been months I've made the pull request in order to change the default parameter placeholder & use JSON queries in my code base :)