using meta-SQL 使用元SQL
%DatePart
Syntax
%DatePart(DTTM_Column)
Description
The %DatePart meta-SQL variable returns the date portion of the specified DateTime column.
DatePart meta-SQL变量返回指定的DateTime列的日期部分。
Note: This meta-SQL variable is not implemented for COBOL.
注意:这个元SQL变量不是为COBOL实现的。
Considerations using %DatePart
使用%DatePart的注意事项
Use %DateOut meta-SQL when fetching values, as in the following example:
获取值时使用%DateOut meta-SQL,如以下示例所示:
%DateOut(%DatePart(DTTM_COLUMN)) from some_table
If a literal is used as the parameter to %DatePart, it must be wrapped in %DateTimeIn:
如果文本用作%DatePart的参数,则必须将其包装在%DateTimeIn中:
insert into some_table values(%DatePart(%DateTimeIn('2001-01-01-12.34.56.789012')))
Parameters
| Parameter | Description |
| DTTM_Column | Specify the datetime column from which you want to return the date. |
%DateTimeDiff
Syntax
%DateTimeDiff(datetime_from, datetime_to)
Description
The %DateTimeDiff meta-SQL function returns a time value, representing the difference between two date times in minutes.
DateTimeDiff meta-SQL函数返回一个时间值,表示两个日期时间之间的差异(以分钟为单位)。Example
The following example returns the difference in hours between the current datetime and the requested datetime:
下面的示例返回当前日期时间和请求日期时间之间的小时数差:
%DateTimeDiff(%CurrentDateIn, RQSTDTTM) < " | RECORD.FIELDNAME * 60;
The following example returns the difference in minutes:
下面的示例返回以分钟为单位的差值:
%DateTimeDiff(%CurrentDateIn, RQSTDTTM) < " | RECORD.FIELDNAME;
%DateTimeIn
Syntax
%DateTimeIn(dtt)
Description
The %DateTimeIn meta-SQL variable expands to platform-specific SQL for a DateTime value in the Where clause of a SQL Select or Update statement, or when a DateTime value is passed in an Insert statement.
对于SQL Select或Update语句的Where子句中的DateTime值,或者当在Insert语句中传递DateTime值时,%DateTime In meta-SQL变量将扩展为特定于平台的SQL。
Restrictions Using COBOL
使用COBOL的限制
You can only use string literals when using this construct in COBOL. You cannot use it with bind parameters in COBOL. For example, the following works in COBOL:
在COBOL中使用此构造时,只能使用字符串文字。您不能将它与COBOL中的绑定参数一起使用。例如,以下代码在COBOL中运行:
UPDATE PS_PERSONAL_DATA SET LASTUPDTTM = %DATETIMEIN('2002-12-11-11.59.00.000000')
The following SQL fails:
以下SQL失败:
UPDATE PS_PERSONAL_DATA SET LASTUPDTTM = %DATETIMEIN(:1)
Parameters
| Parameter | Description |
| dtt | Specify either a DateTime bind variable or a string literal in the form YYYY-MM-DD-hh.mm.ss.ssssss. |
%DateTimeNull
Syntax
%DateTimeNull
Use the %DateTimeNull meta-SQL variable to specify a null value for a DateTime field. Only use this meta-SQL in Insert or Update clauses. Do not use this meta-SQL in a Where clause.
使用%DateTimeNull meta-SQL变量为DateTime字段指定空值。仅在插入或更新子句中使用此元SQL。不要在Where子句中使用这个元SQL。
Note: This meta-SQL is not implemented for COBOL.
注意:这个元SQL不是为COBOL实现的。
This meta-SQL resolves into a database-specific SQL substring, as shown in the following table:
| Database | Resolved Substring |
| DB2 | NULLIF(CURRENT TIMESTAMP, CURRENT TIMESTAMP) |
| All others | NULL |
Parameters None.
Example
%InsertSelect(LEDGER_KK_WK2,LEDGER_KK_WRK, CURRENCY_CD = %Bind(TO_CURRENCY) ,POSTED⇒
_TOTAL_AMT = SUM(POSTED_BASE_AMT),POSTED_TRAN_AMT = 0,POSTED_BASE_AMT = 0,BASE_CURR⇒ ENCY = %Bind(TO_CURRENCY),PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE),DTTM_STAMP_SEC⇒ = %DateTimeNull)
FROM PS_LEDGER_KK_WRK
WHERE PROCESS_INST_STG = %Bind(PROCESS_INSTANCE)
AND CURRENCY_CD <> %Bind(TO_CURRENCY)
GROUP BY PROCESS_INST_STG, BUSINESS_UNIT,LEDGER, ACCOUNT, %List(FIELD_LIST, CFCC1_A⇒ K_SBR) ,STATISTICS_CODE, FISCAL_YEAR,ACCOUNTING_PERIOD
%DateTimeOut
Syntax
%DateTimeOut(datetime_col)
Description
The %DateTimeOut meta-SQL variable expands to either a platform-specific SQL substring or datetime value, depending on the database platform, representing a datetime column in the Select clause of a SQL query
DateTimeOut元SQL变量根据数据库平台展开为特定于平台的SQL子字符串或datetimevalue,表示SQL查询的Select子句中的datetime列
Parameters
| Parameter | Description |
| datetime_col | Specify a datetime column. |
%DecDiv
Syntax
%DecDiv(a,b)
Description
The %DecDiv meta-SQL function returns a number representing the value of a divided by b, where a and b are numeric expressions.
DecDiv meta-SQL函数返回一个数字,表示a除以b的值,其中a和b是数值表达式。
If the result needs to be picked up by a bind variable, pick it up using the Character type or PIC X(50).
如果结果需要由BIND变量获取,则使用字符类型或PIC X(50)来获取结果。
Parameters
| Parameter | Description |
| a | Specify the dividend as a number. |
| b | Specify the divisor as a number. |
Example
%DecDiv(1000.0, :1)
In the example, :1 is a bind variable in SQLExec PeopleCode.
在示例中,:1是SQLExec PeopleCode中的绑定变量。
Related Links
%Mod
%DecMult
Syntax
%DecMult(a,b)
Description
The %DecMult meta-SQL function returns a number representing a multiplied by b, where a and b are numeric expressions.
%DecMult meta-SQL函数返回一个表示a乘以b的数字,其中a和b是数字表达式。
If the result needs to be picked up by a bind variable, pick it up using the Character type or PIC X(50).
如果结果需要由BIND变量获取,则使用字符类型或PIC X(50)来获取结果。
Note: %DecMult is replaced with a simple multiplication function on all platforms except for the DB2 for OS/390 and z/OS platform. On this platform, it is converted to MULTIPLY_ALT. The MULTIPLY_ALT
scalar function returns the product of the two arguments as a decimal value. It is provided as an alternative to the multiplication operator, especially when the sum of the precision of the arguments exceeds 31.
附注:在除DB2 forOS/390和z/OS平台之外的所有平台上,%DecMult都被替换为一个简单的乘法函数。在这个平台上,它被转换为MULTI_ALT。乘法_ALT标量函数将两个参数的乘积作为十进制值返回。它是作为乘法运算符的替代运算符提供的,尤其是当参数的精度之和超过31时。
Note: If you receive an overflow error using this meta-SQL, you may need to use the CAST function on the MSSQL, ORACLE, DB2UNIX and DB2 for OS/390 platforms.
注意:如果使用此元SQL收到溢出错误,则可能需要在MSSQL、ORACLE、DB2UNIX和DB2 for OS/390平台上使用CAST函数。
Parameters
| Parameter | Description |
| a | Specify a number to be multiplied. |
| b | Specify a number to use for multiplying. |
Example
%DecMult(12.3, 34.67)
%DecMult(c1 + c2, c3)
In the example, c1, c2, and c3 are fields of the Number data type.
在示例中,c1、c2和c3是Number数据类型的字段。
%Delete
Syntax
%Delete(:num)
Description
This is a shorthand for:
这是一个简写:
Delete from %Table(:num) where %KeyEqual(:num)
%DTTM
Syntax
%DTTM(date, time)
Description
The %DTTM meta-SQL function combines the database date in the date value with the database time in the time value and returns a database timestamp value.
DTTM meta-SQL函数将日期值中的数据库日期与时间值中的数据馆时间组合起来,并返回一个数据库时间戳值。
Note: For Microsoft SQL Server and DB2 databases, do not use null characters for the time argument. You can use default values such as 00.00.00.000000.
附注:对于微软SQL Server和DB2数据库,不要使用空字符作为time参数。可以使用默认值,如0.00.000.000。
Note: This meta-SQL function is not implemented for COBOL.
附注:这个元SQL函数不是为COBOL实现的。
Example
INSERT INTO TABLE1 (TIMESTAMP) SELECT %DTTM(DATE,TIME) FROM TABLE2
Related Links
%DateIn
%TimeAdd
%EffDtCheck
Syntax
%EffDtCheck(recordname [correlation_id1], correlation_id2, as_of_date)
Description
The %EffDtCheck construct expands into an effective date subquery suitable for a Where clause. The value for as_of_date is automatically wrapped in %DateIn unless as_of_date is already wrapped in %DateIn or refers to other database columns.
EffDtCheck构造扩展为适用于Where子句的有效日期子查询。as_of_date的值自动包装在%DateIn中,除非as_of_date已经包装在%DateIn中或引用其他数据库列。
Note: This meta-SQL construct is not implemented for COBOL.
注意:这个元SQL构造不是为COBOL实现的。
%EffDtCheck only works with effective dates. It does not take effective sequence numbers (EFFSEQ) into account. It also does not do effective-status (EFF_STATUS) checking.
%EffDtCheck仅适用于有效日期。它不考虑有效序列号(EF SEQ)。它也不执行有效状态(EFF_STATUS)检查。
Parameters
| Parameter | Description |
| recordname | Specify the record name to use as the record in the effectivedate checking. This can be a bind variable, a record object, or a record name in the form recname. You cannot specify a RECORD. recname, a record name in quotation marks, or a table name. Note: If you specify a bind variable, it should refer to a record object, not a string variable. |
| correlation_id1 | (Optional) Specify the letter used inside the effective-dating subselect. If this parameter isn't specified, recordname is used. |
| correlation_id2 | Specify the letter already assigned to the main record in the From clause of the SQL statement. |
| as_of_date | Specify the date to use in the effective date. This can be a bind variable, a variable, or a hard-coded date. The value for as_ of_date is automatically wrapped in %DateIn unless as_of_ date is already wrapped in %DateIn or refers to other database columns. |
Example
The following is a generic code sample:
下面是一个通用代码示例:
SELECT. . .
FROM. . .
WHERE %EffDtCheck(recordname correlation_id, as_of_date)
The example code resolves into the following:
示例代码解析为以下内容:
SELECT . . .
FROM. . .
WHERE correlation_id.EFFDT = (SELECT MAX(EFFDT) FROM recordname
WHERE recordname.KEYFIELD1 = correlation_id.KEYFIELD1
AND recordname.KEYFIELD2 = correlation_id.KEYFIELD2 AND. . .
AND recordname.EFFDT <= %DATEIN(as_of_date))
In the following example, &Date has the value of 01/02/1998. The example &Rec object has an EFFDT key field.
在下面的示例中,&Date的值为01/02/1998。示例&Rec对象有一个EF DT键字段。
SQLExec("SELECT FNUM FROM PS_REC A WHERE %EffDtCheck(:1, A, :2)", &Rec, &Date);
This example code resolves into the following:
此示例代码解析为以下内容:
"Select FNUM from PS_REC A where EFFDT = (select MAX(EFFDT)
from PS_REC
where PS_REC.FNUM = A.FNUM and PS_REC.EFFDT <= %DateIn('1998-01-02') )"
The following example uses correlation IDs:
下面的示例使用相关ID:
SELECT A.DEPTID
FROM %Table(DEPT_TBL) A
WHERE
%EffDtCheck(DEPT_TBL B, A, %CurrentDateIn)
AND A.EFF_STATUS = 'A'
This example code resolves into the following:
示例代码解析为以下内容:
SELECT A.DEPTID
FROM %Table(DEPT_TBL) A
WHERE
A.EFFDT = (SELECT MAX(B.EFFDT)
FROM DEPT_TBL B
WHERE
A.SETID = B.SETID AND A.DEPTID = B.DEPTID
AND B.EFFDT <=%CurrentDateIn)
AND A.EFF_STATUS = 'A'
%Execute
Syntax
%Execute([/])command1{; |
/}command2{; | /}...commandN{; | /}
Description
Use the %Execute function to execute database-specific commands from within your Application Engine program. Also, the %Execute function enables you to include multiple statements in a single Application Engine action without encountering database-specific differences. For instance, in some instances you could code a single Application Engine action to contain multiple SQL statements, and they might run successfully on one database platform. However, if you attempt to run the same code against a different database platform, you might encounter errors or skipped SQL.
使用%Execute函数从应用程序引擎程序中执行特定于数据库的命令。此外,%Execute函数使您可以在单个应用程序引擎操作中包含多个语句,而不会遇到特定于数据库的差异。例如,在某些情况下,您可以编写包含多个SQL语句的单个应用程序引擎操作,并且它们可能在一个数据库平台上成功运行。但是,如果尝试在不同的数据库平台上运行相同的代码,则可能会遇到错误或跳过SQL。
By default, Application Engine expects a semicolon to be used to delimit multiple commands within an %Execute function statement. You can instruct Application Engine to use a forward slash (/) delimiter instead by placing a forward slash inside the function parentheses.
默认情况下,应用程序引擎要求在%Execute函数语句中使用分号分隔多个命令。通过在函数括号内放置正斜杠,可以指示应用程序引擎使用正斜杠(/)分隔符。
Note: When you use the %Execute function, it must be located at the beginning of the statement and must be the only function or command contained in the statement. The action type must be SQL.
注意:当您使用%Execute函数时,它必须位于语句的开头,并且必须是语句中包含的唯一函数或命令。操作类型必须是SQL。
Note: No comment statement should be used in a SQL code when using %Execute.
注意:当使用%Execute时,SQL代码中不应使用注释语句。
Example
The following code enables you to use an Oracle PL/SQL block in an %Execute statement:
下面的代码使您能够在%Execute语句中使用甲骨文PL/SQL块:
%Execute(/)
DECLARE
counter INTEGER;
BEGIN
FOR counter := 1 TO 10
UPDATE pslock SET version = version + 1;
END FOR;
END;
/
%ExecuteEdits
Syntax
%ExecuteEdits(type,recordname [alias][,field1,field2, ...])
Description
Use the %ExecuteEdits function to apply data dictionary edits in batch. The %ExecuteEdits function is Application Engine-only meta-SQL. You cannot use it in COBOL, SQR, or PeopleCode, not even in Application Engine PeopleCode.
使用%ExecuteEdits函数批量应用数据字典编辑。ExecuteEdits函数是仅适用于应用程序工程的元SQL。您不能在COBOL、SQR或PeopleCode中使用它,甚至不能在应用程序引擎PeopleCode中使用它。
Notes About %ExecuteEdits
注释关于%ExecuteEdits
Note the following points about the %ExecuteEdits function:
关于%ExecuteEdits函数,请注意以下几点:
- Consider performance carefully when using this function.
- 使用此功能时要仔细考虑性能。
Prompt table and Translate table edits have a significant effect because they involve correlated subqueries. Run a SQL trace at runtime so that you can view the SQL generated by %ExecuteEdits. Look for opportunities to optimize it.
提示表和翻译表编辑具有显著的效果,因为它们涉及到相关的子查询。在运行时运行SQL跟踪,以便可以查看%ExecuteEdits生成的SQL。寻找机会对其进行优化。
- In general, %ExecuteEdits is best used on a temporary table.
- 一般来说,%ExecuteEdits最好用在临时表上。
If you must run it against a real application table, you should provide Where clause conditions to limit the number of rows to include only those that the program is currently processing. Process the rows in the current set at one time rather than row by row.
如果必须对真实的应用程序表运行它,则应提供Where子句条件来限制行数,使其仅包括程序当前正在处理的行数。一次处理当前集中的行,而不是一行一行地处理。
- With %ExecuteEdits, you cannot use work records in a batch, set-based operation.
- 使用%ExecuteEdits,您不能在基于批处理的基于集合的操作中使用工作记录。
All higher-order key fields used by prompt table edits must exist in the record that your code intends to edit, and the field names must match exactly. For example,
提示表编辑所使用的所有较高顺序的关键字字段必须存在于代码要编辑的记录中,并且字段名必须完全匹配。举个例子,
%ExecuteEdits(%Edit_PromptTable, MY_DATA_TMP)
The record MY_DATA_TMP contains the field STATE with a prompt table edit against
PS_REGION_VW, which has key fields COUNTRY and REGION. The REGION field corresponds to STATE, and COUNTRY is the higher-order key. For %ExecuteEdits to work correctly, the MY_DATA_TMP record must contain a field called COUNTRY. The edited field (STATE) can use a different name because Application Engine always references the last key field (ignoring EFFDT).
记录MY_DATA_TMP包含字段STATE和一个针对PS_REGION_VW的提示表编辑,该表具有关键字段COUNTRY和REGION。REGION字段对应于STATE,COUNTRY是高阶键。要使%ExecuteEdits正确工作,MY_DATA_TMP记录必须包含一个名为COUNTRY的字段。编辑的字段(STATE)可以使用不同的名称,因为应用程序引擎始终引用最后一个键字段(忽略EFFDT)。
- In Application Engine, %ExecuteEdits uses the system date when performing comparisons with effective date (EFFDT); however, in some cases this date is not appropriate (Journal Edit, Journal Import, and so on). In these situations, use Journal Date when comparing with EFFDT. To override the use of the default system date with a selected field from a joined table, use %AsOfDateOvr. For example,
- 在应用程序引擎中,%ExecuteEdits在执行与生效日期(EFFDT)的比较时使用系统日期;但是,在某些情况下,此日期不合适(日记编辑、日记导入等)。在这些情况下,使用日记日期与EF DT进行比较。覆盖使用默认系统日期和联接表中的选定字段,请使用%AsOfDateOvr。举个例子,
%ExecuteEdits(%AsOfDateOvr(alias.fieldname), %Bind(...)...)
- Restrict the number and type of edits to the minimum required.
- 将编辑的数量和类型限制在所需的最小值。
Do not edit fields that are known to be valid or that are given default values later in the process. Also consider using a separate record with edits defined specifically for batch or provide a list of fields to be edited.
不要编辑已知有效的字段或稍后在流程中提供默认值的字段。还可以考虑使用专门为批处理定义的编辑的单独记录,或提供要编辑的字段列表。
Parameters
| Parameter | Description |
| type | Specify any combination of the following (added together):
|
| recordname | Specify the record used to obtain the data dictionary edits. |
| field1, field2, ... | Specify a subset of the fields of the record to which edits apply. |
Example
Suppose you want to insert rows with missing or invalid values in three specific fields, selecting data from a temporary table but using edits defined on the original application table. Notice the use of an alias, or correlation name, inside the meta-SQL:
假定您想要在三个特定字段中插入包含缺失值或无效值的行,从临时表中选择数据,但使用在原始应用程序表上定义的编辑。注意meta-SQL中使用了别名或相关名称:
INSERT INTO PS_JRNL_LINE_ERROR (...)
SELECT ... FROM PS_JRNL_LINE_TMP A
WHERE A.PROCESS_INSTANCE = %BIND(PROCESS_INSTANCE) AND %EXECUTEEDITS(%Edit_Required + %Edit_PromptTable,?
JRNL_LINE A, BUSINESS_UNIT, JOURNAL_ID, ACCOUNTING_DT)
To update rows that have some kind of edit error in a temporary table, you can use custom edits defined in the temporary table record:
要更新临时表中存在某种编辑错误的行,可以使用临时表记录中定义的自定义编辑:
UPDATE PS_PENDITEM_TAO
SELECT ERROR_FLAG = 'Y'
WHERE PROCESS_INSTANCE = %BIND(PROCESS_INSTANCE) AND %EXECUTEEDITS(%Edit_Required + %Edit_YesNo + %Edit_DateRange +?
%Edit_PromptTable + %Edit_TranslateTable, PENDITEM_TAO)
相关文章:
using meta-SQL 使用元SQL
%DatePart Syntax %DatePart(DTTM_Column) Description The %DatePart meta-SQL variable returns the date portion of the specified DateTime column. DatePart meta-SQL变量返回指定的DateTime列的日期部分。 Note: This meta-SQL variable is not implemented for COBOL. …...
函数式接口
作者简介:大家好,我是smart哥,前中兴通讯、美团架构师,现某互联网公司CTO 联系qq:184480602,加我进群,大家一起学习,一起进步,一起对抗互联网寒冬 咱们今天讨论下函数式接…...
使用shell快速查看电脑曾经连接过的WiFi密码
此方法只能查看以前连接过的wifi名称和对应的密码 查看连接过的WiFi名称netsh wlan show profiles查看具体的WiFi名称netsh wlan show profile name"你的wifi名称" keyclear...
通过亚马逊云科技云存储服务探索云原生应用的威力
文章作者:Libai 欢迎来到我们关于“使用亚马逊云科技云存储服务构建云原生应用”的文章的第一部分。在本文中,我们将深入探讨云原生应用的世界,并探索亚马逊云科技云存储服务在构建和扩展这些应用中的关键作用。 亚马逊云科技开发者社区为开发…...
Boot工程快速启动【Linux】
Boot工程快速启动【Linux】 在idea中打包cd usr/在local文件夹下mkdir app进入app文件夹把打包好的文件(只上传其中的jar)上传到app文件下检查linux中的Java版本,保证和项目的Java 版本保持一致运行 java -jar sp补全***.jar想看效果得查询当…...
三 STM32F4使用Sys_Tick 实现微秒定时器和延时
更多细节参考这篇 1. 什么是时钟以及作用 1.1 什么是时钟 时钟是由电路产生的周期性的脉冲信号,相当于单片机的心脏 1.2 时钟对于STM32的作用 指令同步:cpu和内核外设使用时钟信号来进行指令同步数据传输控制: 时钟信号控制数据在内部总…...
唯创知音WT2003H系列MP3录音语音芯片:高精度ADC与DAC,强大IO驱动能力成就音频卓越
在音频领域里,高精度和强大的驱动能力一直是工程师们追求的目标。唯创知音的WT2003H系列MP3录音芯片恰好满足了这一需求,该芯片具备16 bit高精度的ADC及DAC功能,大功率的IO驱动能力,能够直接驱动64mA,为电子产品带来卓…...
记录Windows下安装redis的过程
开源博客项目Blog支持使用EasyCaching组件操作redis等缓存数据库,在继续学习开源博客项目Blog之前,准备先学习redis和EasyCaching组件的基本用法,本文记录在Windows下安装redis的过程。 虽然redis官网文档写着支持Linux、macOS、Windows等…...
7.5 Windows驱动开发:监控Register注册表回调
在笔者前一篇文章《内核枚举Registry注册表回调》中实现了对注册表的枚举,本章将实现对注册表的监控,不同于32位系统在64位系统中,微软为我们提供了两个针对注册表的专用内核监控函数,通过这两个函数可以在不劫持内核API的前提下实…...
NC56 XML 报文校验出错一例
好好的上线了、下午开完会告诉我有个凭证没法传入 NC 了。 请求报文如下: <?xml version"1.0" encodingUTF-8?> <ufinterface roottag"voucher" billtype"gl" replace"Y" receiver"10108" sender&q…...
STM32 ADC转换器、串口输出
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、ADC是什么?二、STM32的ADC2.1 认识STM32 ADC2.2转换方式2.3 为什么要校准?2.4 采样时间计算2.5 触发方式2.6 多通道采集解决方案2.7…...
[MySQL--基础]函数、约束
hello! 这里是欧_aita的频道。 今日语录:不管你觉得自己能做什么,或者你觉得你不能做什么,你都是对的。 祝福语:愿你的程序像太阳一样明亮,给世界带来温暖和光明。 大家可以在评论区畅所欲言,可以指出我的错误…...
企业数字化决策者深度分享
2023年11月18日,数聚股份应邀参加在台州椒江举办的数字中国企业峰会。本次会议中,诸多在企业数字化进程中做出重要贡献的高层管理者分享了各行各业极具引领性、创新性的数字化实践案例、产品和解决方案;数聚股份董事长陈庆华携其前瞻的数字化…...
JMeter压测常见面试问题
1、JMeter可以模拟哪些类型的负载? JMeter可以模拟各种类型的负载,包括但不限于Web应用程序、API、数据库、FTP、SMTP、JMS、SOAP / RESTful Web服务等。这使得JMeter成为一个功能强大且灵活的压力测试工具。 2、如何配置JMeter来进行分布式压力测试&a…...
使用opencv将sRGB格式的图片转换为DCI-P3格式【sRGB】【DCI-P3】
要将图像从 sRGB 格式转换为 DCI-P3 格式,您需要使用适当的线性转换矩阵。在 OpenCV 中,这通常涉及使用色彩转换函数,但 OpenCV 默认情况下不直接支持 sRGB 到 DCI-P3 的转换。因此,您需要手动计算并应用转换矩阵。 转换矩阵取决…...
【协议设计与实现】Linux环境下,如何从0开始设计并实现一个网络协议之一——需要考虑的因素
🐚作者简介:花神庙码农(专注于Linux、WLAN、TCP/IP、Python等技术方向)🐳博客主页:花神庙码农 ,地址:https://blog.csdn.net/qxhgd🌐系列专栏:TCP/IP协议&…...
【前端】JS实现SQL格式化
sqlFormatter sql-formatter - npm (npmjs.com) const sqlFormatter require(/utils/sqlFormatter)let sql select count(1) as cnt from t_user where id < 7;// 格式化 // let sqlF sqlFormatter.format(sql);let sqlF sqlFormatter.format(sql, {language:mysql,})…...
java设计模式学习之【工厂模式】
文章目录 引言工厂方法模式简介定义与用途:实现方式: 使用场景优势与劣势工厂模式在spring中的应用电费计算示例(简单工厂模式)改善为方法工厂模式代码地址 引言 在软件开发的世界中,对象的创建可能是一个复杂且重复的…...
android 内存分析(待续)
/proc/meminfo memory状态解读 命令:adb shell cat /proc/meminfo内存分布log 查看方式 命令:adb shell cat /proc/meminfo 用途:可以整体的了解memory使用情况 我们说的可用memory一般以MemAvailable的数据为准。所以了解MemAvailable的组成可以帮助…...
2023-简单点-机器学习中的数值计算问题
上溢和下溢: 上溢:指数函数或对数函数的输入值过大,导致计算结果超出了计算机可以表示的最大值。例如,在softmax函数中,当输入的数值很大时,指数运算的结果可能非常大,导致上溢。 下溢&#x…...
手游刚开服就被攻击怎么办?如何防御DDoS?
开服初期是手游最脆弱的阶段,极易成为DDoS攻击的目标。一旦遭遇攻击,可能导致服务器瘫痪、玩家流失,甚至造成巨大经济损失。本文为开发者提供一套简洁有效的应急与防御方案,帮助快速应对并构建长期防护体系。 一、遭遇攻击的紧急应…...
FFmpeg 低延迟同屏方案
引言 在实时互动需求激增的当下,无论是在线教育中的师生同屏演示、远程办公的屏幕共享协作,还是游戏直播的画面实时传输,低延迟同屏已成为保障用户体验的核心指标。FFmpeg 作为一款功能强大的多媒体框架,凭借其灵活的编解码、数据…...
理解 MCP 工作流:使用 Ollama 和 LangChain 构建本地 MCP 客户端
🌟 什么是 MCP? 模型控制协议 (MCP) 是一种创新的协议,旨在无缝连接 AI 模型与应用程序。 MCP 是一个开源协议,它标准化了我们的 LLM 应用程序连接所需工具和数据源并与之协作的方式。 可以把它想象成你的 AI 模型 和想要使用它…...
django filter 统计数量 按属性去重
在Django中,如果你想要根据某个属性对查询集进行去重并统计数量,你可以使用values()方法配合annotate()方法来实现。这里有两种常见的方法来完成这个需求: 方法1:使用annotate()和Count 假设你有一个模型Item,并且你想…...
uniapp中使用aixos 报错
问题: 在uniapp中使用aixos,运行后报如下错误: AxiosError: There is no suitable adapter to dispatch the request since : - adapter xhr is not supported by the environment - adapter http is not available in the build 解决方案&…...
Springboot社区养老保险系统小程序
一、前言 随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱,社区养老保险系统小程序被用户普遍使用,为方…...
MySQL 部分重点知识篇
一、数据库对象 1. 主键 定义 :主键是用于唯一标识表中每一行记录的字段或字段组合。它具有唯一性和非空性特点。 作用 :确保数据的完整性,便于数据的查询和管理。 示例 :在学生信息表中,学号可以作为主键ÿ…...
Unity UGUI Button事件流程
场景结构 测试代码 public class TestBtn : MonoBehaviour {void Start(){var btn GetComponent<Button>();btn.onClick.AddListener(OnClick);}private void OnClick(){Debug.Log("666");}}当添加事件时 // 实例化一个ButtonClickedEvent的事件 [Formerl…...
安卓基础(Java 和 Gradle 版本)
1. 设置项目的 JDK 版本 方法1:通过 Project Structure File → Project Structure... (或按 CtrlAltShiftS) 左侧选择 SDK Location 在 Gradle Settings 部分,设置 Gradle JDK 方法2:通过 Settings File → Settings... (或 CtrlAltS)…...
消息队列系统设计与实践全解析
文章目录 🚀 消息队列系统设计与实践全解析🔍 一、消息队列选型1.1 业务场景匹配矩阵1.2 吞吐量/延迟/可靠性权衡💡 权衡决策框架 1.3 运维复杂度评估🔧 运维成本降低策略 🏗️ 二、典型架构设计2.1 分布式事务最终一致…...
