dongshanni1611 2018-01-24 14:40
浏览 25
已采纳

每次QBWC调用我的网络应用程序时,是否需要调用CreateUser?

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?

  • 写回答

1条回答 默认 最新

  • doupi7619 2018-01-26 13:35
    关注

    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...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误