dcl1214 发表于 2021-11-24 21:52:41

数据库操作相关函数

本帖最后由 dcl1214 于 2021-11-25 22:48 编辑

以下是关于数据库操作方面的相关函数,cad已经封装好了,lisp可以直接使用,只是好多函数的传入参数个数还不是很明确,现贴出来大家一起研究
(arxload "asilisp")

(vlisp-import-exsubrs
'("ase.arx" "asilisp.arx" "asi_connect" "asi_disconnect")
)

ASI_CONNECT
ASI_CMPIDENT           ASI_COLDSC          ASI_DATABASES    ASI_DBMS
ASI_DEALLOCSTM   ASI_DELETE          ASI_DIAG             ASI_DISCONNECT
ASI_ERRQTY           ASI_EXECUTE          ASI_FEATURE             ASI_FETCH
ASI_IEXECUTE           ASI_INFSCHEMA    ASI_LISPVERSIONASI_MSG
ASI_NEXECUTE           ASI_OBJLIST          ASI_OBJNAME             ASI_OBJP
ASI_OPEN           ASI_PARDSC          ASI_PREPARE             ASI_PROVIDERS
ASI_ROWQTY           ASI_SQL          ASI_STATECSR   ASI_STMTYPE
ASI_UPDATE           ASI_VERSION

(ASI_VERSION)

陨落 发表于 2021-11-25 13:41:22

There are two ASILISP functions that help here. Both return cursors to system tables so you can step through the records to find what you need. For example, this code will return all the available providers:返回所有可用的供应商:
(defun c:getprov ( / fasi_kword fasi_curs fasi_row)
;;; Note that ASILISP *must* be loaded first.
(verify_arxapp_loaded "asilisp")
(setq fasi_curs (asi_providers))
(if (asi_open fasi_curs)
   (prompt "\nasi_open successful.")
   (prompt "\nasi_open failed!")
)
(print fasi_curs)
(while (/= fasi_kword "eXit")
(initget 1 "First Last Next Prior eXit")
(setq fasi_kword (getkword "\nDisplay Row: (First Last Next Prior eXit)"))
(if (/= fasi_kword "eXit")
   (progn (setq fasi_row (asi_fetch fasi_curs fasi_kword))
         (if fasi_row (print fasi_row)
            (prompt "\nNothing to fetch or asi_fetch failed.")
         )
      )
)
)
(if (asi_close fasi_curs)
   (prompt "\nasi_close successful.")
   (prompt "\nasi_close failed!")
)
(princ)
)

陨落 发表于 2021-11-25 13:11:57

asi_connect

Connects to the SQL Environment by implementing <connect statement>

asi_disconnect

Disconnects from the SQL Environment by implementing <disconnect statement> and terminates a connection

asi_coldsc

Retrieves the column's description

asi_deallocstm

Deallocates the prepared SQL statement by means of <deallocate prepared statement>

asi_execute

Executes the prepared SQL statement by implementing <execute_statement>

asi_iexecute

Immediately executes the SQL statement by implementing <execute immediate statement>

asi_nexecute

Executes the native DBMS statement

asi_pardsc

Retrieves the description of the SQL input/output parameters

asi_prepare

Prepares the SQL statement by implementing <prepare statement>

asi_alloc

Allocates the SQL cursor by means of <allocate cursor statement>

asi_close

Closes the opened SQL cursor by means of <dynamic close statement>

asi_delete

Deletes the current row in the SQL cursor by means of <dynamic delete statement: positioned>

asi_fetch

Fetches the current position in the SQL cursor by means of <dynamic fetch statement>

asi_open

Opens the SQL cursor by means of <dynamic open statement>

asi_statecsr

Retrieves the status of the allocated SQL cursor

asi_update

Updates the current row in the SQL cursor by implementing <dynamic update statement: positioned>

asi_cmdtype

Retrieves the type of the SQL statement executed as the string

asi_rowqty

Returns the number of rows processed by the SQL data manipulation statement

asi_stmtype

Retrieves the type of the prepared SQL statement as the string

asi_diag

Retrieves the data from the error diagnostics area

asi_errqty

Retrieves the depth of the error diagnostics area

asi_cmpident

Compares two SQL identifiers

asi_dbms

Retrieves the DBMS name

asi_feature

Checks whether or not DBMS supports the SQL features

asi_getcfg

Used to read data from the specified section of the ASI configuration, which is in the Windows System registry.

asi_lispversion

Returns the AutoLISP ASI version string

asi_msg

Retrieves the message from DBMS

asi_objlist

Retrieves the lists of the valid subordinate SQL objects

asi_objname

Retrieves the SQL object name as the string

asi_objp

Checks the SQL descriptor validation

asi_setcfg

Used to assign a value to the specified entry in the specified section in the System registry

asi_sql

Retrieves the SQL realization string

asi_version

Returns the ASI version string

cchessbd 发表于 2023-3-21 13:35:49

老大,晓东上不了,可否在明经公布一下您的数据库函数库。
可否公布一下数据库如何操作的呢?

这个板块相当封闭。简直没啥用处!
页: [1]
查看完整版本: 数据库操作相关函数