How to check if result of request to DB is empty?

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 11 13:05:25 PST 2015


I am using https://github.com/buggins/ddbc

string query_string = (`SELECT user, password FROM otest.myusers 
where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`);
         auto rs = db.stmt.executeQuery(query_string);

         string dbpassword;
         string dbuser;

         while (rs.next())
         {
             dbuser = rs.getString(1);
             dbpassword = rs.getString(2);
             writeln(dbuser);
             writeln("Place seems unreachable"); // if SQL result 
is empty
...

How I can check if SQL request returned empty result?




More information about the Digitalmars-d-learn mailing list