In this release, a lot of support for MySql back-ends in AMP (standard web) servers. Thanks to Rathinagiri for his MySqlBrowse that served as a base for SqlBrowse.
SQLCONNECTION
Syntax:
SqlConnection( cHostName , cUser , cPassword , cDataBase )
Example:
oConn = new SqlConnection( 'localhost' , 'root' , 'pass' , 'test' )
------------------------------------------------------------------------------------------------
SQLEXEC
Syntax:
<nAffectedRows> = SqlExec ( oConnection , cSqlCommand )
Example:
oConn = new SqlConnection( 'localhost' , 'root' , 'pass' , 'test' )
nAffectedRows = SqlExec ( oConn , 'DELETE FROM TEST WHERE code=123' )
------------------------------------------------------------------------------------------------
SQLBROWSE
Syntax:
SqlBrowse( oParent , nRow , nCol , nWidth , nHeight , oConnection , cQuery, nInnerWidth )
Methods:
- getSelectedRows()
- getRowCount()
- getCell(nRow,nCount)
- select()
- unSelect()
- refresh()
- getId()
- getSelectedRowCount()
Example:
oForm = new Form( "SQLBrowse Test", 590 , 480 );
oConn = new SqlConnection( 'localhost' , 'root', 'vertrigo' , 'test' );
oBrowse = new SqlBrowse( oForm , 050 , 050 , 510 , 340 , oConn ,
'select * from country', 493 );
------------------------------------------------------------------------------------------------
SQLQUERY
Syntax:
SqlQuery( oConnection , cQuery )
Description:
Returns an array containing the query result.
Example:
oConn = new SqlConnection( 'localhost' , 'root', 'vertrigo' , 'test' );
aQuery = SqlQuery( oConn , 'select * from country' );
for ( i = 0 ; i < aQuery.length ; i++ )
{
field1 = aQuery [0];
field2 = aQuery [1];
field3 = aQuery [2];
alert( field1 + ' ' + field2 + ' ' + field3 );
}
------------------------------------------------------------------------------------------------
https://sourceforge.net/projects/hmgscript/
Enjoy!