-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed as not planned
Closed as not planned
Copy link
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
Source code:
@EnableJpaRepositories
@SpringBootApplication
class NativeMysqlCharacterTestApplication
fun main(args: Array<String>) {
val application = runApplication<NativeMysqlCharacterTestApplication>(*args)
val userRepository = application.getBean(UserRepository::class.java)
val str = (1..5).joinToString(separator = "") { "123456789".random().toString() }
userRepository.saveAndFlush(
UserPo(nickname = "测试${str}")
)
val userPos = userRepository.findByNicknameLike("%测试%")
for (userPo in userPos) {
println(userPo)
}
}
Code in bytecode:
The following is an intercept, in which you can see the Chinese text: 测试
0 3� �java/lang/Iterable 5� � 7� �java/lang/CharSequence 9� Wcc/shacocloud/nativemysqlcharactertest/NativeMysqlCharacterTestApplicationKt$main$str$1 ;� �INSTANCE� YLcc/shacocloud/nativemysqlcharactertest/NativeMysqlCharacterTestApplicationKt$main$str$1; = > < ?� �kotlin/jvm/functions/Function1 A� kotlin/collections/CollectionsKt C� �joinToString$default� (Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String; E F
D G� 3cc/shacocloud/nativemysqlcharactertest/model/UserPo I� 测试�� K� $java/lang/invoke/StringConcatFactory M� �makeConcatWithConstants� (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; O P
N Q�� R� &(Ljava/lang/String;)Ljava/lang/String; O T� U� T(Ljava/lang/Long;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V 1 W
J X� saveAndFlush� &(Ljava/lang/Object;)Ljava/lang/Object; Z [
& \� �%测试%� ^� �findByNicknameLike� $(Ljava/lang/String;)Ljava/util/List; ` a
& b� �java/util/List d� �iterator� �()Ljava/util/Iterator; f g
e h� �java/util/Iterator j� hasNext� �()Z l m
k n� �next� �()Ljava/lang/Object; p q
k r� �java/lang/System t� �out� �Ljava/io/PrintStream; v w u x� �java/io/PrintStream z� println� �(Ljava/lang/Object;)V | }
The result of the output (I cannot decompile the result of graalvm):
Hibernate: insert into def_user (nickname,id) values (?,?)
Hibernate: select up1_0.id,up1_0.nickname from def_user up1_0 where up1_0.nickname like replace(?,'\\','\\\\')
UserPo(id=1, nickname='娴嬭瘯58659')
I have prepared a demo project for this purpose:https://github.com/Lorwell/native-mysql-character-test
Metadata
Metadata
Assignees
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid