Action
()
{
//有时间i+1会变成很大的数,可能原因是别的变量 不够空间了。我循环体里i+1变成了15986254,找了我一个小时。
extern char * strtok ( char * string , const char * delimiters ); // Explicit declaration
int count = 0 ; //扫描批次号返回的总数
int ijk = 0 ; //for循环会用到的自增变量
int i = 0 ;
char params [ 1024 ]; //保存参数
char bak_params [ 1024 ];
char batch_params [ 1024 ]; //请求批次号参数
char pon [ 30 ]= "MP141225163908722731" ;
char pon_page [ 4 ];
char area [ 2 ];
char row [ 2 ];
char rack [ 2 ];
char position [ 2 ];
char separators [] = "-" ; //分割货架号
char * token ;
char Bcode [ 20 ];
char Quantity [ 20 ];
char Rack [ 20 ];
int save_success ;
int save_fail ;
//数据库去拿批次号和页编 号
int rc ;
int db_connection ; // 数据库连接
int query_result ; // 查询结果集 MYSQL_RES
char ** result_row ; // 查询的数据衕
char query123 [ 1024 ]; //查询语句
char *server = "192.168.1.98" ;
char *user = "cangchu" ;
char *password = "123456" ;
char *database = "ews" ;
int port = 3306 ;
int unix_socket = NULL ;
int flags = 0 ;
// 找到libmysql.dll的所在位置.
rc = lr_load_dll ( "E:\\loadrunner-lsh\\lib\\libmysql.dll" );
if (rc != 0 ) {
lr_error_message ( "Could not load libmysql.dll" );
lr_abort ();
}
// 创建MySQL对象
db_connection = mysql_init (NULL );
if (db_connection == NULL ) {
lr_error_message ( "Insufficient memory" );
lr_abort ();
}
// 连接到MySQL数据库
rc = mysql_real_connect (db_connection , server , user , password , database , port , unix_socket , flags );
if (rc == NULL ) {
lr_error_message ( "%s" , mysql_error (db_connection ));
mysql_close (db_connection );
lr_abort ();
}
//从数据库读取一个数据并显示
lr_save_string ( "SELECT distinct ob.OrderBatchCode,obp.PageId FROM OrderBatchProductPage obp inner join OrderBatch ob on obp.OrderBatchId \=ob.OrderBatchId inner join OrderBatchItem obi on obp.OrderBatchId\=obi.OrderBatchId left join OrderAllocateRecords oa on ob.OrderBatchCode\=oa.BatchCode and obp.PageId\=oa.PageNumber where obi.status\=1 and oa.BatchCode is null and oa.PageNumber is null limit 1" , "select1" );
rc = mysql_query (db_connection , lr_eval_string ( "{select1}" ));
if (rc != 0 ) {
lr_error_message ( "%s" , mysql_error (db_connection ));
mysql_close (db_connection );
lr_abort ();
}
query_result = mysql_use_result (db_connection );
if (query_result ==NULL ){
lr_error_message ( "%s" , mysql_error (db_connection ));
mysql_free_result (query_result );
mysql_close (db_connection );
lr_abort ();
}
//如果结果集包含多行数据,需要多次调用 mysql_fetch_row 直到返回NULL
result_row =( char **) mysql_fetch_row (query_result );
//赋值批次号和页编码
strcpy (pon ,result_row [ 0 ]);
strcpy (pon_page ,result_row [ 1 ]);
//lr_output_message("返回的数据 :page\=%s,num\=%s", result_row[0],result_row[1]);
//缓存通用KEY和批次号
lr_save_string ( "QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk" , "key1" );
// lr_save_string(pon,"pon1");
// lr_save_string(pon_page,"page1");
//拼接批次号请求地址
strcpy (batch_params , "http://192.168.1.73:9005/api/OrderAllocateRecord/GetOrderAllocateItemList?batchCode=" );
strcat (batch_params ,pon );
strcat (batch_params , "_" );
strcat (batch_params ,pon_page );
strcat (batch_params , "&storageId=173&key=" );
strcat (batch_params , lr_eval_string ( "{key1}" ));
lr_save_string (batch_params , "batch_address_request" );
//拼接保存接口地址,不想放循环体里面
strcpy (params , "http://192.168.1.73:9005/api/OrderAllocateRecord/SaveOrderAllocateItem?batchCode=" );
strcat (params ,pon );
strcat (params , "_" );
strcat (params ,pon_page );
strcat (params , "&storageId=173&barCode=" );
strcpy (bak_params ,params );
//先检查,再访问。
web_reg_find ( "Text=IsSuccess\":true," , "SaveCount=BatchPage_count" , LAST );
web_url ( "Login" , "URL={batch_address_request}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
if ( atoi ( lr_eval_string ( "{BatchPage_count}" ))> 0 )
lr_output_message ( "请求批次页成功" );
else {
web_reg_save_param ( "error_message" , "LB=Message\":\"" , "RB=}" , "Ord=1" , LAST );
web_url ( "batchPageAdd" , "URL={batch_address_request}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
lr_convert_string_encoding ( lr_eval_string ( "{error_message}" ),LR_ENC_UTF8 ,LR_ENC_SYSTEM_LOCALE , "str" );
lr_output_message ( "请求批次页失败,原因是:%s" , lr_eval_string ( "{str}" ));
return 0 ;
}
//请求扫描批次号接口
lr_start_transaction ( "scan batch interface" );
web_reg_save_param ( "Barcodes" , "LB=BarCode\":\"" , "RB=\"," , "Ord=ALL" , LAST );
web_reg_save_param ( "Quantitys" , "LB=\"Quantity\":" , "RB=," , "Ord=ALL" , LAST );
web_reg_save_param ( "Racks" , "LB=\"Racks\":\"" , "RB=\"" , "Ord=ALL" , LAST );
web_add_header ( "Content-Type" , "text/xml; charset=UTF-8" );
web_set_max_html_param_len ( "99999999" );
web_url ( "Login" , "URL={batch_address_request}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
lr_end_transaction ( "scan batch interface" , LR_AUTO );
//保存接口
count = atoi ( lr_eval_string ( "{Barcodes_count}" ));
while (ijk <count ){
strcpy (params ,bak_params );
sprintf (Bcode , "{Barcodes_%d}" ,ijk + 1 );
sprintf (Quantity , "{Quantitys_%d}" ,ijk + 1 );
sprintf (Rack , "{Racks_%d}" ,ijk + 1 );
strcat (params , lr_eval_string (Bcode ));
lr_output_message ( "%s" ,params );
strcat (params , "&quantity=" );
strcat (params , lr_eval_string (Quantity ));
strcat (params , "&UserId=6516&area=" );
token = ( char *) strtok ( lr_eval_string (Rack ), separators ); // Get the first token
strcat (params ,token );
strcat (params , "&row=" );
token = ( char *) strtok (NULL , separators ); // Get the next token
strcat (params ,token );
strcat (params , "&rack=" );
token = ( char *) strtok (NULL , separators ); // Get the next token
strcat (params ,token );
strcat (params , "&position=" );
token = ( char *) strtok (NULL , separators ); // Get the next token
strcat (params ,token );
strcat (params , "&key=" );
strcat (params , lr_eval_string ( "{key1}" ));
lr_save_string (params , "save_allocation" );
web_reg_find ( "Text=IsSuccess\":true," , "SaveCount=success_count" , LAST );
web_url ( "save" , "URL={save_allocation}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
ijk ++;
if ( atoi ( lr_eval_string ( "{success_count}" ))> 0 ){ //验证是否找到了页面上的要检查的字符串
lr_output_message ( "保存成功" );
save_success ++;
}
else {
web_reg_save_param ( "save_error_message" , "LB=Message\":\"" , "RB=}" , "Ord=1" , LAST );
web_url ( "save" , "URL={save_allocation}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
lr_convert_string_encoding ( lr_eval_string ( "{save_error_message}" ),LR_ENC_UTF8 ,LR_ENC_SYSTEM_LOCALE , "str" );
lr_output_message ( "保存配货失败,原因是:%s" , lr_eval_string ( "{str}" ));
save_fail ++;
}
}
//
// lr_output_message("计费接口返回一共 %d个结果。",count);
// for (i=0;i<count;i++) {
// sprintf(temp,"{postNames_%d}",i+1);
// //转换中
// lr_convert_string_encoding(lr_eval_string(temp),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"str");
// p[i]=lr_eval_string("{str}");
// sprintf(temp,"{prices_%d}",i+1);
// price[i]=atof(lr_eval_string(temp));
// lr_output_message("邮寄方式为%s,价格为%.2f",p[i],price[i]);
// }
lr_output_message ( "保存接口成功%d次,失败%d次" ,save_success ,save_fail );
return 0 ;
}
// int rc;
// int db_connection; // 数据库连接
// int query_result; // 查询结果集 MYSQL_RES
// char** result_row; // 查询的数据衕
//
// char *server = "192.168.1.201";
// char *user = "fds";
// char *password = "dfslocal";
// char *database = "EWS";
// int port = 3306;
// int unix_socket = NULL;
// int flags = 0;
//
//
// int columns;//行中值的数量,也就是返回列
// int rows=0;//自增行
// int i ;//定义变量i ,for 循环用到
// char params[1024];
//
// char pon[20]="P141219185233722703";
// lr_save_string("QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk","key1");
// lr_save_string(pon,"pon1");
// strcpy(params,"http://localhost:9002/api/OrderAllocateRecord/SaveOrderAllocateItem?batchCode=");
//
// // 找到libmysql.dll的所在位置.
// rc = lr_load_dll("E:\\loadrunner-lsh\\lib\\libmysql.dll");
// if (rc != 0) {
// lr_error_message("Could not load libmysql.dll");
// lr_abort();
// }
//
// // 创建MySQL对象
// db_connection = mysql_init(NULL);
// if (db_connection == NULL) {
// lr_error_message("Insufficient memory");
// lr_abort();
// }
//
// // 连接到MySQL数据库
// rc = mysql_real_connect(db_connection, server, user, password, database, port, unix_socket, flags);
// if (rc == NULL) {
// lr_error_message("%s", mysql_error(db_connection));
// mysql_close(db_connection);
// lr_abort();
// }
// //从数据库读取一个数据并显示
// rc=mysql_query(db_connection,lr_eval_string("select PageId as page,case when PropertyCode\='' then productcode else PropertyCode end as code ,quantity as num from OrderBatchProductPage where OrderBatchId\=319 order by page"));
// if (rc != 0) {
// lr_error_message("%s", mysql_error(db_connection));
// mysql_close(db_connection);
// lr_abort();
// }
// query_result=mysql_use_result(db_connection);
// if(query_result==NULL){
// lr_error_message("%s",mysql_error(db_connection));
// mysql_free_result(query_result);
// mysql_close(db_connection);
// lr_abort();
// }
//
// //如果结果集包含多行数据,需要多次调用 mysql_fetch_row 直到返回NULL
// columns = mysql_num_fields(query_result);
// while(result_row=(char **)mysql_fetch_row(query_result)){
// rows++;
// lr_output_message(" 第%d行数据 :page\=%s,code\=%s,num\=%s", rows,result_row[0],result_row[1],result_row[2]);
//
// }
/// / if(result_row==NULL){
/// / lr_error_message("Did not expect the result set to be empty");
/// / mysql_free_result(query_result);
/// / mysql_close(db_connection);
/// / lr_abort();
/// / }
//
/// / // 保存参数,用于删除这行数据
/// / lr_save_string(result_row[1], "paramOrderID");
/// / lr_output_message("Order ID is: %s", lr_eval_string("{paramOrderID}"));
// mysql_free_result(query_result);
// char key[1024];
//
//
//
// strcpy(key, "key=QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk");
//
//
// web_url("Login",
// "URL=http://localhost:9002/api/OrderAllocateRecord/SaveOrderAllocateItem?batchCode=P20140909081359627&storageId=1&barCode=SKU040725&quantity=10&UserId=3&area=n1&row=n2&rack=n3&position=n4&key=QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk",
// "RecContentType=text/html",
// "Mode=HTML",
// LAST);
//lr_save_string("B-K-07-26","str");
//token = (char *)strtok(lr_eval_string("{str}"), separators); // Get the first token
//if (!token) {
//lr_output_message ("No tokens found in string!");
//return( -1 );
//}
//while (token != NULL ) { // While valid tokens are returned
//lr_output_message ("%s", token );
//token = (char *)strtok(NULL, separators); // Get the next token
//}
// return;
{
//有时间i+1会变成很大的数,可能原因是别的变量 不够空间了。我循环体里i+1变成了15986254,找了我一个小时。
extern char * strtok ( char * string , const char * delimiters ); // Explicit declaration
int count = 0 ; //扫描批次号返回的总数
int ijk = 0 ; //for循环会用到的自增变量
int i = 0 ;
char params [ 1024 ]; //保存参数
char bak_params [ 1024 ];
char batch_params [ 1024 ]; //请求批次号参数
char pon [ 30 ]= "MP141225163908722731" ;
char pon_page [ 4 ];
char area [ 2 ];
char row [ 2 ];
char rack [ 2 ];
char position [ 2 ];
char separators [] = "-" ; //分割货架号
char * token ;
char Bcode [ 20 ];
char Quantity [ 20 ];
char Rack [ 20 ];
int save_success ;
int save_fail ;
//数据库去拿批次号和页编 号
int rc ;
int db_connection ; // 数据库连接
int query_result ; // 查询结果集 MYSQL_RES
char ** result_row ; // 查询的数据衕
char query123 [ 1024 ]; //查询语句
char *server = "192.168.1.98" ;
char *user = "cangchu" ;
char *password = "123456" ;
char *database = "ews" ;
int port = 3306 ;
int unix_socket = NULL ;
int flags = 0 ;
// 找到libmysql.dll的所在位置.
rc = lr_load_dll ( "E:\\loadrunner-lsh\\lib\\libmysql.dll" );
if (rc != 0 ) {
lr_error_message ( "Could not load libmysql.dll" );
lr_abort ();
}
// 创建MySQL对象
db_connection = mysql_init (NULL );
if (db_connection == NULL ) {
lr_error_message ( "Insufficient memory" );
lr_abort ();
}
// 连接到MySQL数据库
rc = mysql_real_connect (db_connection , server , user , password , database , port , unix_socket , flags );
if (rc == NULL ) {
lr_error_message ( "%s" , mysql_error (db_connection ));
mysql_close (db_connection );
lr_abort ();
}
//从数据库读取一个数据并显示
lr_save_string ( "SELECT distinct ob.OrderBatchCode,obp.PageId FROM OrderBatchProductPage obp inner join OrderBatch ob on obp.OrderBatchId \=ob.OrderBatchId inner join OrderBatchItem obi on obp.OrderBatchId\=obi.OrderBatchId left join OrderAllocateRecords oa on ob.OrderBatchCode\=oa.BatchCode and obp.PageId\=oa.PageNumber where obi.status\=1 and oa.BatchCode is null and oa.PageNumber is null limit 1" , "select1" );
rc = mysql_query (db_connection , lr_eval_string ( "{select1}" ));
if (rc != 0 ) {
lr_error_message ( "%s" , mysql_error (db_connection ));
mysql_close (db_connection );
lr_abort ();
}
query_result = mysql_use_result (db_connection );
if (query_result ==NULL ){
lr_error_message ( "%s" , mysql_error (db_connection ));
mysql_free_result (query_result );
mysql_close (db_connection );
lr_abort ();
}
//如果结果集包含多行数据,需要多次调用 mysql_fetch_row 直到返回NULL
result_row =( char **) mysql_fetch_row (query_result );
//赋值批次号和页编码
strcpy (pon ,result_row [ 0 ]);
strcpy (pon_page ,result_row [ 1 ]);
//lr_output_message("返回的数据 :page\=%s,num\=%s", result_row[0],result_row[1]);
//缓存通用KEY和批次号
lr_save_string ( "QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk" , "key1" );
// lr_save_string(pon,"pon1");
// lr_save_string(pon_page,"page1");
//拼接批次号请求地址
strcpy (batch_params , "http://192.168.1.73:9005/api/OrderAllocateRecord/GetOrderAllocateItemList?batchCode=" );
strcat (batch_params ,pon );
strcat (batch_params , "_" );
strcat (batch_params ,pon_page );
strcat (batch_params , "&storageId=173&key=" );
strcat (batch_params , lr_eval_string ( "{key1}" ));
lr_save_string (batch_params , "batch_address_request" );
//拼接保存接口地址,不想放循环体里面
strcpy (params , "http://192.168.1.73:9005/api/OrderAllocateRecord/SaveOrderAllocateItem?batchCode=" );
strcat (params ,pon );
strcat (params , "_" );
strcat (params ,pon_page );
strcat (params , "&storageId=173&barCode=" );
strcpy (bak_params ,params );
//先检查,再访问。
web_reg_find ( "Text=IsSuccess\":true," , "SaveCount=BatchPage_count" , LAST );
web_url ( "Login" , "URL={batch_address_request}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
if ( atoi ( lr_eval_string ( "{BatchPage_count}" ))> 0 )
lr_output_message ( "请求批次页成功" );
else {
web_reg_save_param ( "error_message" , "LB=Message\":\"" , "RB=}" , "Ord=1" , LAST );
web_url ( "batchPageAdd" , "URL={batch_address_request}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
lr_convert_string_encoding ( lr_eval_string ( "{error_message}" ),LR_ENC_UTF8 ,LR_ENC_SYSTEM_LOCALE , "str" );
lr_output_message ( "请求批次页失败,原因是:%s" , lr_eval_string ( "{str}" ));
return 0 ;
}
//请求扫描批次号接口
lr_start_transaction ( "scan batch interface" );
web_reg_save_param ( "Barcodes" , "LB=BarCode\":\"" , "RB=\"," , "Ord=ALL" , LAST );
web_reg_save_param ( "Quantitys" , "LB=\"Quantity\":" , "RB=," , "Ord=ALL" , LAST );
web_reg_save_param ( "Racks" , "LB=\"Racks\":\"" , "RB=\"" , "Ord=ALL" , LAST );
web_add_header ( "Content-Type" , "text/xml; charset=UTF-8" );
web_set_max_html_param_len ( "99999999" );
web_url ( "Login" , "URL={batch_address_request}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
lr_end_transaction ( "scan batch interface" , LR_AUTO );
//保存接口
count = atoi ( lr_eval_string ( "{Barcodes_count}" ));
while (ijk <count ){
strcpy (params ,bak_params );
sprintf (Bcode , "{Barcodes_%d}" ,ijk + 1 );
sprintf (Quantity , "{Quantitys_%d}" ,ijk + 1 );
sprintf (Rack , "{Racks_%d}" ,ijk + 1 );
strcat (params , lr_eval_string (Bcode ));
lr_output_message ( "%s" ,params );
strcat (params , "&quantity=" );
strcat (params , lr_eval_string (Quantity ));
strcat (params , "&UserId=6516&area=" );
token = ( char *) strtok ( lr_eval_string (Rack ), separators ); // Get the first token
strcat (params ,token );
strcat (params , "&row=" );
token = ( char *) strtok (NULL , separators ); // Get the next token
strcat (params ,token );
strcat (params , "&rack=" );
token = ( char *) strtok (NULL , separators ); // Get the next token
strcat (params ,token );
strcat (params , "&position=" );
token = ( char *) strtok (NULL , separators ); // Get the next token
strcat (params ,token );
strcat (params , "&key=" );
strcat (params , lr_eval_string ( "{key1}" ));
lr_save_string (params , "save_allocation" );
web_reg_find ( "Text=IsSuccess\":true," , "SaveCount=success_count" , LAST );
web_url ( "save" , "URL={save_allocation}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
ijk ++;
if ( atoi ( lr_eval_string ( "{success_count}" ))> 0 ){ //验证是否找到了页面上的要检查的字符串
lr_output_message ( "保存成功" );
save_success ++;
}
else {
web_reg_save_param ( "save_error_message" , "LB=Message\":\"" , "RB=}" , "Ord=1" , LAST );
web_url ( "save" , "URL={save_allocation}" , "RecContentType=text/html" , "Mode=HTML" , LAST );
lr_convert_string_encoding ( lr_eval_string ( "{save_error_message}" ),LR_ENC_UTF8 ,LR_ENC_SYSTEM_LOCALE , "str" );
lr_output_message ( "保存配货失败,原因是:%s" , lr_eval_string ( "{str}" ));
save_fail ++;
}
}
//
// lr_output_message("计费接口返回一共 %d个结果。",count);
// for (i=0;i<count;i++) {
// sprintf(temp,"{postNames_%d}",i+1);
// //转换中
// lr_convert_string_encoding(lr_eval_string(temp),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"str");
// p[i]=lr_eval_string("{str}");
// sprintf(temp,"{prices_%d}",i+1);
// price[i]=atof(lr_eval_string(temp));
// lr_output_message("邮寄方式为%s,价格为%.2f",p[i],price[i]);
// }
lr_output_message ( "保存接口成功%d次,失败%d次" ,save_success ,save_fail );
return 0 ;
}
// int rc;
// int db_connection; // 数据库连接
// int query_result; // 查询结果集 MYSQL_RES
// char** result_row; // 查询的数据衕
//
// char *server = "192.168.1.201";
// char *user = "fds";
// char *password = "dfslocal";
// char *database = "EWS";
// int port = 3306;
// int unix_socket = NULL;
// int flags = 0;
//
//
// int columns;//行中值的数量,也就是返回列
// int rows=0;//自增行
// int i ;//定义变量i ,for 循环用到
// char params[1024];
//
// char pon[20]="P141219185233722703";
// lr_save_string("QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk","key1");
// lr_save_string(pon,"pon1");
// strcpy(params,"http://localhost:9002/api/OrderAllocateRecord/SaveOrderAllocateItem?batchCode=");
//
// // 找到libmysql.dll的所在位置.
// rc = lr_load_dll("E:\\loadrunner-lsh\\lib\\libmysql.dll");
// if (rc != 0) {
// lr_error_message("Could not load libmysql.dll");
// lr_abort();
// }
//
// // 创建MySQL对象
// db_connection = mysql_init(NULL);
// if (db_connection == NULL) {
// lr_error_message("Insufficient memory");
// lr_abort();
// }
//
// // 连接到MySQL数据库
// rc = mysql_real_connect(db_connection, server, user, password, database, port, unix_socket, flags);
// if (rc == NULL) {
// lr_error_message("%s", mysql_error(db_connection));
// mysql_close(db_connection);
// lr_abort();
// }
// //从数据库读取一个数据并显示
// rc=mysql_query(db_connection,lr_eval_string("select PageId as page,case when PropertyCode\='' then productcode else PropertyCode end as code ,quantity as num from OrderBatchProductPage where OrderBatchId\=319 order by page"));
// if (rc != 0) {
// lr_error_message("%s", mysql_error(db_connection));
// mysql_close(db_connection);
// lr_abort();
// }
// query_result=mysql_use_result(db_connection);
// if(query_result==NULL){
// lr_error_message("%s",mysql_error(db_connection));
// mysql_free_result(query_result);
// mysql_close(db_connection);
// lr_abort();
// }
//
// //如果结果集包含多行数据,需要多次调用 mysql_fetch_row 直到返回NULL
// columns = mysql_num_fields(query_result);
// while(result_row=(char **)mysql_fetch_row(query_result)){
// rows++;
// lr_output_message(" 第%d行数据 :page\=%s,code\=%s,num\=%s", rows,result_row[0],result_row[1],result_row[2]);
//
// }
/// / if(result_row==NULL){
/// / lr_error_message("Did not expect the result set to be empty");
/// / mysql_free_result(query_result);
/// / mysql_close(db_connection);
/// / lr_abort();
/// / }
//
/// / // 保存参数,用于删除这行数据
/// / lr_save_string(result_row[1], "paramOrderID");
/// / lr_output_message("Order ID is: %s", lr_eval_string("{paramOrderID}"));
// mysql_free_result(query_result);
// char key[1024];
//
//
//
// strcpy(key, "key=QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk");
//
//
// web_url("Login",
// "URL=http://localhost:9002/api/OrderAllocateRecord/SaveOrderAllocateItem?batchCode=P20140909081359627&storageId=1&barCode=SKU040725&quantity=10&UserId=3&area=n1&row=n2&rack=n3&position=n4&key=QkZ0ZnJ3JTJmaFFNVlc1JTJiSUJzTlZnJTJiUVRkMXNTU2JOJTJmcjhlTDJ4cTFON2x6UWVEWUtYVVZuMGpZWSUyYnhNYW5qRzB2Q1UyTUZKelBOeVNCcXBXM2dvU3V3JTNkJTNk",
// "RecContentType=text/html",
// "Mode=HTML",
// LAST);
//lr_save_string("B-K-07-26","str");
//token = (char *)strtok(lr_eval_string("{str}"), separators); // Get the first token
//if (!token) {
//lr_output_message ("No tokens found in string!");
//return( -1 );
//}
//while (token != NULL ) { // While valid tokens are returned
//lr_output_message ("%s", token );
//token = (char *)strtok(NULL, separators); // Get the next token
//}
// return;