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

How to understand weed3-2.2. Insert and update

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the knowledge of "how to understand weed3-2.2. insert and update". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Weed3 A miniature ORM framework

Source code: https://github.com/noear/weed3 source code: https://gitee.com/noear/weed3

This article focuses on inserting and updating assignments.

Support for general assignment

String mobile= "xxx"; / / my mobile phone number cannot write db.table ("test") .set ("mobile", mobile) / / variable assignment. Set ("sex", 1) / / constant assignment .insert ()

Sql attached values are supported (this is a convenient * *). If the value starts with: $, it means that it is followed by a SQL code (no spaces can occur and is less than 100 characters). Otherwise, it is regarded as a normal string value), as follows:

/ for example, the current time assignment db.table ("test"). Set ("log_time", "$NOW ()"). Insert (); / / another example: field plus 1 appended value db.table ("test"). Set ("num", "$num+1") .where ("id=?", 1). Update () / / another example: batch update db.table ("test"). Set ("txt_md5", "$MD5 (txt)") .where ("id >?") based on the md5 of another field. AND id

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