sqlquery.html

来自「基于mondrian 开源框架进行OLAP多维分析」· HTML 代码 · 共 871 行 · 第 1/3 页

HTML
871
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_15) on Thu Jul 31 17:20:14 EDT 2008 --><TITLE>SqlQuery (Mondrian OLAP Server, version 3.0.4.11371)</TITLE><META NAME="keywords" CONTENT="mondrian.rolap.sql.SqlQuery class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="SqlQuery (Mondrian OLAP Server, version 3.0.4.11371)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../mondrian/rolap/sql/SqlConstraint.html" title="interface in mondrian.rolap.sql"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../mondrian/rolap/sql/SqlQuery.ClauseList.html" title="class in mondrian.rolap.sql"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html?mondrian/rolap/sql/SqlQuery.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="SqlQuery.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">mondrian.rolap.sql</FONT><BR>Class SqlQuery</H2><PRE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>  <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>mondrian.rolap.sql.SqlQuery</B></PRE><HR><DL><DT><PRE>public class <B>SqlQuery</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL></PRE><P><code>SqlQuery</code> allows us to build a <code>select</code> statement and generate it in database-specific SQL syntax. <p> Notable differences in database syntax are:<dl> <dt> Identifier quoting </dt> <dd> Oracle (and all JDBC-compliant drivers) uses double-quotes, for example <code>select * from "emp"</code>. Access prefers brackets, for example <code>select * from [emp]</code>. mySQL allows single- and double-quotes for string literals, and therefore does not allow identifiers to be quoted, for example <code>select 'foo', "bar" from emp</code>. </dd> <dt> AS in from clause </dt> <dd> Oracle doesn't like AS in the from * clause, for example <code>select from emp as e</code> vs. <code>select * from emp e</code>. </dd> <dt> Column aliases </dt> <dd> Some databases require that every column in the select list has a valid alias. If the expression is an expression containing non-alphanumeric characters, an explicit alias is needed. For example, Oracle will barfs at <code>select empno + 1 from emp</code>. </dd> <dt> Parentheses around table names </dt> <dd> Oracle doesn't like <code>select * from (emp)</code> </dd> <dt> Queries in FROM clause </dt> <dd> PostgreSQL and hsqldb don't allow, for example, <code>select * from (select * from emp) as e</code>.</dd> <dt> Uniqueness of index names </dt> <dd> In PostgreSQL and Oracle, index names must be unique within the database; in Access and hsqldb, they must merely be unique within their table </dd> <dt> Datatypes </dt> <dd> In Oracle, BIT is CHAR(1), TIMESTAMP is DATE.      In PostgreSQL, DOUBLE is DOUBLE PRECISION, BIT is BOOL. </dd> </ul> <p> NOTE: Instances of this class are NOT thread safe so the user must make sure this is accessed by only one thread at a time.<P><P><DL><DT><B>Version:</B></DT>  <DD>$Id: //open/mondrian-release/3.0/src/main/mondrian/rolap/sql/SqlQuery.java#5 $</DD><DT><B>Author:</B></DT>  <DD>jhyde</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Nested Class Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>(package private) static&nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.ClauseList.html" title="class in mondrian.rolap.sql">SqlQuery.ClauseList</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.CodeSet.html" title="class in mondrian.rolap.sql">SqlQuery.CodeSet</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collection of alternative code for alternative dialects.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.Datatype.html" title="enum in mondrian.rolap.sql">SqlQuery.Datatype</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Datatype of a column.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.Dialect.html" title="class in mondrian.rolap.sql">SqlQuery.Dialect</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Description of a SQL dialect.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#SqlQuery(java.sql.DatabaseMetaData)">SqlQuery</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html" title="class or interface in java.sql">DatabaseMetaData</A>&nbsp;databaseMetaData)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>SqlQuery</code></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#SqlQuery(mondrian.rolap.sql.SqlQuery.Dialect)">SqlQuery</A></B>(<A HREF="../../../mondrian/rolap/sql/SqlQuery.Dialect.html" title="class in mondrian.rolap.sql">SqlQuery.Dialect</A>&nbsp;dialect)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a SqlQuery using a given dialect and inheriting the formatting preferences from <A HREF="../../../mondrian/olap/MondrianProperties.html#GenerateFormattedSql"><CODE>MondrianProperties.GenerateFormattedSql</CODE></A> property.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#SqlQuery(mondrian.rolap.sql.SqlQuery.Dialect, boolean)">SqlQuery</A></B>(<A HREF="../../../mondrian/rolap/sql/SqlQuery.Dialect.html" title="class in mondrian.rolap.sql">SqlQuery.Dialect</A>&nbsp;dialect,         boolean&nbsp;formatted)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Base constructor used by all other constructors to create an empty instance.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#addFrom(mondrian.olap.MondrianDef.RelationOrJoin, java.lang.String, boolean)">addFrom</A></B>(<A HREF="../../../mondrian/olap/MondrianDef.RelationOrJoin.html" title="class in mondrian.olap">MondrianDef.RelationOrJoin</A>&nbsp;relation,        <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;alias,        boolean&nbsp;failIfExists)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a relation to a query, adding appropriate join conditions, unless it is already present.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#addFrom(mondrian.rolap.sql.SqlQuery, java.lang.String, boolean)">addFrom</A></B>(<A HREF="../../../mondrian/rolap/sql/SqlQuery.html" title="class in mondrian.rolap.sql">SqlQuery</A>&nbsp;sqlQuery,        <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;alias,        boolean&nbsp;failIfExists)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#addFromQuery(java.lang.String, java.lang.String, boolean)">addFromQuery</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;query,             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;alias,             boolean&nbsp;failIfExists)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a subquery to the FROM clause of this Query with a given alias.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>(package private) &nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#addFromTable(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)">addFromTable</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;schema,             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;table,             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;alias,             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;filter,             boolean&nbsp;failIfExists)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds <code>[schema.]table AS alias</code> to the FROM clause.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../mondrian/rolap/sql/SqlQuery.html#addGroupBy(java.lang.String)">addGroupBy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;expression)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?