Java Doc for TdsData.java in  » Database-JDBC-Connection-Pool » jTDS » net » sourceforge » jtds » jdbc » 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 JDBC Connection Pool » jTDS » net.sourceforge.jtds.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sourceforge.jtds.jdbc.TdsData

TdsData
public class TdsData (Code)
Implement TDS data types and related I/O logic.

Implementation notes:

  • This class encapsulates all the knowledge about reading and writing TDS data descriptors and related application data.
  • There are four key methods supplied here:
    1. readType() - Reads the column and parameter meta data.
    2. readData() - Reads actual data values.
    3. writeParam() - Write parameter descriptors and data.
    4. getNativeType() - knows how to map JDBC data types to the equivalent TDS type.

    author:
       Mike Hutchinson
    author:
       Alin Sinpalean
    author:
       freeTDS project
    version:
       $Id: TdsData.java,v 1.60 2007/08/19 02:25:28 bheineman Exp $


  • Field Summary
    final static  intDEFAULT_PRECISION_28
         Default precision for SQL Server 6.5 and 7.
    final static  intDEFAULT_PRECISION_38
         Default precision for Sybase and SQL Server 2000 and newer.
    final static  intDEFAULT_SCALE
         Default Decimal Scale.
    final static  intSYBLONGDATA
        


    Method Summary
    static  voidfillInType(ColInfo ci)
         Fill in the TDS native type code and all other fields for a ColInfo instance with the JDBC type set.
    static  intgetCollation(ResponseStream in, ColInfo ci)
         TDS 8 supplies collation information for character data types.
    public static  StringgetMSTypeName(String typeName, int tdsType)
         For SQL 2005 This routine will modify the meta data to allow the caller to distinguish between varchar(max) and text or varbinary(max) and image or nvarchar(max) and ntext.
    static  voidgetNativeType(ConnectionJDBC2 connection, ParamInfo pi)
         Retrieve the TDS native type code for the parameter.
    static  intgetTds5ParamSize(String charset, boolean isWideChar, ParamInfo pi, boolean useParamNames)
         Calculate the size of the parameter descriptor array for TDS 5 packets.
    Parameters:
      charset - The encoding character set.
    Parameters:
      isWideChar - True if multi byte encoding.
    Parameters:
      pi - The parameter to describe.
    Parameters:
      useParamNames - True if named parameters should be used.
    public static  intgetTdsVersion(int rawTdsVersion)
         Extract the TDS protocol version from the value returned by the server in the LOGINACK packet.
    static  booleanisCollation(ColInfo ci)
         Retrieve the collation status of the column.
    static  booleanisCurrency(ColInfo ci)
         Retrieve the currency status of the column.
    Parameters:
      ci - The column meta data.
    static  booleanisSearchable(ColInfo ci)
         Retrieve the searchable status of the column.
    static  booleanisSigned(ColInfo ci)
         Retrieve the signed status of the column.
    static  booleanisUnicode(ColInfo ci)
         Determines whether the column is Unicode encoded.
    static  voidputCollation(RequestStream out, ParamInfo pi)
         TDS 8 requires collation information for char data descriptors.
    static  ObjectreadData(ConnectionJDBC2 connection, ResponseStream in, ColInfo ci)
         Read the TDS data item from the Response Stream.

    The data size is either implicit in the type for example fixed size integers, or a count field precedes the actual data. The size of the count field varies with the data type.
    Parameters:
      connection - an object reference to the caller of this method;must be a Connection, Statement orResultSet
    Parameters:
      in - The server ResponseStream.
    Parameters:
      ci - The ColInfo column descriptor object.

    static  intreadType(ResponseStream in, ColInfo ci)
         Read the TDS datastream and populate the ColInfo parameter with data type and related information.

    The type infomation conforms to one of the following formats:

    1. [int1 type] - eg SYBINT4.
    2. [int1 type] [int1 buffersize] - eg VARCHAR < 256
    3. [int1 type] [int2 buffersize] - eg VARCHAR > 255.
    4. [int1 type] [int4 buffersize] [int1 tabnamelen] [int1*n tabname] - eg text.
    5. [int1 type] [int4 buffersize] - eg sql_variant.
    6. [int1 type] [int1 buffersize] [int1 precision] [int1 scale] - eg decimal.
    For TDS 8 large character types include a 5 byte collation field after the buffer size.
    Parameters:
      in - The server response stream.
    Parameters:
      ci - The ColInfo column descriptor object.
    static  voidsetColumnCharset(ColInfo ci, ConnectionJDBC2 connection)
         Set the charsetInfo field of ci according to the value of its collation field.

    The Connection is used to find out whether a specific charset was requested.

    static  voidwriteParam(RequestStream out, CharsetInfo charsetInfo, byte[] collation, ParamInfo pi)
         Write a parameter to the server request stream.
    static  voidwriteTds5Param(RequestStream out, CharsetInfo charsetInfo, ParamInfo pi)
         Write the actual TDS 5 parameter data.
    static  voidwriteTds5ParamFmt(RequestStream out, String charset, boolean isWideChar, ParamInfo pi, boolean useParamNames)
         Write a TDS 5 parameter format descriptor.

    Field Detail
    DEFAULT_PRECISION_28
    final static int DEFAULT_PRECISION_28(Code)
    Default precision for SQL Server 6.5 and 7.



    DEFAULT_PRECISION_38
    final static int DEFAULT_PRECISION_38(Code)
    Default precision for Sybase and SQL Server 2000 and newer.



    DEFAULT_SCALE
    final static int DEFAULT_SCALE(Code)
    Default Decimal Scale.



    SYBLONGDATA
    final static int SYBLONGDATA(Code)





    Method Detail
    fillInType
    static void fillInType(ColInfo ci) throws SQLException(Code)
    Fill in the TDS native type code and all other fields for a ColInfo instance with the JDBC type set.
    Parameters:
      ci - the ColInfo instance



    getCollation
    static int getCollation(ResponseStream in, ColInfo ci) throws IOException(Code)
    TDS 8 supplies collation information for character data types.
    Parameters:
      in - the server response stream
    Parameters:
      ci - the column descriptor the number of bytes read from the stream as an int



    getMSTypeName
    public static String getMSTypeName(String typeName, int tdsType)(Code)
    For SQL 2005 This routine will modify the meta data to allow the caller to distinguish between varchar(max) and text or varbinary(max) and image or nvarchar(max) and ntext.
    Parameters:
      typeName - the SQL type returned by sp_columns
    Parameters:
      tdsType - the TDS type returned by sp_columns the (possibly) modified SQL type name as a String



    getNativeType
    static void getNativeType(ConnectionJDBC2 connection, ParamInfo pi) throws SQLException(Code)
    Retrieve the TDS native type code for the parameter.
    Parameters:
      connection - the connectionJDBC object
    Parameters:
      pi - the parameter descriptor



    getTds5ParamSize
    static int getTds5ParamSize(String charset, boolean isWideChar, ParamInfo pi, boolean useParamNames)(Code)
    Calculate the size of the parameter descriptor array for TDS 5 packets.
    Parameters:
      charset - The encoding character set.
    Parameters:
      isWideChar - True if multi byte encoding.
    Parameters:
      pi - The parameter to describe.
    Parameters:
      useParamNames - True if named parameters should be used. The size of the parameter descriptor as an int.



    getTdsVersion
    public static int getTdsVersion(int rawTdsVersion)(Code)
    Extract the TDS protocol version from the value returned by the server in the LOGINACK packet.
    Parameters:
      rawTdsVersion - the TDS protocol version as returned by the server the jTDS internal value for the protocol version (i.e one of theDriver.TDSXX values)



    isCollation
    static boolean isCollation(ColInfo ci)(Code)
    Retrieve the collation status of the column.

    TDS 8.0 character columns include collation information.
    Parameters:
      ci - the column meta data true if the column requires collation data.




    isCurrency
    static boolean isCurrency(ColInfo ci)(Code)
    Retrieve the currency status of the column.
    Parameters:
      ci - The column meta data. boolean true if the column is a currency type.



    isSearchable
    static boolean isSearchable(ColInfo ci)(Code)
    Retrieve the searchable status of the column.
    Parameters:
      ci - the column meta data true if the column is not a text or image type.



    isSigned
    static boolean isSigned(ColInfo ci)(Code)
    Retrieve the signed status of the column.
    Parameters:
      ci - the column meta data true if the column is a signed numeric.



    isUnicode
    static boolean isUnicode(ColInfo ci)(Code)
    Determines whether the column is Unicode encoded.
    Parameters:
      ci - the column meta data true if the column is Unicode encoded



    putCollation
    static void putCollation(RequestStream out, ParamInfo pi) throws IOException(Code)
    TDS 8 requires collation information for char data descriptors.
    Parameters:
      out - The Server request stream.
    Parameters:
      pi - The parameter descriptor.
    throws:
      IOException -



    readData
    static Object readData(ConnectionJDBC2 connection, ResponseStream in, ColInfo ci) throws IOException, ProtocolException(Code)
    Read the TDS data item from the Response Stream.

    The data size is either implicit in the type for example fixed size integers, or a count field precedes the actual data. The size of the count field varies with the data type.
    Parameters:
      connection - an object reference to the caller of this method;must be a Connection, Statement orResultSet
    Parameters:
      in - The server ResponseStream.
    Parameters:
      ci - The ColInfo column descriptor object. The data item Object or null.
    throws:
      IOException -
    throws:
      ProtocolException -




    readType
    static int readType(ResponseStream in, ColInfo ci) throws IOException, ProtocolException(Code)
    Read the TDS datastream and populate the ColInfo parameter with data type and related information.

    The type infomation conforms to one of the following formats:

    1. [int1 type] - eg SYBINT4.
    2. [int1 type] [int1 buffersize] - eg VARCHAR < 256
    3. [int1 type] [int2 buffersize] - eg VARCHAR > 255.
    4. [int1 type] [int4 buffersize] [int1 tabnamelen] [int1*n tabname] - eg text.
    5. [int1 type] [int4 buffersize] - eg sql_variant.
    6. [int1 type] [int1 buffersize] [int1 precision] [int1 scale] - eg decimal.
    For TDS 8 large character types include a 5 byte collation field after the buffer size.
    Parameters:
      in - The server response stream.
    Parameters:
      ci - The ColInfo column descriptor object. The number of bytes read from the input stream.
    throws:
      IOException -
    throws:
      ProtocolException -



    setColumnCharset
    static void setColumnCharset(ColInfo ci, ConnectionJDBC2 connection) throws SQLException(Code)
    Set the charsetInfo field of ci according to the value of its collation field.

    The Connection is used to find out whether a specific charset was requested. In this case, the column charset will be ignored.
    Parameters:
      ci - the ColInfo instance to update
    Parameters:
      connection - a Connection instance to check whether ithas a fixed charset or not
    throws:
      SQLException - if a CharsetInfo is not found for thisparticular column collation




    writeParam
    static void writeParam(RequestStream out, CharsetInfo charsetInfo, byte[] collation, ParamInfo pi) throws IOException(Code)
    Write a parameter to the server request stream.
    Parameters:
      out - the server request stream
    Parameters:
      charsetInfo - the default character set
    Parameters:
      collation - the default SQL Server 2000 collation
    Parameters:
      pi - the parameter descriptor



    writeTds5Param
    static void writeTds5Param(RequestStream out, CharsetInfo charsetInfo, ParamInfo pi) throws IOException, SQLException(Code)
    Write the actual TDS 5 parameter data.
    Parameters:
      out - the server RequestStream
    Parameters:
      charsetInfo - the encoding character set
    Parameters:
      pi - the parameter to output
    throws:
      IOException -
    throws:
      SQLException -



    writeTds5ParamFmt
    static void writeTds5ParamFmt(RequestStream out, String charset, boolean isWideChar, ParamInfo pi, boolean useParamNames) throws IOException(Code)
    Write a TDS 5 parameter format descriptor.
    Parameters:
      out - The server RequestStream.
    Parameters:
      charset - The encoding character set.
    Parameters:
      isWideChar - True if multi byte encoding.
    Parameters:
      pi - The parameter to describe.
    Parameters:
      useParamNames - True if named parameters should be used.
    throws:
      IOException -



    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.