当前位置: 首页 > news >正文

illuminate/database 使用 五

之前文章:

illuminate/database 使用 一-CSDN博客

illuminate/database 使用 二-CSDN博客

illuminate/database 使用 三-CSDN博客

illuminate/database 使用 四-CSDN博客

一、原生查询

1.1 原理

        根据之前内容调用执行的静态类为Illuminate\Database\Capsule\Manager类。

        根据其源码调用其未定义的静态类,返回的是Illuminate\Database\MySqlConnection类对应的静态类。

        调用顺序Manager->DatabaseManager->ConnectionFactory->MySqlConnection。

        Manager通过对象的定义和调用,实现调用DatabaseManager类。

        ConnectionFactory通过工厂模式调用MySqlConnection。

        MySqlConnection继承Connection。

        Connection中可用方法:

  • selectOne($query, $bindings = [], $useReadPdo = true) 查询并返回一行

  • selectFromWriteConnection($query, $bindings = []) 从读库中查询并返回

  • select($query, $bindings = [], $useReadPdo = true) 查询

  • cursor($query, $bindings = [], $useReadPdo = true)

  • insert($query, $bindings = []) 插入数据 返回布尔执行结果

  • update($query, $bindings = []) 修改数据 返回影响行数

  • delete($query, $bindings = []) 删除数据

  • statement($query, $bindings = []) 返回布尔执行结果

  • affectingStatement($query, $bindings = []) 返回结果影响行数

  • unprepared($query) 对PDO连接运行一个未准备的原始查询

1.2 实现代码

function test2()
{$sql = "select * from userinfo where id=:id";$info = Capsule::select($sql, ['id' => 1]);var_dump($info);$sql = "select * from userinfo where id in (?) order by id desc";$info = Capsule::selectOne($sql, [2, 3]);var_dump($info);$sql = "insert into userinfo(name,age) values(:name,:age)";$row = Capsule::insert($sql, ['name' => 'name', 'age' => 10]);var_dump($row);$sql = "update userinfo set name=:name where id=:id";$row = Capsule::update($sql, ['name' => 'name2', 'id' => 4]);var_dump($row);$sql = "select * from userinfo where id=:id";$info = Capsule::statement($sql, ['id' => 1]);var_dump($info);$sql = "select * from userinfo where id=:id";$info = Capsule::affectingStatement($sql, ['id' => 1]);var_dump($info);$sql = "insert into userinfo(name,age) values('name1','10')";$info = Capsule::unprepared($sql);var_dump($info);$sql = "delete from userinfo where name='name1'";$row = Capsule::delete($sql);var_dump($row);
}
test2();

 执行结果:

array(1) {[0] =>class stdClass#15 (3) {public $id =>int(1)public $name =>string(3) "123"public $age =>int(22)}
}
class stdClass#17 (3) {public $id =>int(2)public $name =>string(5) "name2"public $age =>int(13)
}
bool(true)
int(0)
bool(true)
int(1)
bool(true)
int(1)

1.3 源代码

namespace Illuminate\Database\Capsule;
use Illuminate\Container\Container;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Database\DatabaseManager;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Support\Traits\CapsuleManagerTrait;
use PDO;class Manager
{/*** Dynamically pass methods to the default connection.** @param  string  $method* @param  array  $parameters* @return mixed*/public static function __callStatic($method, $parameters){return static::connection()->$method(...$parameters);}/*** Get a connection instance from the global manager.** @param  string|null  $connection* @return \Illuminate\Database\Connection*/public static function connection($connection = null){return static::$instance->getConnection($connection);}/*** Get a registered connection instance.** @param  string|null  $name* @return \Illuminate\Database\Connection*/public function getConnection($name = null){return $this->manager->connection($name);}/*** Create a new database capsule manager.** @param  \Illuminate\Container\Container|null  $container* @return void*/public function __construct(Container $container = null){$this->setupContainer($container ?: new Container);// Once we have the container setup, we will setup the default configuration// options in the container "config" binding. This will make the database// manager work correctly out of the box without extreme configuration.$this->setupDefaultConfiguration();$this->setupManager();}/*** Build the database manager instance.** @return void*/protected function setupManager(){$factory = new ConnectionFactory($this->container);$this->manager = new DatabaseManager($this->container, $factory);}
}
namespace Illuminate\Database;use Doctrine\DBAL\Types\Type;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Support\Arr;
use Illuminate\Support\ConfigurationUrlParser;
use Illuminate\Support\Str;
use InvalidArgumentException;
use PDO;
use RuntimeException;class DatabaseManager implements ConnectionResolverInterface
{/*** Create a new database manager instance.** @param  \Illuminate\Contracts\Foundation\Application  $app* @param  \Illuminate\Database\Connectors\ConnectionFactory  $factory* @return void*/public function __construct($app, ConnectionFactory $factory){$this->app = $app;$this->factory = $factory;$this->reconnector = function ($connection) {$this->reconnect($connection->getNameWithReadWriteType());};}/*** Reconnect to the given database.** @param  string|null  $name* @return \Illuminate\Database\Connection*/public function reconnect($name = null){$this->disconnect($name = $name ?: $this->getDefaultConnection());if (!isset($this->connections[$name])) {return $this->connection($name);}return $this->refreshPdoConnections($name);}/*** Get a database connection instance.** @param  string|null  $name* @return \Illuminate\Database\Connection*/public function connection($name = null){[$database, $type] = $this->parseConnectionName($name);$name = $name ?: $database;// If we haven't created this connection, we'll create it based on the config// provided in the application. Once we've created the connections we will// set the "fetch mode" for PDO which determines the query return types.if (!isset($this->connections[$name])) {$this->connections[$name] = $this->configure($this->makeConnection($database), $type);}return $this->connections[$name];}/*** Make the database connection instance.** @param  string  $name* @return \Illuminate\Database\Connection*/protected function makeConnection($name){$config = $this->configuration($name);// First we will check by the connection name to see if an extension has been// registered specifically for that connection. If it has we will call the// Closure and pass it the config allowing it to resolve the connection.if (isset($this->extensions[$name])) {return call_user_func($this->extensions[$name], $config, $name);}// Next we will check to see if an extension has been registered for a driver// and will call the Closure if so, which allows us to have a more generic// resolver for the drivers themselves which applies to all connections.if (isset($this->extensions[$driver = $config['driver']])) {return call_user_func($this->extensions[$driver], $config, $name);}return $this->factory->make($config, $name);}
}
namespace Illuminate\Database\Connectors;use Illuminate\Contracts\Container\Container;
use Illuminate\Database\Connection;
use Illuminate\Database\MySqlConnection;
use Illuminate\Database\PostgresConnection;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Database\SqlServerConnection;
use Illuminate\Support\Arr;
use InvalidArgumentException;
use PDOException;class ConnectionFactory
{/*** Establish a PDO connection based on the configuration.** @param  array  $config* @param  string|null  $name* @return \Illuminate\Database\Connection*/public function make(array $config, $name = null){$config = $this->parseConfig($config, $name);if (isset($config['read'])) {return $this->createReadWriteConnection($config);}return $this->createSingleConnection($config);}/*** Create a single database connection instance.** @param  array  $config* @return \Illuminate\Database\Connection*/protected function createSingleConnection(array $config){$pdo = $this->createPdoResolver($config);return $this->createConnection($config['driver'], $pdo, $config['database'], $config['prefix'], $config);}/*** Create a new connection instance.** @param  string  $driver* @param  \PDO|\Closure  $connection* @param  string  $database* @param  string  $prefix* @param  array  $config* @return \Illuminate\Database\Connection** @throws \InvalidArgumentException*/protected function createConnection($driver, $connection, $database, $prefix = '', array $config = []){if ($resolver = Connection::getResolver($driver)) {return $resolver($connection, $database, $prefix, $config);}switch ($driver) {case 'mysql':return new MySqlConnection($connection, $database, $prefix, $config);case 'pgsql':return new PostgresConnection($connection, $database, $prefix, $config);case 'sqlite':return new SQLiteConnection($connection, $database, $prefix, $config);case 'sqlsrv':return new SqlServerConnection($connection, $database, $prefix, $config);}throw new InvalidArgumentException("Unsupported driver [{$driver}].");}
}
namespace Illuminate\Database;use Doctrine\DBAL\Driver\PDOMySql\Driver as DoctrineDriver;
use Doctrine\DBAL\Version;
use Illuminate\Database\PDO\MySqlDriver;
use Illuminate\Database\Query\Grammars\MySqlGrammar as QueryGrammar;
use Illuminate\Database\Query\Processors\MySqlProcessor;
use Illuminate\Database\Schema\Grammars\MySqlGrammar as SchemaGrammar;
use Illuminate\Database\Schema\MySqlBuilder;
use Illuminate\Database\Schema\MySqlSchemaState;
use Illuminate\Filesystem\Filesystem;
use PDO;class MySqlConnection extends Connection
{}

 

namespace Illuminate\Database;use Closure;
use DateTimeInterface;
use Doctrine\DBAL\Connection as DoctrineConnection;
use Doctrine\DBAL\Types\Type;
use Exception;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Database\Events\StatementPrepared;
use Illuminate\Database\Events\TransactionBeginning;
use Illuminate\Database\Events\TransactionCommitted;
use Illuminate\Database\Events\TransactionRolledBack;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Query\Grammars\Grammar as QueryGrammar;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\Schema\Builder as SchemaBuilder;
use Illuminate\Support\Arr;
use LogicException;
use PDO;
use PDOStatement;
use RuntimeException;class Connection implements ConnectionInterface
{/*** Get a new query builder instance.** @return \Illuminate\Database\Query\Builder*/public function query(){return new QueryBuilder($this, $this->getQueryGrammar(), $this->getPostProcessor());}/*** Run a select statement against the database.** @param  string  $query* @param  array  $bindings* @param  bool  $useReadPdo* @return array*/public function select($query, $bindings = [], $useReadPdo = true){return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {if ($this->pretending()) {return [];}// For select statements, we'll simply execute the query and return an array// of the database result set. Each element in the array will be a single// row from the database table, and will either be an array or objects.$statement = $this->prepared($this->getPdoForSelect($useReadPdo)->prepare($query));$this->bindValues($statement, $this->prepareBindings($bindings));$statement->execute();return $statement->fetchAll();});}/*** Run an insert statement against the database.** @param  string  $query* @param  array  $bindings* @return bool*/public function insert($query, $bindings = []){return $this->statement($query, $bindings);}/*** Run an update statement against the database.** @param  string  $query* @param  array  $bindings* @return int*/public function update($query, $bindings = []){return $this->affectingStatement($query, $bindings);}/*** Run a delete statement against the database.** @param  string  $query* @param  array  $bindings* @return int*/public function delete($query, $bindings = []){return $this->affectingStatement($query, $bindings);}/*** Run a raw, unprepared query against the PDO connection.** @param  string  $query* @return bool*/public function unprepared($query){return $this->run($query, [], function ($query) {if ($this->pretending()) {return true;}$this->recordsHaveBeenModified($change = $this->getPdo()->exec($query) !== false);return $change;});}/*** Execute the given callback in "dry run" mode.** @param  \Closure  $callback* @return array*/public function pretend(Closure $callback){return $this->withFreshQueryLog(function () use ($callback) {$this->pretending = true;// Basically to make the database connection "pretend", we will just return// the default values for all the query methods, then we will return an// array of queries that were "executed" within the Closure callback.$callback($this);$this->pretending = false;return $this->queryLog;});}/*** Execute an SQL statement and return the boolean result.** @param  string  $query* @param  array  $bindings* @return bool*/public function statement($query, $bindings = []){return $this->run($query, $bindings, function ($query, $bindings) {if ($this->pretending()) {return true;}$statement = $this->getPdo()->prepare($query);$this->bindValues($statement, $this->prepareBindings($bindings));$this->recordsHaveBeenModified();return $statement->execute();});}
}

二、 sql输出

2.1 原理

       Illuminate\Database\MySqlConnection类包含变量queryLog,获取对应执行语句实际上就是获取queryLog。根据源码每次执行sql语句,都使用该类run()函数执行,run()中包括logQuery()函数。而logQuery函数就是对queryLog变量进行设置。

        返回的queryLog变量值,顺序和执行顺序相同,所以取左后一条就是最新执行的sql。

        框架中默认记录不记录queryLog。

2.2 实现代码

function test3()
{Capsule::enableQueryLog();$sql = "select * from userinfo where id=:id";$info = Capsule::select($sql, ['id' => 1]);$sql = "select * from userinfo where id in (?) order by id desc";$info = Capsule::selectOne($sql, [2, 3]);$logs = Capsule::getQueryLog();var_dump($logs);var_dump(end($logs));
}
test3();

 执行结果

array(2) {[0] =>array(3) {'query' =>string(35) "select * from userinfo where id=:id"'bindings' =>array(1) {'id' =>int(1)}'time' =>double(7.35)}[1] =>array(3) {'query' =>string(55) "select * from userinfo where id in (?) order by id desc"'bindings' =>array(2) {[0] =>int(2)[1] =>int(3)}'time' =>double(0.33)}
}
array(3) {'query' =>string(55) "select * from userinfo where id in (?) order by id desc"'bindings' =>array(2) {[0] =>int(2)[1] =>int(3)}'time' =>double(0.33)
}

说实话,输出结果和想的不太一样。我还是希望传回拼接后的语句,当然传$sql的时候就可以传拼接后的sql语句。

因为需要打印sql大概有两种情况

  1. 调试sql,对于使用复杂sql时很实用。
  2. 调试数据导致的bug。实际运行,bug情况很多,有些是数据导致,查看对应业务的sql执行有时候能快速发现问题。

2.3 源码

class Connection implements ConnectionInterface
{/*** All of the queries run against the connection.** @var array*/protected $queryLog = [];/*** Indicates whether queries are being logged.** @var bool*/protected $loggingQueries = false;/*** Enable the query log on the connection.** @return void*/public function enableQueryLog(){$this->loggingQueries = true;}/*** Disable the query log on the connection.** @return void*/public function disableQueryLog(){$this->loggingQueries = false;}/*** Log a query in the connection's query log.** @param  string  $query* @param  array  $bindings* @param  float|null  $time* @return void*/public function logQuery($query, $bindings, $time = null){$this->event(new QueryExecuted($query, $bindings, $time, $this));if ($this->loggingQueries) {$this->queryLog[] = compact('query', 'bindings', 'time');}}/*** Run a SQL statement and log its execution context.** @param  string  $query* @param  array  $bindings* @param  \Closure  $callback* @return mixed** @throws \Illuminate\Database\QueryException*/protected function run($query, $bindings, Closure $callback){foreach ($this->beforeExecutingCallbacks as $beforeExecutingCallback) {$beforeExecutingCallback($query, $bindings, $this);}$this->reconnectIfMissingConnection();$start = microtime(true);// Here we will run this query. If an exception occurs we'll determine if it was// caused by a connection that has been lost. If that is the cause, we'll try// to re-establish connection and re-run the query with a fresh connection.try {$result = $this->runQueryCallback($query, $bindings, $callback);} catch (QueryException $e) {$result = $this->handleQueryException($e, $query, $bindings, $callback);}// Once we have run the query we will calculate the time that it took to run and// then log the query, bindings, and execution time so we will report them on// the event that the developer needs them. We'll log time in milliseconds.$this->logQuery($query, $bindings, $this->getElapsedTime($start));return $result;}/*** Run a raw, unprepared query against the PDO connection.** @param  string  $query* @return bool*/public function unprepared($query){return $this->run($query, [], function ($query) {if ($this->pretending()) {return true;}$this->recordsHaveBeenModified($change = $this->getPdo()->exec($query) !== false);return $change;});}
}

相关文章:

illuminate/database 使用 五

之前文章: illuminate/database 使用 一-CSDN博客 illuminate/database 使用 二-CSDN博客 illuminate/database 使用 三-CSDN博客 illuminate/database 使用 四-CSDN博客 一、原生查询 1.1 原理 根据之前内容调用执行的静态类为Illuminate\Database\Capsule\M…...

武汉灰京文化:益智游戏的教育与娱乐完美结合

随着游戏技术的不断发展,益智类游戏正经历着一场革命性的变革,逐渐融合了教育和娱乐的元素。创新的设计和互动方式使得许多益智游戏成为了知识传递和技能训练的有效工具,同时保持了娱乐体验的趣味性。这种教育与娱乐的完美结合不仅使益智游戏…...

arcgis api for js 中的query实现数据查询

相当于服务地址中的query查询 获取图层范围内的数据4.24 import Query from arcgis/core/rest/support/Query; import * as QueryTask from "arcgis/core/rest/query";//获取图层范围内的数据4.24 _returnFeatureFromWhere(url, where, geo) {const self thisretu…...

AcWing 1250. 格子游戏(并查集)

题目链接 活动 - AcWing本课程系统讲解常用算法与数据结构的应用方式与技巧。https://www.acwing.com/problem/content/1252/ 题解 当两个点已经是在同一个连通块中,再连一条边,就围成一个封闭的圈。一般用x * n y的形式将(x, y&#xff0…...

CSS对文本的简单修饰

CSS格式&#xff1a; 格式一&#xff1a;在head中的style标签范围内。 < style> 在style内的只写名字不写 &#xff1a; < > 选择器 { 属性的名称 &#xff1a; 样式&#xff1b; 属性的名称&#xff1a;样式&#xff1b; } < style> style中的注释用/* *…...

C++17中if和switch语句的新特性

1.从C17开始&#xff0c;if语句允许在条件表达式里添加一条初始化语句。当仅在if语句范围内需要变量时&#xff0c;使用这种形式的if语句。在if语句的条件表达式里定义的变量将在整个if语句中有效&#xff0c;包括else部分。 std::mutex mx; bool shared_flag true; // guard…...

极坐标下的牛拉法潮流计算57节点MATLAB程序

微❤关注“电气仔推送”获得资料&#xff08;专享优惠&#xff09; 潮流计算&#xff1a; 潮流计算是根据给定的电网结构、参数和发电机、负荷等元件的运行条件&#xff0c;确定电力系统各部分稳态运行状态参数的计算。通常给定的运行条件有系统中各电源和负荷点的功率、枢纽…...

软件设计师——计算机网络(三)

&#x1f4d1;前言 本文主要是【计算机网络】——软件设计师——计算机网络的文章&#xff0c;如果有什么需要改进的地方还请大佬指出⛺️ &#x1f3ac;作者简介&#xff1a;大家好&#xff0c;我是听风与他&#x1f947; ☁️博客首页&#xff1a;CSDN主页听风与他 &#x1…...

【ArkTS】循环控制与List的使用

ArkTS如何进行循环渲染 现有数据如下 class Item{name:stringimage:Resourceprice:numberdicount:numberconstructor(name:string,image:Resource,price:number,dicount?:number) {this.name namethis.image imagethis.price pricethis.dicount dicount} }private items…...

条款3:尽量使用const

文章目录 const指针和函数声明const修饰指针const修饰函数const修饰容器const应用在函数中 const限定成员函数避免const重载的代码重复总结 const指针和函数声明 const修饰指针 char greeting[] "Hello"; char* p greeting; // non-const 指针,// non-const 数据…...

Chromadb词向量数据库总结

简介 Chroma 词向量数据库是一个用于自然语言处理&#xff08;NLP&#xff09;和机器学习的工具&#xff0c;它主要用于词嵌入&#xff08;word embeddings&#xff09;。词向量是将单词转换为向量表示的技术&#xff0c;可以捕获单词之间的语义和语法关系&#xff0c;使得计算…...

Gin之GORM 操作数据库(MySQL)

GORM 简单介绍 GORM 是 Golang 的一个 orm 框架。简单说&#xff0c;ORM 就是通过实例对象的语法&#xff0c;完成关系型数据库的操作的技术&#xff0c;是"对象-关系映射"&#xff08;Object/Relational Mapping&#xff09; 的缩写。使用 ORM框架可以让我们更方便…...

二十七、读写文件

二十七、读写文件 27.1 文件类QFile #include <QCoreApplication>#include<QFile> #include<QDebug>int main(int argc, char *argv[]) {QCoreApplication a(argc, argv);QFile file("D:/main.txt");if(!file.open(QIODevice::WriteOnly | QIODe…...

flutter 代码混淆

Flutter 应用混淆&#xff1a; Flutter 应用的混淆非常简单&#xff0c;只需要在构建 release 版应用时结合使用 --obfuscate 和 --split-debug-info 这两个参数即可。 –obfuscate --split-debug-info 用来指定输出调试文件的位置&#xff0c;该命令会生成一个符号映射表。目前…...

05 Vue中常用的指令

概述 All Vue-based directives start with a v-* prefix as a Vue-specific attribute. 所有基于 Vue 的指令都以 v-* 前缀作为 Vue 特有的属性。 v-text The v-text directive has the same reactivity as with interpolation. Interpolation with {{ }} is more perform…...

Mr. Cappuccino的第67杯咖啡——MacOS通过PD安装Win11

MacOS通过PD安装Win11 下载ParallelsDesktop安装ParallelsDesktop激活ParallelsDesktop下载Windows11安装Windows11激活Windows11 下载ParallelsDesktop ParallelsDesktop下载地址 安装ParallelsDesktop 关闭上面的窗口&#xff0c;继续操作 激活ParallelsDesktop 关闭上面的…...

【云原生kubernets】Service 的功能与应用

一、Service介绍 在kubernetes中&#xff0c;pod是应用程序的载体&#xff0c;我们可以通过pod的ip来访问应用程序&#xff0c;但是pod的ip地址不是固定的&#xff0c;这也就意味着不方便直接采用pod的ip对服务进行访问。为了解决这个问题&#xff0c;kubernetes提供了Service资…...

docker安装Prometheus

docker安装Prometheus Docker搭建Prometheus监控系统 环境准备(这里的环境和版本是经过测试没有问题,并不是必须这个版本) 主机名IP配置系统说明localhost随意2核4gCentOS7或者Ubuntu20.0.4docker版本23.0.1或者24.0.5,docker-compose版本1.29 安装Docker Ubuntu20.0.4版本…...

了解 Flutter 3.16 功能更新

作者 / Kevin Chisholm 我们在季度 Flutter 稳定版发布会上带来了 Flutter 3.16&#xff0c;此版本包含诸多更新: Material 3 成为新的默认主题、为 Android 带来 Impeller 的预览版、允许添加适用于 DevTools 的扩展程序等等&#xff0c;以及同步推出 Flutter 休闲游戏工具包重…...

python之画动态图 gif效果图

import pandas as pd import matplotlib import matplotlib.pyplot as plt import os# set up matplotlib is_ipython inline in matplotlib.get_backend() if is_ipython:from IPython import displayplt.ion()def find_csv_files(directory):csv_files [] # 用于存储找到的…...

[2025CVPR]DeepVideo-R1:基于难度感知回归GRPO的视频强化微调框架详解

突破视频大语言模型推理瓶颈,在多个视频基准上实现SOTA性能 一、核心问题与创新亮点 1.1 GRPO在视频任务中的两大挑战 ​安全措施依赖问题​ GRPO使用min和clip函数限制策略更新幅度,导致: 梯度抑制:当新旧策略差异过大时梯度消失收敛困难:策略无法充分优化# 传统GRPO的梯…...

.Net框架,除了EF还有很多很多......

文章目录 1. 引言2. Dapper2.1 概述与设计原理2.2 核心功能与代码示例基本查询多映射查询存储过程调用 2.3 性能优化原理2.4 适用场景 3. NHibernate3.1 概述与架构设计3.2 映射配置示例Fluent映射XML映射 3.3 查询示例HQL查询Criteria APILINQ提供程序 3.4 高级特性3.5 适用场…...

Linux简单的操作

ls ls 查看当前目录 ll 查看详细内容 ls -a 查看所有的内容 ls --help 查看方法文档 pwd pwd 查看当前路径 cd cd 转路径 cd .. 转上一级路径 cd 名 转换路径 …...

如何将联系人从 iPhone 转移到 Android

从 iPhone 换到 Android 手机时&#xff0c;你可能需要保留重要的数据&#xff0c;例如通讯录。好在&#xff0c;将通讯录从 iPhone 转移到 Android 手机非常简单&#xff0c;你可以从本文中学习 6 种可靠的方法&#xff0c;确保随时保持连接&#xff0c;不错过任何信息。 第 1…...

unix/linux,sudo,其发展历程详细时间线、由来、历史背景

sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...

IoT/HCIP实验-3/LiteOS操作系统内核实验(任务、内存、信号量、CMSIS..)

文章目录 概述HelloWorld 工程C/C配置编译器主配置Makefile脚本烧录器主配置运行结果程序调用栈 任务管理实验实验结果osal 系统适配层osal_task_create 其他实验实验源码内存管理实验互斥锁实验信号量实验 CMISIS接口实验还是得JlINKCMSIS 简介LiteOS->CMSIS任务间消息交互…...

图表类系列各种样式PPT模版分享

图标图表系列PPT模版&#xff0c;柱状图PPT模版&#xff0c;线状图PPT模版&#xff0c;折线图PPT模版&#xff0c;饼状图PPT模版&#xff0c;雷达图PPT模版&#xff0c;树状图PPT模版 图表类系列各种样式PPT模版分享&#xff1a;图表系列PPT模板https://pan.quark.cn/s/20d40aa…...

如何应对敏捷转型中的团队阻力

应对敏捷转型中的团队阻力需要明确沟通敏捷转型目的、提升团队参与感、提供充分的培训与支持、逐步推进敏捷实践、建立清晰的奖励和反馈机制。其中&#xff0c;明确沟通敏捷转型目的尤为关键&#xff0c;团队成员只有清晰理解转型背后的原因和利益&#xff0c;才能降低对变化的…...

MyBatis中关于缓存的理解

MyBatis缓存 MyBatis系统当中默认定义两级缓存&#xff1a;一级缓存、二级缓存 默认情况下&#xff0c;只有一级缓存开启&#xff08;sqlSession级别的缓存&#xff09;二级缓存需要手动开启配置&#xff0c;需要局域namespace级别的缓存 一级缓存&#xff08;本地缓存&#…...

认识CMake并使用CMake构建自己的第一个项目

1.CMake的作用和优势 跨平台支持&#xff1a;CMake支持多种操作系统和编译器&#xff0c;使用同一份构建配置可以在不同的环境中使用 简化配置&#xff1a;通过CMakeLists.txt文件&#xff0c;用户可以定义项目结构、依赖项、编译选项等&#xff0c;无需手动编写复杂的构建脚本…...