FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Ads y registro bloqueados ( SOLUCIONADO )
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Ads y registro bloqueados ( SOLUCIONADO )
Posted: Tue Apr 20, 2010 03:42 PM

Estimados,

habra alguna forma de saber que usuario tiene un registro bloqueado con el servidor de ADS

desde ya muchas gracias..

Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ads y registro bloqueados
Posted: Tue Apr 20, 2010 09:01 PM

ADSMGGETLOCKOWNER()

Regards



G. N. Rao.

Hyderabad, India
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: Ads y registro bloqueados
Posted: Tue Apr 20, 2010 10:35 PM
Gracias por responder

revisando la funcion
Code (fw): Select all Collapse
 * NOTE: returns an array of 5 elements if successful
 *       [1] Client machine name when server runs on NT/2000
 *           Client Username when server runs on Netware
 *       [2] Netware connection number
 *       [3] Login user name for data dictionary connections (ADS 6.0 and above)
 *       [4] Client machine IP address (ADS 6.0 and above)
 *       [5] lock type ADS_MGMT_NO_LOCK ADS_MGMT_RECORD_LOCK ADS_MGMT_FILE_LOCK
 *       
 *       returns the advantage error code if it fails.
 */
HB_FUNC( ADSMGGETLOCKOWNER )
{
   UNSIGNED16 pusLockType = 0;
   UNSIGNED16 usStructSize = sizeof( ADS_MGMT_USER_INFO );
   ADS_MGMT_USER_INFO * pstUserInfo = ( ADS_MGMT_USER_INFO * ) hb_xgrab( sizeof( ADS_MGMT_USER_INFO ) );

pero siempre me retorna un arreglo vacio,

tendras un ejemplo como funciona

desde ya gracias
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
Posts: 1074
Joined: Fri Oct 07, 2005 01:56 PM
Re: Ads y registro bloqueados
Posted: Thu Apr 22, 2010 04:03 PM
Adjunto la solución en ADS server para saber quien tiene bloqueado un registro X de una base de datos

gracias a nageswaragunupudi por darme un pista para dar con la solucion

Code (fw): Select all Collapse
Function VerRegLock( cDbf, nReg )
    local aRay

    DEFAULT cDbf := "dbtodos.ADT", nReg := 1

    AdsMgConnect( "\\servercarmona2\WINVENT\DatosAdt" )

    aRay := AdsMgGetLockOwner( "\\servercarmona2\WINVENT\DatosAdt\" +cDbf, nReg )

    AdsMgDisconnect()

    if !empty( aRay )
        if empty( aRay[1] )
            MsgInfo( "No existe el registro "+ltrim(str(nReg)) + " bloqueado en "+cDbf, "Usuario" )
        else
            MsgInfo( "Maquina     :"+aRay[1] + CRLF +;
                        "Conexion nº :"+cValtochar(aRay[2]) + CRLF +;
                        "Login Name  :"+aRay[3] + CRLF +;
                        "Ip cliente  :"+aRay[4] + CRLF +;
                        "Lock Type   :"+cValtochar(aRay[5]), "Registro nº "+ltrim(str(nReg)) + " bloqueado en "+cDbf )
        endif
    else
        MsgInfo( "Error en la Conexión "+CRLF+"Error nº "+cValtochar( AdsGetLastError() ), "Usuario" )
    endif

return( .t. )

//--------------------------------------------------------------------------------------------------
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl

Continue the discussion