blob: ac5f34867a026d53cef13c8fcd8cfcfa397d75a4 [file]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en-us" lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="DC.Type" content="reference"/>
<meta name="DC.Title" content="FROM Clause"/>
<meta name="abstract" content=""/>
<meta name="description" content=""/>
<meta name="DC.Relation" scheme="URI" content="../reference/oqlsyntax.html"/>
<meta name="copyright" content="Copyright (c) 2008, 2010 SAP AG and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html " type="primary"/>
<meta name="DC.Rights.Owner" content="Copyright (c) 2008, 2010 SAP AG and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html " type="primary"/>
<meta name="DC.Format" content="XHTML"/>
<meta name="DC.Identifier" content="ref_oqlsyntaxfrom"/>
<meta name="DC.Language" content="en-us"/>
<link rel="stylesheet" type="text/css" href="../styles/commonltr.css"/>
<title>FROM Clause</title>
</head>
<body id="ref_oqlsyntaxfrom">
<h1 class="title topictitle1">FROM Clause</h1>
<div class="body refbody"><p class="shortdesc"/>
<div class="section"><h2 class="title sectiontitle">Specify the class</h2>
<p class="p">
The FROM clause defines the classes on which to operate.
Specify the class by one of the following means:
</p>
<strong class="ph b">by class name:</strong>
<pre class="pre codeblock">SELECT * FROM java.lang.String</pre>
<strong class="ph b">by a regular expression matching the class name:</strong>
<pre class="pre codeblock">SELECT * FROM "java\.lang\..*"</pre>
<strong class="ph b">by the object address of the class:</strong>
<pre class="pre codeblock">SELECT * FROM 0x2b7468c8</pre>
<strong class="ph b">by the object addresses of more than one class:</strong>
<pre class="pre codeblock">SELECT * FROM 0x2b7468c8,0x2b74aee0</pre>
<strong class="ph b">by the object id of the class:</strong>
<pre class="pre codeblock">SELECT * FROM 20815</pre>
<strong class="ph b">by the object ids of more than one class:</strong>
<pre class="pre codeblock">SELECT * FROM 20815,20975</pre>
<strong class="ph b">by a sub select:</strong>
<pre class="pre codeblock">SELECT * FROM ( SELECT *
FROM java.lang.Class c
WHERE c implements org.eclipse.mat.snapshot.model.IClass )</pre>
<p class="p">
The statement returns all objects in the heap. The
<span class="keyword cmdname">implements</span>
check is necessary, as the heap dump can contain
<span class="keyword cmdname">java.lang.Class</span>
instances caused by proxy classes or classes representing
primitive types such as
<span class="keyword cmdname">int.class</span> or <span class="keyword cmdname">Integer.TYPE</span>.
The following query has
the same effect, which calls a method directly on
the ISnapshot object:
</p>
<pre class="pre codeblock">SELECT * FROM ${snapshot}.getClasses()</pre>
</div>
<div class="section"><h2 class="title sectiontitle">Include sub classes</h2>
<p class="p">
Use the
<span class="keyword cmdname">INSTANCEOF</span>
keyword to include objects of sub-classes into the
query:
</p>
<pre class="pre codeblock">SELECT * FROM INSTANCEOF java.lang.ref.Reference</pre>
<p class="p">
The resulting table contains, amongst others,
WeakReference and SoftReference objects because both
classes extend from
<span class="keyword cmdname">java.lang.ref.Reference</span>
. By the way, the same result has the following query
</p>
<pre class="pre codeblock">SELECT * FROM ${snapshot}.getClassesByName("java.lang.ref.Reference", true)</pre>
</div>
<div class="section"><h2 class="title sectiontitle">
Prevent interpretation of the from term as classes
</h2>
<p class="p">
Use the OBJECTS keyword if you do not want to process
the term as classes.
Specify the object or objects by one of the following means:
</p>
<strong class="ph b">by class name:</strong>
<pre class="pre codeblock">SELECT * FROM OBJECTS java.lang.String</pre>
<p class="p">
The result is just one object, the java.lang.String
class object.
</p>
<strong class="ph b">by the object address of the particular object:</strong>
<pre class="pre codeblock">SELECT * FROM OBJECTS 0x2b7468c8</pre>
<strong class="ph b">by the object addresses of particular objects:</strong>
<pre class="pre codeblock">SELECT * FROM OBJECTS 0x2b7468c8,0x2b746868</pre>
<strong class="ph b">by the object id of the particular object:</strong>
<pre class="pre codeblock">SELECT * FROM OBJECTS 20815</pre>
<strong class="ph b">by the object ids of particular objects:</strong>
<pre class="pre codeblock">SELECT * FROM OBJECTS 20815,20814</pre>
<strong class="ph b">by a sub expression (Memory Analyzer 1.4 or later):</strong>
<pre class="pre codeblock">SELECT * FROM OBJECTS (1 + ${snapshot}.GCRoots.length)</pre>
<div class="note note"><span class="notetitle">Note:</span>
Please note, that currently the FROM OBJECTS term is in
the test phase!
</div>
</div>
<div class="section"><h2 class="title sectiontitle">
Autocompletion
</h2>
<p class="p">
The OQL pane now has autocompletion for class names, class name regular expressions,
field names, attributes and methods.
See <a class="xref" href="tipsandtricks.html#oqlcompletion">OQL autocompletion</a>.
</p>
</div>
</div>
<div class="related-links">
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../reference/oqlsyntax.html">OQL Syntax</a></div>
</div>
</div>
</body>
</html>