Java Doc for BasicSqlService.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » db » impl » 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 » ERP CRM Financial » sakai » org.sakaiproject.db.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.sakaiproject.db.impl.BasicSqlService

All known Subclasses:   org.sakaiproject.db.impl.SqlServiceTest,
BasicSqlService
abstract public class BasicSqlService implements SqlService(Code)

BasicSqlService implements the SqlService.


Inner Class :public class StreamWithConnection extends InputStream

Field Summary
final protected static  StringTRANSACTION_CONNECTION
     Key name in thread local to find the current transaction connection.
protected  DataSourcedefaultDataSource
    
protected  DataSourcelongDataSource
    
protected  booleanm_autoDdl
     Configuration: to run the ddl on init or not.
final protected  GregorianCalendarm_cal
     Used to work with dates in GMT in the db.
protected  booleanm_commitAfterRead
    
protected  intm_deadlockRetries
     Configuration: number of on-deadlock retries for save.
protected  booleanm_showSql
     if true, debug each sql command with timing.
protected  Stringm_vendor
     Database vendor used; possible values are oracle, mysql, hsqldb (default).


Method Summary
public  ConnectionborrowConnection()
    
public  voiddbCancel(Connection conn)
     Cancel the update that was locked on this connection.
public  LongdbInsert(Connection callerConnection, String sql, Object[] fields, String autoColumn)
     Execute the "insert" sql, returning a possible auto-update field Long value
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  callerConnection - The connection to use.
Parameters:
  autoColumn - The name of the db column that will have auto-update - we will return the value used (leave null to disable this feature).
public  LongdbInsert(Connection callerConnection, String sql, Object[] fields, String autoColumn, InputStream last, int lastLength)
     Execute the "insert" sql, returning a possible auto-update field Long value
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  callerConnection - The connection to use.
Parameters:
  autoColumn - The name of the db column that will have auto-update - we will return the value used (leave null to disable this feature).
Parameters:
  last - A stream to set as the last field.
public  ListdbRead(String sql)
     Read a single field from the db, from multiple records, returned as string[], one per record.
Parameters:
  sql - The sql statement.
public  ListdbRead(String sql, Object[] fields, SqlReader reader)
     Process a query, filling in with fields, and return the results as a List, one per record read.
public  ListdbRead(Connection callerConn, String sql, Object[] fields, SqlReader reader)
     Process a query, filling in with fields, and return the results as a List, one per record read.
public  voiddbReadBinary(String sql, Object[] fields, byte[] value)
     Read a single field from the db, from multiple record - concatenating the binary values into value.
public  voiddbReadBinary(Connection callerConn, String sql, Object[] fields, byte[] value)
     Read a single field from the db, from multiple record - concatenating the binary values into value.
public  InputStreamdbReadBinary(String sql, Object[] fields, boolean big)
     Read a single field / record from the db, returning a stream on the result record / field.
public  voiddbReadBlobAndUpdate(String sql, byte[] content)
     Read a single field BLOB from the db from one record, and update it's bytes with content.
public  ConnectiondbReadLock(String sql, StringBuffer field)
     Read a single field from the db, from a single record, return the value found, and lock for update.
Parameters:
  sql - The sql statement.
Parameters:
  field - A StringBuffer that will be filled with the field.
public  voiddbUpdateCommit(String sql, Object[] fields, String var, Connection conn)
     Commit the update that was locked on this connection.
public  booleandbWrite(String sql)
     Execute the "write" sql - no response.
Parameters:
  sql - The sql statement.
public  booleandbWrite(String sql, String var)
     Execute the "write" sql - no response.
public  booleandbWrite(String sql, Object[] fields)
     Execute the "write" sql - no response, using a set of fields from an array plus one more as params.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
public  booleandbWrite(Connection connection, String sql, Object[] fields)
     Execute the "write" sql - no response, using a set of fields from an array and a given connection.
Parameters:
  connection - The connection to use.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
public  booleandbWrite(String sql, Object[] fields, String lastField)
     Execute the "write" sql - no response, using a set of fields from an array plus one more as params.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  lastField - The value to bind to the last parameter in the sql statement.
protected  booleandbWrite(String sql, Object[] fields, String lastField, Connection callerConnection, boolean failQuiet)
     Execute the "write" sql - no response, using a set of fields from an array plus one more as params and connection.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  lastField - The value to bind to the last parameter in the sql statement.
Parameters:
  callerConnection - The connection to use.
Parameters:
  failQuiet - If true, don't log errors from statement failure true if successful, false if not due to unique constraint violation or duplicate key (i.e.
public  booleandbWriteBinary(String sql, Object[] fields, byte[] var, int offset, int len)
     Execute the "write" sql - no response.
public  booleandbWriteFailQuiet(Connection connection, String sql, Object[] fields)
     Execute the "write" sql - no response, using a set of fields from an array and a given connection logging no errors on failure.
Parameters:
  connection - The connection to use.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
public  voidddl(ClassLoader loader, String resource)
    
protected  voiddebug(String str, String sql, Object[] fields)
    
protected  StringdebugFields(Object[] fields)
    
public  voiddestroy()
     Final cleanup.
public  StringgetBooleanConstant(boolean value)
    
public  GregorianCalendargetCal()
    
public  LonggetNextSequence(String tableName, Connection conn)
    
public  StringgetVendor()
    
public  voidinit()
     Final initialization, once all dependencies are set.
protected  intprepareStatement(PreparedStatement pstmt, Object[] fields)
     Prepare a prepared statement with fields.
Parameters:
  pstmt - The prepared statement to fill in.
Parameters:
  fields - The Object array of values to fill in.
public  voidreturnConnection(Connection conn)
    
public  voidsetAutoDdl(String value)
     Configuration: to run the ddl on init or not.
public  voidsetCommitAfterRead(String value)
    
public  voidsetDeadlockRetries(String value)
     Configuration: number of on-deadlock retries for save.
public  voidsetDefaultDataSource(DataSource defaultDataSource)
    
public  voidsetLongDataSource(DataSource slowDataSource)
    
public  voidsetShowSql(String value)
     Configuration: to show each sql command in the logs or not.
public  voidsetVendor(String value)
     Configuration: Database vendor used; possible values are oracle, mysql, hsqldb.
abstract protected  ThreadLocalManagerthreadLocalManager()
    
public  booleantransact(Runnable callback, String tag)
    
abstract protected  UsageSessionServiceusageSessionService()
    

Field Detail
TRANSACTION_CONNECTION
final protected static String TRANSACTION_CONNECTION(Code)
Key name in thread local to find the current transaction connection.



defaultDataSource
protected DataSource defaultDataSource(Code)
The "shared", "common" database connection pool



longDataSource
protected DataSource longDataSource(Code)
The "slow" connection pool for file uploads/downloads



m_autoDdl
protected boolean m_autoDdl(Code)
Configuration: to run the ddl on init or not.



m_cal
final protected GregorianCalendar m_cal(Code)
Used to work with dates in GMT in the db.



m_commitAfterRead
protected boolean m_commitAfterRead(Code)
Should we do a commit after a single statement read?



m_deadlockRetries
protected int m_deadlockRetries(Code)
Configuration: number of on-deadlock retries for save.



m_showSql
protected boolean m_showSql(Code)
if true, debug each sql command with timing.



m_vendor
protected String m_vendor(Code)
Database vendor used; possible values are oracle, mysql, hsqldb (default).





Method Detail
borrowConnection
public Connection borrowConnection() throws SQLException(Code)



dbCancel
public void dbCancel(Connection conn)(Code)
Cancel the update that was locked on this connection.
Parameters:
  conn - The database connection on which the lock was gained.



dbInsert
public Long dbInsert(Connection callerConnection, String sql, Object[] fields, String autoColumn)(Code)
Execute the "insert" sql, returning a possible auto-update field Long value
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  callerConnection - The connection to use.
Parameters:
  autoColumn - The name of the db column that will have auto-update - we will return the value used (leave null to disable this feature). The auto-update value, or null



dbInsert
public Long dbInsert(Connection callerConnection, String sql, Object[] fields, String autoColumn, InputStream last, int lastLength)(Code)
Execute the "insert" sql, returning a possible auto-update field Long value
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  callerConnection - The connection to use.
Parameters:
  autoColumn - The name of the db column that will have auto-update - we will return the value used (leave null to disable this feature).
Parameters:
  last - A stream to set as the last field. The auto-update value, or null



dbRead
public List dbRead(String sql)(Code)
Read a single field from the db, from multiple records, returned as string[], one per record.
Parameters:
  sql - The sql statement. The List of Strings of single fields of the record found, or empty if none found.



dbRead
public List dbRead(String sql, Object[] fields, SqlReader reader)(Code)
Process a query, filling in with fields, and return the results as a List, one per record read. If a reader is provided, it will be called for each record to prepare the Object placed into the List. Otherwise, the first field of each record, as a String, will be placed in the list.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  reader - The reader object to read each record. The List of things read, one per record.



dbRead
public List dbRead(Connection callerConn, String sql, Object[] fields, SqlReader reader)(Code)
Process a query, filling in with fields, and return the results as a List, one per record read. If a reader is provided, it will be called for each record to prepare the Object placed into the List. Otherwise, the first field of each record, as a String, will be placed in the list.
Parameters:
  callerConn - The db connection object to use (if not null).
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  reader - The reader object to read each record. The List of things read, one per record.



dbReadBinary
public void dbReadBinary(String sql, Object[] fields, byte[] value)(Code)
Read a single field from the db, from multiple record - concatenating the binary values into value.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  value - The array of bytes to fill with the value read from the db.



dbReadBinary
public void dbReadBinary(Connection callerConn, String sql, Object[] fields, byte[] value)(Code)
Read a single field from the db, from multiple record - concatenating the binary values into value.
Parameters:
  callerConn - The optional db connection object to use.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  value - The array of bytes to fill with the value read from the db.



dbReadBinary
public InputStream dbReadBinary(String sql, Object[] fields, boolean big) throws ServerOverloadException(Code)
Read a single field / record from the db, returning a stream on the result record / field. The stream holds the conection open - so it must be closed or finalized quickly!
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  big - If true, the read is expected to be potentially large.
throws:
  ServerOverloadException - if the read cannot complete due to lack of a free connection (if wait is false)



dbReadBlobAndUpdate
public void dbReadBlobAndUpdate(String sql, byte[] content)(Code)
Read a single field BLOB from the db from one record, and update it's bytes with content.
Parameters:
  sql - The sql statement to select the BLOB.
Parameters:
  content - The new bytes for the BLOB.



dbReadLock
public Connection dbReadLock(String sql, StringBuffer field)(Code)
Read a single field from the db, from a single record, return the value found, and lock for update.
Parameters:
  sql - The sql statement.
Parameters:
  field - A StringBuffer that will be filled with the field. The Connection holding the lock.



dbUpdateCommit
public void dbUpdateCommit(String sql, Object[] fields, String var, Connection conn)(Code)
Commit the update that was locked on this connection.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  var - The value to bind to the last parameter in the sql statement.
Parameters:
  conn - The database connection on which the lock was gained.



dbWrite
public boolean dbWrite(String sql)(Code)
Execute the "write" sql - no response.
Parameters:
  sql - The sql statement. true if successful, false if not.



dbWrite
public boolean dbWrite(String sql, String var)(Code)
Execute the "write" sql - no response. a long field is set to "?" - fill it in with var
Parameters:
  sql - The sql statement.
Parameters:
  var - The value to bind to the first parameter in the sql statement. true if successful, false if not.



dbWrite
public boolean dbWrite(String sql, Object[] fields)(Code)
Execute the "write" sql - no response, using a set of fields from an array plus one more as params.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters. true if successful, false if not.



dbWrite
public boolean dbWrite(Connection connection, String sql, Object[] fields)(Code)
Execute the "write" sql - no response, using a set of fields from an array and a given connection.
Parameters:
  connection - The connection to use.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters. true if successful, false if not.



dbWrite
public boolean dbWrite(String sql, Object[] fields, String lastField)(Code)
Execute the "write" sql - no response, using a set of fields from an array plus one more as params.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  lastField - The value to bind to the last parameter in the sql statement. true if successful, false if not.



dbWrite
protected boolean dbWrite(String sql, Object[] fields, String lastField, Connection callerConnection, boolean failQuiet)(Code)
Execute the "write" sql - no response, using a set of fields from an array plus one more as params and connection.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  lastField - The value to bind to the last parameter in the sql statement.
Parameters:
  callerConnection - The connection to use.
Parameters:
  failQuiet - If true, don't log errors from statement failure true if successful, false if not due to unique constraint violation or duplicate key (i.e. the record already exists) OR we are instructed to fail quiet.



dbWriteBinary
public boolean dbWriteBinary(String sql, Object[] fields, byte[] var, int offset, int len)(Code)
Execute the "write" sql - no response. a long binary field is set to "?" - fill it in with var
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
Parameters:
  var - The value to bind to the last parameter in the sql statement.
Parameters:
  offset - The start within the var to write
Parameters:
  len - The number of bytes of var, starting with index, to write true if successful, false if not.



dbWriteFailQuiet
public boolean dbWriteFailQuiet(Connection connection, String sql, Object[] fields)(Code)
Execute the "write" sql - no response, using a set of fields from an array and a given connection logging no errors on failure.
Parameters:
  connection - The connection to use.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters. true if successful, false if not.



ddl
public void ddl(ClassLoader loader, String resource)(Code)



debug
protected void debug(String str, String sql, Object[] fields)(Code)
Append a message about this SQL statement to the DEBUG string in progress, if any
Parameters:
  str - The SQL statement.
Parameters:
  fields - The bind fields.



debugFields
protected String debugFields(Object[] fields)(Code)



destroy
public void destroy()(Code)
Final cleanup.



getBooleanConstant
public String getBooleanConstant(boolean value)(Code)



getCal
public GregorianCalendar getCal()(Code)



getNextSequence
public Long getNextSequence(String tableName, Connection conn)(Code)



getVendor
public String getVendor()(Code)



init
public void init()(Code)
Final initialization, once all dependencies are set.



prepareStatement
protected int prepareStatement(PreparedStatement pstmt, Object[] fields) throws SQLException, UnsupportedEncodingException(Code)
Prepare a prepared statement with fields.
Parameters:
  pstmt - The prepared statement to fill in.
Parameters:
  fields - The Object array of values to fill in. the next pos that was not filled in.
throws:
  UnsupportedEncodingException -



returnConnection
public void returnConnection(Connection conn)(Code)



setAutoDdl
public void setAutoDdl(String value)(Code)
Configuration: to run the ddl on init or not.
Parameters:
  value - the auto ddl value.



setCommitAfterRead
public void setCommitAfterRead(String value)(Code)
Configuration: should we do a commit after each single SQL read?
Parameters:
  value - the setting (true of false) string.



setDeadlockRetries
public void setDeadlockRetries(String value)(Code)
Configuration: number of on-deadlock retries for save.
Parameters:
  value - the number of on-deadlock retries for save.



setDefaultDataSource
public void setDefaultDataSource(DataSource defaultDataSource)(Code)

Parameters:
  defaultDataSource - The defaultDataSource to set.



setLongDataSource
public void setLongDataSource(DataSource slowDataSource)(Code)

Parameters:
  slowDataSource - The slowDataSource to set.



setShowSql
public void setShowSql(String value)(Code)
Configuration: to show each sql command in the logs or not.
Parameters:
  value - the showSql setting.



setVendor
public void setVendor(String value)(Code)
Configuration: Database vendor used; possible values are oracle, mysql, hsqldb.
Parameters:
  value - the Database vendor used.



threadLocalManager
abstract protected ThreadLocalManager threadLocalManager()(Code)
the ThreadLocalManager collaborator.



transact
public boolean transact(Runnable callback, String tag)(Code)



usageSessionService
abstract protected UsageSessionService usageSessionService()(Code)
the UsageSessionService collaborator.



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.