How to execute SQL in Mapper interface of Mybatis
Preface
In many ORM frameworks, Mybatis is used by more and more Internet companies. The main reason is that Mybatis is easy to use and flexible to operate. This series is going to ask questions to learn more about Mybatis from the source layer.
Put questions to
The most common way to use Mybatis is to get a Mapper interface object, and the ...
Posted by verN on Fri, 08 Nov 2019 10:49:44 +0100
There are three ways to batch import and delete the Mybatis framework
Create a database first
CREATE TABLE user (
id varchar(32) CHARACTER SET utf8 NOT NULL,
name varchar(50) CHARACTER SET utf8 DEFAULT NULL ,
dflag char(1) CHARACTER SET utf8 DEFAULT NULL ,
PRIMARY KEY (`id`)
)
jdbc.properties configuration
mysql.driver=com.mysql.jdbc.Driver
mysql.url=jdbc:mysql://127.0.0.1:3306/qingmu?char ...
Posted by sheac on Tue, 05 Nov 2019 22:59:51 +0100
Application of Radiology principle to realize cross database operation (obtaining member information in assembly by reflection)
1. The concept of reflection has been explained in the blog in the previous section. Next, we start to analyze the business requirements logic, and then use the reflection principle to realize it;2. Description:
Usually, only one database can be connected to operate data in a project, but some complex businesses will u ...
Posted by joey3002 on Mon, 04 Nov 2019 00:01:49 +0100
SQLAlchemy -- basic addition, deletion, modification and query
Catalog
brief introduction
install
Component
Simple use
Execute native sql (not commonly used)
orm use (key)
Common data types
Common parameters of Column
Common operations (CURD)
Create an instance of a mapping class
Create Session session
add()/ ...
Posted by Hikari on Sun, 03 Nov 2019 17:02:59 +0100
The plug-in mechanism of mybatis
I. Introduction to mybatis plug-in
As for the plugins of mybatis, I think you've used them, such as the most commonly used reverse engineering, which generates model, dao, xml files and paging plugins according to the table structure. What's the working principle of these plugins, such as paging plugins? Why can it change the sql statements we ...
Posted by hustler on Sun, 03 Nov 2019 13:27:50 +0100
MySQL percona toolkit -- Pt OSC execute SQL command
PT OSC execution log
In the DROP COLUMN operation for table tb004 with data volume of 100000, the PT OSC tool log is:
Operation, tries, wait:
analyze_table, 10, 1
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Altering `db001`.`tb004`...
Creating new table... ...
Posted by KiwiDave on Sun, 03 Nov 2019 06:30:47 +0100
Struts2 -- add, delete, modify and query
Using struts to complete adding, deleting, modifying and checkingIdeas: 1. Import related pom dependencies (struts, custom tag library dependency) 2. Import the paginated tag class, z.tld, and complete the configuration of web.xml 3. dao layer to access data 4. The web layer calls the dao layer to return data to the foreground. 5. Configur ...
Posted by GateGuardian on Sat, 02 Nov 2019 08:29:39 +0100
MySQL? Reference manual (counting line)
Counting row
A database is often used to answer "how often does a certain type of data appear in a table?" The problem. For example, you may want to know how many pets you have, or how many pets each owner has, or you may want to conduct various types of census operations on your animals.
Calculate the total number of animals you own ...
Posted by joel danny on Thu, 31 Oct 2019 20:29:57 +0100
Mybatis dynamic SQL [if tag, where tag, SQL tag and include tag, foreache tag]
Requirement: query users by gender and name
SQL statement:
Select id, username, birthday, sex, address from 'user ` where sex = 1 and username like'% 3% '
Problems:
There may be only one A.sex and username attribute, and the other is null or empty [use if tag]
B. when the sex/username property is null or empty, the ...
Posted by theonewhotopes on Thu, 31 Oct 2019 15:35:31 +0100
Partial function and DBUtils for getting started with Flask
Last article > Message flash, request extension, middleware, blueprint and context management for the introduction to Flask (1)
Supplement
1. Partial function
#!/usr/bin/env python
# coding:utf-8
import functools
def fun(a, b):
print(a, b)
new_fun = functools.partial(fun, "aaa")
new ...
Posted by michalurban on Thu, 31 Oct 2019 15:22:09 +0100