PostgreSQl Adatper-nexj/research notes PostgreAdapter

From CDOT Wiki
Revision as of 21:29, 19 January 2011 by Peter.liu (talk | contribs) (Created page with '<pre> 1/15/2011 (Peter Liu) Summary of preliminary source code inspection 1. the structure of the SQLAdapter class - constants - attributes - assoic…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  
1/15/2011 (Peter Liu)
   Summary of preliminary source code inspection
   
   1. the structure of the SQLAdapter class
      - constants
      - attributes
      - assoications
      - operations
      - conrete methods
        - some concrete methods return null
      - abstract methods
      - inner classes (Note: They could be informative for understanding the code.)
     
   2. The class is well documented with javadoc comments.
     (Note: Generate documentation files of these two classes by using this command line:
      javadoc SQLAdapter.java MySQLAdapter.java.)
   
   3. research strategy: divide and conquer, collaborate
   
   4. research questions
      a. What do these methods do (i.e. behvioural/functional descriptions)?
         Give examples for illustration.
      
      b. What are the design/persistence concepts that are encoded by these methods?
         (e.g. object-relational mapping? building a server-specific SQL query?)
                          
   5. research tactics (for the coming two weeks; open for ideas)
      a. select one method or a group of related methods for investigation
        
      b. read all the javadoc comments in SQLAdapter carefully
                             
              - examples: "Appends an SQL literal to a string buffer.",
                          "Appends the specified SQL type conversion expression to a string buffer."
                          "@param gen The SQLGenerator instance."
                          "Appends a prefix hint to the SQL clause: HINT select ..."
                          "Checks if a given vendor-specific SQL exception is a query timeout exception."
                                          
      c. investigate the types of some parameters (e.g. SQLGenerator, SQLJoin, Query)   
                            
      d. read the abstract methods that have been implemented in MySQLAdapter
                      
      e. share the findings with each other
                         
      
    6. Three lists of methods are given below.
    
   --------------------------------------------------------------------------------------------------
                                                                                                                                                                                                           
   A. List of abstract methods
      Note: The list of abstract methods is organized by the way the methods appears in the *source code*
   
                                                                      MySQLAdapter
                                       
   1. protected abstract Boolean isUnicode(
                                     RelationalSchema schema,
                                     ResultSet rs, int nColumn)
                                    throws SQLException;               x

   
   2. protected abstract long getMinTime();                            x

 
   3. protected abstract long getMaxTime();                            x

   
   4. public String getInitialSQL() // it returns null!                xxx-overriden
 

   
   5. public abstract String getTestSQL();                             x

 
   6. public abstract void appendMatchStatement(
                              StringBuffer buf, String sAlias,
                              Column column, SQLJoin join,
                              Pair expression);                        x

   
   7. public abstract String appendStringLengthPrefix(
                                StringBuffer buf,
                                FunctionOperator op);                  x

   
   8. public abstract String appendSubstringPrefix(
                                StringBuffer buf,
                                FunctionOperator op);                  x

   
   9. public abstract boolean isLiteral(Primitive type, Object value); x

   10. public abstract void appendLiteral(
                                      StringBuffer buf,
                                      Primitive type, Object value);   x


   11. public abstract void appendTypeConversion(
                               StringBuffer buf, Object op,
                               Primitive fromType, Primitive type,
                               SQLGenerator gen);                      x

   
   12. public abstract void appendPrefixHint(StringBuffer buf,
                                             Query query);             x

   
   13. public abstract void appendInfixHint(StringBuffer buf,
                                            Query query);              x

   
   14. public abstract void appendSuffixHint(StringBuffer buf,
                                             Query query);             x

   
   15. public abstract void appendTableHint(StringBuffer buf,
                                            SQLJoin join,
                                            Query query);              x

   
   16. public abstract void appendIdentityPrefix(StringBuffer buf,
                                                 SQLInsert work);      x

   
   17. public abstract boolean appendIdentityColumn(StringBuffer buf,
                                                    SQLInsert work);   x

   
   18. public abstract boolean appendIdentityValue(StringBuffer buf,
                                                   SQLInsert work);    x

   
   19. public abstract boolean appendIdentitySuffix(StringBuffer buf,
                                                    SQLInsert work);   x

   
   20. public abstract void bindIdentity(PreparedStatement stmt,
                                         SQLInsert work)
                                throws SQLException;                   x

   
   21. public abstract Object getIdentityValue(PreparedStatement stmt,
                                           Column column,
                                           SQLInsert work)
                                 throws SQLException;                  x

   
   22. public abstract boolean appendNoRowsBlock(StringBuffer buf);    x

   
   23. public abstract void appendNoRowsStart(StringBuffer buf);       x

   
   24. public abstract void appendNoRowsEnd(StringBuffer buf);         x

   =========
   
   25. public abstract boolean isBatchSupported();                     x

   26. public abstract boolean isBatchUpdateCountSupported();          x

   27. public abstract boolean isBatchable(SQLWork work);              x

   ==========
   
   28. protected abstract boolean isDateRangeException(
                                                    SQLException e);   x

   29. protected abstract boolean isQueryTimeoutException(
                                                    SQLException e);   x

   30. protected abstract boolean isDuplicateKeyException(
                                                    SQLException e);   x

   ==========
   
   31. protected abstract String getDuplicateKeyName(SQLException e);  x

   
   32. protected abstract boolean indexNameMatches(
                                               Index index,
                                               String sPhysicalName);  x

   ==========
   
   33. protected abstract boolean isDeadlockException(SQLException e); x
   
   34. protected abstract boolean isLockTimeoutException(
                                                      SQLException e); x

   ==========
   
   35. public abstract SQLSchemaManager createSchemaManager();         !!!-Grace

       (Note: It is used by the next concrete method
              createSchemaManager(RelationalDatabsae databse).)
              
              
    
    B. List of concrete methods in SQLAdapter that are OVERRIDEN in MySQLAdapter
    
    1. appendLikeEscape
    
    2. appendLiteral(StringBuffer buf, String value)
       (Note: Another appendLiteral is an abstract method.)
       
    3. getConnection
    
    4. getInitialSQL
    
    5. getMatchJoin
    
    6. setFetchSize
    
   
    C. List of methods that are ADDED to MySQLAdatper
    
    1. appendMatchExpression
    
    2. appendMatchLiteral