Beispiel #1
0
Action()
{
	lr_save_datetime("%y%j", DATE_NOW, "JulianDate"); 
	lr_output_message("Today's Julian Date is %s",lr_eval_string("{JulianDate}"));
	
	return 0;
}
Beispiel #2
0
Action()
{

	char chQuery[128];

	MYSQL *Mconn; 
    
	lr_load_dll("libmysql.dll"); 

	Mconn = lr_mysql_connect(MYSQLSERVER, MYSQLUSERNAME, MYSQLPASSWORD, MYSQLDB, atoi(MYSQLPORT));

	lr_save_string(lr_eval_string("{pTransactionName}"),"sTransactionName");
	lr_save_string(lr_eval_string("{pResult}"),"sResult");
	lr_save_string(lr_eval_string("{pRandom}"),"sResponseTime");

	lr_save_datetime("%H:%M:%S", TIME_NOW, "sTime"); 

	sprintf(chQuery, "insert into test.sample_writes (sqTransactionName, sqResult, sqResponseTime, sqTime) values ('%s','%s','%s','%s');",
				lr_eval_string("{sTransactionName}"),
				lr_eval_string("{sResult}"),
				lr_eval_string("{sResponseTime}"),
				lr_eval_string("{sTime}"));

	lr_mysql_query(Mconn, chQuery);

	lr_mysql_disconnect(Mconn);


	return 0;
}
Beispiel #3
0
// --------------------------------------------------------------------------------------------------
//    y_datetime()
//      Simply returns the current date-time as a string, in this format:
//        YYYYMMDD,HHMMSS (yesss, separated by a comma. That is most suitable for this moment.
// @author: Raymond de Jongh
// @author: Floris Kraak
//
// This mostly exists to facilitate y_write_to_log(), in logging.c 
//
// Comment: Ray, please have a look at lr_save_datetime() for me will you? Thanks ;-)
//           -- Floris
// --------------------------------------------------------------------------------------------------
void y_datetime()
{
    lr_save_datetime("%Y%m%d,%H%M%S", DATE_NOW, "DATE_TIME_STRING");
}
Beispiel #4
0
get_google_short_url_qrcode(){
	int rc=0;
		char            strFileName[256]; // largest size of file.
		char           *szBuf;
		unsigned long   nLength;

	if( stricmp("Y",LPCSTR_SaveImageYN ) == FOUND ){ // Run-time Attribute "SaveImageYN" or command line option "-SaveImageYN"
	   // continue if SaveImageYN was specified with Y
	}else{
		return LR_PASS;
	}

		set_pShortHostKey_from_url( lr_eval_string("{pShortURL}") ); // from get_google_short_url()
			//wi_startPrintingTrace();
			//lr_output_message(">> pShortHostKey=\"%s\"." ,lr_eval_string("{pShortHostKey}") );
			//wi_stopPrinting();

		// For shortened URL http://goo.gl/AC4IW", details are at http://goo.gl/#analytics/goo.gl/AC4IW/all_time
		// {pShortHostKey}=AC4IW in example: URL http://goo.gl/AC4IW.qr redirects to 
		// The QR code impage at http://chart.googleapis.com/chart?cht=qr&chs=100x100&choe=UTF-8&chld=H|0&chl=http://goo.gl/AC4IW
		web_reg_save_param_ex("ParamName=pImage", "LB=\r\n\r\n", "RB=\"",  "Notfound=warning", LAST); // The \r\n\r\n is to begin capture after the two blank lines between HTTP header and body.
		web_reg_save_param_ex("ParamName=pImage_len", "LB=Content-Length: ", "Notfound=warning", "RB=\r\n", LAST);

		sprintf(       tempString1, "%s_3image", lr_eval_string("{pTransSequence}") );
		lr_save_string(tempString1,"pTransName");
	    wi_start_transaction();
	    
    // This URL was obtained from the DNS-level redirect in the HTML header in response to request for .qr, such as:
    // The document has moved <A 
    //        HREF="http://chart.googleapis.com/chart?cht=qr&amp;chs=150x150&amp;choe=UTF-8&amp;chld=H&amp;chl=http://goo.gl/x6wUIS">here</A>.\n
    	// &amp; needs to be coverted to & character in URLs.
    	
		// WARNING: The 150x150 in this URL may change over time as more characters are needed for uniqueness.
		// Previously,  100x100 was being returned:
		//    "URL={pShortURL}.qr",
		web_url("imagefile",
	        "URL=http://chart.googleapis.com/chart?cht=qr&chs=150x150&choe=UTF-8&chld=H&chl={pShortURL}",
	        "Resource=1",
	        "RecContentType=image/png",
	        "Snapshot=t1.inf",
	        LAST);
		// FIXME: File created has black box at bottom.
	
	    rc = wi_end_transaction();

		// strFileName=wi_define_FileName():
		lr_save_datetime("%Y%m%d%H%M%S", DATE_NOW, "pYMDHMS"); // YYMMDDHHMMSS (12 char), no micro seconds
		sprintf(strFileName, "%s%s_%d_T%s_%s_%s.png"
		        ,lr_eval_string("{pImageFilePath}")
				,global_unique_id
				,iActionIterations
				,lr_eval_string("{pYMDHMS}")
		        ,lr_eval_string("{pShortHostKey}")
		        ,lr_eval_string("{pImage_len}")
		       );

		lr_eval_string_ext("{pImage}", strlen("{pImage}"), &szBuf, &nLength, 0, 0, -1);
		// lr_eval_string_ext( in_str, in_len,    pointer out_str, out_len, Reserved for future use. 
		if( nLength <= 0 ){
			lr_error_message(">> No image returned for %s.",strFileName);
		}else{
			if( wi_WriteDataToFile(strFileName, szBuf, nLength) == LR_PASS ){
				wi_startPrintingInfo();
				lr_output_message(">> QRcode_image file created at \"%s\".",strFileName);
				wi_stopPrinting();
			   	// TODO: 23. Remember after runs to clear out the files to an archive filer.
			}else{
				wi_startPrintingError();
				lr_error_message(">>> QRcode_image file NOT created at \"%s\".",strFileName);
				wi_stopPrinting();
			}
		}
	return rc;
} // retrieve_pShortURL_qrcode()