提交 207f063c authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 36d52017
......@@ -78,8 +78,8 @@ or by using Statement.setMaxRows(max).
<h3>Large Result Sets and External Sorting</h3>
<p>
For result set larger than 1000 rows, the result is buffered to disk. If ORDER BY is used,
the sorting is done using an external sort algorithm. In this case, each block of rows is sorted using
For large result set, the result is buffered to disk. The threshold can be defined using the statement SET MAX_MEMORY_ROWS.
If ORDER BY is used, the sorting is done using an external sort algorithm. In this case, each block of rows is sorted using
quick sort, then written to disk; when reading the data, the blocks are merged together.
</p>
......
......@@ -16,7 +16,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>H2 Console: The progress display when opening a database has been improved.
<ul><li>ORDER BY on tableName.columnName didn't work correctly if the column
name was also used as an alias.
</li><li>H2 Console: The progress display when opening a database has been improved.
</li><li>The error message when the server doesn't start has been improved.
</li><li>Key values can now be changed in updatable result sets.
</li><li>Changes in updatable result sets are now visible even when resetting the result set.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
setlocal
cd ../..
rem call java16
rem call build all
rem makensis /v2 src/installer/h2.nsi
rem soffice.exe -invisible macro:///Standard.Module1.H2Pdf
REM ***** BASIC *****
rem run macro: soffice.exe -invisible macro:///standard.module1.macro1
Sub Main
H2Pdf
H2Pdf
End Sub
sub H2Pdf
Url = "file:///C:/data/h2database/h2/docs/html/onePage.html"
dim FileProperties(1) As New com.sun.star.beans.PropertyValue
FileProperties(0).Name = "FilterName"
FileProperties(0).Value = "HTML (StarWriter)"
FileProperties(1).Name = "UpdateDocMode"
FileProperties(1).Value = 3 'full update
document = StarDesktop.loadComponentFromURL(Url, "_blank", 0, FileProperties)
docs = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
StyleFamilies = document.StyleFamilies
ParagraphStyles = StyleFamilies.getByName("ParagraphStyles")
BodyStyle = ParagraphStyles.getByName("Text body")
BodyStyle.ParaOrphans = 2
BodyStyle.ParaWidows = 2
rem dim args1(2) as new com.sun.star.beans.PropertyValue
rem args1(0).Name = "Template"
rem args1(0).Value = "Text body"
rem args1(1).Name = "ParaOrphans"
rem args1(1).Value = 2
rem args1(2).Name = "ParaWidows"
rem args1(2).Value = 2
rem dispatcher.executeDispatch(docs, ".uno:StyleApply", "", 0, args1())
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Param"
args1(0).Value = "Text body"
dispatcher.executeDispatch(docs, ".uno:EditStyle", "", 0, args1())
MsgBox "OK"
rem wait 2000
HeadingStyle = ParagraphStyles.getByName("Heading 1")
HeadingStyle.BreakType = 3 ' Insert Page Break Before
HeadingStyle.ParaKeepTogether = false
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Param"
args2(0).Value = "Heading 1"
dispatcher.executeDispatch(docs, ".uno:EditStyle", "", 0, args2())
MsgBox "OK"
rem wait 2000
rem Dim args2(2) as new com.sun.star.beans.PropertyValue
rem args2(0).Name = "Template"
rem args2(0).Value = "Heading 1"
rem args2(1).Name = "BreakType"
rem args2(1).Value = 3
rem args2(2).Name = "ParaKeepTogether"
rem args2(2).Value = false
rem dispatcher.executeDispatch(docs, ".uno:StyleApply", "", 0, args2())
images = document.GraphicObjects
For i = 0 to images.getCount() - 1
image = images.getByIndex(i)
if image.Size.Width <> image.ActualSize.Width or image.Size.Height <> image.ActualSize.Height then
image.Size.Width = image.ActualSize.Width
image.Size.Height = image.ActualSize.Height
rem msgbox "update"
wait 1000
end if
Next
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
rem ----------------------------------------------------------------------
PageStyles = StyleFamilies.getByName("PageStyles")
Standard = PageStyles.getByName("HTML")
Standard.FooterIsOn = True
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
oText = Standard.FooterText
oText.setString("")
PageNumber = document.createInstance("com.sun.star.text.TextField.PageNumber")
PageNumber.NumberingType = 4 ' magic constant: 4=Arabic numbers
PageNumber.SubType = 1 ' magic constant: use current page number
PageCount = document.createInstance("com.sun.star.text.TextField.PageCount")
PageCount.NumberingType = 4 ' magic constant: 4=Arabic numbers
FooterCursor = oText.Text.createTextCursor()
oText.insertString(FooterCursor, Chr(09)& Chr(09) & "Page ", False)
oText.insertTextContent(FooterCursor, PageNumber, False)
oText.insertString(FooterCursor, " of ", False)
oText.insertTextContent(FooterCursor, PageCount, False)
Cursor = document.Text.createTextCursor()
Cursor.gotoStart(false)
document.Text.insertString(Cursor, "H2 Database Engine", False)
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.ParaStyleName = "Text body"
document.Text.insertString(Cursor, "Version 1.0.76 (2008-08-02)", False)
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.BreakType = 4 ' Insert Page Break After
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.ParaStyleName = "Heading 1"
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
toc = document.createInstance("com.sun.star.text.ContentIndex")
toc.Title= "Table of Contents"
toc.CreateFromOutline = True
toc.Level = 4
toc.IsProtected = false
document.Text.insertTextContent(Cursor, toc, false)
Cursor.ParaStyleName = "Text body"
Cursor.BreakType = 4 ' Insert Page Break After
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.ParaStyleName = "Heading 1"
rem MsgBox toc.ParaStyleLevel1
rem MsgBox toc.ParaStyleLevel2
rem MsgBox toc.ParaStyleLevel3
rem MsgBox toc.ParaStyleLevel4
rem "Content 1"
dim linkStart(0) As New com.sun.star.beans.PropertyValue
dim linkEnd(0) As New com.sun.star.beans.PropertyValue
For i = 1 To 4
oLevel = toc.LevelFormat.getByIndex(i)
iCount = UBound(oLevel)
rem Dim newFormat(iCount + 2) As new com.sun.star.beans.PropertyValue
rem Dim newFormat(iCount + 2) As new com.sun.star.beans.PropertyValue
x = DimArray(5)
rem x = CreateUnoStruct("[][]com.sun.star.beans.PropertyValue")
rem x(0) = CreateUnoStruct("[]com.sun.star.beans.PropertyValue")
x = Array(linkStart, oLevel(0), oLevel(1), oLevel(2), oLevel(3), linkEnd)
old = oLevel(0)
rem ReDim linkStart(1) As New com.sun.star.beans.PropertyValue
rem ReDim linkEnd(1) As New com.sun.star.beans.PropertyValue
Url = "file:///C:/data/h2database/h2/docs/html/onePage.html"
dim FileProperties(1) As New com.sun.star.beans.PropertyValue
FileProperties(0).Name = "FilterName"
FileProperties(0).Value = "HTML (StarWriter)"
FileProperties(1).Name = "UpdateDocMode"
FileProperties(1).Value = 3 'full update
document = StarDesktop.loadComponentFromURL(Url, "_blank", 0, FileProperties)
docs = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
StyleFamilies = document.StyleFamilies
ParagraphStyles = StyleFamilies.getByName("ParagraphStyles")
BodyStyle = ParagraphStyles.getByName("Text body")
BodyStyle.ParaOrphans = 2
BodyStyle.ParaWidows = 2
rem dim args1(2) as new com.sun.star.beans.PropertyValue
rem args1(0).Name = "Template"
rem args1(0).Value = "Text body"
rem args1(1).Name = "ParaOrphans"
rem args1(1).Value = 2
rem args1(2).Name = "ParaWidows"
rem args1(2).Value = 2
rem dispatcher.executeDispatch(docs, ".uno:StyleApply", "", 0, args1())
rem dim args1(0) as new com.sun.star.beans.PropertyValue
rem args1(0).Name = "Param"
rem args1(0).Value = "Text body"
rem dispatcher.executeDispatch(docs, ".uno:EditStyle", "", 0, args1())
rem MsgBox "OK"
rem wait 2000
HeadingStyle = ParagraphStyles.getByName("Heading 1")
HeadingStyle.BreakType = 3 ' Insert Page Break Before
HeadingStyle.ParaKeepTogether = false
rem dim args2(0) as new com.sun.star.beans.PropertyValue
rem args2(0).Name = "Param"
rem args2(0).Value = "Heading 1"
rem dispatcher.executeDispatch(docs, ".uno:EditStyle", "", 0, args2())
rem MsgBox "OK"
rem wait 2000
rem Dim args2(2) as new com.sun.star.beans.PropertyValue
rem args2(0).Name = "Template"
rem args2(0).Value = "Heading 1"
rem args2(1).Name = "BreakType"
rem args2(1).Value = 3
rem args2(2).Name = "ParaKeepTogether"
rem args2(2).Value = false
rem dispatcher.executeDispatch(docs, ".uno:StyleApply", "", 0, args2())
images = document.GraphicObjects
For i = 0 to images.getCount() - 1
image = images.getByIndex(i)
if image.Size.Width <> image.ActualSize.Width or image.Size.Height <> image.ActualSize.Height then
image.Size.Width = image.ActualSize.Width
image.Size.Height = image.ActualSize.Height
rem msgbox "update"
wait 100
end if
Next
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
rem ----------------------------------------------------------------------
PageStyles = StyleFamilies.getByName("PageStyles")
Standard = PageStyles.getByName("HTML")
Standard.FooterIsOn = True
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
oText = Standard.FooterText
oText.setString("")
PageNumber = document.createInstance("com.sun.star.text.TextField.PageNumber")
PageNumber.NumberingType = 4 ' magic constant: 4=Arabic numbers
PageNumber.SubType = 1 ' magic constant: use current page number
PageCount = document.createInstance("com.sun.star.text.TextField.PageCount")
PageCount.NumberingType = 4 ' magic constant: 4=Arabic numbers
FooterCursor = oText.Text.createTextCursor()
oText.insertString(FooterCursor, Chr(09)& Chr(09), False)
oText.insertTextContent(FooterCursor, PageNumber, False)
oText.insertString(FooterCursor, " of ", False)
oText.insertTextContent(FooterCursor, PageCount, False)
Cursor = document.Text.createTextCursor()
Cursor.gotoStart(false)
Cursor.gotoNextParagraph(false)
Cursor.gotoNextParagraph(false)
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
toc = document.createInstance("com.sun.star.text.ContentIndex")
toc.Title= "Table of Contents"
toc.CreateFromOutline = True
toc.Level = 4
toc.IsProtected = false
document.Text.insertTextContent(Cursor, toc, false)
rem Cursor.ParaStyleName = "Text body"
rem Cursor.BreakType = 4 ' Insert Page Break After
rem document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
rem Cursor.ParaStyleName = "Heading 1"
Cursor.gotoStart(false)
result = true
' loop over all following paragraphs
while result
result = Cursor.gotoNextParagraph(false)
if Cursor.ParaStyleName = "Heading 1" then
Cursor.BreakType = 4 ' Insert Page Break After
rem document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
end if
wend
dim linkStart(0) As New com.sun.star.beans.PropertyValue
dim linkEnd(0) As New com.sun.star.beans.PropertyValue
For i = 1 To 4
oLevel = toc.LevelFormat.getByIndex(i)
iCount = UBound(oLevel)
rem Dim newFormat(iCount + 2) As new com.sun.star.beans.PropertyValue
rem Dim newFormat(iCount + 2) As new com.sun.star.beans.PropertyValue
x = DimArray(5)
rem x = CreateUnoStruct("[][]com.sun.star.beans.PropertyValue")
rem x(0) = CreateUnoStruct("[]com.sun.star.beans.PropertyValue")
x = Array(linkStart, oLevel(0), oLevel(1), oLevel(2), oLevel(3), linkEnd)
old = oLevel(0)
rem ReDim linkStart(1) As New com.sun.star.beans.PropertyValue
rem ReDim linkEnd(1) As New com.sun.star.beans.PropertyValue
linkStart(0).Name = "TokenType"
linkStart(0).Value = "TokenHyperlinkStart"
linkStart(0).Handle = -1
linkStart(0).State = com.sun.star.beans.PropertyState.DIRECT_VALUE
rem linkStart(1).Name = old(0).Name
rem linkStart(1).Value = old(0).Value
rem linkStart(1).Handle = old(0).Handle
rem linkStart(1).State = old(0).State
linkEnd(0).Name = "TokenType"
rem linkStart(1).Name = old(0).Name
rem linkStart(1).Value = old(0).Value
rem linkStart(1).Handle = old(0).Handle
rem linkStart(1).State = old(0).State
linkEnd(0).Name = "TokenType"
linkEnd(0).Value = "TokenHyperlinkEnd"
linkEnd(0).Handle = -1
linkEnd(0).State = com.sun.star.beans.PropertyState.DIRECT_VALUE
rem linkEnd(1).Name = old(0).Name
rem linkEnd(1).Value = old(0).Value
rem linkEnd(1).Handle = old(0).Handle
rem linkEnd(1).State = old(0).State
rem For j = 0 To iCount
rem a = oLevel(j)
rem newFormat(j + 1, 0) = a(0)
rem newFormat(j + 1, 1) = a(1)
rem linkEnd(1).Name = old(0).Name
rem linkEnd(1).Value = old(0).Value
rem linkEnd(1).Handle = old(0).Handle
rem linkEnd(1).State = old(0).State
rem For j = 0 To iCount
rem a = oLevel(j)
rem newFormat(j + 1, 0) = a(0)
rem newFormat(j + 1, 1) = a(1)
rem newFormat(j + 1, 0) = CreateUnoStruct("com.sun.star.beans.PropertyValue")
rem newFormat(j + 1, 0).Name = oLevel(j).Name
rem newFormat(j + 1).Value = oLevel(j).Value
rem newFormat(j + 1).Handle = oLevel(j).Handle
rem newFormat(j + 1).State = oLevel(j).State
rem Next
rem Next
rem newFormat(iCount + 2, 0) = CreateUnoStruct("com.sun.star.beans.PropertyValue")
rem newFormat(iCount + 2, 0) = CreateUnoStruct("com.sun.star.beans.PropertyValue")
rem newFormat(iCount + 2, 0).Name = "TokenType"
rem newFormat(iCount + 2, 0).Value = "TokenHyperlinkEnd"
rem newFormat(iCount + 2, 0).Handle = -1
rem newFormat(iCount + 2, 0).State = com.sun.star.beans.PropertyState.DIRECT_VALUE
rem a = oLevel(1)
rem newFormat(iCount + 2, 1) = a(1)
rem oProperties = CreateUnoStruct("[]com.sun.star.beans.PropertyValue")
rem oProperties.Set "[]com.sun.star.beans.PropertyValue", newFormat
rem toc.LevelFormat.replaceByIndex(i, oLevel)
rem oProperties = CreateUnoStruct("[]com.sun.star.beans.PropertyValue")
rem oProperties.Set "[]com.sun.star.beans.PropertyValue", newFormat
rem toc.LevelFormat.replaceByIndex(i, oLevel)
toc.LevelFormat.replaceByIndex(i, x)
next
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
toc.update()
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
toc.update()
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
dim pdfurl as string
pdfurl = "file:///C:/data/h2database/h2web/h2.pdf"
dim pdfProperties(1) as new com.sun.star.beans.PropertyValue
pdfProperties(0).Name = "FilterName"
pdfProperties(0).Value = "writer_pdf_Export"
document.storeToURL(pdfurl, pdfProperties())
next
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
toc.update()
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
toc.update()
dispatcher.executeDispatch(docs, ".uno:UpdateAll", "", 0, Array())
pdfTemp = "file:///C:/data/h2database/h2web/h2temp.pdf"
pdf = "file:///C:/data/h2database/h2web/h2.pdf"
dim pdfProperties(1) as new com.sun.star.beans.PropertyValue
pdfProperties(0).Name = "FilterName"
pdfProperties(0).Value = "writer_pdf_Export"
document.storeToURL(pdfTemp, pdfProperties())
fileAccessService = createUnoService("com.sun.star.ucb.SimpleFileAccess")
fileAccessService.move(pdfTemp, pdf)
ThisComponent.close(true)
end sub
sub Other
rem ----------------------------------------------------------------------
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem FooterCursor = Standard.FooterTextRight.Text.createTextCursor()
rem Standard.FooterTextRight.Text.insertTextContent(FooterCursor, PageNumber, False)
......@@ -301,41 +304,41 @@ rem ----------------------------------------------------------------------
end sub
sub Footer
oDoc = ThisComponent
oStyles = oDoc.getStyleFamilies
oPS = oStyles.getByName("PageStyles")
Stan = oPS.getByName("HTML")
Stan.FooterIsOn = True
oText = Stan.FooterText
oText.setString("")
PageNumber = oDoc.createInstance("com.sun.star.text.TextField.PageNumber")
PageNumber.NumberingType = 4
PageCount = oDoc.createInstance("com.sun.star.text.TextField.PageCount")
PageCount.NumberingType = 4
FooterCursor = oText.Text.createTextCursor()
oText.insertString(FooterCursor, "Page ", False)
oText.insertTextContent(FooterCursor, PageNumber, False)
oText.insertString(FooterCursor, " of ", False)
oText.insertTextContent(FooterCursor, PageCount, False)
MsgBox "End"
oDoc = ThisComponent
oStyles = oDoc.getStyleFamilies
oPS = oStyles.getByName("PageStyles")
Stan = oPS.getByName("HTML")
Stan.FooterIsOn = True
oText = Stan.FooterText
oText.setString("")
PageNumber = oDoc.createInstance("com.sun.star.text.TextField.PageNumber")
PageNumber.NumberingType = 4
PageCount = oDoc.createInstance("com.sun.star.text.TextField.PageCount")
PageCount.NumberingType = 4
FooterCursor = oText.Text.createTextCursor()
oText.insertString(FooterCursor, "Page ", False)
oText.insertTextContent(FooterCursor, PageNumber, False)
oText.insertString(FooterCursor, " of ", False)
oText.insertTextContent(FooterCursor, PageCount, False)
MsgBox "End"
end sub
sub Test
MsgBox "hallo"
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
dim FileProperties(0) As New com.sun.star.beans.PropertyValue
dim Url As String
dim StyleFamilies As Object
dim PageProperties as object
dim Standard as Object
dim PageNumber as Object
dim HContent as Object
dim HText as Object
dim MyPageStyle as object
MsgBox "hallo"
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
dim FileProperties(0) As New com.sun.star.beans.PropertyValue
dim Url As String
dim StyleFamilies As Object
dim PageProperties as object
dim Standard as Object
dim PageNumber as Object
dim HContent as Object
dim HText as Object
dim MyPageStyle as object
end sub
......@@ -362,7 +365,29 @@ rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
document.Text.insertString(Cursor, "H2 Database Engine", False)
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.ParaStyleName = "Text body"
document.Text.insertString(Cursor, "Version 1.0.76 (2008-08-02)", False)
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.BreakType = 4 ' Insert Page Break After
document.Text.insertControlCharacter(Cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
Cursor.ParaStyleName = "Heading 1"
rem ----------------------------------------------------------------------
end sub
\ No newline at end of file
end sub
sub ReadVersion
fileAccessService = createUnoService("com.sun.star.ucb.SimpleFileAccess")
Url = "file:///C:/data/h2database/h2/docs/html/version.txt"
inputStream = fileAccessService.openFileRead(Url)
textInputStream = createUnoService("com.sun.star.io.TextInputStream")
textInputStream.setInputStream(inputStream)
textInputStream.setEncoding("UTF-8")
s = textInputStream.readLine()
MsgBox s
end sub
......@@ -1279,7 +1279,7 @@ public class Parser {
Query command = parseSelectSub();
return parseSelectUnionExtension(command, start, false);
}
private Query parseSelectUnionExtension(Query command, int start, boolean unionOnly) throws SQLException {
while (true) {
if (readIf("UNION")) {
......@@ -1306,7 +1306,15 @@ public class Parser {
break;
}
}
if (!unionOnly && readIf("ORDER")) {
if (!unionOnly) {
parseEndOfQuery(command);
}
setSQL(command, null, start);
return command;
}
private void parseEndOfQuery(Query command) throws SQLException {
if (readIf("ORDER")) {
read("BY");
Select oldSelect = currentSelect;
if (command instanceof Select) {
......@@ -1346,7 +1354,34 @@ public class Parser {
command.setOrder(orderList);
currentSelect = oldSelect;
}
if (!unionOnly && readIf("LIMIT")) {
int test;
if (database.getMode().supportOffsetFetch) {
if (readIf("OFFSET")) {
Select temp = currentSelect;
// make sure aggregate functions will not work here
currentSelect = null;
command.setOffset(readExpression().optimize(session));
if (!readIf("ROW")) {
read("ROWS");
}
currentSelect = temp;
}
if (readIf("FETCH")) {
Select temp = currentSelect;
// make sure aggregate functions will not work here
currentSelect = null;
if (readIf("FIRST")) {
Expression limit = readExpression().optimize(session);
command.setLimit(limit);
if (!readIf("ROW")) {
read("ROWS");
}
readIf("ONLY");
}
currentSelect = temp;
}
}
if (readIf("LIMIT")) {
Select temp = currentSelect;
// make sure aggregate functions will not work here
currentSelect = null;
......@@ -1367,7 +1402,7 @@ public class Parser {
}
currentSelect = temp;
}
if (!unionOnly && readIf("FOR")) {
if (readIf("FOR")) {
if (readIf("UPDATE")) {
if (readIf("OF")) {
do {
......@@ -1387,8 +1422,6 @@ public class Parser {
}
}
}
setSQL(command, null, start);
return command;
}
private Query parseSelectSub() throws SQLException {
......@@ -2943,7 +2976,7 @@ public class Parser {
if (len == 0) {
throw getSyntaxError();
}
return getSaveTokenType(s);
return getSaveTokenType(s, database.getMode().supportOffsetFetch);
}
/**
......@@ -2952,14 +2985,14 @@ public class Parser {
* @param s the token to check
* @return true if it is a keyword
*/
public static boolean isKeyword(String s) {
public static boolean isKeyword(String s, boolean supportOffsetFetch) {
if (s == null || s.length() == 0) {
return false;
}
return getSaveTokenType(s) != IDENTIFIER;
return getSaveTokenType(s, supportOffsetFetch) != IDENTIFIER;
}
private static int getSaveTokenType(String s) {
private static int getSaveTokenType(String s, boolean supportOffsetFetch) {
switch (s.charAt(0)) {
case 'C':
if (s.equals("CURRENT_TIMESTAMP")) {
......@@ -2984,6 +3017,8 @@ public class Parser {
return KEYWORD;
} else if ("FULL".equals(s)) {
return KEYWORD;
} else if (supportOffsetFetch && "FETCH".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "FALSE", FALSE);
case 'G':
......@@ -3016,6 +3051,8 @@ public class Parser {
case 'O':
if ("ON".equals(s)) {
return KEYWORD;
} else if (supportOffsetFetch && "OFFSET".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "ORDER", KEYWORD);
case 'P':
......@@ -3476,7 +3513,7 @@ public class Parser {
boolean ifNotExists = readIfNoExists();
String constantName = readIdentifierWithSchema();
Schema schema = getSchema();
if (isKeyword(constantName)) {
if (isKeyword(constantName, false)) {
throw Message.getSQLException(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);
}
read("VALUE");
......@@ -3493,7 +3530,7 @@ public class Parser {
CreateAggregate command = new CreateAggregate(session);
command.setForce(force);
String name = readUniqueIdentifier();
if (isKeyword(name) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
if (isKeyword(name, false) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
throw Message.getSQLException(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);
}
command.setName(name);
......@@ -3597,7 +3634,7 @@ public class Parser {
CreateFunctionAlias command = new CreateFunctionAlias(session);
command.setForce(force);
String name = readUniqueIdentifier();
if (isKeyword(name) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
if (isKeyword(name, false) || Function.getFunction(database, name) != null || Aggregate.getAggregateType(name) >= 0) {
throw Message.getSQLException(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);
}
command.setAliasName(name);
......@@ -4550,7 +4587,7 @@ public class Parser {
return StringUtils.quoteIdentifier(s);
}
}
if (Parser.isKeyword(s)) {
if (Parser.isKeyword(s, true)) {
return StringUtils.quoteIdentifier(s);
}
return s;
......
......@@ -267,7 +267,7 @@ public abstract class Query extends Prepared {
int idx = expressions.size();
if (e instanceof ExpressionColumn) {
ExpressionColumn exprCol = (ExpressionColumn) e;
String alias = exprCol.getOriginalAliasName();
String tableAlias = exprCol.getOriginalTableAliasName();
String col = exprCol.getOriginalColumnName();
for (int j = 0; j < visible; j++) {
boolean found = false;
......@@ -275,15 +275,15 @@ public abstract class Query extends Prepared {
if (ec instanceof ExpressionColumn) {
ExpressionColumn c = (ExpressionColumn) ec;
found = col.equals(c.getColumnName());
if (alias != null && found) {
String ca = c.getOriginalAliasName();
if (tableAlias != null && found) {
String ca = c.getOriginalTableAliasName();
if (ca != null) {
found = alias.equals(ca);
found = tableAlias.equals(ca);
}
}
} else if (!(ec instanceof Alias)) {
continue;
} else if (col.equals(ec.getAlias())) {
} else if (tableAlias == null && col.equals(ec.getAlias())) {
found = true;
} else {
Expression ec2 = ec.getNonAliasExpression();
......
......@@ -7,58 +7,62 @@
package org.h2.engine;
/*
* Release checklist
* Release checklist:
*
* - Test with Hibernate
* - Run FindBugs
* - build jarClient, check jar file size
* - build jar, test with IKVM
* - build javadocImpl
* - Compile with JDK 1.6:
* java16
* build compile
* set classpath=
* build javadoc
* build javadocImpl (to find missing javadocs)
* - reset to JDK 1.4
* build compile
* java16
* compile
* - Change version and build number in
* Constants.java
* build jarClient
* - Check jar file size
* build jar
* build javadocImpl
* java16
* build compile
* set classpath=
* build javadoc
* build javadocImpl
* - Check if missing javadocs
* java14
* build compile
* java16
* compile
* - Change version and build number in Constants.java
* - Maybe increase TCP_DRIVER_VERSION (old clients must be compatible!)
* - Check code coverage
* - No " Message.get" (must be "throw Message.get")
* - Check that is no TODO in the docs
* - Run regression test with JDK 1.4 and 1.5
* - Use latest versions of other dbs (Derby 10.4.1.3;
* PostgreSQL 8.3.1; MySQL 5.0.51)
* - Use latest versions of other dbs
* Derby 10.4.1.3
* PostgreSQL 8.3.1
* MySQL 5.0.51
* - Change version(s) in performance.html
* - Run 'build benchmark' (with JDK 1.4 currently)
* java14
* build benchmark
* - Copy the benchmark results and update the performance page and diagram
* - Documentation: check if all Javadoc files are in the index
* - Update the changelog (add new version)
* - Update the newsfeed
* - build docs
* build docs
* - Check dataWeb/index.html, versions and links in main, downloads, build
* - PDF
* - footer
* - front page
* - orphan control
* - check images
* - table of contents
* - Use java 1.4
* - build all
* soffice.exe -invisible macro:///Standard.Module1.H2Pdf
* - Check in the PDF file:
* - footer
* - front page
* - orphan control
* - check images
* - table of contents
* java14
* build all
* - Copy the pdf file to h2/docs
* - build zip
* - Windows installer (nsis)
* build zip
* makensis /v2 src/installer/h2.nsi
* - Test Console
* - Test all languages
* - Scan for viruses
* - build mavenDeployCentral
* build mavenDeployCentral
* - Upload to SourceForge
* - java16
* - build compile
* - refresh
* java16
* build compile
* - svn commit
* - svn copy: /svn/trunk /svn/tags/version-1.0.x; Version 1.0.x (yyyy-mm-dd)
* - Newsletter: prepare (always to BCC!!)
......
......@@ -80,6 +80,12 @@ public class Mode {
*/
public boolean uniqueIndexSingleNull;
/**
* If the syntax [OFFSET .. ROW] [FETCH ... ONLY] should be supported.
* This is an alternative syntax for LIMIT .. OFFSET.
*/
public boolean supportOffsetFetch;
private String name;
static {
......
......@@ -199,7 +199,7 @@ public class ExpressionColumn extends Expression {
return columnName;
}
public String getOriginalAliasName() {
public String getOriginalTableAliasName() {
return tableAlias;
}
......
......@@ -314,7 +314,7 @@ implements Trigger, CloseListener
Parser p = new Parser(session);
String tab = q.substring(0, idx);
ExpressionColumn expr = (ExpressionColumn) p.parseExpression(tab);
String schemaName = expr.getOriginalAliasName();
String schemaName = expr.getOriginalTableAliasName();
String tableName = expr.getColumnName();
q = q.substring(idx + " WHERE ".length());
Object[][] columnData = parseKey(conn, q);
......
......@@ -391,7 +391,7 @@ public class DbContextRule implements Rule {
return null;
}
String alias = up.substring(0, i);
if (Parser.isKeyword(alias)) {
if (Parser.isKeyword(alias, true)) {
return null;
}
return query.substring(alias.length());
......@@ -414,7 +414,7 @@ public class DbContextRule implements Rule {
return null;
}
String alias = up.substring(0, i);
if (Parser.isKeyword(alias)) {
if (Parser.isKeyword(alias, true)) {
return null;
}
if (add) {
......
......@@ -270,6 +270,18 @@ java org.h2.test.TestAll timer
/*
drop table test;
create table test(a int);
insert into test values(1);
insert into test values(2);
select -test.a a from test order by test.a;
select -test.a from test order by test.a;
select -test.a aa from test order by a;
select -test.a aa from test order by aa;
select -test.a a from test order by test.a;
select -test.a a from test order by a;
drop all objects;
create domain email as varchar;
create table test(e email);
......@@ -289,8 +301,15 @@ https://bugs.eclipse.org/bugs/show_bug.cgi?id=137701
Support large updates (use the transaction log to undo).
H2 Console: support single file upload and directory download (optional)
document FTL_SEARCH, FTL_SEARCH_DATA
find quote:
You can't make a system that will not lose data, you can only make
a system that knows the last save point of 100% integrity. There are
too many variables and too much randomness on a cold hard power failure.
JaQu
row level locking
......
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(a int);
> ok
insert into test values(1), (2);
> update count: 2
select -test.a a from test order by test.a;
> A
> --
> -1
> -2
> rows (ordered): 2
select -test.a from test order by test.a;
> - TEST.A
> --------
> -1
> -2
> rows (ordered): 2
select -test.a aa from test order by a;
> AA
> --
> -1
> -2
> rows (ordered): 2
select -test.a aa from test order by aa;
> AA
> --
> -2
> -1
> rows (ordered): 2
select -test.a a from test order by a;
> A
> --
> -2
> -1
> rows (ordered): 2
drop table test;
> ok
CREATE TABLE table_a(a_id INT PRIMARY KEY, left_id INT, right_id INT);
> ok
......
......@@ -11,6 +11,7 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import org.h2.engine.Constants;
import org.h2.util.StringUtils;
/**
......@@ -52,6 +53,8 @@ public class MergeDocs {
writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>");
writer.println("H2 Documentation");
writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetPdf.css\" /></head><body>");
writer.println("<h1>H2 Database Engine</h1>");
writer.println("<p>Version " + Constants.getFullVersion() + "</p>");
writer.println(finalText);
writer.println("</body></html>");
writer.close();
......
......@@ -548,4 +548,7 @@ usable weblica jena preserved instrumentation inspect jayaprakash ashwin
varargs automate couldn unclear eat dtp disks tablespaces great reproduces
hhh overridden sqle propogation buildid tsv monospace microarrays pathogen
geocoder geocoding longitude estimating microarray latitude magnolia pfgrc
refill analyzers patches popular came growing indication
\ No newline at end of file
refill analyzers patches popular came growing indication arabic graphic toc
numbering goto outline makensis macro hyperlink dispatch setlocal wend
widows msgbox designer styles families uno soffice orphans stan ucb rem
pdfurl upate pagebreak
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论