Java Doc for Database.java in  » Database-DBMS » Quadcap-Embeddable-Database » com » quadcap » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.quadcap.sql.file.Datafile
      com.quadcap.sql.Database

Database
public class Database extends Datafile (Code)
This class implements the QED SQL database outer API.
author:
   Stan Bailes


Field Summary
final static  ConfigStringbackupClass
    
 LongMapblobActivity
    
 LongMapblobMorgue
    
 BtreeblobPermRefCounts
    
 intcloseCount
    
 intconnectionCount
    
 QDriverdriver
    
public  ObjectdriverLock
    
 MultiSetforwardDeps
    
 BtreeindexIndex
    
 longnextTransId
    
public  DatabaseRootnroot
    
 MultiSetreverseDeps
    
 longrootBlock
    
 BtreetableIndex
    
 MaptableMap
    
 ConnectionzConn
    
 SessionzSession
    

Constructor Summary
public  Database()
    

Method Summary
public  intaddConnection()
    
public  voidaddIndex(String indexName, String tableName)
     TODO: XXX Unicode!!! Add a new named index for the specified table.
public  voidaddMorgue(long blob, long transId)
    
public  voidaddRelation(Relation table)
    
public  voidaddViewDependency(String base, String view)
    
public  voidbootFromRoot(boolean restart)
    
public  voidcheckAuth(String user, String passwd)
     Check the specified authentication credentials; throw an exception if authorization shouldn't be granted. We really don't care about passwords.
public  voidcheckViewDependency(String base, String view)
    
public  voidcheckpointHandler(LongMap activeTransactions)
     Called during a checkpoint operation.
public  voidcreateRoot(String fileName, Properties props)
    
public  voiddelMorgue(long blob)
    
public  voiddeleteIndex(String indexName)
    
public  voiddisplay(PrintWriter w)
    
public  voidemptyMorgue(LongMap activeTransactions)
     Empty the BLOB morgue.
public  LongIteratorenumerateMorgue()
     Enumerate the morgue.
public  java.sql.ResultSetexecute(String sql)
     Helper to execute a single SQL statement (in its own connection) and return a result set.
public  java.sql.ResultSetexecute(Session session, String sql)
     Helper to execute a single SQL statement for the given session.
public  voidflushRoot()
    
public  intgetBackupCount()
    
public  intgetBackupDays()
    
public  StringgetBackupDir()
    
public  StringgetBackupFormat()
    
public  intgetBackupLastDay()
    
public  intgetBackupTime()
    
public  EnumerationgetBases(String view)
    
public  intgetConnectionCount()
    
public  QDrivergetDriver()
    
public  longgetNextTransId()
     Return the next available transaction ID.
public  intgetPermBlobRefCount(long blob)
     Return the current persistent refcount for the specified blob.
public  RelationgetRelation(String name)
    
public  IteratorgetRelationNameIterator()
     This hacky crack of encapsulation is for sql.meta.MetaTables, to support DatabaseMetaData.getTables().
public  voidgetRow(long rowId, LazyRow row, boolean isTemp)
    
final  SessiongetSession(Transaction t)
    
public  StringgetTableForIndex(String indexName)
     Return the table for the index of the specified name.
public  longgetTableIdentity(String name)
    
public  EnumerationgetViews(String base)
    
public  booleaninMemory()
    
public  voidinit(QDriver driver, String url, String fileName, Properties props)
    
 FilemakeBackupFile(int n)
    
public  voidmaybeBackup()
     Figure out if it's time to do a backup.
public  longputRow(Session session, BlockFile f, Tuple t, Row row)
    
final public  voidputRow(Session session, Tuple t, long rowId, Row row)
    
public  voidreadRoot()
    
public  intrefCountBlob(long transId, long blob, int incr)
    
public  voidremoveConnection()
     Remove a connection.
public  voidremoveRelation(String name)
    
public  voidremoveRow(long rowId)
    
public  voidremoveRow(BlockFile file, long rowId)
    
public  voidremoveViewDependencies(String view)
    
 voidrenameIndexedTable(String oldN, String newN)
     RENAME TABLE percolates into the index index...
public  voidrenameRelation(Relation r, String newN)
     Rename a relation.
public  voidsetBackupCount(int count)
    
public  voidsetBackupDays(int count)
    
public  voidsetBackupDir(String str)
    
public  voidsetBackupFormat(String str)
    
public  voidsetBackupLastDay(int day)
    
public  voidsetBackupTime(int time)
    
public  voidupdateRelation(Relation table)
    
public  voidupdateTableIdentity(String name, long num)
     The "table identity" is a long value stored along with the table stream pointer, so that it can easily be updated as long as the index is in memory, without touching any data pages.

Field Detail
backupClass
final static ConfigString backupClass(Code)



blobActivity
LongMap blobActivity(Code)
Map blob -> Vector



blobMorgue
LongMap blobMorgue(Code)
The Morgue; BLOB/CLOBs with zero (persistent) refcounts: blobRef -> any



blobPermRefCounts
Btree blobPermRefCounts(Code)



closeCount
int closeCount(Code)



connectionCount
int connectionCount(Code)



driver
QDriver driver(Code)



driverLock
public Object driverLock(Code)



forwardDeps
MultiSet forwardDeps(Code)



indexIndex
Btree indexIndex(Code)



nextTransId
long nextTransId(Code)



nroot
public DatabaseRoot nroot(Code)



reverseDeps
MultiSet reverseDeps(Code)



rootBlock
long rootBlock(Code)



tableIndex
Btree tableIndex(Code)



tableMap
Map tableMap(Code)



zConn
Connection zConn(Code)



zSession
Session zSession(Code)




Constructor Detail
Database
public Database()(Code)
Constructor




Method Detail
addConnection
public int addConnection()(Code)
Add a new connection (just remember the count...)



addIndex
public void addIndex(String indexName, String tableName) throws IOException(Code)
TODO: XXX Unicode!!! Add a new named index for the specified table.



addMorgue
public void addMorgue(long blob, long transId)(Code)
Add a blob/clob to the morgue



addRelation
public void addRelation(Relation table) throws IOException, SQLException(Code)
Add a new table/view '



addViewDependency
public void addViewDependency(String base, String view) throws IOException(Code)
Establish the dependency link between a view and a base table



bootFromRoot
public void bootFromRoot(boolean restart) throws IOException(Code)
Get ready to rumble!!!



checkAuth
public void checkAuth(String user, String passwd) throws SQLException(Code)
Check the specified authentication credentials; throw an exception if authorization shouldn't be granted. We really don't care about passwords. This is an embedded database, remember; it's really just a fancy API on top of a simple file!



checkViewDependency
public void checkViewDependency(String base, String view) throws SQLException, IOException(Code)
Make sure that the specified view dependency is valid



checkpointHandler
public void checkpointHandler(LongMap activeTransactions) throws IOException(Code)
Called during a checkpoint operation.
Parameters:
  activeTransactions - is a map whose keys are the set ofids of active transactions.



createRoot
public void createRoot(String fileName, Properties props) throws IOException(Code)
Create a new root block



delMorgue
public void delMorgue(long blob)(Code)
Remove a blob/clob from the morgue



deleteIndex
public void deleteIndex(String indexName) throws IOException(Code)
Remove the specified index



display
public void display(PrintWriter w) throws IOException(Code)



emptyMorgue
public void emptyMorgue(LongMap activeTransactions) throws IOException(Code)
Empty the BLOB morgue. Remove any BLOBS in the morge that were deleted by transactions which have committed.



enumerateMorgue
public LongIterator enumerateMorgue()(Code)
Enumerate the morgue.



execute
public java.sql.ResultSet execute(String sql) throws SQLException, IOException(Code)
Helper to execute a single SQL statement (in its own connection) and return a result set.



execute
public java.sql.ResultSet execute(Session session, String sql) throws IOException, SQLException(Code)
Helper to execute a single SQL statement for the given session.



flushRoot
public void flushRoot() throws IOException(Code)
Write the database root



getBackupCount
public int getBackupCount()(Code)
Return the backup count



getBackupDays
public int getBackupDays()(Code)
Return the backup days



getBackupDir
public String getBackupDir()(Code)
Return the backup directory name



getBackupFormat
public String getBackupFormat()(Code)
Return the backup format



getBackupLastDay
public int getBackupLastDay()(Code)
Return the backup last day



getBackupTime
public int getBackupTime()(Code)
Return the backup time



getBases
public Enumeration getBases(String view) throws IOException(Code)
Return an enumeration containing all base tables for the specified view



getConnectionCount
public int getConnectionCount()(Code)
Return the number of active connections



getDriver
public QDriver getDriver()(Code)
Sleight of hand to get my driver interface



getNextTransId
public long getNextTransId() throws IOException(Code)
Return the next available transaction ID.



getPermBlobRefCount
public int getPermBlobRefCount(long blob) throws IOException(Code)
Return the current persistent refcount for the specified blob.



getRelation
public Relation getRelation(String name) throws IOException(Code)
Return the table/view with the specified name XXX Fix this "cache" implementation



getRelationNameIterator
public Iterator getRelationNameIterator() throws IOException(Code)
This hacky crack of encapsulation is for sql.meta.MetaTables, to support DatabaseMetaData.getTables(). All he really needs is an Iterator which returns the table names....



getRow
public void getRow(long rowId, LazyRow row, boolean isTemp) throws IOException, SQLException(Code)



getSession
final Session getSession(Transaction t) throws IOException, SQLException(Code)



getTableForIndex
public String getTableForIndex(String indexName) throws IOException(Code)
Return the table for the index of the specified name.



getTableIdentity
public long getTableIdentity(String name) throws IOException, SQLException(Code)
Return the table identity for the table
exception:
  SQLException - if the table can't be located



getViews
public Enumeration getViews(String base) throws IOException(Code)
Return an enumeration of all views for the specified base table



inMemory
public boolean inMemory()(Code)



init
public void init(QDriver driver, String url, String fileName, Properties props) throws IOException, SQLException(Code)



makeBackupFile
File makeBackupFile(int n) throws IOException(Code)



maybeBackup
public void maybeBackup() throws IOException(Code)
Figure out if it's time to do a backup.



putRow
public long putRow(Session session, BlockFile f, Tuple t, Row row) throws SQLException, IOException(Code)
Convenience method to write a new row to the database



putRow
final public void putRow(Session session, Tuple t, long rowId, Row row) throws SQLException, IOException(Code)
Convenience method to update a table row



readRoot
public void readRoot() throws IOException(Code)
Read the root block from an existing database



refCountBlob
public int refCountBlob(long transId, long blob, int incr) throws IOException(Code)



removeConnection
public void removeConnection()(Code)
Remove a connection. If the connection count drops to zero, we get crafty.



removeRelation
public void removeRelation(String name) throws IOException, SQLException(Code)
Delete the specified table/view



removeRow
public void removeRow(long rowId) throws IOException(Code)



removeRow
public void removeRow(BlockFile file, long rowId) throws IOException(Code)



removeViewDependencies
public void removeViewDependencies(String view) throws SQLException, IOException(Code)



renameIndexedTable
void renameIndexedTable(String oldN, String newN) throws IOException(Code)
RENAME TABLE percolates into the index index...



renameRelation
public void renameRelation(Relation r, String newN) throws IOException(Code)
Rename a relation. This involves: 1. Changing the cached relation 2. Changing the btree index to the relation 3. Changing any indexIndex entries referring to the rel 4. Changing any forwardDeps or backwardDeps which refer to the relation



setBackupCount
public void setBackupCount(int count) throws IOException(Code)
Set the backup count



setBackupDays
public void setBackupDays(int count) throws IOException(Code)
Set the backup days



setBackupDir
public void setBackupDir(String str) throws IOException(Code)
Set the backup directory



setBackupFormat
public void setBackupFormat(String str) throws IOException(Code)
Set the backup format



setBackupLastDay
public void setBackupLastDay(int day) throws IOException(Code)
Set the backup last day



setBackupTime
public void setBackupTime(int time) throws IOException(Code)
Set the backup time



updateRelation
public void updateRelation(Relation table) throws IOException(Code)
Store a modified version of the specified view/table to the store



updateTableIdentity
public void updateTableIdentity(String name, long num) throws IOException, SQLException(Code)
The "table identity" is a long value stored along with the table stream pointer, so that it can easily be updated as long as the index is in memory, without touching any data pages.



Fields inherited from com.quadcap.sql.file.Datafile
protected BlockFile file(Code)(Java Doc)
protected Object fileLock(Code)(Java Doc)
protected boolean inMemory(Code)(Java Doc)
public static boolean isCaseSensitive(Code)(Java Doc)
protected String origFileName(Code)(Java Doc)
protected boolean readOnly(Code)(Java Doc)
protected DatafileRoot root(Code)(Java Doc)
protected byte[] temp(Code)(Java Doc)
protected BlockFile tempFile(Code)(Java Doc)

Methods inherited from com.quadcap.sql.file.Datafile
abstract public void bootFromRoot(boolean restart) throws IOException(Code)(Java Doc)
public void checkpoint(boolean truncate, boolean fastSync) throws IOException(Code)(Java Doc)
public void checkpointHandler(LongMap activeTransactions) throws IOException(Code)(Java Doc)
public void close()(Code)(Java Doc)
public void commitTransaction(Transaction trans) throws IOException(Code)(Java Doc)
abstract public void createRoot(String fileName, Properties props) throws IOException(Code)(Java Doc)
public void doStep(Transaction t, LogEntry e) throws IOException, DatafileException(Code)(Java Doc)
public void finalize() throws Throwable(Code)(Java Doc)
public Transaction findTransaction(long transId) throws IOException(Code)(Java Doc)
abstract public void flushRoot() throws IOException(Code)(Java Doc)
public BlockFile getFile()(Code)(Java Doc)
public Object getFileLock()(Code)(Java Doc)
public LockManager getLockManager()(Code)(Java Doc)
final public Log getLog()(Code)(Java Doc)
abstract public long getNextTransId() throws IOException(Code)(Java Doc)
public Object getObject(long ref) throws IOException(Code)(Java Doc)
public long getSize()(Code)(Java Doc)
public BlockFile getTempFile() throws IOException(Code)(Java Doc)
public BlockFile getTempFile(boolean incr) throws IOException(Code)(Java Doc)
public String getURL()(Code)(Java Doc)
public boolean inRecovery() throws IOException(Code)(Java Doc)
public void init(String url, String fileName, Properties props) throws IOException(Code)(Java Doc)
public void initFileDatabase(String url, String fileName, Properties props) throws IOException(Code)(Java Doc)
public void initMemoryDatabase(String url, String fileName, Properties props) throws IOException(Code)(Java Doc)
public boolean isReadOnly()(Code)(Java Doc)
final public Transaction makeTransaction(boolean writeLog) throws IOException(Code)(Java Doc)
abstract public void maybeBackup() throws IOException(Code)(Java Doc)
public long putObject(Object obj) throws IOException(Code)(Java Doc)
abstract public void readRoot() throws IOException(Code)(Java Doc)
public void releaseLocks(Transaction trans)(Code)(Java Doc)
public void releaseTempFile()(Code)(Java Doc)
public void removeObject(long ref) throws IOException(Code)(Java Doc)
public void rollbackStatement(Transaction trans, int stmtId) throws IOException(Code)(Java Doc)
public void rollbackTransaction(Transaction trans) throws IOException(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void updateObject(long seg, Object obj) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.