明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2439|回复: 3

数据库操作相关函数

[复制链接]
发表于 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_LISPVERSION  ASI_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)

评分

参与人数 1明经币 +1 收起 理由
陨落 + 1 很给力!

查看全部评分

发表于 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)
)
回复 支持 1 反对 0

使用道具 举报

发表于 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
发表于 2023-3-21 13:35:49 | 显示全部楼层
老大,晓东上不了,可否在明经公布一下您的数据库函数库。
可否公布一下数据库如何操作的呢?

这个板块相当封闭。简直没啥用处!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-12-23 05:58 , Processed in 0.173256 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表