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

2015-12-12 Thread Suliman via Digitalmars-d-learn
it's seems that next block is execute even if is rs.next() is false: writeln("rs.next()-->", rs.next()); if(!rs.next()) //if user do not in DB { // is execute even if rs.next() is false writeln("Executed, but rs.nst was set to false"); } The output: rs.next()-->false Executed, but rs.nst was

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:36:10 UTC, Suliman wrote: On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin wrote: On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 10:36:12 UTC, drug wrote: 12.12.2015 13:28, Suliman пишет: it's seems that next block is execute even if is rs.next() is false: writeln("rs.next()-->", rs.next()); if(!rs.next()) //if user do not in DB { // is execute even if rs.next() is false

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok! Yes, there was issue with host name, but it's do not solve problem. Second DB have same fields and I still getting false instead moving into while loop

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

2015-12-12 Thread Vadim Lopatin via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok! Yes, there was issue with host name, but it's do not solve problem.

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

2015-12-12 Thread anonymous via Digitalmars-d-learn
On 12.12.2015 08:44, Suliman wrote: string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what happens when the user enters an apostrophe in

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 13:18:12 UTC, anonymous wrote: On 12.12.2015 08:44, Suliman wrote: string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic

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

2015-12-12 Thread drug via Digitalmars-d-learn
12.12.2015 13:28, Suliman пишет: it's seems that next block is execute even if is rs.next() is false: writeln("rs.next()-->", rs.next()); if(!rs.next()) //if user do not in DB { // is execute even if rs.next() is false writeln("Executed, but rs.nst was set to false"); } The output:

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin wrote: On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok!

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 12:43:36 UTC, Suliman wrote: On Saturday, 12 December 2015 at 12:36:10 UTC, Suliman wrote: On Saturday, 12 December 2015 at 12:14:30 UTC, Vadim Lopatin wrote: On Saturday, 12 December 2015 at 12:06:21 UTC, Suliman wrote: On Saturday, 12 December 2015 at

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
Oh sorry! I used wrong host! All ok!

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

2015-12-12 Thread Suliman via Digitalmars-d-learn
On Saturday, 12 December 2015 at 11:53:51 UTC, Suliman wrote: On Saturday, 12 December 2015 at 11:31:18 UTC, Suliman wrote: Oh sorry! I used wrong host! All ok! Yes, there was issue with host name, but it's do not solve problem. Second DB have same fields and I still getting false instead

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

2015-12-12 Thread Chris Wright via Digitalmars-d-learn
On Sat, 12 Dec 2015 07:44:40 +, Suliman wrote: >>> string query_string = (`SELECT user, password FROM otest.myusers where >>> user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); >> >> Don't piece queries together without escaping the dynamic parts. >> Imagine what happens when the

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

2015-12-11 Thread anonymous via Digitalmars-d-learn
On 11.12.2015 22:05, Suliman wrote: I am using https://github.com/buggins/ddbc string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what

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

2015-12-11 Thread Suliman via Digitalmars-d-learn
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

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

2015-12-11 Thread Suliman via Digitalmars-d-learn
string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what happens when the user enters an apostrophe in the username field. Do you mean to