Skip site navigation (1) Skip section navigation (2)

Username and Password authentication using pqxx library.

From: aravind chandu <avin_friends(at)yahoo(dot)com>
To: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Username and Password authentication using pqxx library.
Date: 2008-10-28 22:40:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

            I am using pqxx API for postgresql.The following is the part of my code.The problem is in the query I am selecting the number of rows from the table since there is only one user name and password row it should return 1 and if there is no match then it should return 0.But here Even though I give wrong username or password its getting authenticated.please help me,what should I put in the "if ()" statement inorder to solve this issue .

result R(T.exec("select count(*) from dbtable where username="+username+" and password="+password+""));
    if (R.empty()) 
            throw logic_error("No tables found");
            *shm = '5';

Thank You,



pgsql-general by date

Next:From: Tom AllisonDate: 2008-10-28 22:41:00
Subject: postgresql and Mac OS X
Previous:From: Alvaro HerreraDate: 2008-10-28 20:08:36
Subject: Re: Quiet "CONTEXT"?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group