成都创新互联网站制作重庆分公司

lr连接数据笔记

globals.h

#ifndef _GLOBALS_H
#define _GLOBALS_H

//--------------------------------------------------------------------
// Include Files
    #include "lrun.h"
    #include "web_api.h"
    #include "lrw_custom_body.h"
    #include "Ptt_MySQL.h"

    #define MYSQLSERVER "ip"
    #define MYSQLUSERNAME "user"
    #define MYSQLPASSWORD "pwd"
    #define MYSQLDB "xin"
    #define MYSQLPORT 3306

    MYSQL *Mconn;
    int rc;

//--------------------------------------------------------------------
// Global Variables

#endif // _GLOBALS_H

vuser_init

vuser_init()
{

    rc = lr_load_dll("libmysql.dll");

     if (rc != 0) {

     lr_error_message("Could not load libmysql.dll");

     lr_abort();

    }

// 连接到MySQL数据库
     Mconn = lr_mysql_connect(MYSQLSERVER, MYSQLUSERNAME, MYSQLPASSWORD, MYSQLDB, MYSQLPORT);

    return 0;
}

vuser_end()

{
lr_mysql_disconnect(Mconn);
return 0;
}

10年积累的成都网站建设、成都网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站策划后付款的网站建设流程,更有克东免费网站建设让你可以放心的选择与我们合作。

Action

Action()
{
        char *str;
        char *old = "交易成功";
        char *dengdai = "任务正在等待处理,请稍后~";
        char *zhenxing = "查询未完成,请稍后~";
        char *ycldd;
        int i,j;
        char chQuery[128];

    mysql_query(Mconn,lr_eval_string("SET NAMES gbk")); //遇到中文字符乱码,在插入带中文字的数据前,增加了如下语句:

    sprintf(chQuery, "select t.userid,t.bank_id,t.username from xin.webank_apply_data t where  t.login_mobile=14725001445;");

    lr_mysql_query(Mconn, chQuery); 

     lr_save_string(row[0][0].cell, "userid");
     lr_save_string(row[1][0].cell, "bank_id");
     lr_save_string(row[2][0].cell, "username");

    lr_output_message(lr_eval_string("userid: {userid}; bank_id: {bank_id}; username:{username}"));

    //[desc] => 

    web_reg_save_param_ex(
    "ParamName=yansi",
    "LB=[desc] => ",
    "RB=\n",
    "Ordinal=1",
    SEARCH_FILTERS,
    LAST);

    //验四
    web_url("chouzhouyansi","URL=http://ip:3306/newCzCreditApply?user_ids={userid}",LAST);
    str = lr_eval_string("{yansi}");   //取出关联字段与实际值做比较。
    lr_output_message("关联字段: %s",str);
    if(strcmp(str,old) == 0)   
    {

    lr_think_time(5);

    i:  
    web_reg_save_param_ex(
    "ParamName=yuchuli",
    "LB=[desc] => ",
    "RB=\n",
    "Ordinal=1",
    SEARCH_FILTERS,
    LAST);

    ycldd = lr_eval_string("{yuchuli}"); 

    //预处理
    lr_output_message("预处理:%s","预处理");

    lr_think_time(1);

     web_url("chouzhouyuchuli","URL=http://ip:3306/newCzCreditQuery?user_ids={userid}",LAST);
    lr_think_time(5);

    if((strcmp(ycldd,dengdai) == 0) && (strcmp(ycldd,zhenxing) == 0))
    {
        lr_output_message("提示目前状态是: %s",lr_eval_string("{jiayichenggong}"));

        return 0;
    }
    else
    {
        lr_output_message("这是显示结果:%s","eles中的语句");

    lr_think_time(10);

    web_reg_save_param_ex(
    "ParamName=jiayichenggong",
    "LB=[desc] => ",
    "RB=\n",
    "Ordinal=1",
    SEARCH_FILTERS,
    LAST);

     web_url("chouzhouyuchuli","URL=http://ip:3306/newCzCreditQuery?user_ids={userid}",LAST);

    ycldd = lr_eval_string("{jiayichenggong}"); 

    if(strcmp(old,ycldd) == 0)
    {
        lr_output_message("交易成功");
        lr_think_time(1);

    }
    else 
    {
        goto i;
    }
    }   
}

    return 0;
}

本文名称:lr连接数据笔记
URL链接:http://cxhlcq.com/article/jcpges.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部