/// <summary> /// Executes the query. /// </summary> /// <param name="command">The command.</param> /// <returns>IDfCollection.</returns> public IDfCollection ExecuteQuery(DqlCommand command) { //File.AppendAllText("DqlConnect.log", sessionId + " executing query \r\n"); //File.AppendAllText("DqlConnect.log", sessionId + " state " + state + Environment.NewLine); if (state == ConnectionState.Closed) { throw new System.InvalidOperationException("Invalid operation. The connection is closed."); } if (_session == null || !_session.isConnected()) { throw new DqlSessionException("Invalid Documentum Session"); } if (_clientx == null) { throw new Exception("The operation in invalid. Please check the connection and/or connection string and try again.\r\nFailed to retrieve a DQL client object"); } IDfQuery query = _clientx.getQuery(); if (query == null) { throw new Exception("IDfQuery object is null"); } query.setDQL(command.CommandText); query.setBatchSize(10000); return(query.execute(_session, (int)tagDfQueryTypes.IDfQuery_DF_READ_QUERY)); }
/// <summary> /// Opens a database connection with the settings specified by the <see cref="P:System.Data.Common.DbConnection.ConnectionString" />. /// </summary> /// <exception cref="System.Exception">Failed conecting to Documentum</exception> public override void Open() { if (state == ConnectionState.Open || state == ConnectionState.Connecting) { return; } state = ConnectionState.Connecting; if (builder == null) { builder = new DqlConnectionStringBuilder(); builder.ConnectionString = this.ConnectionString; } _loginInfoObj = _clientx.getLoginInfo(); _loginInfoObj.setUser(builder.UserId); _loginInfoObj.setPassword(builder.Password); //File.AppendAllText("DqlConnect.log", sessionId + " login success\r\n"); try { // Create a new session to the requested DocBase _session = _client.newSession(builder.Repository, _loginInfoObj); if (_session == null && !_session.isConnected()) { state = ConnectionState.Closed; throw new DqlSessionException("Failed conecting to Documentum"); } state = ConnectionState.Open; } catch (Exception ex) { state = ConnectionState.Closed; throw new DqlSessionException("Unable to create session. Make sure the repository is available.\r\n" + connectionString, ex); } }