• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Statement is an interface?

 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know that who does the implementation of this interface and how does it return the statement for executing the query form the connection object?
How does the database recognize that the call is for Simple/Prepared/Callable Statement?
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the "Factory" pattern. It can have a series of interfaces that define specific behaviors, with the implementations provided by a factory class.
In this case the object handle is declared using the type of interface needed. The instance is received from the Connection class via one of its methods: createStatement(), prepareCall() or prepareStatement(). Considering the tight coupling between a Statement object and the associated Connection object, this makes a lot of sense.
The Statement interface provides access to the base behavior, and is extended by the PreparedStatement, which is further extended by the CallableStatement.
[ July 07, 2003: Message edited by: Philip Shanks ]

T
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the "Factory" pattern. It can have a series of interfaces that define specific behaviors, with the implementations provided by a factory class.
In this case the object handle is declared using the type of interface needed. The instance is received from the Connection class via one of its methods: createStatement(), prepareCall() or prepareStatement(). Considering the tight coupling between a Statement object and the associated Connection object, this makes a lot of sense.
The Statement interface provides access to the base behavior, and is extended by the PreparedStatement, which is further extended by the CallableStatement.
[ July 07, 2003: Message edited by: Philip Shanks ]

When I have gone through your answer, I got a question as given below:
What is "Factory" pattern?
What are the Factory classes?
Where can I find these classes and Factory Pattern?
Do you have any documentation for this ,if you have any documentation or article on this please send it to me.
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey man, just "Google" for it!
Here is what I found.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic