01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: org_apache_derby_jdbc_EmbeddedDriver.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf.dam.contentstores.rawstoredrivers;
09:
10: import com.uwyn.rife.config.RifeConfig;
11: import com.uwyn.rife.database.Datasource;
12: import com.uwyn.rife.database.queries.CreateTable;
13: import com.uwyn.rife.database.queries.Insert;
14: import java.io.IOException;
15: import java.io.InputStream;
16: import java.sql.Blob;
17:
18: public class org_apache_derby_jdbc_EmbeddedDriver extends generic {
19: public org_apache_derby_jdbc_EmbeddedDriver(Datasource datasource) {
20: super (datasource);
21:
22: mCreateTableContentInfo = new CreateTable(getDatasource())
23: .table(RifeConfig.Cmf.getTableContentStoreRawInfo())
24: .column("contentId", int.class, CreateTable.NOTNULL)
25: .column(getContentSizeColumnName(), int.class,
26: CreateTable.NOTNULL).primaryKey(
27: "PK_CONTENTRAW", "contentId").foreignKey(
28: "FK_CONTENTRAW",
29: RifeConfig.Cmf.getTableContentInfo(),
30: "contentId", "contentId");
31:
32: mCreateTableContentChunk = new CreateTable(getDatasource())
33: .table(RifeConfig.Cmf.getTableContentStoreRawChunk())
34: .column("contentId", int.class, CreateTable.NOTNULL)
35: .column("ordinal", int.class, CreateTable.NOTNULL)
36: .column("chunk", Blob.class).primaryKey(
37: "PK_CONTENTCHUNK",
38: new String[] { "contentId", "ordinal" })
39: .foreignKey("FK_CONTENTCHUNK",
40: RifeConfig.Cmf.getTableContentInfo(),
41: "contentId", "contentId");
42: }
43:
44: protected int storeChunks(Insert storeContentChunk, final int id,
45: InputStream data) throws IOException {
46: return storeChunksNoStream(storeContentChunk, id, data);
47: }
48: }
|