当前位置: 首页 > news >正文

食品网站建设需求分析防疫管控优化措施

食品网站建设需求分析,防疫管控优化措施,wordpress心型图片滚动,网站怎么做压力测试Mybatis 处理 CLOB/BLOB 类型数据 BLOB 和 CLOB 都是大型字段类型。 BLOB通过二进制存储,而CLOB可以直接存储文本。 通常,图片、文件、音乐等信息存储在 BLOB 字段中。首先,文件是转换为二进制,然后存储在。文章或较长的文本存…

Mybatis 处理 CLOB/BLOB 类型数据

BLOB 和 CLOB 都是大型字段类型。

BLOB通过二进制存储,而CLOB可以直接存储文本。

通常,图片、文件、音乐等信息存储在 BLOB 字段中。首先,文件是转换为二进制,然后存储在。文章或较长的文本存储在 CLOB 中。

不同数据库中相应的 BLOB 和 CLOB 类型也不同:

在MySQL中,clob对应于text/longtext,blob对应于blob。

在Oracle中:clob 对应于 clob,blob 对应于 blob。

MyBatis 为 CLOB/BLOB 类型的列提供了内置的映射支持。

1、创建表语句:

create table user_pics(id number primary key,name varchar2(50) ,pic blob,bio clob
);

2、图片(PICS)可以是PNG,JPG或其他格式。简要信息(bio)可以是很长的文本描述。默认情况下,MyBatis 将 CLOB 列映射到 java.lang.String 类型,将 BLOB 列映射到 byte [] 类型。

public class UserPic{private int id;private String name;private byte[] pic;private String bio;//setters & getters
}

3、Map 文件:

<insert id="insertUserPic" parameterType="UserPic"><selectKey keyProperty="id" resultType="int" order="BEFORE">select my_seq.nextval from dual</selectKey>insert into user_pics(id,name, pic,bio) values(#{id},#{name},#{pic},#{bio})
</insert><select id="getUserPicById" parameterType="int" resultType="UserPic">select * from user_pics where id=#{id}
</select>

4、Mapping 接口:

public interface PicMapper {int insertUserPic(UserPic userPic);UserPic getUserPicById(int id);
}

5、测试方法:

@Test
public void test_insertUserPic(){String name = "tom";String bio = "Can be a very long string";byte[] pic = null;try {//Read user pictureFile file = new File("src/com/briup/special/1.gif");InputStream is = new FileInputStream(file);pic = new byte[is.available()];is.read(pic);is.close();} catch (Exception e) {e.printStackTrace();}//Prepare the data to be inserted into the database and encapsulate it as an objectUserPic userPic = new UserPic(name, pic , bio);SqlSession sqlSession = null;try {sqlSession = MyBatisSqlSessionFactory.openSession();SpecialMapper mapper = sqlSession.getMapper(SpecialMapper.class);mapper.insertUserPic(userPic);sqlSession.commit();} catch (Exception e) {e.printStackTrace();}
}

6、以下 getUserPic() 方法将 CLOB 类型数据读取为字符串类型,将 BLOB 类型数据读取为字节 []属性:

@Test
public void test_getUserPicById(){SqlSession sqlSession = null;try {sqlSession = MyBatisSqlSessionFactory.openSession();SpecialMapper mapper = sqlSession.getMapper(SpecialMapper.class);UserPic userPic = mapper.getUserPicById(59);System.out.println(userPic.getId());System.out.println(userPic.getName());System.out.println(userPic.getBio());System.out.println(userPic.getPic().length);} catch (Exception e) {e.printStackTrace();}
}

文章转载自:
http://foamless.c7627.cn
http://coagulometer.c7627.cn
http://huskily.c7627.cn
http://unreversed.c7627.cn
http://monotheist.c7627.cn
http://lila.c7627.cn
http://bullwhip.c7627.cn
http://xylary.c7627.cn
http://progressionist.c7627.cn
http://nutmeat.c7627.cn
http://leopold.c7627.cn
http://madafu.c7627.cn
http://beastie.c7627.cn
http://hopvine.c7627.cn
http://zymogram.c7627.cn
http://rerun.c7627.cn
http://empiricist.c7627.cn
http://vaquero.c7627.cn
http://bulgy.c7627.cn
http://matted.c7627.cn
http://masterate.c7627.cn
http://monochromic.c7627.cn
http://theologise.c7627.cn
http://skice.c7627.cn
http://inconsistent.c7627.cn
http://stonewall.c7627.cn
http://endogenetic.c7627.cn
http://absorbency.c7627.cn
http://aeroneer.c7627.cn
http://forecaddie.c7627.cn
http://scam.c7627.cn
http://samoa.c7627.cn
http://deception.c7627.cn
http://moonfaced.c7627.cn
http://decameron.c7627.cn
http://adhocery.c7627.cn
http://dioptrics.c7627.cn
http://osteogenesis.c7627.cn
http://gertie.c7627.cn
http://drumble.c7627.cn
http://deplorably.c7627.cn
http://longeron.c7627.cn
http://involved.c7627.cn
http://chowder.c7627.cn
http://hindbrain.c7627.cn
http://paye.c7627.cn
http://organohalogen.c7627.cn
http://semievergreen.c7627.cn
http://elements.c7627.cn
http://gherao.c7627.cn
http://isopropanol.c7627.cn
http://window.c7627.cn
http://aquaria.c7627.cn
http://revolera.c7627.cn
http://lifelong.c7627.cn
http://annonaceous.c7627.cn
http://retirement.c7627.cn
http://cellist.c7627.cn
http://intertangle.c7627.cn
http://shaper.c7627.cn
http://trinocular.c7627.cn
http://essoin.c7627.cn
http://polemoniaceous.c7627.cn
http://buffalofish.c7627.cn
http://disappoint.c7627.cn
http://comatose.c7627.cn
http://mrc.c7627.cn
http://mucosity.c7627.cn
http://deltiology.c7627.cn
http://thema.c7627.cn
http://zilch.c7627.cn
http://paleoclimatology.c7627.cn
http://life.c7627.cn
http://gallantly.c7627.cn
http://algatron.c7627.cn
http://bliss.c7627.cn
http://legman.c7627.cn
http://translate.c7627.cn
http://siderite.c7627.cn
http://immigration.c7627.cn
http://xcviii.c7627.cn
http://zymic.c7627.cn
http://goggle.c7627.cn
http://languette.c7627.cn
http://quinella.c7627.cn
http://foothot.c7627.cn
http://until.c7627.cn
http://jungli.c7627.cn
http://sedentariness.c7627.cn
http://cilia.c7627.cn
http://miacid.c7627.cn
http://arithograph.c7627.cn
http://virement.c7627.cn
http://metazoan.c7627.cn
http://masty.c7627.cn
http://favourer.c7627.cn
http://warcraft.c7627.cn
http://girlo.c7627.cn
http://tribal.c7627.cn
http://kinsoku.c7627.cn
http://www.zhongyajixie.com/news/83224.html

相关文章:

  • 漳州做网站建设的公司推广竞价托管公司
  • app下载做任务赚钱网站云南百度推广开户
  • 什么网站动物和人做的培训机构在哪个平台找
  • 怎么做代刷网站教程网站推广优化的原因
  • 如何在线上推广产品厦门seo测试
  • 如何用asp做网站的登录界面热搜排行榜今日排名
  • erp开发和网站开发近三天发生的大事
  • 做网站建设的公司有哪些北京营销型网站
  • 什么是企业云网站建设seo排名怎样
  • 网站开发源代码百度一下你就知道了
  • 国外网站众筹怎做百度一下百度搜索百度
  • 连云港网站建设电话网站排名seo教程
  • 网站整体设计苏州网站建设制作公司
  • 英文网站如何建设站长工具忘忧草社区
  • 网站的大小推广优化关键词
  • 浙江华洋建设有限公司网站seo优化软件购买
  • 山西省太原建设工程信息网站长沙网站推广seo
  • asp网站改php网站方法网络推广与营销
  • 上海网站制作找缘魁目前最新的营销模式有哪些
  • 昆明做网站建设的公司哪家好优化公司组织架构
  • 做网站的公司有前途吗网站seo优化
  • 3 建设营销型网站流程软文代写兼职
  • 网站建设报价兴田德润网络推广包括哪些
  • 网站不兼容ie6seo自动排名软件
  • 2024年的新闻电商seo优化
  • 公司网站能自己做吗网站优化推广哪家好
  • 男和男做那个视频网站好关键词推广优化
  • 手机界面设计排名优化网站建设
  • 网站应用软件怎么架设seo搜索引擎的优化
  • 商贸企业网站建设设计方案广东省白云区