MySQLPreparedStatement::~MySQLPreparedStatement()
{
    ClearParameters();
    mysql_stmt_close(m_Mstmt);
    delete[] m_bind;
}
Ejemplo n.º 2
0
bool NXConnection::SetParameters( NXSettings* sets )
{
  string sTmp = "";

  ClearParameters( pSession );

  sTmp = options->GetNXPersonalDirectory();

  NX_LOG_LOGDEBUG( "setting 'NX_PersonalDirectory' to '" + sTmp + "'." );
  SetStringParameter( pSession, NX_PersonalDirectory, sTmp.c_str() );

  NX_LOG_LOGDEBUG( "checking cookie...");

  sTmp = options->GetNXCookieFilePath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_CookieTempFilePath' to '" + sTmp + "'." );
  SetStringParameter( pSession, NX_CookieTempFilePath, sTmp.c_str() );

  if( GetExistingSessionCookie( pSession ) != NX_Ok )
  {
    if( GenerateSessionCookie( pSession ) != NX_Ok )
    {
      NX_LOG_LOGERROR( "session cookie NOT found... and cannot create a new one." );
      return false;
    }
  }
  NX_LOG_LOGDEBUG( "cookie found...");

  sTmp = options->GetNXSshPath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_SshPath' to '" + sTmp + "'.");
  SetStringParameter( pSession, NX_SshPath, options->GetNXSshPath().c_str() );

  sTmp = options->GetNXSshKeyPath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_SshKeyPath' to '" + sTmp + "'.");
  SetStringParameter( pSession, NX_SshKeyPath, sTmp.c_str() );

  sTmp = options->GetNXSshLogPath();
  NX_LOG_LOGDEBUG( "Info: setting 'NX_SshLogPath' to '" + sTmp + "'." );
  SetStringParameter( pSession, NX_SshLogPath, sTmp.c_str() );

#ifndef WIN32
SetBoolParameter(pSession, NX_ProxyUseOptionsFile, true);
#endif

  /* Convert other Paramaters */
  SettingsToParameters stp( sets, pSession );
  stp.Convert();

  SetStringParameter( pSession, NX_ProxyPath, options->GetNXProxyPath().c_str() );
  SetStringParameter( pSession, NX_ProxyLibraryPath, options->GetNXLibDirectory().c_str() );
  SetStringParameter( pSession, NX_ProxyMode, "S" );

#if defined (WIN32)
    /* XServer */
  string xspath = options->GetNXBinDirectory() + "\\nxwin.exe";
 
  SetStringParameter( pSession, NX_XServerPath, xspath.c_str() );
  SetStringParameter( pSession, NX_XServerName, "nxwin.exe" );
  SetStringParameter( pSession, NX_XServerPort, ":0" );
  SetStringParameter( pSession, NX_ProxyDisplay, ":0" );
 
  SetStringParameter( pSession, NX_XServer_FirstCustomOption, "-emulate3buttons" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 1, "-agent" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 2, "-hide" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 3 , "-noreset" );
  SetStringParameter( pSession, NX_XServer_FirstCustomOption + 4 , "-ac" );
#endif
  return true;
}