mysql-native v2.1.0
bauss
jj_1337 at live.dk
Tue Mar 6 18:54:16 UTC 2018
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?
More information about the Digitalmars-d-announce
mailing list