Reputation: 778
Lines 245-251 is what I'm referring to. Do I need to use the createUser method each time this file is called, or simply the first time for a given user? If I need to call createUser only the first time, how can I check if the user was already created? I don't see a function to test for that
if (!QuickBooks_Utilities::initialized($dsn))
{
QuickBooks_Utilities::initialize($dsn);
QuickBooks_Utilities::createUser($dsn, $user, $pass);
}
else
{
//QuickBooks_Utilities::createUser($dsn, $user, $pass);
$Queue = new QuickBooks_WebConnector_Queue($dsn);
$Queue->enqueue(QUICKBOOKS_QUERY, 6);
}
The first time this script is executed nothing is initialized so that needs to happen then I will create that user. When it's not the first time this script is executed how can I tell whether or not a user has been created? Should I just check quickbooks_user table for a user with matching username?
Upvotes: 0
Views: 83
Reputation: 27962
Do I need to use the createUser method each time this file is called, or simply the first time for a given user?
Just the first time (which is what your code is currently doing - the call to initialized()
will only return false
the very first time you run the script).
In fact, you don't even have to use createUser
at all if you don't want to - you can just add users yourself into the quickbooks_user
table.
If I need to call createUser only the first time, how can I check if the user was already created?
Do an SQL query against the quickbooks_user
table.
The first time this script is executed nothing is initialized so that needs to happen then I will create that user.
This ^^^ is incorrect. Every time the script runs it CHECKS to see if the SQL tables are initialized, and if they are not, then it initializes things (creates the SQL tables) and creates the user.
When it's not the first time this script is executed how can I tell whether or not a user has been created? Should I just check quickbooks_user table for a user with matching username?
Sure, you can do an SQL query. I question why you need even need to know this though...
Upvotes: 1