Skip to content

named parameters #63

@tofutim

Description

@tofutim

Is it possible to used named parameters in PreparedStatement? For example, in my old code, I have "WHERE Entries MATCH @query" and in C# before I would use bind("@query", "stuff"), and then execute.

https://sqlite.org/c3ref/bind_blob.html

My old code had:

				cmdAttachDatabase.Bind("@dbname", DbName);
                cmdAttachDatabase.Bind("@dbfullpath", _initDbPath);     // This may contain the CEROD password
				SQLite3.Result result = (SQLite3.Result)cmdAttachDatabase.ExecuteNonQuery();
				if (result != SQLite3.Result.OK)
				{
					throw new Exception("Unable to attach database");
				}

with

        internal static string AttachDatabase
        {
            get
            {
                return @"ATTACH @dbfullpath AS @dbname;";
            }
        }

https://sqlite.org/c3ref/bind_parameter_index.html

An execute and select that takes Map<String, Object?> might do the trick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions