Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Weed3-2.4. What are the stored procedures and query procedures in

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what the storage process and query process in weed3-2.4. are. The content is concise and easy to understand. It will definitely make your eyes shine. I hope you can gain something through the detailed introduction of this article.

Weed3 A Micro ORM Framework (Only 0.1Mb Oh)

Two schemes are designed for stored procedure support

1. Stored Procedure Calls to Docking Databases

db.call("user_get").set("_user_id",1).getMap();

SQL query procedure (I call it query procedure)

Looks a bit like mybatis SQL annotation code

//db.call ("SELECT * FROM user WHERE id=@{user_id}").set("user_id",1).getMap();

They can also be materialized (into a separate class)

Materialization is used to arrange data processing in other modules (or folders)

1. Materialization of stored procedures for docking databases

public class user_get extends DbStoredProcedure { public user_get() { super(DbConfig.test); call("user_get"); set("_userID", () -> userID); } public long userID;}user_get sp =new user_get();sp.userID=10;Map map = sp.caching(cache).getMap();//Add a cache incidentally

2. Materialization of query process

public class user_get2 extends DbQueryProcedure { public user_get2() { super(db); sql("select * from user where type=@{type} AND sex=@{sex}"); //This binding method took a long time to come up with (just don't want to reflect!) set("type", () -> type); set("sex", () -> sex); } public int type; public int sex;}//DbQueryProcedure provides the same interface as DbStoredProcedure user_get2 sp =new user_get2();sp.userID=10;Map map = sp.caching(cache).getMap(); the above content is weed3-2.4. What are the stored procedures and query procedures? Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report