com.quadcap.sql

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » Quadcap Embeddable Database » com.quadcap.sql 
com.quadcap.sql
SQL Database engine. Various design related information follows.

Tuples and Columns

public interface Tuple {
    public int numColumns();
    public Column getColumn(int i);
}

public interface Column {
    public String getName();
    public Type getType();
    public boolean isFixed();
    public int getOffset();
    public int getLength();
    public Enumeration getConstraints();
}

public interface Table extends Tuple {
    public int numRows();
    public Row getRow(int i);
    public Enumeration getConstraints();
    public Constraint getPrimaryKeyConstraint();
}

public interface Row extends Tuple {
    public Row(Tuple def, byte[] bytes);
}

public interface Index {
    public Tuple getBaseType();

    /**
     * Return an enumeration of the keys of this index, in order, starting
     * with the first index value not less than first
     */
    public Enumeration enumerate(TupleValue first);

    /**
     * Return an enumeration of the keys of this index, in reverse order,
     * starting with the first index value not greater than last
     */
    public Enumeration reverseEnumerate(TupleValue last);
}

public interface Type {
    public String getTypeName();
    public int compare(Type other);

    public void setBytes(byte[] buf, int offset, int cnt);
    public byte[] getBytes();

    public Object getObject();
    public void setObject(Object obj);
}


public interface Constraint {
    public Tuple get
}

public interface PrimaryKeyConstraint extends Constraint {
}

public interface ForeignKeyConstraint extends Constraint {
}

public interface UniqueConstraint extends Constraint {
}

Inheritance Tree for Tuple and Cursor

interface Tuple					// columns, qualifier	
  class TupleImpl

interface Cursor extends Tuple			// rows and movement
  abstract class CursorImpl extends TupleImpl implements Cursor
    class JoinCursor extends CursorImpl

interface Relation extends Tuple		// constraints, cursor mgmt
  class View extends TupleImpl implements Relation
  class Table extends TupleImpl implements Relation

Cursor
  CursorImpl
    Filter
      Aggregate
      Distinct
      GroupBy
      Having
      Predicate
    Index
    Items
    JoinCross
    JoinInner
    Merge
    OrderBy
    Static
    View

Table Expressions:
  Updatable
    SelectFromTable
  NonUpdatable
    JoinedTable
    MergeExpression
    VectorExpression (table value constructor)
  Possibly updatable
    SelectFromItem

TreeNode
  ClassOrInterfaceDef
    ClassDef
    interfaceDef
  Decl
    VariableDecl
    MethodDecl
    InnerClassDecl
    StaticBlockDecl
  Literal

Logging and recovery

Write-ahead logging
  Log entries:
    redo
    undo
    redo/undo
    CLR written when performing partial rollback
    begintransaction
    commit
    checkpoint

Recovery: redo, then undo
  Restore from last checkpoint.
  Redo all records from that point to the end of the log.
  Undo all loser transactions.

Checkpoint:
  Periodically, or at connection close, take checkpoint.
    Copy entire datafile
      Can optimize with 'modified pages' bitmap
    Compress log.
      Only save log records for pending uncommited transactions.

Join operations:

Break where clause down into "exp AND exp AND ..." form.
For each expression, classify it as one of:
  - table vs table (t1.fld == t2.fld)
  - table vs const (t1.fld == val)

All tables that don't appear in table vs table expressions go first in
the join order.

Tables that don't have any constant expressions go last in the join order.

All tables are joined using nested loops joins.  

Join over columns
  Natural (inner, left, right, full), Union
  Using : inner, left, right, full
Join on expression
  Cross
  On : inner, left, right, full

Stmt.execute(Session)
  • SelectStmt
  • StmtAddColumn
  • StmtAddConstraint
  • StmtAlterColumn
  • StmtCreateIndex
  • StmtCreateSchema
  • StmtCreateTable
  • StmtCreateView
  • StmtDelete
  • StmtDropConstraint
  • StmtDropIndex
  • StmtDropTable
  • StmtInsert
  • StmtNull
  • StmtUpdate
  • Table.insertRow
Session.doStep(LogStep)
  • AddColumn
  • AddConstraint
  • AddTable
  • AlterColumn
  • DeleteConstraint
  • DeleteRow
  • DropTable
  • InsertBlob
  • InsertRow
  • ModIndexEntry
  • UpdateRow
  • StmtCreateView
LogStep.redo(Session)
  • class View

Random stress testing

Dimensions
1. Number of tables
2. Number of columns
3. Datatypes
4. Field sizes
5. Integrity violations, statement rollback
6. Transaction rollback 
7. Views
8. Join, union, intersection, subquery,
Java Source File NameTypeComment
AddColumn.javaClass Log step to add a column to a table, supplying default values as necessary.
AddConstraint.javaClass Log step to add a constraint to a table.
AddIndexEntry.javaClass Log step to add a entry to an index.
AddTable.javaClass Log step to add a table to a database.
AggregateCursor.javaClass Used in conjunction with a GroupByCursor to handle aggregate functions (e.g., SUM, AVG, etc.) with a GROUP BY clause.
AggregateExpression.javaClass Expression implementing one of AVG, SUM, MIN, or MAX.
AlterColumn.javaClass Log Step to alter the definition of a table column.
Analyze.javaClass Join planner.
AutoNumberConstraint.javaClass Constraint class for SQL AUTO_NUMBER constraints.
AutoNumberStep.javaClass Log step to record allocations of auto numbers...
Backup.javaInterface The "Back me up" hook, implemented external to this package.
BC_Cursor.javaClass Cursor that implements the DISTINCT modifier by creating temporary table, where the entire row is used as the index key.
BinaryExpression.javaClass Expression class for all binary ops.
CheckConstraint.javaClass Constraint class for SQL CHECK constraints.
Column.javaClass A column lives in a tuple, has a name, a type, and a default value.
Connection.javaClass Analagous (and mapped onto) a JDBC Connection, this class maintains state and locks on behalf of a single session.
Constraint.javaClass A constraint is a condition which must be satisfied relative to the rows of a table.
Cursor.javaInterface The base cursor interface.
CursorImpl.javaClass Base cursor implementation class.
Database.javaClass This class implements the QED SQL database outer API.
DatabaseRoot.javaClass The persistent root block of the database.
DbException.javaClass
DbRuntimeException.javaClass A kind of runtime exception that we can throw.
DefaultTableConstraint.javaClass If a table has no other constraints (e.g., primary key, unique), we synthesize this constraint to force the creation of an index, since the table traversal code depends on having an index to iterate.
DeleteConstraint.javaClass Log step to remove a table constraint.
DeletedRows.javaClass StatementContext which manages delete operations generated by a statement, defers those operations so consistency can be checked, and at the end of the statement's execution, performs all of the deletes.
DeleteIndexEntry.javaClass Log step to delete an index entry.
DeleteRow.javaClass Log step to delete a row from a table.
DistinctCursor.javaClass Cursor that implements the DISTINCT modifier by creating temporary table, where the entire row is used as the index key.
DropColumn.javaClass Log step to add a column to a table, supplying default values as necessary.
DropTable.javaClass Log step to remove a table from a database.
ExportedKeyConstraint.javaClass A hidden 'ExportedKeyConstraint' is created for tables that are referenced as foreign keys by other tables.
ExportedKeys.javaClass A statement context which keeps track of the set of changes to the keys in a foreign-key constraint during the statement execution.
Expression.javaClass Base class for all expression types.
ExpressionVisitor.javaInterface Expression tree visitor.
FilterCursor.javaClass Base class for all filter cursor types.
ForeignKeyConstraint.javaClass Abstract base class for imported and exported key constraints.
Function.javaInterface An SQL function, defined as the value resulting from some function on a row.
FunctionExpression.javaClass Implement function expressions.
GroupByCursor.javaClass Cursor to support SQL GROUP BY.
HavingCursor.javaClass Cursor to support HAVING clause.
ImportedKeyConstraint.javaClass
IndexConstraint.javaClass Base class for all index constraints.
IndexCursor.javaClass Cursor for iterating an index.
InExpression.javaClass Expression implementing IN (list).
InsertBlob.javaClass Log step to insert a BLOB value into the database.
InsertRow.javaClass Log step to insert a row into a table.
ItemsCursor.javaClass This cursor performs the name-mapping function associated with the SELECT clause.
ItemsRow.javaClass Part of the 'ItemCursor' implementation, this implements a row that is a mapped Essentially, a vector with one-based indices.
JdbcEscapeTokenStream.javaClass Handle JDBC escape processing as a token stream.
JoinCrossCursor.javaClass
JoinCrossRow.javaClass A row containing a cross-join, all columns from each of two cursors.
JoinCursor.javaClass
JoinedTable.javaClass A table expression representing a single join operation.
JoinInnerCursor.javaClass
JoinMapRow.javaClass A row containing a cross-join, all columns from each of two cursors.
JoinNaturalRow.javaClass A row containing a natural join, all columns from each of two cursors, with only one instance of the join columns.
JoinUnionCursor.javaClass Half of a UNION join.
Key.javaClass Micro-optimized (-;) key serialization and comparison.
LazyRow.javaClass A row that we deserialize only as needed to produce values.
LogStep.javaClass Basic unit of write-ahead logging strategy.
MapRow.javaClass
MergeCursor.javaClass Cursor implementing the SQL UNION or INTERSECTION operations.
MergeExpression.javaClass Table expression representing UNION or INTERSECTION operations.
ModIndexEntry.javaClass Abstract log step for all operations that modify indexes.
MultiCursor.javaClass Cursor implementation that concatenates multiple cursors together and makes them appear as a single cursor.
MultiSet.javaClass Implement a multi-valued map over a Btree.
NameExpression.javaClass Expression class for names (typically column or function names).
NonUniqueIndexConstraint.javaClass Index constraint for indexes which do not require unique values.
NotNullConstraint.javaClass
OrderByCursor.javaClass Cursor implementing the ORDER BY clause, uses a temporary table with the order-by columns as the key, then iterates the table's index.
OrderElement.javaClass A parsed ORDER BY element.
ParameterExpression.javaClass
PredicateCursor.javaClass Cursor for WHERE predicates.
PrimaryKeyConstraint.javaClass Index constraint for PRIMARY KEYs.
QDriver.javaInterface An adaptor that allows us to get at the Database behind a Driver.
QedResultSet.javaInterface An adaptor interface that allows us to get at the cursor behind the resultset.
QuantifiedCompare.javaClass Expression implemented quantified comparisons: ALL, ANY.
RefcountBlob.javaClass Log step to insert a BLOB value into the database.
Relation.javaInterface The common base class for tables and views.
RenameCursor.javaClass Cursor performs the name-mapping function associated with the SELECT clause.
Row.javaClass Essentially, a vector with one-based indices.
SelectExpression.javaClass A table expression representing a SELECT clause.
SelectFromItem.javaClass TableExpression permitting individual tables in the SELECT statement to be "renamed" via the AS clause. This may be necessary for example, in cases where a table is joined to itself.
SelectFromTable.javaClass Table expression implementation of TABLE table-name.
SelectItem.javaClass An item in a SELECT clause.
SelectStmt.javaClass Implementation of SQL SELECT statement.
Session.javaClass Analagous (and mapped onto) a JDBC Statement, this class maintains state and locks on behalf of a single session.
SQLLexer.javaClass
SQLParser.javaClass
SQLTokenTypes.javaInterface
StatementContext.javaInterface This interface models some stateful action that is associated with the execution of a statement, but which can't be actually performed until the end of the statement execution.
StaticCursor.javaClass Cursor implementation of VALUES clause.
Stmt.javaInterface Abstract statement execution interface.
StmtAddColumn.javaClass Implementation of SQL ADD COLUMN statement.
StmtAddConstraint.javaClass Implementation of SQL ALTER TABLE ADD CONSTRAINT statement.
StmtAlterColumn.javaClass Implementation of SQL ALTER COLUMN statement.
StmtCommit.javaClass Implementation of the SQL COMMIT statement.
StmtCreateIndex.javaClass Implementation of the SQL CREATE INDEX statement.
StmtCreateSchema.javaClass Implementation of the SQL CREATE SCHEMA statement.
StmtCreateTable.javaClass Implementation of the SQL CREATE TABLE statement.
StmtCreateView.javaClass Implementation of the SQL CREATE VIEW statement.
StmtDelete.javaClass Implementation of the SQL DELETE statement.
StmtDropColumn.javaClass Implementation of SQL ALTER TABLE DROP COLUMN statement.
StmtDropConstraint.javaClass Implementation of the SQL DROP CONSTRAINT statement.
StmtDropIndex.javaClass Implementation of the SQL DROP INDEX statement.
StmtDropTable.javaClass Implementation of the SQL DROP TABLE statement.
StmtInsert.javaClass Implementation of the SQL INSERT statement.
StmtNull.javaClass Implementation of no statement whatsoever.
StmtRenameTable.javaClass Implementation of the SQL ALTER TABLE RENAME TO statement.
StmtRollback.javaClass Implementation of the SQL ROLLBACK statement.
StmtUpdate.javaClass Implementation of the SQL UPDATE statement.
Table.javaClass A single SQL base table.
TableExpression.javaClass Some kind of expression that yields a 'table', which can be joined or merged or cursored.
TableOps.javaClass
TempTable.javaClass Temporary tables are Useful for several operations, including GROUP BY, DISTINCT, and ORDER BY.
TempTableMerge.javaClass A special temp table used to implement UNION and INTERSECT expressions.
TernaryExpression.javaClass
Trace.javaClass
Tuple.javaInterface A tuple is a kind of abstract datatype; it consists of an ordered list of named columns.
TupleImpl.javaClass Base class for tuple implementations.
UnaryExpression.javaClass Expression implementing unary ops.
UniqueConstraint.javaClass Index constraint for indexes in which keys must be unique.
UpdateIndex.javaClass StatementContext which manages index update operations generated by a statement, defers those operations so consistency can be checked, and at the end of the statement's execution, performs all of the updates.
UpdateItem.javaClass One part of a compiled UPDATE statement, including a column name and an expression which generates a value.
UpdateRow.javaClass Log step to update one or more values in a table row.
ValueExpression.javaClass Expression yielding a constant value.
VectorExpression.javaClass
Version.javaInterface Track build numbers and build info with autogenerated code.
View.javaClass A SQL VIEW.
ViewCursor.javaClass This cursor performs the name mapping associated with the (optional) column list of the CREATE VIEW statement.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.