Method and device for calling SQLite database by Lisp language based on CAD

By loading the Lisp loader file and DLL functions in the Lisp interpreter environment of the CAD platform, and directly calling the SQLite database operation DLL, the problems of complex deployment and high privileges of traditional methods are solved. This achieves simple, low-privilege, and efficient database calls, making it suitable for lightweight data management in a local area network environment.

CN122044699APending Publication Date: 2026-05-15XIAN MIDLINE SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAN MIDLINE SOFTWARE TECH CO LTD
Filing Date
2026-02-04
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

In the secondary development of CAD platforms, existing technologies and traditional database calling methods suffer from problems such as complex deployment, high permission requirements, susceptibility to interference from security software, cumbersome architecture, and low efficiency.

Method used

In the Lisp interpreter environment of the CAD platform, the Lisp loader file is loaded and the DLL loading function is obtained. The SQLite database operation DLL is loaded into the CAD application process space through the DLL loading function. The Lisp interpreter calls the interface functions of the SQLite database operation DLL to perform database operations, including opening, creating, sending SQL commands and receiving results, and closing the database file through the interface function.

Benefits of technology

It enables direct and efficient calls to SQLite databases using the Lisp language. It is easy to deploy, has low permission requirements, is not easily interfered with by security software, is highly efficient on a single machine, and has wide compatibility, making it suitable for lightweight data management in a local area network environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122044699A_ABST
    Figure CN122044699A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for calling an SQLite database through a Lisp language based on CAD, and the method comprises the steps: loading a Lisp loader file in a Lisp interpreter environment of a CAD platform, and obtaining a DLL loading function; through a DLL loading function, an SQLite database operation DLL is loaded into a CAD application process space; calling an interface function provided by an SQLite database operation DLL through a Lisp interpreter so as to open or create an SQLite database file; sending an SQL operation command to the SQLite database file through the interface function, and receiving a return result; and closing the SQLite database file through an interface function. According to the method provided by the invention, on the basis of a registration-free loading mechanism of the DLL, direct and efficient calling of the SQLite database by the Lisp language is realized, and the method is simple in deployment, low in permission requirement, not easy to be interfered by security software, high in single machine efficiency and wide in compatibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer software technology, specifically to a method and apparatus for calling an SQLite database using the Lisp language based on CAD. Background Technology

[0002] In the application scenarios of centerline CAD, there is a frequent need to process and read large-scale data, while providing users with standardized interfaces to support data interaction and integration between various software. Therefore, the selection and architecture design of the database directly determines the system's operating efficiency and compatibility, making it particularly crucial.

[0003] When providing secondary development services to clients, Zhongxian CAD develops desktop applications based on a CAD platform, while its target user group is mostly located in a local area network environment. Deploying the database on a central server would not only easily lead to excessive server load but also significantly increase bandwidth consumption, resulting in system response delays. Against this backdrop, the lightweight advantages of stand-alone databases become apparent, making them a more suitable choice for the scenario. Among them, SQLite (a lightweight, embedded, zero-configuration, serverless relational database management system) is the preferred solution for stand-alone databases due to its convenient deployment and low resource consumption.

[0004] For SQLite connectivity requirements, current mainstream technologies include ODBC, ARX, C#, and VBA. However, these solutions all have significant limitations. For example, ODBC requires prior registration and configuration and depends on administrator privileges, resulting in complex deployment and high permission requirements. ARX is deeply bound to specific CAD versions, leading to poor compatibility and cumbersome architecture issues with redundant files. C# has cross-scenario compatibility constraints, and the design of some intermediate layers that require independent processes can easily trigger security software alerts and introduce additional performance overhead, resulting in overall low efficiency. Summary of the Invention

[0005] Therefore, this application provides a method and apparatus for calling an SQLite database using the Lisp language based on CAD, in order to solve the problems of complex deployment, high permission requirements, susceptibility to interference from security software, cumbersome architecture, and low efficiency of traditional database calling methods in the secondary development of CAD platforms.

[0006] To achieve the above objectives, this application provides the following technical solution:

[0007] Firstly, a method for calling an SQLite database using the Lisp language based on CAD includes:

[0008] Step 1: In the Lisp interpreter environment of the CAD platform, load the Lisp loader file and obtain the DLL loading function;

[0009] Step 2: Load the SQLite database operation DLL into the CAD application process space using the DLL loading function;

[0010] Step 3: Use the Lisp interpreter to call the interface functions provided by the SQLite database operation DLL to open or create an SQLite database file;

[0011] Step 4: Send SQL operation commands to the SQLite database file through the interface function and receive the return results;

[0012] Step 5: Close the SQLite database file using the interface function.

[0013] Preferably, in step 1, the Lisp loader file is a compiled load-dll.fas file; and the DLL loading function is the load-dll function.

[0014] Preferably, in step 2, the SQLite database operation DLL is sqlite64.dll or sqlite32.dll.

[0015] Preferably, in step S2, when the SQLite database operation DLL is loaded into the CAD application process space, it inherits the system permissions already obtained by the CAD application process, without the need for a separate registration operation.

[0016] Preferably, in step 3, the interface functions include: dsqlite_open, dsqlite_query, dsqlite_close, and dsqlite_DML.

[0017] Preferably, in step 4, the SQL operation command includes a data query command.

[0018] Preferably, step 4 includes executing an SQL command containing the transaction start keyword through the interface function.

[0019] Secondly, a device for calling an SQLite database using the Lisp language based on CAD, comprising:

[0020] The loading module is used to load the Lisp loader file and obtain the DLL loading function in the Lisp interpreter environment of the CAD platform;

[0021] The DLL injection module is used to load the SQLite database operation DLL into the CAD application process space through the DLL loading function.

[0022] The database connection module is used to call the interface functions provided by the SQLite database operation DLL through the Lisp interpreter to open or create an SQLite database file;

[0023] The command execution module is used to send SQL operation commands to the SQLite database file through the interface function and receive the return results;

[0024] The resource management module is used to close the SQLite database file through the interface function.

[0025] Thirdly, a computer device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of a method for calling an SQLite database using a CAD-based Lisp language.

[0026] Fourthly, a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method for calling an SQLite database using a CAD-based Lisp language.

[0027] Compared with the prior art, this application has at least the following beneficial effects:

[0028] This application provides a method for calling an SQLite database using the Lisp language in CAD, comprising: loading a Lisp loader file and obtaining a DLL loading function in the Lisp interpreter environment of the CAD platform; loading an SQLite database operation DLL into the CAD application process space through the DLL loading function; calling the interface functions provided by the SQLite database operation DLL through the Lisp interpreter to open or create an SQLite database file; sending SQL operation commands to the SQLite database file through the interface functions and receiving the return results; and closing the SQLite database file through the interface functions. The method provided in this application, based on a DLL registration-free loading mechanism, enables direct and efficient calling of the SQLite database by the Lisp language, and is simple to deploy, has low permission requirements, is not easily interfered with by security software, is highly efficient on a single machine, and has wide compatibility. Attached Figure Description

[0029] To more intuitively illustrate the prior art and this application, exemplary drawings are provided below. It should be understood that the specific shapes and structures shown in the drawings should not generally be regarded as limiting conditions for implementing this application; for example, based on the technical concept disclosed in this application and the exemplary drawings, those skilled in the art are able to easily make conventional adjustments or further optimizations to the addition / reduction / classification, specific shapes, positional relationships, connection methods, size ratios, etc. of certain units (components).

[0030] Figure 1 A flowchart illustrating a method for calling an SQLite database using Lisp language based on CAD, provided in Embodiment 1 of this application;

[0031] Figure 2 This is a schematic diagram illustrating the working principle of a method for calling an SQLite database using Lisp language based on CAD, provided in Embodiment 1 of this application.

[0032] Figure 3 The main flowchart of a method for querying an SQLite database using Lisp language based on CAD provided in Embodiment 1 of this application is shown. Detailed Implementation

[0033] The present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0034] In the description of this application: unless otherwise stated, "a plurality of" means two or more. The terms "first," "second," "third," etc., in this application are intended to distinguish the objects referred to and do not have any special meaning in terms of technical connotation (e.g., they should not be construed as an emphasis on importance or order). Expressions such as "including," "comprising," and "having" also mean "not limited to" (certain units, components, materials, steps, etc.).

[0035] The terms used in this application, such as "upper," "lower," "left," "right," and "middle," are generally used to indicate the general relative positional relationship for the purpose of intuitive understanding by referring to the accompanying drawings, and are not absolute limitations on the positional relationship in the actual product.

[0036] Example 1

[0037] Please see Figure 1 and Figure 2 This embodiment discloses a method for calling an SQLite database using the Lisp language based on CAD, including:

[0038] S1: In the Lisp interpreter environment of the CAD platform, load the Lisp loader file and obtain the DLL loading function;

[0039] Specifically, the Lisp loader file is the compiled load-dll.fas file (i.e., the compiled Lisp program file that "loads dynamic link libraries"); the DLL loading function is the load-dll function.

[0040] Please see Figure 3 In this step, running the code (load dll -f, for example: load "D: \\load-dll.fas") will load a file named load-dll.fas. After successful loading, a load-dll function will be generated. This function is not available before executing this line of code. If you do not execute (load dll -f) and directly execute the next step (load-dll dll), an error will occur because the load-dll function is not available. Therefore, the purpose of loading the load-dll.fas file is to obtain the load-dll function.

[0041] The `load-dll` function is primarily used to load the `sqlite64.dll` or `sqlite32.dll` files, so the first step must be executing `load dll -f`. Here, the variable `dll -f` is the full path to the `load-dll.fas` file. It returns `nil` upon successful loading, and `load-dll.fas` can be stored in its own memory location.

[0042] S2: Load the SQLite database operation DLL into the CAD application process space via the DLL loading function;

[0043] Specifically, the SQLite database operation DLL is either sqlite64.dll (for 64-bit CAD and database communication) or sqlite32.dll (for 32-bit CAD and database communication).

[0044] Continue reading Figure 3 In this step, the code (load-dll dll, for example: load-dll "D:\\sqlite64.dll") is run to load the sqlite64.dll or sqlite32.dll file (in this embodiment, code can be used, for example: getenv "PROCESSOR_ARCHITECTURE", and the returned result can be used to determine whether the CAD is 32-bit or 64-bit). The previous step must be executed before this step, otherwise the load-dll function will not be available.

[0045] Loading the sqlite64.dll or sqlite32.dll file is primarily for obtaining interface functions such as dsqlite_open, dsqlite_query, dsqlite_close, dsqlite_DML, and dsqlite_dict. Without executing `(load-dll dll)`, functions like `dsqlite_open` will be unusable and will result in errors when executed directly. Therefore, `(load-dll dll)` is mandatory. The variable `dll` specifies the path to the sqlite64.dll file. Successful loading returns a value of 'T'. If an error message indicates that the `LOAD-DLL` function is missing, it means the `load-dll.fas` file was not loaded successfully.

[0046] In this embodiment, when the SQLite database operation DLL is loaded into the CAD application process space, it inherits the system permissions already obtained by the CAD application process, without the need for a separate registration operation.

[0047] S3: Use the Lisp interpreter to call the interface functions provided by the SQLite database operation DLL to open or create an SQLite database file;

[0048] Specifically, as shown in step S2, the interface functions include: dsqlite_open, dsqlite_query, dsqlite_close, dsqlite_dict, and dsqlite_DML. The dsqlite_open function is used to open or create an SQLite database file; the dsqlite_query function is used to send SQL operation commands and receive the return results; the dsqlite_close function is used to close the SQLite database file; dsqlite_dict indicates querying the SQLite database using dictionary mode; and dsqlite_DML (e.g., dsqlite_DML db-f sql) is used to execute Data Manipulation Language commands into an opened SQLite database file [e.g., dsqlite_DML "C:\\sqlite.db" " insert into Test values ​​(1 ,2 ,3 ,4) "].

[0049] The `dsqlite_DML` function takes two arguments: the first is the path to the SQLite database file; the second is a string of SQL statements defining the insert, update, or delete operations. Before calling this function, ensure that the SQLite database operation DLL has been loaded via the dynamic link library loader and that the target database has been opened using the `dsqlite_open` function. In other words, running the code (`dsqlite_DML db-f sql`) executes insert, update, and delete statements [before execution, ensure that `load-dll dll` has been executed and the SQLite database is open]. Here, `db-f` represents the SQLite database path, and `sql` represents the query statement.

[0050] Continue reading Figure 3 In this step, the code `dsqlite_open db -f`, for example: `dsqlite_open "C:\\sqlite.db"`, is used to create or open an SQLite database. [You must execute `load-dll dll` beforehand; otherwise, executing `dsqlite_open db -f` directly will result in an error]. Here, `db -f` is the path to the SQLite database. If the SQLite database does not exist, it will be created and opened in that path. If the SQLite database exists, it will be opened directly. Returning 0 after successfully creating or opening the SQLite database, you can then execute SQL statements. If an error message indicates that the `dsqlite_open` function is missing, it means that `sqlite64.dll` or `sqlite32.dll` was not loaded successfully.

[0051] S4: Send SQL operation commands to the SQLite database file through the interface function and receive the returned results;

[0052] Specifically, SQL operation commands include data query commands.

[0053] Continue reading Figure 3In this step, the code `dsqlite_query db-f sql`, for example: `dsqlite_query "C:\\sqlite.db" "select * from test")`, executes the query SQL statement. [Before execution, ensure that `(load-dll dll)` has been executed and the SQLite database is open.] Here, `db-f` is the SQLite database path, `sql` is the query statement, and the code returns a string of query results. Then, `(read str)` reads the content from this string. `str` is the return result of `(dsqlite_query db-f sql)`. The return result is provided in at least one of the following formats: a dictionary object, a CSV file, or a Lisp program file.

[0054] S5: Close the SQLite database file via an interface function.

[0055] Specifically, in this step, running the code (dsqlite_close db -f) closes the open SQLite database and releases memory. Example: (dsqlite_close "C:\\sqlite.db").

[0056] In this embodiment, a method for calling an SQLite database using Lisp language based on CAD is provided. Before step S4, the method further includes executing an SQL command containing the transaction initiation keyword through an interface function. Specifically, before executing query or insert / delete / update statements, execute (dsqlite_DML db -f "BEGIN TRANSACTION;") to initiate a transaction, then execute the SQL statement, and finally execute (dsqlite_DML db -f "COMMIT;") to close the transaction. If pre-compilation is required, execute (dsqlite_CMPSTMT db -f sql) to perform pre-compilation after initiating the transaction, then execute (dsqlite_STMTBIND[expr...]) to write data, and finally execute (dsqlite_STMTFNL) to destroy the pre-compiled data after committing the transaction [before execution, ensure that (load-dll dll) has been executed and the SQLite database is open].

[0057] Example: (setq db -f "C:\\sqlite.db")

[0058] (dsqlite_DML db-f "BEGIN TRANSACTION;")

[0059] (dsqlite_CMPSTMT db-f "insert into Test10 values ​​(?, ?, ?);")

[0060] (REPEAT 10 (dsqlite_STMTBIND 3 "aaa" "HelloWorld") )

[0061] (dsqlite_DML DB-f "commit transaction;")

[0062] (dsqlite_STMTFNL).

[0063] When CAD is first installed, the company grants it installation and usage permissions, which fall under the company's software management scope (the same applies to antivirus software). Once CAD is successfully installed, all CAD files have legitimate usage permissions. Since CAD requires extensive Lisp language support to start normally, the DLL in this embodiment focuses on using Lisp language to obtain the user's initial installation permissions, so that the user does not need to request permissions again during subsequent use.

[0064] Therefore, the method for calling an SQLite database using Lisp language based on CAD provided in this embodiment has the following advantages:

[0065] (1) No administrator privileges required: Ordinary users can deploy and use it without requesting permissions;

[0066] (2) No COM registration required: This eliminates the component registration step and reduces deployment complexity;

[0067] (3) Silent antivirus software: No EXE startup item to avoid being mistakenly blocked by antivirus software;

[0068] (4) Lightweight deployment: Only 2 core files are required, with no additional dependencies;

[0069] (5) Standalone operation: It does not rely on the network and avoids the pressure of local area network bandwidth;

[0070] (6) Convenient data exchange: Lsp interacts directly with C++ without the need for format conversion;

[0071] (7) Controllable logs: Log output can be flexibly controlled based on LSP files, which facilitates troubleshooting;

[0072] (8) Number of files: It is not necessary to release an ARX file for every CAD version.

[0073] In summary, the method for calling an SQLite database using Lisp language based on CAD provided in this embodiment does not require additional registration or configuration, nor does it require obtaining high privileges. It can achieve stable and efficient calling of the SQLite database, effectively avoiding the pain points of traditional solutions. Moreover, this method has outstanding advantages such as simple deployment, low permission requirements, resistance to interference from security software, high efficiency on a single machine, and wide compatibility. It is particularly suitable for lightweight data management integration in the local area network environment of industrial design software.

[0074] Example 2

[0075] This embodiment provides a device for calling an SQLite database using the Lisp language based on CAD, including:

[0076] The loading module is used to load the Lisp loader file and obtain the DLL loading function in the Lisp interpreter environment of the CAD platform;

[0077] The DLL injection module is used to load the SQLite database operation DLL into the CAD application process space through the DLL loading function.

[0078] The database connection module is used to call the interface functions provided by the SQLite database operation DLL through the Lisp interpreter to open or create an SQLite database file;

[0079] The command execution module is used to send SQL operation commands to the SQLite database file through the interface function and receive the return results;

[0080] The resource management module is used to close the SQLite database file through the interface function.

[0081] For details on the implementation of each module in a device for calling an SQLite database using a Lisp language based on CAD, please refer to the above description of the method for calling an SQLite database using a Lisp language based on CAD, which will not be repeated here.

[0082] Example 3

[0083] This embodiment provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of a method for calling an SQLite database using the Lisp language based on CAD.

[0084] Example 4

[0085] This embodiment provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of a method for calling an SQLite database using the Lisp language based on CAD.

[0086] The technical features of the above embodiments can be combined in any way (as long as there is no contradiction in the combination of these technical features). For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described; these embodiments not explicitly written should also be considered to be within the scope of this specification.

Claims

1. A method for calling an SQLite database using Lisp language based on CAD, characterized in that, include: Step 1: In the Lisp interpreter environment of the CAD platform, load the Lisp loader file and obtain the DLL loading function; Step 2: Load the SQLite database operation DLL into the CAD application process space using the DLL loading function; Step 3: Use the Lisp interpreter to call the interface functions provided by the SQLite database operation DLL to open or create an SQLite database file; Step 4: Send SQL operation commands to the SQLite database file through the interface function and receive the return results; Step 5: Close the SQLite database file using the interface function.

2. The method for calling an SQLite database using Lisp language based on CAD according to claim 1, characterized in that, In step 1, the Lisp loader file is the compiled load-dll.fas file; the DLL loading function is the load-dll function.

3. The method for calling an SQLite database using Lisp language based on CAD according to claim 1, characterized in that, In step 2, the SQLite database operation DLL is either sqlite64.dll or sqlite32.dll.

4. The method for calling an SQLite database using Lisp language based on CAD according to claim 1, characterized in that, In step S2, when the SQLite database operation DLL is loaded into the CAD application process space, it inherits the system permissions already obtained by the CAD application process and does not require a separate registration operation.

5. The method for calling an SQLite database using Lisp language based on CAD according to claim 1, characterized in that, In step 3, the interface functions include: dsqlite_open, dsqlite_query, dsqlite_close, and dsqlite_DML.

6. The method for calling an SQLite database using Lisp language based on CAD according to claim 1, characterized in that, In step 4, the SQL operation commands include data query commands.

7. The method for calling an SQLite database using Lisp language based on CAD according to claim 1, characterized in that, Step 4 is preceded by: executing an SQL command containing the transaction start keyword through the interface function.

8. A device for calling an SQLite database using Lisp language based on CAD, characterized in that, include: The loading module is used to load the Lisp loader file and obtain the DLL loading function in the Lisp interpreter environment of the CAD platform; The DLL injection module is used to load the SQLite database operation DLL into the CAD application process space through the DLL loading function. The database connection module is used to call the interface functions provided by the SQLite database operation DLL through the Lisp interpreter to open or create an SQLite database file; The command execution module is used to send SQL operation commands to the SQLite database file through the interface function and receive the return results; The resource management module is used to close the SQLite database file through the interface function.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.