On Tuesday, 6 March 2018 at 18:36:45 UTC, bauss wrote:
On Tuesday, 6 March 2018 at 18:31:08 UTC, bauss wrote:
On Saturday, 3 March 2018 at 07:37:38 UTC, Nick Sabalausky (Abscissa) wrote:
[...]


I'm unsure how I'd go about implementing prepared statements in a vibe.d application correctly.

[...]

Like more specifically do I still call lockConnection() on a MySQLPool?

I think it would be easier to help me if I put some examples.

I just tried changing stuff and I can't seem to get it working.

I kept using lockConnection() as before, I assume it's the right way.

Then I changed the way I retrieve prepared statements from:

  auto prepared = prepare(connection, sql);
  prepared.setArgs(params);

to:

  auto prepared = connection.prepare(sql);
  prepared.setArgs(params);

Then ex. for reading many entries:

From:

  return prepared.querySet().map!((row)
  {
    auto model = new TModel;
    model.row = row;
    model.readModel();
    return model;
  });

To:

  return connection.query(prepared).map!((row)
  {
    auto model = new TModel;
    model.row = row;
    model.readModel();
    return model;
  });

But it doesn't seem to work.

I get the following exception:

"Attempting to popFront an empty map" which I assume is because the result is empty.

So what am I doing wrong in using prepared statements with the new updates?
      • Re: mysql-n... aberba via Digitalmars-d-announce
        • Re: mys... Martin Tschierschke via Digitalmars-d-announce
          • Re:... aberba via Digitalmars-d-announce
            • ... Martin Tschierschke via Digitalmars-d-announce
            • ... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
      • Re: mysql-n... Sönke Ludwig via Digitalmars-d-announce
        • Re: mys... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
        • Re: mys... Steven Schveighoffer via Digitalmars-d-announce
  • Re: mysql-native v2.... bauss via Digitalmars-d-announce
    • Re: mysql-nativ... bauss via Digitalmars-d-announce
      • Re: mysql-n... bauss via Digitalmars-d-announce
        • Re: mys... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
          • Re:... bauss via Digitalmars-d-announce
            • ... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
              • ... bauss via Digitalmars-d-announce
              • ... Nick Sabalausky (Abscissa) via Digitalmars-d-announce
              • ... bauss via Digitalmars-d-announce
              • ... Steven Schveighoffer via Digitalmars-d-announce
              • ... bauss via Digitalmars-d-announce
              • ... Steven Schveighoffer via Digitalmars-d-announce
              • ... bauss via Digitalmars-d-announce

Reply via email to