Ejemplo n.º 1
0
        public override List <ITableShortInfo> GetTableNames(string searchString)
        {
            string selectStmt = GetStatementForSelectTableNames(searchString);

            List <ITableShortInfo>      tables     = new List <ITableShortInfo>();
            InternalSqlServerConnection connection = null;

            try
            {
                connection = new InternalSqlServerConnection(DbContext.ConnectionString);
                using (InternalSqlServerCommand command = new InternalSqlServerCommand(selectStmt, connection))
                {
                    SqlDataReader reader = command.Command.ExecuteReader(CommandBehavior.CloseConnection);
                    while (reader.Read())
                    {
                        tables.Add(TableShortInfoFactory.CreateInstance(reader.GetString(0), GetRowCount(reader.GetString(0))));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ADatabaseException("ERROR when getting table names: " + selectStmt, ex);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }

            return(tables);
        }
Ejemplo n.º 2
0
        public override List <ITableShortInfo> GetTableNames(string searchString)
        {
            var selectStmt = GetStatementForSelectTableNames(searchString);

            var tables = new List <ITableShortInfo>();
            var cursor = DbContext.PowerPlant.CreateDataCursor();

            try
            {
                var reader = cursor.ExecuteReader(selectStmt);
                while (reader.Read())
                {
                    tables.Add(TableShortInfoFactory.CreateInstance(reader.GetString(0), GetRowCount(reader.GetString(0))));
                }
            }
            catch (Exception ex)
            {
                throw new ADatabaseException("ERROR with statement in GetTableNames", ex);
            }
            finally
            {
                cursor.Close();
            }

            return(tables);
        }