HMGSCRIPT R42

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 2283
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 544 times
Been thanked: 115 times
Contact:

Re: HMGSCRIPT R42

Post by serge_girard » Sat Nov 04, 2017 7:10 am

I'm afraid I can't help (change database to mysql because of series of disasters with XML files, I understand!)

Serge

User avatar
jairpinho
Posts: 301
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 10 times
Contact:

Post by jairpinho » Wed Feb 06, 2019 12:30 am

hello guys need something else in the browser to generate the pdfs? is not generating the pdf I should have installed some extension in the browser, I found out what is the file myapp.cgi makes the connection of the user but I am trying to login and does not accept
Last edited by jairpinho on Wed Feb 06, 2019 12:37 am, edited 1 time in total.
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
jairpinho
Posts: 301
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 10 times
Contact:

Post by jairpinho » Wed Feb 06, 2019 12:36 am

Hi guys need an example with mysql connection with grid, do we have this possibility?
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
serge_girard
Posts: 2283
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 544 times
Been thanked: 115 times
Contact:

Post by serge_girard » Wed Feb 06, 2019 8:26 am

Yes, it is possible:

Just try something like this:

Code: Select all

SET HMGWEB=c:\hmgweb\jairsources
SET HBPATH=C:\hmgweb\harbour\bin
SET HMGINCPATH=c:\hmgweb\include
SET APACHECGIPATH=C:\hmgweb\apache\cgi-bin

%HBPATH%\hbmk2 %HMGWEB%\your_source -i%HMGINCPATH% -shared hbhpdf.hbc hbmysql.hbc hbct.hbc hbmisc.hbc
IF ERRORLEVEL 0 MOVE your_source.exe   %APACHECGIPATH%\your_source.cgi
To compile your source.

Serge

User avatar
jairpinho
Posts: 301
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 10 times
Contact:

Post by jairpinho » Thu Feb 07, 2019 9:17 pm

serge_girard wrote:
Wed Feb 06, 2019 8:26 am
Yes, it is possible:

Just try something like this:

Code: Select all

SET HMGWEB=c:\hmgweb\jairsources
SET HBPATH=C:\hmgweb\harbour\bin
SET HMGINCPATH=c:\hmgweb\include
SET APACHECGIPATH=C:\hmgweb\apache\cgi-bin

%HBPATH%\hbmk2 %HMGWEB%\your_source -i%HMGINCPATH% -shared hbhpdf.hbc hbmysql.hbc hbct.hbc hbmisc.hbc
IF ERRORLEVEL 0 MOVE your_source.exe   %APACHECGIPATH%\your_source.cgi
To compile your source.

Serge
I need connection via hmgscript I will not use cgi files I chose hmgscript has this example here but I do not use php and yes mariadb

Code: Select all

///////////////////////////////////////////////////////////////////////////////////////////////
// MySQLBROWSE DEMO
///////////////////////////////////////////////////////////////////////////////////////////////


function MySQLBrowse( oParent , nRow , nCol , nWidth , nHeight , cHost, cUser, cPassword, nPort, cDB, cQuery, nInnerWidth )
{

	var cId = 'control' + (nControlCount).toString() ; nControlCount++ ;

	var query = 'cHost=' + cHost + '&'
               + 'cUser=' + cUser + '&'
               + 'cPassword=' + cPassword + '&'
               + 'nPort=' + nPort + '&'
               + 'cDB=' + cDB + '&' 
               + 'cQuery=' + cQuery + '&' 
               + 'cId=' + cId + '&'
               + 'nInnerWidth=' + nInnerWidth + '&';

	var control = document.createElement( "div" )        ;

	var panel = cId + '_panel';

	control.className      = "browse"                    ;      
	control.style.position = "absolute"                  ;
	control.style.top      = nRow                        ;
	control.style.left     = nCol                        ;
	control.style.width    = nWidth                      ;
	control.style.height   = nHeight                     ;
	control.id             = panel                       ;
	control.innerHTML      = "Loading..."                ;
	control.style.border   = "solid 1px rgb(200,200,200)"    ;
	control.style.overflow = "scroll"                    ;
    
	document.getElementById( oParent.getId() ).appendChild( control )                ;

	xmlHttp=new XMLHttpRequest();
	xmlHttp.open( "POST" , "/php/mysql.php"  , false ) ;
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send( query );
	document.getElementById(panel).innerHTML = xmlHttp.responseText;

	this.getPageSize = function()
	{
		return nPageSize ;
	}

	this.getSelectedRowCount = function()
	{
		var i, n ;

		n = 0 ;

		for ( i=1 ; i < document.getElementById(cId).rows.length ; i++ )
		{
			if ( document.getElementById(cId).rows[i].cells[0].getElementsByTagName("input")[0].checked == true ) 
			{
				n++ ;
			}			 
		}
		return n;
	};

	this.getSelectedRows = function()
	{
		var selectedRows=new Array();
		var i, code, first, last, n ;

		n = 0 ;

		for ( i=1 ; i < document.getElementById(cId).rows.length ; i++ )
		{
			if ( document.getElementById(cId).rows[i].cells[0].getElementsByTagName("input")[0].checked == true ) 
			{
				selectedRows[n] = i ;
				n++ ;
			}			 
		}
		return selectedRows;
	};

	this.getRowCount = function()
	{
		return document.getElementById(cId).rows.length;
	}

	this.getCell = function( nRow , nCOl )
	{
		return trim(document.getElementById(cId).rows[nRow].cells[nCOl].childNodes[0].data);
	}

	this.select = function( nRow )
	{
		document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0].checked = true ;
		changeState( document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0] );
	}

	this.unSelect = function( nRow )
	{
		document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0].checked = false ;
		changeState( document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0] );
	}

	this.refresh = function(  )
	{ 

		xmlHttp=new XMLHttpRequest();
		xmlHttp.open( "POST" , "/php/mysql.php"  , false ) ;
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.send( query );
		document.getElementById(panel).innerHTML = xmlHttp.responseText;
	}


	this.getId = function ()
	{
		return cId;		
	}


}   




function test_0()
{
   oWin = new Form( "MySQLBrowse Test", 590 , 480 );


   Button( oWin , 390 , 40  , "Refresh"         , "oBrowse.refresh()"      );  
   Button( oWin , 390 , 170 , "Show Selected"   , "ShowSelected(oBrowse)"  );  
   Button( oWin , 390 , 300 , "Append"          , "AppendTest( oBrowse )"  );  
                                                                                          
   Button( oWin , 430 , 40  , "Delete Selected" , "DeleteTest(oBrowse)"    );  
   Button( oWin , 430 , 170 , "Select All"      , "SelectAll( oBrowse )"   );  
   Button( oWin , 430 , 300 , "UnSelect All"    , "UnSelectAll( oBrowse )" );  
   Button( oWin , 430 , 430 , "Close"           , "oWin.release()"         );  
   
	oBrowse = new MySQLBrowse( oWin , 
	050 , 050 , 510 , 340 , 'localhost', 'root', '401375', '3306', 'techworks', 'select * from clientes', 250 );

}
//---------------------------------------------------------------------------------------------//
function ShowSelected( oBrowse )
{

	if ( oBrowse.getSelectedRowCount() == 0 )
	{
		alert('No Rows Selected!');
		return;
	}

	var aSelection = oBrowse.getSelectedRows();

	for ( var i = 0 ; i < aSelection.length ; i++ )
	{
		nRow = aSelection [i] ;

		code  = oBrowse.getCell( nRow , 1 );
		first = oBrowse.getCell( nRow , 2 );
		last  = oBrowse.getCell( nRow , 3 );

		alert ( code + ' ' + first + last );
	}

}

Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
jairpinho
Posts: 301
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 10 times
Contact:

Post by jairpinho » Mon Feb 18, 2019 12:21 am

jairpinho wrote:
Thu Feb 07, 2019 9:17 pm
serge_girard wrote:
Wed Feb 06, 2019 8:26 am
Yes, it is possible:

Just try something like this:

Code: Select all

SET HMGWEB=c:\hmgweb\jairsources
SET HBPATH=C:\hmgweb\harbour\bin
SET HMGINCPATH=c:\hmgweb\include
SET APACHECGIPATH=C:\hmgweb\apache\cgi-bin

%HBPATH%\hbmk2 %HMGWEB%\your_source -i%HMGINCPATH% -shared hbhpdf.hbc hbmysql.hbc hbct.hbc hbmisc.hbc
IF ERRORLEVEL 0 MOVE your_source.exe   %APACHECGIPATH%\your_source.cgi
To compile your source.

Serge
I need connection via hmgscript I will not use cgi files I chose hmgscript has this example here but I do not use php and yes mariadb

Code: Select all

///////////////////////////////////////////////////////////////////////////////////////////////
// MySQLBROWSE DEMO
///////////////////////////////////////////////////////////////////////////////////////////////


function MySQLBrowse( oParent , nRow , nCol , nWidth , nHeight , cHost, cUser, cPassword, nPort, cDB, cQuery, nInnerWidth )
{

	var cId = 'control' + (nControlCount).toString() ; nControlCount++ ;

	var query = 'cHost=' + cHost + '&'
               + 'cUser=' + cUser + '&'
               + 'cPassword=' + cPassword + '&'
               + 'nPort=' + nPort + '&'
               + 'cDB=' + cDB + '&' 
               + 'cQuery=' + cQuery + '&' 
               + 'cId=' + cId + '&'
               + 'nInnerWidth=' + nInnerWidth + '&';

	var control = document.createElement( "div" )        ;

	var panel = cId + '_panel';

	control.className      = "browse"                    ;      
	control.style.position = "absolute"                  ;
	control.style.top      = nRow                        ;
	control.style.left     = nCol                        ;
	control.style.width    = nWidth                      ;
	control.style.height   = nHeight                     ;
	control.id             = panel                       ;
	control.innerHTML      = "Loading..."                ;
	control.style.border   = "solid 1px rgb(200,200,200)"    ;
	control.style.overflow = "scroll"                    ;
    
	document.getElementById( oParent.getId() ).appendChild( control )                ;

	xmlHttp=new XMLHttpRequest();
	xmlHttp.open( "POST" , "/php/mysql.php"  , false ) ;
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send( query );
	document.getElementById(panel).innerHTML = xmlHttp.responseText;

	this.getPageSize = function()
	{
		return nPageSize ;
	}

	this.getSelectedRowCount = function()
	{
		var i, n ;

		n = 0 ;

		for ( i=1 ; i < document.getElementById(cId).rows.length ; i++ )
		{
			if ( document.getElementById(cId).rows[i].cells[0].getElementsByTagName("input")[0].checked == true ) 
			{
				n++ ;
			}			 
		}
		return n;
	};

	this.getSelectedRows = function()
	{
		var selectedRows=new Array();
		var i, code, first, last, n ;

		n = 0 ;

		for ( i=1 ; i < document.getElementById(cId).rows.length ; i++ )
		{
			if ( document.getElementById(cId).rows[i].cells[0].getElementsByTagName("input")[0].checked == true ) 
			{
				selectedRows[n] = i ;
				n++ ;
			}			 
		}
		return selectedRows;
	};

	this.getRowCount = function()
	{
		return document.getElementById(cId).rows.length;
	}

	this.getCell = function( nRow , nCOl )
	{
		return trim(document.getElementById(cId).rows[nRow].cells[nCOl].childNodes[0].data);
	}

	this.select = function( nRow )
	{
		document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0].checked = true ;
		changeState( document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0] );
	}

	this.unSelect = function( nRow )
	{
		document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0].checked = false ;
		changeState( document.getElementById(cId).rows[nRow].cells[0].getElementsByTagName("input")[0] );
	}

	this.refresh = function(  )
	{ 

		xmlHttp=new XMLHttpRequest();
		xmlHttp.open( "POST" , "/php/mysql.php"  , false ) ;
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.send( query );
		document.getElementById(panel).innerHTML = xmlHttp.responseText;
	}


	this.getId = function ()
	{
		return cId;		
	}


}   




function test_0()
{
   oWin = new Form( "MySQLBrowse Test", 590 , 480 );


   Button( oWin , 390 , 40  , "Refresh"         , "oBrowse.refresh()"      );  
   Button( oWin , 390 , 170 , "Show Selected"   , "ShowSelected(oBrowse)"  );  
   Button( oWin , 390 , 300 , "Append"          , "AppendTest( oBrowse )"  );  
                                                                                          
   Button( oWin , 430 , 40  , "Delete Selected" , "DeleteTest(oBrowse)"    );  
   Button( oWin , 430 , 170 , "Select All"      , "SelectAll( oBrowse )"   );  
   Button( oWin , 430 , 300 , "UnSelect All"    , "UnSelectAll( oBrowse )" );  
   Button( oWin , 430 , 430 , "Close"           , "oWin.release()"         );  
   
	oBrowse = new MySQLBrowse( oWin , 
	050 , 050 , 510 , 340 , 'localhost', 'root', '401375', '3306', 'techworks', 'select * from clientes', 250 );

}
//---------------------------------------------------------------------------------------------//
function ShowSelected( oBrowse )
{

	if ( oBrowse.getSelectedRowCount() == 0 )
	{
		alert('No Rows Selected!');
		return;
	}

	var aSelection = oBrowse.getSelectedRows();

	for ( var i = 0 ; i < aSelection.length ; i++ )
	{
		nRow = aSelection [i] ;

		code  = oBrowse.getCell( nRow , 1 );
		first = oBrowse.getCell( nRow , 2 );
		last  = oBrowse.getCell( nRow , 3 );

		alert ( code + ' ' + first + last );
	}

}

Hello everyone, could someone help me in an example of connection via .js from hmgscript I am developing system but I still could not connect to the bank in the forum example need arqruivo mysql.php I use mariadb how should I do?
xmlHttp = new XMLHttpRequest ();
xmlHttp.open ("POST", "/php/mysql.php", false);
xmlHttp.setRequestHeader ('Content-Type', 'application / x-www-form-urlencoded');
xmlHttp.send (query);
document.getElementById (panel) .innerHTML = xmlHttp.responseText;
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
serge_girard
Posts: 2283
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 544 times
Been thanked: 115 times
Contact:

Post by serge_girard » Mon Feb 18, 2019 10:20 am

Jair,

Can you send complete sources?

Serge

User avatar
jairpinho
Posts: 301
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 10 times
Contact:

Post by jairpinho » Mon Feb 18, 2019 4:04 pm

serge_girard wrote:
Mon Feb 18, 2019 10:20 am
Jair,

Can you send complete sources?

Serge
added mysql button and example, add the folder harbour, I retired to get smaller file size
app42b.zip
(13.83 KiB) Downloaded 31 times
Last edited by jairpinho on Mon Feb 18, 2019 6:24 pm, edited 1 time in total.
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
serge_girard
Posts: 2283
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 544 times
Been thanked: 115 times
Contact:

Post by serge_girard » Mon Feb 18, 2019 5:57 pm

Jair,

File is probably damaged!

Serge

User avatar
jairpinho
Posts: 301
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 10 times
Contact:

Post by jairpinho » Mon Feb 18, 2019 6:24 pm

serge_girard wrote:
Mon Feb 18, 2019 5:57 pm
Jair,

File is probably damaged!

Serge
app42b.zip
(13.83 KiB) Downloaded 46 times
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

Post Reply