WO2020258674A1 - 脚本文件校验方法、装置、服务器及存储介质 - Google Patents

脚本文件校验方法、装置、服务器及存储介质 Download PDF

Info

Publication number
WO2020258674A1
WO2020258674A1 PCT/CN2019/118600 CN2019118600W WO2020258674A1 WO 2020258674 A1 WO2020258674 A1 WO 2020258674A1 CN 2019118600 W CN2019118600 W CN 2019118600W WO 2020258674 A1 WO2020258674 A1 WO 2020258674A1
Authority
WO
WIPO (PCT)
Prior art keywords
script file
verification
script
database
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/118600
Other languages
English (en)
French (fr)
Inventor
王保军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020258674A1 publication Critical patent/WO2020258674A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3604Analysis of software for verifying properties of programs
    • G06F11/3608Analysis of software for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis

Definitions

  • the database is used to verify the first script file.
  • the using the database to verify the first script file includes:
  • the method further includes:
  • the verification result is output through the verification display interface.
  • the method further includes:
  • a third aspect of the present application provides a server, the server includes a processor and a memory, and the processor is configured to implement the script file verification method when executing computer-readable instructions stored in the memory.
  • Fig. 1 is a flowchart of a preferred embodiment of a script file verification method disclosed in the present application.
  • Fig. 2 is a functional module diagram of a preferred embodiment of a script file verification device disclosed in the present application.
  • Fig. 3 is a schematic diagram of the structure of a server implementing a preferred embodiment of the script file verification method according to the present application.
  • the server may refer to a computer system that can provide services to other devices (such as electronic devices) in the network.
  • the electronic device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions. Its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (ASIC), and a field programmable gate. Array (FPGA), digital processor (DSP), embedded device, etc.
  • the server may also include network equipment and/or user equipment.
  • the network device includes but not limited to a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on Cloud Computing
  • the user equipment includes but is not limited to any An electronic product that can interact with the user through a keyboard, mouse, remote control, touch panel, or voice control device, for example, personal computer, tablet computer, smart phone, personal digital assistant PDA, etc.
  • FIG. 1 is a flowchart of a preferred embodiment of a script file verification method disclosed in the present application. Among them, according to different needs, the order of the steps in the flowchart can be changed, and some steps can be omitted.
  • the server obtains the storage address of the first script file that needs to be verified.
  • In the address configuration interface output a plurality of script files; receive a selection instruction for a plurality of the script files; according to the selection instruction, determine the selected script file as the first script file, and obtain the first script file The storage address.
  • the server establishes a connection with the database according to the database connection information.
  • connections can be established with multiple types of databases, that is, sessions can be established with multiple databases at the same time.
  • sessions can be established with multiple databases at the same time.
  • multiple databases can also be verified at the same time to improve the verification efficiency of the script file.
  • the server uses the database to verify the first script file.
  • the verification of script files of different databases can be supported, such as relational databases such as DB2, sybase, Mysql, pg, oracle.
  • relational databases such as DB2, sybase, Mysql, pg, oracle.
  • you only need to configure the information such as the storage address of the configuration script file, and the configuration database connection information).
  • the information such as the storage address of the configuration script file, and the configuration database connection information.
  • the first script file may be verified in the database by means of recursive thinking and file extraction, and during the verification process, the verification result of each first script file is recorded .
  • the use of the database to verify the first script file includes:
  • JDBC Java Database Connectivity
  • Java Database Connectivity is an application program interface used in the Java language to regulate how client programs access the database. It provides methods such as querying and updating data in the database, and can connect to JDBC applications through the JAVA database.
  • the API Application Programming Interface
  • the first script files can be sent to the database corresponding to the first script files for targeted verification, without the need to manually transfer the script files one by one. Put it into the corresponding database for verification, which can reduce the entire verification time and improve the verification efficiency.
  • the method further includes:
  • the verification result is output through the verification display interface.
  • the verification result may include, but is not limited to: the number of verified DDL files, the number of DML files, the number of successful DDL files verification, the number of failed DDL files verification, the number of successful DML files verification, and the DML files
  • the number of verification failures If the file verification fails, a detailed display can be provided. Users can click on the detailed display to see the name of the script file executed, the execution time, the reason for the failure, and the corresponding suggested modification plan.
  • the success and failure of the verification of the first script file can be indicated by the returned status code and status description information, where the status description information is used to describe the meaning represented by the status code.
  • the status code can be divided into a first status code and a second status code.
  • the first status code can be used to indicate a successful verification
  • the second status code can be used to indicate a verification failure.
  • the first status code is "1”
  • the first status code is "1”.
  • the second status code is "0".
  • the method further includes:
  • the verification result is sent to the mailbox corresponding to the first developer account.
  • the link of the verification result may also be sent to the mailbox corresponding to the developer account.
  • the developer can directly view the verification result of the first script file through the link provided in the email. If the verification result indicates that there are some scripts If the file verification fails, the developer can repair the script files that failed the verification one by one according to the list of error messages, and submit the error reason and repair plan. After that, for the repaired script files, they can submit individual files for verification. , You can also submit all the documents together for verification.
  • the file naming of the first script file is non-standard.
  • the SVNKIT third-party API can be used to obtain and submit the The personnel record of the first script file.
  • a second developer account can be obtained, and the second developer account is the account of the submitter who submitted the first script file.
  • the method further includes:
  • the file naming of the first script file is non-standard, and the first script file is not submitted via SVN, that is, the file name does not carry the developer account, And the storage address of the first script file is not SVN.
  • the login account of the login person currently logged in to the server can be obtained through the API provided by java, and the verification result is sent to the login account The corresponding mailbox.
  • the method further includes:
  • the second script file is repaired according to the first script repair solution.
  • the script file is repaired.
  • the server when the server repairs the second script file, it may select from the multiple first scripts. Determine the target script repair plan with the highest evaluation value among the repair plans, and repair the second script file according to the target script repair plan. Wherein, for each of the first script repair solutions, the developer may evaluate the first script repair solution according to the effect of subsequent repairs, and submit an evaluation value.
  • the server may also output multiple first script repair solutions, and the developer selects one of the first script repair solutions, and the server then repairs the second script file according to the selected first script repair solution.
  • the multiple first script repair solutions and the first script repair solution adopted by the server can be presented together to achieve a visual effect, allowing developers to see at a glance.
  • the first script file that needs to be verified can be obtained directly through the server without manual copy and paste.
  • FIG. 2 is a functional module diagram of a preferred embodiment of a script file verification device disclosed in the present application.
  • the script file verification device runs on a server.
  • the script file verification device may include multiple functional modules composed of program code segments.
  • the program code of each program segment in the script file verification device can be stored in a memory and executed by at least one processor to perform part or all of the steps in the script file verification method described in FIG. 1.
  • the script file verification device can be divided into multiple functional modules according to the functions it performs.
  • the functional modules may include: a first acquisition module 201, a configuration module 202, a second acquisition module 203, an establishment module 204, and a verification module 205.
  • the module referred to in this application refers to a series of computer-readable instruction segments that can be executed by at least one processor and can complete fixed functions, and are stored in a memory.
  • the script file verification device includes:
  • the first obtaining module 201 is configured to obtain the storage address of the first script file that needs to be verified.
  • a verification tool is installed on the server. With the verification tool, all script files that need to be verified can be scanned in full, and then verified through the database.
  • the first script file can be a database schema definition language (Data Definition Language, DDL) and a data manipulation language (Data Management Language, DML), where the storage address of the script file can be the developer’s own local disk or It can be the SVN (Subversion, source code version control system) of the project, where SVN can be understood as a code library used by developers of the same project to store code.
  • DDL Data Definition Language
  • DML Data Management Language
  • the first obtaining module 201 obtaining the storage address of the first script file that needs to be verified includes:
  • In the address configuration interface output a plurality of script files; receive a selection instruction for a plurality of the script files; according to the selection instruction, determine the selected script file as the first script file, and obtain the first script file The storage address.
  • the verification tool when the first script file needs to be verified, the verification tool can be started. After the verification tool is started, the address configuration interface can be output. In the address configuration interface, the user You can manually enter the storage address of the first script file, or you can output multiple script files in the address configuration interface. Among them, the verification tool can communicate with the device that stores multiple script files. After the first script file is selected and determined from the files, the storage address corresponding to the first script file can be determined.
  • the configuration module 202 is configured to configure database connection information matching the first script file.
  • the database connection information may include, but is not limited to, the database connection string address, driver type, user name, and password information.
  • the connection string address may include, but is not limited to, database server domain name, database port, and database instance.
  • Different databases have different corresponding driver types.
  • the user name and password information are the user name and password information of the user who logs in to the database. Used for authentication when logging into the database.
  • the second obtaining module 203 is configured to obtain the first script file from the storage address.
  • the content of the first script file can be obtained from the location corresponding to the storage address directly according to the storage address, without the developer manually copying the script. document content.
  • the establishment module 204 is configured to establish a connection with the database according to the database connection information.
  • connection string address of the database can be obtained from the database connection information, and the database to be connected can be determined according to the connection string address. Further, a connection session with the database can be created, that is, with the database establish connection.
  • connections can be established with multiple types of databases, that is, sessions can be established with multiple databases at the same time.
  • sessions can be established with multiple databases at the same time.
  • multiple databases can also be verified at the same time to improve the verification efficiency of the script file.
  • the verification module 205 is configured to use the database to verify the first script file when a verification instruction for the first script file is received.
  • the verification of script files of different databases can be supported, such as relational databases such as DB2, sybase, Mysql, pg, oracle.
  • relational databases such as DB2, sybase, Mysql, pg, oracle.
  • you only need to configure the information such as the storage address of the configuration script file, and the configuration database connection information).
  • the information such as the storage address of the configuration script file, and the configuration database connection information.
  • the verification module 205 uses the database to verify the first script file includes:
  • the script verification device further includes:
  • the return module is used to receive the verification result returned by the database through the API after the verification is completed;
  • the output module is used to output the verification result through the verification display interface.
  • the verification result may include, but is not limited to: the number of verified DDL files, the number of DML files, the number of successful DDL files verification, the number of failed DDL files verification, the number of successful DML files verification, and the DML files
  • the number of verification failures If the file verification fails, a detailed display can be provided. Users can click on the detailed display to see the name of the script file executed, the execution time, the reason for the failure, and the corresponding suggested modification plan.
  • the second obtaining module 203 is further configured to obtain the file name of the first script file
  • the script file verification device further includes:
  • the judging module is used to judge whether the file name carries the first developer account number
  • the sending module is configured to send the verification result to the mailbox corresponding to the first developer account if the file name carries the first developer account.
  • the file naming of the first script file may be standardized, and the developer account may be carried in the file name, such as SRXXXX_01_database name_dml_zhangsan.sql, where zhangsan is the developer account.
  • the judgment module is further configured to judge whether the storage address of the first script file is the source code version control system SVN if the file name does not carry a developer account;
  • the second obtaining module 203 is further configured to obtain a record of the person who submitted the first script file from the SVN if the storage address of the first script file is SVN;
  • the second obtaining module 203 is further configured to obtain a second developer account through the personnel record;
  • the script file verification device further includes:
  • a receiving module configured to receive the first script repair solution uploaded for the reason of the verification failure of the first script file
  • a storage module for storing the first script repair scheme
  • the repairing module is used for verifying the second script file, if the reason for the verification failure of the second script file is the same as the reason for the verification failure of the first script file, according to the first script restoration scheme Repair the second script file.
  • the developer can upload the first script repair solution for the reason for the verification failure of the first script file, and the server can store the In the first script repair solution, when the second script file is subsequently verified, if the second script file is in the verification process, the verification fails, and the verification of the second script file fails
  • the reason is the same as that of the verification failure of the first script file, and the server can directly repair the second script file directly according to the first script repair scheme without the developer needing to repair it again, which can save script verification. Time to verify, improve script verification efficiency.
  • the server when the server repairs the second script file, it may select from the multiple first scripts. Determine the target script repair plan with the highest evaluation value among the repair plans, and repair the second script file according to the target script repair plan. Wherein, for each of the first script repair solutions, the developer may evaluate the first script repair solution according to the effect of subsequent repairs, and submit an evaluation value.
  • the server may also output multiple first script repair solutions, and the developer selects one of the first script repair solutions, and the server then repairs the second script file according to the selected first script repair solution.
  • the multiple first script repair solutions and the first script repair solution adopted by the server can be presented together to achieve a visual effect, allowing developers to see at a glance.
  • the first script file that needs to be verified can be directly obtained through the server without manual copy and paste.
  • it is only necessary to configure the database connection information in the same server namely It can be suggested that the dialogue between a server and multiple databases can be verified by multiple different databases at the same time during script file verification, which can improve the efficiency of script verification.
  • FIG. 3 is a schematic diagram of the structure of a server implementing a preferred embodiment of the script file verification method of the present application.
  • the server 3 includes a memory 31, at least one processor 32, computer readable instructions 33 stored in the memory 31 and executable on the at least one processor 32, and at least one communication bus 34.
  • FIG. 3 is only an example of the server 3, and does not constitute a limitation on the server 3. It may include more or fewer components than shown in the figure, or combine certain components, or be different.
  • the server 3 may also include input and output devices, network access devices, etc.
  • the at least one processor 32 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), application specific integrated circuits (ASICs). ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the processor 32 can be a microprocessor or the processor 32 can also be any conventional processor, etc.
  • the processor 32 is the control center of the server 3, and connects each of the entire server 3 through various interfaces and lines. section.
  • the memory 31 may include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a Secure Digital (SD) card, a flash memory card (Flash Card), At least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a Secure Digital (SD) card, a flash memory card (Flash Card), At least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • the memory 31 in the server 3 stores multiple instructions to implement a script file verification method, and the processor 32 can execute the multiple instructions to achieve:
  • the first script file that needs to be verified can be directly obtained through the server without manual copy and paste.
  • the integrated modules/units of the server 3 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile readable storage medium.
  • this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware by computer-readable instructions.
  • the computer-readable instructions can be stored in a non-volatile memory.
  • the computer-readable instruction code may be in the form of source code, object code, executable file, or some intermediate forms, etc.
  • the non-volatile readable medium may include: any entity or device capable of carrying the computer readable instruction code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory).
  • modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

一种脚本文件校验方法、装置、服务器及存储介质,所述方法包括:服务器获取需要进行校验的第一脚本文件的存储地址(S11);服务器配置与所述第一脚本文件匹配的数据库连接信息(S12);服务器从所述存储地址中获取所述第一脚本文件(S13);服务器根据所述数据库连接信息,与数据库建立连接(S14);在接收到针对所述第一脚本文件的校验指令时,服务器使用所述数据库,对所述第一脚本文件进行校验(S15)。该方法能提高脚本文件校验的效率。

Description

脚本文件校验方法、装置、服务器及存储介质
本申请要求于2019年06月28日提交中国专利局,申请号为201910580049.1发明名称为“脚本文件校验方法、装置、服务器及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请。
技术领域
本申请涉及终端技术领域,尤其涉及一种脚本文件校验方法、装置、服务器及存储介质。
背景技术
开发人员在项目开发过程中,通常会在开发环境下的各个数据库中创建相应的表,并且在对表进行定义或者修改表结构后,整理对应的建表语句,再生成数据库的脚本文件。通常,这些脚本文件是人工编写的,难免会存在很多问题,日常中开发人员手动编写好脚本后,通常是一张一张表的复制粘贴进数据库中进行校验。
然而实践中发现,由于不同的脚本文件对应不同的数据库,不同的数据库要求的客户端也不同。在对这些脚本文件进行校验时,需要将不同的脚本文件放入不同的数据库中进行校验,另外,如果客户端不同,则需要在不同的客户端上,安装不同的数据库。如果需要校验大量的脚本文件,则需要在校验的过程中,不断的根据不同的脚本文件,不同的客户端进行相应的更改,来回切换配置,这使得脚本文件校验的效率较低。
发明内容
鉴于以上内容,有必要提供一种脚本文件校验方法、装置、服务器及存储介质,能够提高脚本文件校验的效率。
本申请的第一方面提供一种脚本文件校验方法,所述方法包括:
获取需要进行校验的第一脚本文件的存储地址;
配置与所述第一脚本文件匹配的数据库连接信息;
从所述存储地址中获取所述第一脚本文件;
根据所述数据库连接信息,与数据库建立连接;
在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
在一种可能的实现方式中,所述获取需要进行校验的第一脚本文件的存储地址包括:
在地址配置界面,接收输入的第一脚本文件的存储地址;或
在地址配置界面,输出多个脚本文件;接收针对多个所述脚本文件的选择指令;根据所述选择指令,将被选择的脚本文件确定为第一脚本文件,并获取所述第一脚本文件的存储地址。
在一种可能的实现方式中,所述使用所述数据库,对所述第一脚本文件进行校验包括:
使用JAVA编程语言,读取所述第一脚本文件的内容;
使用JAVA数据库连接JDBC的应用程序编程接口API,将所述第一脚本文件的内容作为参数发送至所述数据库进行校验。
在一种可能的实现方式中,所述方法还包括:
在校验结束后,通过所述API接收所述数据库返回的校验结果;
通过校验展示界面,输出所述校验结果。
在一种可能的实现方式中,所述方法还包括:
获取所述第一脚本文件的文件名称;
判断所述文件名称中是否携带有第一开发人员账号;
若所述文件名称中携带有第一开发人员账号,将所述校验结果发送至所述第一开发人员账号对应的邮箱中。
在一种可能的实现方式中,所述方法还包括:
若所述文件名称中未携带有开发人员账号,判断所述第一脚本文件的存储地址是否为源代码的版本控制系统SVN;
若所述第一脚本文件的存储地址为SVN,从所述SVN中获取提交所述第一脚本文件的人员记录;
通过所述人员记录,获取第二开发人员账号;
将所述校验结果发送至所述第二开发人员账号对应的邮箱中。
在一种可能的实现方式中,所述方法还包括:
接收针对所述第一脚本文件的校验失败原因上传的第一脚本修复方案;
存储所述第一脚本修复方案;
在对第二脚本文件进行校验时,若所述第二脚本文件的校验失败原因与所述第一脚本文 件的校验失败原因相同,根据所述第一脚本修复方案对所述第二脚本文件进行修复。
本申请的第二方面提供一种脚本文件校验装置,所述装置包括:
第一获取模块,用于获取需要进行校验的第一脚本文件的存储地址;
配置模块,用于配置与所述第一脚本文件匹配的数据库连接信息;
第二获取模块,用于从所述存储地址中获取所述第一脚本文件;
建立模块,用于根据所述数据库连接信息,与数据库建立连接;
校验模块,用于在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
本申请的第三方面提供一种服务器,所述服务器包括处理器和存储器,所述处理器用于执行所述存储器中存储的计算机可读指令时实现所述的脚本文件校验方法。
本申请的第四方面提供一种非易失性可读存储介质,所述非易失性可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现所述的脚本文件校验方法。
由以上技术方案,本申请中,可以先获取需要进行校验的第一脚本文件的存储地址,配置与所述第一脚本文件匹配的数据库连接信息,进一步地,从所述存储地址中获取所述第一脚本文件,根据所述数据库连接信息,与数据库建立连接,更进一步地,在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。可见,本申请中,可以直接通过服务器来获取需要进行校验的第一脚本文件,而不需要人工复制粘贴,此外,只需要在同一个服务器中,配置数据库连接信息,即可建议一个服务器与多个数据库之间的对话,在进行脚本文件校验时,即可多个不同的数据库同时进行校验,从而可以提高脚本校验的效率。
附图说明
图1是本申请公开的一种脚本文件校验方法的较佳实施例的流程图。
图2是本申请公开的一种脚本文件校验装置的较佳实施例的功能模块图。
图3是本申请实现脚本文件校验方法的较佳实施例的服务器的结构示意图。
具体实施方式
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施例对本申请进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整 地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。
其中,服务器可以是指能对网络中其它设备(如电子设备)提供服务的计算机系统。
所述电子设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(ASIC)、现场可编程门阵列(FPGA)、数字处理器(DSP)、嵌入式设备等。所述服务器还可包括网络设备和/或用户设备。其中,所述网络设备包括但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络服务器构成的云,所述用户设备包括但不限于任何一种可与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理PDA等。
请参见图1,图1是本申请公开的一种脚本文件校验方法的较佳实施例的流程图。其中,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。
S11、服务器获取需要进行校验的第一脚本文件的存储地址。
本申请实施例中,服务器上安装有校验工具,通过该校验工具,可以对所有需要进行校验的脚本文件进行全量扫描,然后通过数据库进行校验。
其中,所述第一脚本文件可以是数据库模式定义语言(Data Definition Language,DDL)和数据操纵语言(Data Manipulation Language,DML),其中,脚本文件的存储地址可以是开发人员自己的本地磁盘,也可以是项目的SVN(Subversion,源代码的版本控制系统),其中,SVN可以理解为同一个项目的开发人员用于存储代码的代码库。
具体的,所述获取需要进行校验的第一脚本文件的存储地址包括:
在地址配置界面,接收输入的第一脚本文件的存储地址;或
在地址配置界面,输出多个脚本文件;接收针对多个所述脚本文件的选择指令;根 据所述选择指令,将被选择的脚本文件确定为第一脚本文件,并获取所述第一脚本文件的存储地址。
在该可选的实施方式中,当需要进行第一脚本文件的校验时,可以启动校验工具,在所述校验工具启动后,即可输出地址配置界面,在该地址配置界面,用户可以手动输入第一脚本文件的存储地址,或者,也可以在地址配置界面,输出多个脚本文件,其中,校验工具可以与存储多个脚本文件的设备进行通信连接,当用户从多个脚本文件中选择并确定第一脚本文件后,即可确定第一脚本文件对应的存储地址。
S12、服务器配置与所述第一脚本文件匹配的数据库连接信息。
其中,数据库连接信息可以包括但不限于数据库的连接串地址、驱动类、用户名以及密码信息。其中,所述连接串地址可以包括但不限于数据库服务器域名、数据库端口以及数据库实例,不同的数据库,对应的驱动类不同,其中,用户名以及密码信息即登录数据库的用户的用户名和密码信息,用于在登录数据库时进行身份验证。
其中,如果所述第一脚本文件对应的数据库类型有多种,则可以配置多种不同类型的数据库的数据库连接信息,以与待校验的所述第一脚本文件相匹配。
S13、服务器从所述存储地址中获取所述第一脚本文件。
其中,在获取到所述第一脚本文件的存储地址之后,可以直接根据所述存储地址,从所述存储地址对应的位置获取所述第一脚本文件的内容,而无需开发人员手动去复制脚本文件内容。
S14、服务器根据所述数据库连接信息,与数据库建立连接。
具体的,可以从所述数据库连接信息中获取数据库的连接串地址,根据所述连接串地址,确定需要连接的数据库,进一步的,即可创建和所述数据库的连接会话,即与所述数据库建立连接。
如果所述第一脚本文件对应的数据库类型有多种,则可以与多种类型的数据库建立连接,也即可以同时与多个数据库建立会话。后续在校验时,也可以多个数据库同时进行校验,以提高脚本文件的校验效率。
S15、在接收到针对所述第一脚本文件的校验指令时,服务器使用所述数据库,对所述第一脚本文件进行校验。
在实际工作中,开发人员在校验脚本文件时基本上都是人工登录连接数据库的客户端,然后在客户端提供的窗口中去执行脚本文件,通常,不同的数据库需要使用不同的客户端,比如oracle数据库,使用PL/SQL客户端,mysql数据库,使用MYSQL Workbench 客户端。
而在本申请中,可以支持不同数据库的脚本文件的校验,比如:DB2,sybase,Mysql,pg,oracle等关系型数据库。针对不同的数据库,只需要进行信息的配置(如配置脚本文件的存储地址、配置数据库连接信息)即可,无需关注不同数据库使用不同的客户端,这给脚本文件的校验带来了极大便利。
本申请实施例中,可以借助递归思想和文件提取,将所述第一脚本文件在所述数据库中进行校验,在校验的过程中,记录每个所述第一脚本文件的校验结果。
在进行第一脚本文件校验时,如果第一脚本文件对应的数据库有多个,可以多个不同的数据库同时进行第一脚本文件的校验,从而可以提高第一脚本文件校验的效率。
具体的,所述使用所述数据库,对所述第一脚本文件进行校验包括:
使用JAVA编程语言,读取所述第一脚本文件的内容;
使用JAVA数据库连接JDBC的应用程序编程接口API,将所述第一脚本文件的内容作为参数发送至所述数据库进行校验。
其中,JAVA数据库连接JDBC(Java Database Connectivity)是Java语言中用来规范客户端程序如何来访问数据库的应用程序接口,提供了诸如查询和更新数据库中数据的方法,可以通过JAVA数据库连接JDBC的应用程序编程接口API(Application Programming Interface)连接应用程序和数据库,实现对数据库的访问。
其中,不同的数据库有不同的脚本校验机制。可以针对不同的所述第一脚本文件,将所述第一脚本文件发送至与所述第一脚本文件对应的数据库中,以进行针对性的校验,而无需人工一个一个地去将脚本文件放入相应的数据库进行校验,从而能够减少整个校验的时间,提高校验效率。
作为一种可选的实施方式,所述方法还包括:
在校验结束后,通过所述API接收所述数据库返回的校验结果;
通过校验展示界面,输出所述校验结果。
其中,所述校验结果可以包括但不限于:校验的DDL文件数量、DML文件数量,DDL文件校验成功的数量、DDL文件校验失败的数量、DML文件校验成功的数量以及DML文件校验失败的数量,文件校验失败的还可以提供详细展示,用户点击详情展示,可以看到执行的脚本文件名称,执行的时间,失败的原因以及对应的建议修改方案。
其中,所述第一脚本文件的校验成功与失败可以通过返回的状态码以及状态描述信息来指示,其中,状态描述信息是用来描述状态码所代表的含义的。状态码可以分为第 一状态码和第二状态码,第一状态码可以用于表示校验成功,第二状态码可以用于表示校验失败,比如第一状态码为“1”,第二状态码为“0”。
作为一种可选的实施方式,所述方法还包括:
获取所述第一脚本文件的文件名称;
判断所述文件名称中是否携带有第一开发人员账号;
若所述文件名称中携带有第一开发人员账号,将所述校验结果发送至所述第一开发人员账号对应的邮箱中。
其中,可选的,还可以将所述校验结果的链接发送至所述开发人员账号对应的邮箱中。
其中,所述第一脚本文件的文件命名可以是规范的,在文件名称中可以携带有开发人员账号,比如SRXXXX_01_数据库名称_dml_zhangsan.sql,其中,zhangsan即开发人员账号。
可选的,开发人员在接收到携带有所述校验结果的邮件后,可以通过邮件中提供的链接直接查看所述第一脚本文件的校验结果,如果所述校验结果表明有部分脚本文件的校验失败,则开发人员可以根据错误信息的列表,逐一对校验失败的脚本文件进行修复,并提交错误原因和修复方案,之后,针对修复的脚本文件,可以单个文件的提交校验,也可以将所有的文件一起提交校验。
作为一种可选的实施方式,所述方法还包括:
若所述文件名称中未携带有开发人员账号,判断所述第一脚本文件的存储地址是否为源代码的版本控制系统SVN;
若所述第一脚本文件的存储地址为SVN,从所述SVN中获取提交所述第一脚本文件的人员记录;
通过所述人员记录,获取第二开发人员账号;
将所述校验结果发送至所述第二开发人员账号对应的邮箱中。
在该可选的实施方式中,所述第一脚本文件的文件命名是非规范的,但是,如果所述第一脚本文件是通过SVN的方式提取的,则可以借助SVNKIT第三方API获取提交所述第一脚本文件的人员记录,通过所述人员记录,可以获取第二开发人员账号,所述第二开发人员账号即提交所述第一脚本文件的提交人员的账户。
作为一种可选的实施方式,所述方法还包括:
若所述文件名称中未携带有开发人员账号,且所述第一脚本文件的存储地址不为 SVN,获取当前登录人员的登录账号;
将所述校验结果发送至所述登录账号对应的邮箱中。
在该可选的实施方式中,所述第一脚本文件的文件命名是非规范的,所述第一脚本文件也并没有通过SVN的方式提交,即所述文件名称中未携带有开发人员账号,且所述第一脚本文件的存储地址不为SVN,这种情况下,可以通过java提供的API来获取当前登录服务器的登录人员的登录账号,并将所述校验结果发送至所述登录账号对应的邮箱中。
作为一种可选的实施方式,所述方法还包括:
接收针对所述第一脚本文件的校验失败原因上传的第一脚本修复方案;
存储所述第一脚本修复方案;
在对第二脚本文件进行校验时,若所述第二脚本文件的校验失败原因与所述第一脚本文件的校验失败原因相同,根据所述第一脚本修复方案对所述第二脚本文件进行修复。
在该可选的实施方式中,开发人员对所述第一脚本文件进行修复后,开发人员可以将针对所述第一脚本文件的校验失败原因上传第一脚本修复方案,服务器可以存储所述第一脚本修复方案,当后续在对第二脚本文件进行校验时,如果所述第二脚本文件在校验的过程中,同样出现校验失败,且所述第二脚本文件的校验失败原因与所述第一脚本文件的校验失败原因相同,则服务器可以直接根据所述第一脚本修复方案对所述第二脚本文件进行自动修复,而无需开发人员再次修复,从而可以节省脚本校验的时间,提高脚本校验效率。
可选的,如果针对所述第一脚本文件的校验失败原因上传的第一脚本修复方案有多个,服务器在对所述第二脚本文件进行修复时,可以从所述多个第一脚本修复方案中确定评价值最高的目标脚本修复方案,并根据所述目标脚本修复方案对所述第二脚本文件进行修复。其中,针对每个所述第一脚本修复方案,开发人员可以根据后续修复的效果来对所述第一脚本修复方案进行评价,并提交评价值。可选的,服务器还可以输出多个第一脚本修复方案,由开发人员来选择其中某个第一脚本修复方案,服务器再根据选择的第一脚本修复方案对所述第二脚本文件进行修复。其中,可以将所述多个第一脚本修复方案以及服务器采用的第一脚本修复方案一并呈现出来,达到可视化的效果,让开发人员一目了然。
在图1所描述的方法流程中,可以直接通过服务器来获取需要进行校验的第一脚本文件,而不需要人工复制粘贴,此外,只需要在同一个服务器中,配置数据库连接信息, 即可建议一个服务器与多个数据库之间的对话,在进行脚本文件校验时,即可多个不同的数据库同时进行校验,从而可以提高脚本校验的效率。
以上所述,仅是本申请的具体实施方式,但本申请的保护范围并不局限于此,对于本领域的普通技术人员来说,在不脱离本申请创造构思的前提下,还可以做出改进,但这些均属于本申请的保护范围。
请参见图2,图2是本申请公开的一种脚本文件校验装置的较佳实施例的功能模块图。
在一些实施例中,所述脚本文件校验装置运行于服务器中。所述脚本文件校验装置可以包括多个由程序代码段所组成的功能模块。所述脚本文件校验装置中的各个程序段的程序代码可以存储于存储器中,并由至少一个处理器所执行,以执行图1所描述的脚本文件校验方法中的部分或全部步骤。
本实施例中,所述脚本文件校验装置根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:第一获取模块201、配置模块202、第二获取模块203、建立模块204及校验模块205。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器中。
所述脚本文件校验装置包括:
第一获取模块201,用于获取需要进行校验的第一脚本文件的存储地址。
本申请实施例中,服务器上安装有校验工具,通过该校验工具,可以对所有需要进行校验的脚本文件进行全量扫描,然后通过数据库进行校验。
其中,所述第一脚本文件可以是数据库模式定义语言(Data Definition Language,DDL)和数据操纵语言(Data Manipulation Language,DML),其中,脚本文件的存储地址可以是开发人员自己的本地磁盘,也可以是项目的SVN(Subversion,源代码的版本控制系统),其中,SVN可以理解为同一个项目的开发人员用于存储代码的代码库。
具体的,所述第一获取模块201获取需要进行校验的第一脚本文件的存储地址包括:
在地址配置界面,接收输入的第一脚本文件的存储地址;或
在地址配置界面,输出多个脚本文件;接收针对多个所述脚本文件的选择指令;根据所述选择指令,将被选择的脚本文件确定为第一脚本文件,并获取所述第一脚本文件的存储地址。
在该可选的实施方式中,当需要进行第一脚本文件的校验时,可以启动校验工具, 在所述校验工具启动后,即可输出地址配置界面,在该地址配置界面,用户可以手动输入第一脚本文件的存储地址,或者,也可以在地址配置界面,输出多个脚本文件,其中,校验工具可以与存储多个脚本文件的设备进行通信连接,当用户从多个脚本文件中选择并确定第一脚本文件后,即可确定第一脚本文件对应的存储地址。
配置模块202,用于配置与所述第一脚本文件匹配的数据库连接信息。
其中,数据库连接信息可以包括但不限于数据库的连接串地址、驱动类、用户名以及密码信息。其中,所述连接串地址可以包括但不限于数据库服务器域名、数据库端口以及数据库实例,不同的数据库,对应的驱动类不同,其中,用户名以及密码信息即登录数据库的用户的用户名和密码信息,用于在登录数据库时进行身份验证。
其中,如果所述第一脚本文件对应的数据库类型有多种,则可以配置多种不同类型的数据库的数据库连接信息,以与待校验的所述第一脚本文件相匹配。
第二获取模块203,用于从所述存储地址中获取所述第一脚本文件。
其中,在获取到所述第一脚本文件的存储地址之后,可以直接根据所述存储地址,从所述存储地址对应的位置获取所述第一脚本文件的内容,而无需开发人员手动去复制脚本文件内容。
建立模块204,用于根据所述数据库连接信息,与数据库建立连接。
具体的,可以从所述数据库连接信息中获取数据库的连接串地址,根据所述连接串地址,确定需要连接的数据库,进一步的,即可创建和所述数据库的连接会话,即与所述数据库建立连接。
如果所述第一脚本文件对应的数据库类型有多种,则可以与多种类型的数据库建立连接,也即可以同时与多个数据库建立会话。后续在校验时,也可以多个数据库同时进行校验,以提高脚本文件的校验效率。
校验模块205,用于在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
在实际工作中,开发人员在校验脚本文件时基本上都是人工登录连接数据库的客户端,然后在客户端提供的窗口中去执行脚本文件,通常,不同的数据库需要使用不同的客户端,比如oracle数据库,使用PL/SQL客户端,mysql数据库,使用MYSQL Workbench客户端。
而在本申请中,可以支持不同数据库的脚本文件的校验,比如:DB2,sybase,Mysql,pg,oracle等关系型数据库。针对不同的数据库,只需要进行信息的配置(如配置脚本 文件的存储地址、配置数据库连接信息)即可,无需关注不同数据库使用不同的客户端,这给脚本文件的校验带来了极大便利。
本申请实施例中,可以借助递归思想和文件提取,将所述第一脚本文件在所述数据库中进行校验,在校验的过程中,记录每个所述第一脚本文件的校验结果。
在进行第一脚本文件校验时,如果第一脚本文件对应的数据库有多个,可以多个不同的数据库同时进行第一脚本文件的校验,从而可以提高第一脚本文件校验的效率。
具体的,所述校验模块205使用所述数据库,对所述第一脚本文件进行校验包括:
使用JAVA编程语言,读取所述第一脚本文件的内容;
使用JAVA数据库连接JDBC的应用程序编程接口API,将所述第一脚本文件的内容作为参数发送至所述数据库进行校验。
其中,JAVA数据库连接JDBC(Java Database Connectivity)是Java语言中用来规范客户端程序如何来访问数据库的应用程序接口,提供了诸如查询和更新数据库中数据的方法,可以通过JAVA数据库连接JDBC的应用程序编程接口API(Application Programming Interface)连接应用程序和数据库,实现对数据库的访问。
其中,不同的数据库有不同的脚本校验机制。可以针对不同的所述第一脚本文件,将所述第一脚本文件发送至与所述第一脚本文件对应的数据库中,以进行针对性的校验,而无需人工一个一个地去将脚本文件放入相应的数据库进行校验,从而能够减少整个校验的时间,提高校验效率。
可选的,所述脚本校验装置还包括:
返回模块,用于在校验结束后,通过所述API接收所述数据库返回的校验结果;
输出模块,用于通过校验展示界面,输出所述校验结果。
其中,所述校验结果可以包括但不限于:校验的DDL文件数量、DML文件数量,DDL文件校验成功的数量、DDL文件校验失败的数量、DML文件校验成功的数量以及DML文件校验失败的数量,文件校验失败的还可以提供详细展示,用户点击详情展示,可以看到执行的脚本文件名称,执行的时间,失败的原因以及对应的建议修改方案。
其中,所述第一脚本文件的校验成功与失败可以通过返回的状态码以及状态描述信息来指示,其中,状态描述信息是用来描述状态码所代表的含义的。状态码可以分为第一状态码和第二状态码,第一状态码可以用于表示校验成功,第二状态码可以用于表示校验失败,比如第一状态码为“1”,第二状态码为“0”。
可选的,所述第二获取模块203,还用于获取所述第一脚本文件的文件名称;
所述脚本文件校验装置还包括:
判断模块,用于判断所述文件名称中是否携带有第一开发人员账号;
发送模块,用于若所述文件名称中携带有第一开发人员账号,将所述校验结果发送至所述第一开发人员账号对应的邮箱中。
其中,可选的,所述发送模块,还用于将所述校验结果的链接发送至所述开发人员账号对应的邮箱中。
其中,所述第一脚本文件的文件命名可以是规范的,在文件名称中可以携带有开发人员账号,比如SRXXXX_01_数据库名称_dml_zhangsan.sql,其中,zhangsan即开发人员账号。
可选的,开发人员在接收到携带有所述校验结果的邮件后,可以通过邮件中提供的链接直接查看所述第一脚本文件的校验结果,如果所述校验结果表明有部分脚本文件的校验失败,则开发人员可以根据错误信息的列表,逐一对校验失败的脚本文件进行修复,并提交错误原因和修复方案,之后,针对修复的脚本文件,可以单个文件的提交校验,也可以将所有的文件一起提交校验。
可选的,所述判断模块,还用于若所述文件名称中未携带有开发人员账号,判断所述第一脚本文件的存储地址是否为源代码的版本控制系统SVN;
所述第二获取模块203,还用于若所述第一脚本文件的存储地址为SVN,从所述SVN中获取提交所述第一脚本文件的人员记录;
所述第二获取模块203,还用于通过所述人员记录,获取第二开发人员账号;
所述发送模块,还用于将所述校验结果发送至所述第二开发人员账号对应的邮箱中。
在该可选的实施方式中,所述第一脚本文件的文件命名是非规范的,但是,如果所述第一脚本文件是通过SVN的方式提取的,则可以借助SVNKIT第三方API获取提交所述第一脚本文件的人员记录,通过所述人员记录,可以获取第二开发人员账号,所述第二开发人员账号即提交所述第一脚本文件的提交人员的账户。
可选的,所述第二获取模块203,还用于若所述文件名称中未携带有开发人员账号,且所述第一脚本文件的存储地址不为SVN,获取当前登录人员的登录账号;
所述发送模块,还用于将所述校验结果发送至所述登录账号对应的邮箱中。
在该可选的实施方式中,所述第一脚本文件的文件命名是非规范的,所述第一脚本文件也并没有通过SVN的方式提交,即所述文件名称中未携带有开发人员账号,且所述 第一脚本文件的存储地址不为SVN,这种情况下,可以通过java提供的API来获取当前登录服务器的登录人员的登录账号,并将所述校验结果发送至所述登录账号对应的邮箱中。
可选的,所述脚本文件校验装置还包括:
接收模块,用于接收针对所述第一脚本文件的校验失败原因上传的第一脚本修复方案;
存储模块,用于存储所述第一脚本修复方案;
修复模块,用于在对第二脚本文件进行校验时,若所述第二脚本文件的校验失败原因与所述第一脚本文件的校验失败原因相同,根据所述第一脚本修复方案对所述第二脚本文件进行修复。
在该可选的实施方式中,开发人员对所述第一脚本文件进行修复后,开发人员可以将针对所述第一脚本文件的校验失败原因上传第一脚本修复方案,服务器可以存储所述第一脚本修复方案,当后续在对第二脚本文件进行校验时,如果所述第二脚本文件在校验的过程中,同样出现校验失败,且所述第二脚本文件的校验失败原因与所述第一脚本文件的校验失败原因相同,则服务器可以直接根据所述第一脚本修复方案对所述第二脚本文件进行自动修复,而无需开发人员再次修复,从而可以节省脚本校验的时间,提高脚本校验效率。
可选的,如果针对所述第一脚本文件的校验失败原因上传的第一脚本修复方案有多个,服务器在对所述第二脚本文件进行修复时,可以从所述多个第一脚本修复方案中确定评价值最高的目标脚本修复方案,并根据所述目标脚本修复方案对所述第二脚本文件进行修复。其中,针对每个所述第一脚本修复方案,开发人员可以根据后续修复的效果来对所述第一脚本修复方案进行评价,并提交评价值。可选的,服务器还可以输出多个第一脚本修复方案,由开发人员来选择其中某个第一脚本修复方案,服务器再根据选择的第一脚本修复方案对所述第二脚本文件进行修复。其中,可以将所述多个第一脚本修复方案以及服务器采用的第一脚本修复方案一并呈现出来,达到可视化的效果,让开发人员一目了然。
在图2所描述脚本校验装置中,可以直接通过服务器来获取需要进行校验的第一脚本文件,而不需要人工复制粘贴,此外,只需要在同一个服务器中,配置数据库连接信息,即可建议一个服务器与多个数据库之间的对话,在进行脚本文件校验时,即可多个不同的数据库同时进行校验,从而可以提高脚本校验的效率。
如图3所示,图3是本申请实现脚本文件校验方法的较佳实施例的服务器的结构示意图。所述服务器3包括存储器31、至少一个处理器32、存储在所述存储器31中并可在所述至少一个处理器32上运行的计算机可读指令33及至少一条通讯总线34。
本领域技术人员可以理解,图3所示的示意图仅仅是服务器3的示例,并不构成对服务器3的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述服务器3还可以包括输入输出设备、网络接入设备等。
所述至少一个处理器32可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。该处理器32可以是微处理器或者该处理器32也可以是任何常规的处理器等,所述处理器32是所述服务器3的控制中心,利用各种接口和线路连接整个服务器3的各个部分。
所述存储器31可用于存储所述计算机可读指令33和/或模块/单元,所述处理器32通过运行或执行存储在所述存储器31内的计算机可读指令和/或模块/单元,以及调用存储在存储器31内的数据,实现所述服务器3的各种功能。所述存储器31可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据服务器3的使用所创建的数据(比如音频数据)等。此外,存储器31可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。
结合图1,所述服务器3中的所述存储器31存储多个指令以实现一种脚本文件校验方法,所述处理器32可执行所述多个指令从而实现:
获取需要进行校验的第一脚本文件的存储地址;
配置与所述第一脚本文件匹配的数据库连接信息;
从所述存储地址中获取所述第一脚本文件;
根据所述数据库连接信息,与数据库建立连接;
在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
具体地,所述处理器32对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
在图3所描述的服务器3中,可以直接通过服务器来获取需要进行校验的第一脚本文件,而不需要人工复制粘贴,此外,只需要在同一个服务器中,配置数据库连接信息,即可建议一个服务器与多个数据库之间的对话,在进行脚本文件校验时,即可多个不同的数据库同时进行校验,从而可以提高脚本校验的效率。
所述服务器3集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个非易失性可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述非易失性可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统 权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种脚本文件校验方法,其特征在于,所述方法包括:
    获取需要进行校验的第一脚本文件的存储地址;
    配置与所述第一脚本文件匹配的数据库连接信息;
    从所述存储地址中获取所述第一脚本文件;
    根据所述数据库连接信息,与数据库建立连接;
    在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
  2. 根据权利要求1所述的方法,其特征在于,所述获取需要进行校验的第一脚本文件的存储地址包括:
    在地址配置界面,接收输入的第一脚本文件的存储地址;或
    在地址配置界面,输出多个脚本文件;接收针对多个所述脚本文件的选择指令;根据所述选择指令,将被选择的脚本文件确定为第一脚本文件,并获取所述第一脚本文件的存储地址。
  3. 根据权利要求1所述的方法,其特征在于,所述使用所述数据库,对所述第一脚本文件进行校验包括:
    使用JAVA编程语言,读取所述第一脚本文件的内容;
    使用JAVA数据库连接JDBC的应用程序编程接口API,将所述第一脚本文件的内容作为参数发送至所述数据库进行校验。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    在校验结束后,通过所述API接收所述数据库返回的校验结果;
    通过校验展示界面,输出所述校验结果。
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述方法还包括:
    获取所述第一脚本文件的文件名称;
    判断所述文件名称中是否携带有第一开发人员账号;
    若所述文件名称中携带有第一开发人员账号,将所述校验结果发送至所述第一开发人员账号对应的邮箱中。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    若所述文件名称中未携带有开发人员账号,判断所述第一脚本文件的存储地址是否为源代码的版本控制系统SVN;
    若所述第一脚本文件的存储地址为SVN,从所述SVN中获取提交所述第一脚本文件的人员记录;
    通过所述人员记录,获取第二开发人员账号;
    将所述校验结果发送至所述第二开发人员账号对应的邮箱中。
  7. 根据权利要求1至4中任一项所述的方法,其特征在于,所述方法还包括:
    接收针对所述第一脚本文件的校验失败原因上传的第一脚本修复方案;
    存储所述第一脚本修复方案;
    在对第二脚本文件进行校验时,若所述第二脚本文件的校验失败原因与所述第一脚本文件的校验失败原因相同,根据所述第一脚本修复方案对所述第二脚本文件进行修复。
  8. 一种脚本文件校验装置,其特征在于,所述脚本文件校验装置包括:
    第一获取模块,用于获取需要进行校验的第一脚本文件的存储地址;
    配置模块,用于配置与所述第一脚本文件匹配的数据库连接信息;
    第二获取模块,用于从所述存储地址中获取所述第一脚本文件;
    建立模块,用于根据所述数据库连接信息,与数据库建立连接;
    校验模块,用于在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
  9. 一种服务器,其特征在于,所述服务器包括处理器和存储器,所述处理器用于执行存储器中存储的至少一个计算机可读指令以实现以下步骤:
    获取需要进行校验的第一脚本文件的存储地址;
    配置与所述第一脚本文件匹配的数据库连接信息;
    从所述存储地址中获取所述第一脚本文件;
    根据所述数据库连接信息,与数据库建立连接;
    在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
  10. 根据权利要求9所述的服务器,其特征在于,所述处理器执行至少一个计算机可读指令以实现所述获取需要进行校验的第一脚本文件的存储地址时,具体包括:
    在地址配置界面,接收输入的第一脚本文件的存储地址;或
    在地址配置界面,输出多个脚本文件;接收针对多个所述脚本文件的选择指令;根据所 述选择指令,将被选择的脚本文件确定为第一脚本文件,并获取所述第一脚本文件的存储地址。
  11. 根据权利要求9所述的服务器,其特征在于,所述处理器执行至少一个计算机可读指令以实现所述使用所述数据库,对所述第一脚本文件进行校验时,具体包括:
    使用JAVA编程语言,读取所述第一脚本文件的内容;
    使用JAVA数据库连接JDBC的应用程序编程接口API,将所述第一脚本文件的内容作为参数发送至所述数据库进行校验。
  12. 根据权利要求11所述的服务器,其特征在于,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    在校验结束后,通过所述API接收所述数据库返回的校验结果;
    通过校验展示界面,输出所述校验结果。
  13. 根据权利要求9至12中任一项所述的服务器,其特征在于,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    获取所述第一脚本文件的文件名称;
    判断所述文件名称中是否携带有第一开发人员账号;
    若所述文件名称中携带有第一开发人员账号,将所述校验结果发送至所述第一开发人员账号对应的邮箱中。
  14. 根据权利要求13所述的服务器,其特征在于,所述处理器执行至少一个计算机可读指令还用以实现以下步骤:
    若所述文件名称中未携带有开发人员账号,判断所述第一脚本文件的存储地址是否为源代码的版本控制系统SVN;
    若所述第一脚本文件的存储地址为SVN,从所述SVN中获取提交所述第一脚本文件的人员记录;
    通过所述人员记录,获取第二开发人员账号;
    将所述校验结果发送至所述第二开发人员账号对应的邮箱中。
  15. 一种非易失性可读存储介质,其特征在于,所述非易失性可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
    获取需要进行校验的第一脚本文件的存储地址;
    配置与所述第一脚本文件匹配的数据库连接信息;
    从所述存储地址中获取所述第一脚本文件;
    根据所述数据库连接信息,与数据库建立连接;
    在接收到针对所述第一脚本文件的校验指令时,使用所述数据库,对所述第一脚本文件进行校验。
  16. 根据权利要求15所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行以实现所述获取需要进行校验的第一脚本文件的存储地址时,具体包括:
    在地址配置界面,接收输入的第一脚本文件的存储地址;或
    在地址配置界面,输出多个脚本文件;接收针对多个所述脚本文件的选择指令;根据所述选择指令,将被选择的脚本文件确定为第一脚本文件,并获取所述第一脚本文件的存储地址。
  17. 根据权利要求15所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行以实现所述使用所述数据库,对所述第一脚本文件进行校验时,具体包括:
    使用JAVA编程语言,读取所述第一脚本文件的内容;
    使用JAVA数据库连接JDBC的应用程序编程接口API,将所述第一脚本文件的内容作为参数发送至所述数据库进行校验。
  18. 根据权利要求17所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    在校验结束后,通过所述API接收所述数据库返回的校验结果;
    通过校验展示界面,输出所述校验结果。
  19. 根据权利要求15至18中任一项所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    获取所述第一脚本文件的文件名称;
    判断所述文件名称中是否携带有第一开发人员账号;
    若所述文件名称中携带有第一开发人员账号,将所述校验结果发送至所述第一开发人员账号对应的邮箱中。
  20. 根据权利要求19所述的存储介质,其特征在于,所述至少一个计算机可读指令被处理器执行还用以实现以下步骤:
    若所述文件名称中未携带有开发人员账号,判断所述第一脚本文件的存储地址是否为源代码的版本控制系统SVN;
    若所述第一脚本文件的存储地址为SVN,从所述SVN中获取提交所述第一脚本文件的人员记录;
    通过所述人员记录,获取第二开发人员账号;
    将所述校验结果发送至所述第二开发人员账号对应的邮箱中。
PCT/CN2019/118600 2019-06-28 2019-11-14 脚本文件校验方法、装置、服务器及存储介质 Ceased WO2020258674A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910580049.1A CN110471665A (zh) 2019-06-28 2019-06-28 脚本文件校验方法、装置、服务器及存储介质
CN201910580049.1 2019-06-28

Publications (1)

Publication Number Publication Date
WO2020258674A1 true WO2020258674A1 (zh) 2020-12-30

Family

ID=68507317

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118600 Ceased WO2020258674A1 (zh) 2019-06-28 2019-11-14 脚本文件校验方法、装置、服务器及存储介质

Country Status (2)

Country Link
CN (1) CN110471665A (zh)
WO (1) WO2020258674A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112163412B (zh) * 2020-09-30 2024-02-09 善恒展创(深圳)发展合伙企业(有限合伙) 数据校验方法、装置、电子设备及存储介质
CN112380136A (zh) * 2020-12-03 2021-02-19 北京联创信安科技股份有限公司 数据清理方法、装置、测试设备及存储介质
CN112685077A (zh) * 2020-12-29 2021-04-20 平安普惠企业管理有限公司 数据修改方法、系统、计算机设备及计算机可读存储介质
CN113297028A (zh) * 2021-03-18 2021-08-24 中国平安人寿保险股份有限公司 一种脚本执行方法、装置、计算机设备及存储介质
CN113076214B (zh) * 2021-04-01 2022-12-20 山东英信计算机技术有限公司 一种namelist文件的验证和纠正方法、装置、设备及可读介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739340A (zh) * 2009-12-17 2010-06-16 金蝶软件(中国)有限公司 一种脚本文件的验证方法和装置
US20170206245A1 (en) * 2016-01-20 2017-07-20 Oracle International Corporation System and method for dynamic conversion of database accessing scripts during runtime in a mainframe rehosting platform
CN108009087A (zh) * 2017-11-29 2018-05-08 广州品唯软件有限公司 数据库测试方法、装置及计算机可读存储介质
CN108415826A (zh) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 应用的测试方法、终端设备及计算机可读存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104516908A (zh) * 2013-09-29 2015-04-15 华为技术有限公司 一种数据库访问方法和装置
CN107122365A (zh) * 2016-02-25 2017-09-01 阿里巴巴集团控股有限公司 异构数据库的访问方法及装置
CN108733720B (zh) * 2017-04-24 2021-02-26 北京京东尚科信息技术有限公司 多数据库类型的sql查询的在线校验方法和校验系统
CN108763081A (zh) * 2018-05-29 2018-11-06 郑州云海信息技术有限公司 一种数据库测试方法及其装置、计算机可读存储介质
CN109308285A (zh) * 2018-10-11 2019-02-05 平安科技(深圳)有限公司 数据库脚本管理方法、装置、计算机设备及存储介质
CN109871368B (zh) * 2018-12-15 2023-07-18 中国平安人寿保险股份有限公司 数据库检测方法、装置、计算机装置及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739340A (zh) * 2009-12-17 2010-06-16 金蝶软件(中国)有限公司 一种脚本文件的验证方法和装置
US20170206245A1 (en) * 2016-01-20 2017-07-20 Oracle International Corporation System and method for dynamic conversion of database accessing scripts during runtime in a mainframe rehosting platform
CN108009087A (zh) * 2017-11-29 2018-05-08 广州品唯软件有限公司 数据库测试方法、装置及计算机可读存储介质
CN108415826A (zh) * 2018-01-12 2018-08-17 深圳壹账通智能科技有限公司 应用的测试方法、终端设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN110471665A (zh) 2019-11-19

Similar Documents

Publication Publication Date Title
WO2020258674A1 (zh) 脚本文件校验方法、装置、服务器及存储介质
US20230359778A1 (en) Configuration of a digital twin for a building or other facility via bim data extraction and asset register mapping
CN111061817B (zh) 自适应业务构建系统、方法及计算机可读介质
US9483386B2 (en) Information interaction test device and method based on automatic generation of associated test cases
US10572361B2 (en) Concurrent production use of a production enterprise system and testing of a modified enterprise system
US12505028B2 (en) Automatic generation of test scenarios from specification files
US9848277B2 (en) High-speed application for installation on mobile devices for permitting remote configuration of such mobile devices
US20170192879A1 (en) System and method for automating testing without scripting
CN103412749A (zh) 一种基于关系型数据库的代码生成方法及代码生成器
US20180157584A1 (en) Implicit coordination of deployment and regression testing across data centers and system clusters
CN108923997B (zh) 一种基于python的云服务节点自动测试方法及装置
CN110163002A (zh) 一种SaaS软件租户数据隔离的方法
WO2019104891A1 (zh) 报表导入导出的方法、装置、存储介质及终端
WO2019214014A1 (zh) 网销产品管理方法、装置、终端设备及存储介质
US10613708B2 (en) Cloning a hypervisor
CN113190463B (zh) 一种代码测试方法,节点及系统
CN110619016A (zh) 一种大数据平台的数据处理方法、设备以及存储介质
CN116679907A (zh) 人工智能信息的处理方法、装置、电子设备和存储介质
CN116719795A (zh) 异构数据库的数据迁移方法、装置、设备、介质及产品
WO2021022702A1 (zh) 日志插入方法、装置、计算机装置及存储介质
US11693765B2 (en) Unified regression platform for regression testing
CN111427902B (zh) 基于轻量型数据库的元数据管理方法、装置、设备及介质
CN120408400A (zh) 车辆物料清单的校验方法、设备、介质及产品
US20250004926A1 (en) API Validation Framework
CN115657901B (zh) 一种基于统一参数的业务变更方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19935408

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19935408

Country of ref document: EP

Kind code of ref document: A1