jdbc之statement执行器

一、前言:

​ 本文主要讲述java.sql包下的statement执行器,集成各厂商对其的实现包就可以连接使用其厂商的数据库啦!是不是很神奇,针对mysql我们往下看.

二、Statement执行器

  • Statement执行器关系图

    Wrapper是包装器接口

    AutoCloseable是自动关闭接口

    Statement是执行器接口

    PreparedStatement是预处理执行器接口

    CallableStatement是存储过程执行器接口

    ↓↓↓↓↓↓↓↓ mysql实现 ↓↓↓↓↓↓↓↓

    WrapperBase是基础包装,主要准备连接池、准备异常拦截器、托管子类所需的接口代理缓存

    StatementWrapper是基础执行器包装

    PreparedStatementWrapper是预处理执行器包装

    CallableStatementWrapper是存储过程执行器包装

    avatar

  • Wrapper

    包装器

    avatar

  • AutoCloseable

    自动关闭器

    avatar

  • Statement

    执行器接口

    avatar

  • PreparedStatement

    预处理执行器

    avatar

  • CallableStatement

    存储过程执行器

    avatar

  • WrapperBase

    基础包装,主要准备连接池、准备异常拦截器、托管子类所需的接口代理缓存

    avatar

  • StatementWrapper

    基础执行器包装,特别注意:属性wrappedStmt是Statement接口对象

    avatar

  • PreparedStatementWrapper

    预处理执行器包装,加入了sql脚本的执行操作

    avatar

  • CallableStatementWrapper

    存储过程执行器包装

    avatar

三、总结

​ 学完mysql数据库厂商对Statement处理器的扩展,相信大家对这个statement有了更加深入的了解了,其它数据库厂商也是围绕这些接口做的扩展,妈妈再也不用担心我不了解Statement啦!

  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

请我喝杯咖啡吧~

支付宝
微信