LightDB24.1 pro*c 支持EXEC ORACLE OPTION (CHAR_MAP=STRING)

背景介绍

为了方便ORACLE数据库迁移到LightDB数据库,兼容Pro*C的语法规则。从LightDB24.1版本开始ECPG支持EXEC ORACLE OPTION(CHAR_MAP=STRING)。设置该选项后,将保证字符数组以null结尾。
LightDB ECPG官网
使用约束:

  • 仅支持一维字符数组,保证一维字符数组以null结尾。
  • 仅支持select into到本地数组,保证本地数组null结尾。

使用示例

  1. ecpg源文件
#include <stdio.h>
#include <stdlib.h>EXEC ORACLE OPTION (RELEASE_cursor = No);
EXEC ORACLE OPTION (char_map=String);
exec sql type string is char[5];
typedef char string[5];EXEC SQL BEGIN DECLARE SECTION;
struct TBempl
{char	a;char b[5];
};union StateMachine
{
char c1[5];
int c2;
};
EXEC SQL END DECLARE SECTION;int main()
{EXEC SQL BEGIN DECLARE SECTION;struct TBempl v1;struct TBempl v2;int i = 0;int j = 0;string s1;string s2[2];char arr[2][5];struct TBempl v3[2];union StateMachine u1;EXEC SQL END DECLARE SECTION;EXEC SQL WHENEVER SQLWARNING SQLPRINT;EXEC SQL WHENEVER SQLERROR SQLPRINT;char cc[5];EXEC SQL CONNECT TO oracle_test AS main;EXEC SQL SELECT c1,c2 INTO :v1 from test_struct;EXEC SQL SELECT c2 INTO :v2.b from test_struct;EXEC SQL SELECT name INTO :s1 from test;EXEC SQL SELECT name INTO :s2 from test2;EXEC SQL SELECT name INTO :arr from test2;EXEC SQL SELECT name INTO :u1.c1 from test;EXEC SQL SELECT name INTO :cc from test;EXEC SQL SELECT c1,c2 INTO :v3 from test_struct2;printf("===============struct v1================\n");printf("Print ASCII:%x\n",(unsigned char)v1.a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)v1.b[i]);}printf("===============struct v2================\n");//printf("Print ASCII:%x\n",(unsigned char)v1.a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)v2.b[i]);}printf("================string s1===================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)s1[i]);}printf("================string s2[2]===================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)s2[0][i]);}printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)s2[1][i]);}printf("================union u1.c1===================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)u1.c1[i]);}printf("================arr[2][5]===================\n");for (i=0;i<5;i++){printf("Print ASCII:%x\n",(unsigned char)arr[0][i]);}for (i=0;i<5;i++){printf("Print ASCII:%x\n",(unsigned char)arr[1][i]);}printf("================cc[5]===================\n");for (i=0;i<5;i++){printf("Print ASCII:%x\n",(unsigned char)cc[i]);}printf("================v3[2]===================\n");printf("Print ASCII:%x\n",(unsigned char)v3[0].a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)v3[0].b[i]);}printf("======================================\n");printf("Print ASCII:%x\n",(unsigned char)v3[1].a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)v3[1].b[i]);}EXEC SQL SELECT c1,c2 INTO :v3[1] from test_struct;printf("================v3[1]===================\n");printf("Print ASCII:%x\n",(unsigned char)v3[1].a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",(unsigned char)v3[1].b[i]);}EXEC SQL DISCONNECT;
}
  1. 编译pgc文件生成c文件,ecpg ecpg_struct.pgc -o ecpg_struct.c
/* Processed by ecpg (13.8) */
/* These include files are added by the preprocessor */
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */#line 1 "ecpg_struct.pgc"
#include <stdio.h>
#include <stdlib.h>/* exec oracle option (RELEASE_cursor=No) */
/* exec oracle option (char_map=String) *//* exec sql type string is char [ 5 ] */
#line 7 "ecpg_struct.pgc"typedef char  string [ 5 ];#line 8 "ecpg_struct.pgc"#line 8 "ecpg_struct.pgc"/* exec sql begin declare section */struct TBempl { 
#line 13 "ecpg_struct.pgc"char a ;#line 14 "ecpg_struct.pgc"char b [ 5 ] ;} ; union StateMachine { 
#line 19 "ecpg_struct.pgc"char c1 [ 5 ] ;#line 20 "ecpg_struct.pgc"int c2 ;} ;/* exec sql end declare section */
#line 22 "ecpg_struct.pgc"int  main ( )
#line 24 "ecpg_struct.pgc"{/* exec sql begin declare section */#line 27 "ecpg_struct.pgc"struct TBempl v1 ;#line 28 "ecpg_struct.pgc"struct TBempl v2 ;#line 29 "ecpg_struct.pgc"int i = 0 ;#line 30 "ecpg_struct.pgc"int j = 0 ;#line 31 "ecpg_struct.pgc"string s1 ;#line 32 "ecpg_struct.pgc"string s2 [ 2 ] ;#line 33 "ecpg_struct.pgc"char arr [ 2 ] [ 5 ] ;#line 34 "ecpg_struct.pgc"struct TBempl v3 [ 2 ] ;#line 35 "ecpg_struct.pgc"union StateMachine u1 ;
/* exec sql end declare section */
#line 36 "ecpg_struct.pgc"/* exec sql whenever sql_warning  sqlprint ; */
#line 37 "ecpg_struct.pgc"/* exec sql whenever sqlerror  sqlprint ; */
#line 38 "ecpg_struct.pgc"#line 40 "ecpg_struct.pgc"char cc [ 5 ] ;#line 40 "ecpg_struct.pgc"{ ECPGconnect(__LINE__, 0, "oracle_test", NULL, NULL, "main", 0); 
#line 41 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 41 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 41 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select c1, c2 from test_struct", ECPGt_EOIT, ECPGt_char,&(v1.a),(long)1,(long)1,sizeof( struct TBempl ),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(v1.b),(long)5,(long)1,sizeof( struct TBempl ),1L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 44 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 44 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 44 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select c2 from test_struct", ECPGt_EOIT, ECPGt_char,(v2.b),(long)5,(long)1,(5)*sizeof(char),1L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 45 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 45 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 45 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select name from test", ECPGt_EOIT, ECPGt_char,(s1),(long)5,(long)1,(5)*sizeof(char),1L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 46 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 46 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 46 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select name from test2", ECPGt_EOIT, ECPGt_char,(s2),(long)5,(long)2,(5)*sizeof(char),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 47 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 47 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 47 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select name from test2", ECPGt_EOIT, ECPGt_char,(arr),(long)5,(long)2,(5)*sizeof(char),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 48 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 48 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 48 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select name from test", ECPGt_EOIT, ECPGt_char,(u1.c1),(long)5,(long)1,(5)*sizeof(char),1L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 49 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 49 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 49 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select name from test", ECPGt_EOIT, ECPGt_char,(cc),(long)5,(long)1,(5)*sizeof(char),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 50 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 50 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 50 "ecpg_struct.pgc"{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select c1, c2 from test_struct2", ECPGt_EOIT, ECPGt_char,&(v3->a),(long)1,(long)2,sizeof( struct TBempl ),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(v3->b),(long)5,(long)2,sizeof( struct TBempl ),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 51 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 51 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 51 "ecpg_struct.pgc"printf("===============struct v1================\n");printf("Print ASCII:%x\n",( unsigned char)v1.a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)v1.b[i]);}printf("===============struct v2================\n");//printf("Print ASCII:%x\n",(unsigned char)v1.a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)v2.b[i]);}printf("================string s1===================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)s1[i]);}printf("================string s2[2]===================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)s2[0][i]);}printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)s2[1][i]);}printf("================union u1.c1===================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)u1.c1[i]);}printf("================arr[2][5]===================\n");for(i=0;i<5;i++){printf("Print ASCII:%x\n",( unsigned char)arr[0][i]);}for(i=0;i<5;i++){printf("Print ASCII:%x\n",( unsigned char)arr[1][i]);}printf("================cc[5]===================\n");for(i=0;i<5;i++){printf("Print ASCII:%x\n",( unsigned char)cc[i]);}printf("================v3[2]===================\n");printf("Print ASCII:%x\n",( unsigned char)v3[0].a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)v3[0].b[i]);}printf("======================================\n");printf("Print ASCII:%x\n",( unsigned char)v3[1].a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)v3[1].b[i]);}{ struct lt_ecpg_config lt_conf;lt_conf.ecpg_version_num=LT_ECPG_CONFIG_VERSION;lt_conf.oracle_char_map=1;ECPGdo(__LINE__, 0, 1, NULL, 0, &lt_conf, ECPGst_normal, "select c1, c2 from test_struct", ECPGt_EOIT, ECPGt_char,&(v3[1].a),(long)1,(long)1,sizeof( struct TBempl ),0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char,&(v3[1].b),(long)5,(long)1,sizeof( struct TBempl ),1L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 108 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 108 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 108 "ecpg_struct.pgc"printf("================v3[1]===================\n");printf("Print ASCII:%x\n",( unsigned char)v3[1].a);printf("======================================\n");for(i=0;i<5;i++) {printf("Print ASCII:%x\n",( unsigned char)v3[1].b[i]);}{ ECPGdisconnect(__LINE__, "CURRENT");
#line 116 "ecpg_struct.pgc"if (sqlca.sqlwarn[0] == 'W') sqlprint();
#line 116 "ecpg_struct.pgc"if (sqlca.sqlcode < 0) sqlprint();}
#line 116 "ecpg_struct.pgc"}
  1. 编译c文件生成bin文件,运行得到结果,会发现只有一维数组添加了null结尾
gcc ecpg_struct.c -lecpg -lpgtypes -o ecpg_charmap -I /home/lightdb/stage/lightdb-x/include/ -L/home/lightdb/stage/lightdb-x/lib
[lightdb@192 ~]$ ./ecpg_charmap
===============struct v1================
Print ASCII:48
======================================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:44
Print ASCII:0
===============struct v2================
======================================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:44
Print ASCII:0
================string s1===================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:20
Print ASCII:0
================string s2[2]===================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:20
Print ASCII:20
======================================
Print ASCII:44
Print ASCII:45
Print ASCII:46
Print ASCII:20
Print ASCII:20
================union u1.c1===================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:20
Print ASCII:0
================arr[2][5]===================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:20
Print ASCII:20
Print ASCII:44
Print ASCII:45
Print ASCII:46
Print ASCII:20
Print ASCII:20
================cc[5]===================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:20
Print ASCII:20
================v3[2]===================
Print ASCII:48
======================================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:44
Print ASCII:45
======================================
Print ASCII:49
======================================
Print ASCII:46
Print ASCII:47
Print ASCII:48
Print ASCII:49
Print ASCII:4a
================v3[1]===================
Print ASCII:48
======================================
Print ASCII:41
Print ASCII:42
Print ASCII:43
Print ASCII:44
Print ASCII:0
[lightdb@192 ~]$ 
  1. 样例代码中使用的相关表数据
lightdb@oracle_test=# select * from test;name  
-------ABC  
(1 row)lightdb@oracle_test=# \d+ testTable "public.test"Column |     Type     | Collation | Nullable | Default | Storage  | Stats target | Description 
--------+--------------+-----------+----------+---------+----------+--------------+-------------name   | character(5) |           |          |         | extended |              | 
Access method: heaplightdb@oracle_test=# 
lightdb@oracle_test=# select * from test2;name  
-------ABC  DEF  
(2 rows)lightdb@oracle_test=# \d+ test2Table "public.test2"Column |     Type     | Collation | Nullable | Default | Storage  | Stats target | Description 
--------+--------------+-----------+----------+---------+----------+--------------+-------------name   | character(5) |           |          |         | extended |              | 
Access method: heaplightdb@oracle_test=# select * from test_struct;c1 |  c2   
----+-------H  | ABCDE
(1 row)lightdb@oracle_test=# \d+ test_structTable "public.test_struct"Column |     Type     | Collation | Nullable | Default | Storage  | Stats target | Description 
--------+--------------+-----------+----------+---------+----------+--------------+-------------c1     | character(1) |           |          |         | extended |              | c2     | character(5) |           |          |         | extended |              | 
Access method: heaplightdb@oracle_test=# 
lightdb@oracle_test=# select * from test_struct2;c1 |  c2   
----+-------H  | ABCDEI  | FGHIJ
(2 rows)lightdb@oracle_test=# 
lightdb@oracle_test=# \d+ test_struct2Table "public.test_struct2"Column |     Type     | Collation | Nullable | Default | Storage  | Stats target | Description 
--------+--------------+-----------+----------+---------+----------+--------------+-------------c1     | character(1) |           |          |         | extended |              | c2     | character(5) |           |          |         | extended |              | 
Access method: heaplightdb@oracle_test=# 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/3915.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

从单按键状态机思维扫描引申到4*4矩阵按键全键无冲扫描,一步一步教,超好理解,超好复现(STM32程序例子HAL库)

目前大部分代码存在的问题 ​ 单次只能对单个按键产生反应&#xff1b;多个按键按下就难以修改&#xff1b;并且代码耦合度较高&#xff0c;逻辑难以修改&#xff0c;对于添加长按&#xff0c;短按&#xff0c;双击的需求修改困难。 解决 16个按键按下无冲&#xff0c;并且代…

如何在CentOS本地搭建DataEase数据分析服务并实现远程查看数据分析

文章目录 前言1. 安装DataEase2. 本地访问测试3. 安装 cpolar内网穿透软件4. 配置DataEase公网访问地址5. 公网远程访问Data Ease6. 固定Data Ease公网地址 前言 DataEase 是开源的数据可视化分析工具&#xff0c;帮助用户快速分析数据并洞察业务趋势&#xff0c;从而实现业务…

【项目分享】用 Python 写一个桌面倒计日程序!

事情是这样的&#xff0c;我们班主任想委托我做一个程序&#xff0c;能显示还有几天考试。我立即理解了这个意思&#xff0c;接下了这个项目。 话不多说&#xff0c;来看看这个项目吧—— 项目简介 仓库地址&#xff1a;https://gitee.com/yaoqx/desktop-countdown-day 这是 …

幻兽帕鲁中文怎么设置 游戏中文修改方法 《幻兽帕鲁》宠物指定配种显示英文解决方法 幻兽帕鲁Steam游戏解说合集 Mac玩Windows游戏

在广阔的世界中收集神奇的生物“帕鲁”&#xff0c;派他们进行战斗、建造、做农活&#xff0c;工业生产等&#xff0c;这是一款支持多人游戏模式的全新开放世界生存制作游戏。幻兽帕鲁支持多人在线捕捉“帕鲁”&#xff0c;展开丰富的冒险玩法&#xff1b;不同的关卡具有不同的…

Bellman Ford算法:解决负权边图的最短路径问题

Bellman Ford算法的介绍 在计算机科学的世界中&#xff0c;Bellman Ford算法是一种解决单源最短路径问题的算法&#xff0c;它可以处理有负权边的图。这个算法的名字来源于两位科学家Richard Bellman和Lester Randolph Ford&#xff0c;他们是这个算法的发明者。 这个算法的主…

AI图书推荐:2024年ChatGPT副业搞钱指南

本书《2024年ChatGPT副业搞钱指南》&#xff08;ChatGPT Side Hustles 2024&#xff09;由Alec Rowe撰写&#xff0c;旨在指导读者如何利用ChatGPT技术来提升被动收入、创造新的现金流&#xff0c;并在数字化时代保持领先。 本书是深入了解被动收入未来的综合指南。本书揭示了超…

【算法基础实验】图论-基于DFS的连通性检测

基于DFS的连通性检测 理论基础 在图论中&#xff0c;连通分量是无向图的一个重要概念&#xff0c;特别是在处理图的结构和解析图的组成时。连通分组件表示图中的一个子图&#xff0c;在这个子图中任意两个顶点都是连通的&#xff0c;即存在一条路径可以从一个顶点到达另一个顶…

Flutter应用下拉菜单设计DropdownButtonFormField控件介绍

文章目录 DropdownButtonFormField介绍使用方法重点代码说明属性解释 注意事项 DropdownButtonFormField介绍 Flutter 中的 DropdownButtonFormField 是一个用于在表单中选择下拉菜单的控件。它是 DropdownButton 和 TextFormField 的组合&#xff0c;允许用户从一组选项中选择…

sql中开窗函数的使用

窗口函数 普通的聚集函数只能用来计算一行内的结果&#xff0c;或者把所有行聚集成一行结果。而窗口函数可以跨行计算&#xff0c;并且把结果填到每一行中。 •通过查询筛选出的行的某些部分&#xff0c;窗口调用函数实现了类似于聚集函数的功能&#xff0c;所以聚集函数也可以…

井字棋游戏

1. 游戏创建 1.1导包 from tkinter import * import numpy as np import math import tkinter.messagebox 1.2 窗口内容 1.2.1创建一个窗口 root Tk() # 窗口名称 root.title("井字棋 from Sun") 1.2.2 创建一个框架&#xff0c;将其放置在窗口中 Frame1 F…

SpringBoot这29个注解你都用到过么

你好&#xff0c;我是柳岸花开。 在现代的Java开发中&#xff0c;Spring框架成为了无可争议的霸主。其强大的依赖注入和面向切面编程能力让开发者摆脱了繁琐的配置&#xff0c;专注于业务逻辑的实现。而Spring的核心功能正是通过一系列的注解来实现的。本文将带您了解Spring中不…

汽车底盘域的学习笔记

前言&#xff1a;底盘域分为传统车型底盘域和新能源车型底盘域&#xff08;新能源系统又可以分为纯电和混动车型&#xff0c;有时间可以再研究一下&#xff09; 1&#xff1a;传统车型底盘域 细分的话可以分为四个子系统 传动系统 行驶系统 转向系统 制动系统 1.1传动系…

css边距的接触

一、鼠标悬停 &#xff1a;鼠标选停到上时&#xff0c;设置样式 名&#xff1a;hover{ 样式&#xff1a;样式值 } 例如&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"view…

IOS 添加自动布局约束NSLayoutConstraint

自定义UICollectionViewCell&#xff0c;并添加自动布局约束。 #import "ViewChooseView.h"#pragma mark - Cellinterface ViewChooseViewCell : UICollectionViewCellproperty (nonatomic, strong) UILabel *showTemeLab; property (nonatomic, strong) UILabel *p…

什么样的内外网文档摆渡,可以实现安全高效传输?

内外网文档摆渡通常指的是在内网&#xff08;公司或组织的内部网络&#xff09;和外网&#xff08;如互联网&#xff09;之间安全地传输文件的过程。这个过程需要特别注意安全性&#xff0c;因为内网往往包含敏感数据&#xff0c;直接连接内网和外网可能会带来安全风险。因此会…

设计模式——终止模式之两阶段终止模式

文章目录 1. 错误思路2. 两阶段终止模式2.1 利用 isInterrupted2.2 利用停止标记interrupt-打断park Two Phase Termination 在一个线程 T1 中如何“优雅”终止线程 T2&#xff1f;这里的【优雅】指的是给 T2 一个料理后事的机会。 1. 错误思路 使用线程对象的 stop() 方法停…

GEM TSU Interface Details and IEEE 1588 Support

摘要&#xff1a;Xilinx ZNYQ ULTRASCALE MPSOC的GEM和1588的使用 对于FPGA来说&#xff0c;只需要勾选一些znyq的配置就行了&#xff0c;其余的都是软件的工作&#xff1b; 所有配置都勾选之后&#xff0c;最终会露出来的接口如下&#xff1a; GEM需要勾选的配置如下&#xf…

15.Blender Eevee和Cycles渲染引擎对比

初步介绍 Eevee是实时渲染的引擎&#xff0c;会省略一些解算方式&#xff0c;尤其对光线和阴影 Cycles会考虑这些因素&#xff0c;所以会对光线和阴影的表达更加真实&#xff0c;有一个实时光线追踪的功能 Cycles渲染完之后&#xff0c;每移动一次画面&#xff0c;都会重新渲染…

政安晨:【Keras机器学习示例演绎】(十九)—— 可视化网络学习内容

目录 简介 设置 建立特征提取模型 设置梯度上升过程 设置端到端滤波器可视化回路 可视化目标层中的前 64 个滤波器 政安晨的个人主页&#xff1a;政安晨 欢迎 &#x1f44d;点赞✍评论⭐收藏 收录专栏: TensorFlow与Keras机器学习实战 希望政安晨的博客能够对您有所裨益&…

基于Rust的多线程 Web 服务器

构建多线程 Web 服务器 在 socket 上监听 TCP 连接解析少量的 HTTP 请求创建一个合适的 HTTP 响应使用线程池改进服务器的吞吐量优雅的停机和清理注意&#xff1a;并不是最佳实践 创建项目 ~/rust ➜ cargo new helloCreated binary (application) hello package~/rust ➜ma…