提交 b74219aa authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 48a06615
......@@ -391,7 +391,8 @@ When defining a function alias with source code, the Sun javac is compiler
is used if the tools.jar is in the classpath. If not, javac is run as a separate process.
Only the source code is stored in the database; the class is compiled each time
the database is re-opened. Source code is usually passed
as dollar quoted text to avoid escaping problems.
as dollar quoted text to avoid escaping problems. If import statements are used,
then the tag @CODE must be added before the method.
If the first parameter of the Java function is a java.sql.Connection, then a
connection to the database is provided. This connection must not be closed.
......
......@@ -282,7 +282,7 @@ encrypted using AES-256 and XTEA encryption algorithms
<td class="compareY">Yes</td>
<td class="compareN">No</td>
<td class="compareN">No</td>
<td class="compareN">No</td>
<td class="compareY">Yes</td>
<td class="compareY">Yes</td>
</tr><tr>
<td>Role Based Security</td>
......
......@@ -71,7 +71,7 @@ Some think Java is too slow for low level operations,
but this is no longer true. Garbage collection for example is
now faster than manual memory management.
</p><p>
Developing Java code is faster than C or C++ code. When using Java,
Developing Java code is faster than developing C or C++ code. When using Java,
most time can be spent on improving the algorithms instead of
porting the code to different platforms or doing memory management.
Features such as Unicode and network libraries are already built-in.
......
......@@ -140,7 +140,7 @@ Welcome to H2, the Java SQL database. The main features of H2 are:
<td class="compareY">Yes</td>
<td class="compareN">No</td>
<td class="compareN">No</td>
<td class="compareN">No</td>
<td class="compareY">Yes</td>
<td class="compareY">Yes</td>
</tr><tr>
<td>Footprint (jar/dll size)</td>
......
......@@ -468,6 +468,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Maybe reject join without "on" (except natural join).
</li><li>Cluster: support load balance with values for each server / auto detect.
</li><li>Implement GiST (Generalized Search Tree for Secondary Storage).
</li><li>Function to read a number of bytes/characters from an BLOB or CLOB.
</li></ul>
<h2>Not Planned</h2>
......
......@@ -42,7 +42,7 @@ package org.h2.compress;
* </p>
* <ul>
* <li>Each instance should be used by a single thread only.</li>
* <li>The data buffers must be smaller than 2^31.</li>
* <li>The data buffers should be smaller than 1 GB.</li>
* <li>For performance reasons, safety checks on expansion are omitted.</li>
* <li>Invalid compressed data can cause an ArrayIndexOutOfBoundsException.</li>
* </ul>
......
CREATE FUNCTION name ( argName ] type [ { DEFAULT | = } defaultExpression ] [, ...] ] )
[ RETURNS type ]
{ LANGUAGE languageName | IMMUTABLE | STABLE
| VOLATILE | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT
| STRICT | COST executionCost | ROWS resultRows
IMMUTABLE cannot modify the database and always returns the same result
STABLE cannot modify the database and within a single table scan it will consistently
return the same result
VOLATILE value can change
CALLED ON NULL INPUT
RETURNS NULL ON NULL INPUT or STRICT
CREATE FUNCTION add(integer, integer) RETURNS integer
AS 'select $1 + $2;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$
BEGIN
RETURN i + 1;
END;
$$ LANGUAGE ...;
create alias newFunctionAliasName [ DETERMINISTIC ]
as
FOR classAndMethodName
......@@ -8,3 +8,24 @@
-- update all rows in all tables
select 'update ' || table_schema || '.' || table_name || ' set ' || column_name || '=' || column_name || ';'
from information_schema.columns where ORDINAL_POSITION = 1 and table_schema <> 'INFORMATION_SCHEMA';
-- read the first few bytes from a BLOB
drop table test;
drop alias first_bytes;
create alias first_bytes as $$
import java.io.*;
@CODE
byte[] firstBytes(InputStream in, int len) throws IOException {
try {
byte[] data = new byte[len];
DataInputStream din = new DataInputStream(in);
din.readFully(data, 0, len);
return data;
} finally {
in.close();
}
}
$$;
create table test(data blob);
insert into test values('010203040506070809');
select first_bytes(data, 3) from test;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论