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


org.sakaiproject.db.api.SqlService

All known Subclasses:   org.sakaiproject.db.impl.BasicSqlService,
SqlService
public interface SqlService (Code)

SqlService provides access to pooled Connections to Sql databases.

The Connection objects managed by this service are standard java.sql.Connection objects.





Method Summary
 ConnectionborrowConnection()
     Access an available or newly created Connection from the default pool.
 voiddbCancel(Connection conn)
     Cancel the update that was locked on this connection.
 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).
 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, with an additional stream parameter.
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 - An input stream to add as the last parameter.
Parameters:
  lastLength - The number of bytes in the input stream to write.
 ListdbRead(String sql)
     Read a single field from the db, from multiple records, returned as string[], one per record.
Parameters:
  sql - The sql statement.
 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.
 ListdbRead(Connection conn, String sql, Object[] fields, SqlReader reader)
     Process a query, filling in with fields, and return the results as a List, one per record read.
 voiddbReadBinary(String sql, Object[] fields, byte[] value)
     Read a single field from the db, from multiple record - concatenating the binary values into value.
 voiddbReadBinary(Connection conn, String sql, Object[] fields, byte[] value)
     Read a single field from the db, from multiple record - concatenating the binary values into value.
 InputStreamdbReadBinary(String sql, Object[] fields, boolean big)
     Read a single field / record from the db, returning a stream on the result record / field.
 voiddbReadBlobAndUpdate(String sql, byte[] content)
     Read a single field BLOB from the db from one record, and update it's bytes with content.
 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.
 voiddbUpdateCommit(String sql, Object[] fields, String var, Connection conn)
     Commit the update that was locked on this connection.
 booleandbWrite(String sql)
     Execute the "write" sql - no response.
Parameters:
  sql - The sql statement.
 booleandbWrite(String sql, String var)
     Execute the "write" sql - no response.
 booleandbWrite(String sql, Object[] fields)
     Execute the "write" sql - no response, using a set of fields from an array.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters.
 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.
 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.
 booleandbWriteBinary(String sql, Object[] fields, byte[] var, int offset, int len)
     Execute the "write" sql - no response.
 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.
 voidddl(ClassLoader loader, String resource)
     Load and run the named file using the given class loader, as a ddl check / create.
 StringgetBooleanConstant(boolean value)
     Get the SQL statement constant for a Boolean or Bit field for this value.
Parameters:
  value - The value.
 GregorianCalendargetCal()
     Access the calendar used in processing Time objects for Sql.
 LonggetNextSequence(String tableName, Connection conn)
     Get the next value from this sequence, for those technologies that support sequences.
 StringgetVendor()
    
 voidreturnConnection(Connection conn)
     Release a database connection.
Parameters:
  conn - The connetion to release.
 booleantransact(Runnable callback, String tag)
     Run some code in a transaction.



Method Detail
borrowConnection
Connection borrowConnection() throws SQLException(Code)
Access an available or newly created Connection from the default pool. Will wait a while until one is available. The Connection object.
throws:
  SQLException - if a connection cannot be delivered.



dbCancel
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
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
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, with an additional stream parameter.
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 - An input stream to add as the last parameter.
Parameters:
  lastLength - The number of bytes in the input stream to write. The auto-update value, or null



dbRead
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
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
List dbRead(Connection conn, 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:
  conn - The db connection object to use.
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
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
void dbReadBinary(Connection conn, String sql, Object[] fields, byte[] value)(Code)
Read a single field from the db, from multiple record - concatenating the binary values into value.
Parameters:
  conn - 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
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
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
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
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
boolean dbWrite(String sql)(Code)
Execute the "write" sql - no response.
Parameters:
  sql - The sql statement. true if successful, false if not.



dbWrite
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
boolean dbWrite(String sql, Object[] fields)(Code)
Execute the "write" sql - no response, using a set of fields from an array.
Parameters:
  sql - The sql statement.
Parameters:
  fields - The array of fields for parameters. true if successful, false if not.



dbWrite
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
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.



dbWriteBinary
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
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
void ddl(ClassLoader loader, String resource)(Code)
Load and run the named file using the given class loader, as a ddl check / create. The first non-comment ('--') line will be run, and if successfull, all other non-comment lines will be run. SQL statements must be on a single line, and may have ';' terminators.
Parameters:
  loader - The ClassLoader used to load the resource.
Parameters:
  resource - The path name to the resource - vender string and .sql will be added



getBooleanConstant
String getBooleanConstant(boolean value)(Code)
Get the SQL statement constant for a Boolean or Bit field for this value.
Parameters:
  value - The value. The SQL statement constant for a Boolean or Bit field for this value.



getCal
GregorianCalendar getCal()(Code)
Access the calendar used in processing Time objects for Sql. The calendar used in processing Time objects for Sql.



getNextSequence
Long getNextSequence(String tableName, Connection conn)(Code)
Get the next value from this sequence, for those technologies that support sequences. For the others, return null.
Parameters:
  tableName - The sequence table name
Parameters:
  conn - The database connection to use (it will use a new one if null). The Integer value that is the next sequence, or null if sequences are not supported



getVendor
String getVendor()(Code)
a string indicating the database vendor - "oracle" or "mysql" or "hsqldb".



returnConnection
void returnConnection(Connection conn)(Code)
Release a database connection.
Parameters:
  conn - The connetion to release. If null or not one of ours, ignored.



transact
boolean transact(Runnable callback, String tag)(Code)
Run some code in a transaction. The code is callback. Any calls to this service will be done within the transaction if they don't supply their own connection.
If the transaction fails due to a deadlock, it will be retried a number of times.
Parameters:
  callback - The code to run.
Parameters:
  tag - A string to use in logging failure to identify the transaction. true if all went well. The SqlServiceDeadlockException will be thrown if we end up failing due to a deadlock, and theSqlServiceUniqueViolation.



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