0
假設,我們有以下ALIST:如何更改值在2維ALIST
(setq sql-connection-alist
'((local
(sql-product 'mysql)
(sql-server "localhost")
(sql-user "user")
(sql-password "")
(sql-database "")
(sql-port 3306))))
而且功能:
(defun sql-local()
"Connect to the local MySQL server"
(interactive "sWhat database do you want to connect? ")
(let ((symbol (intern key)))
;here I want to set the database field for sql-database = symbol
(sql-connect-preset symbol)))
如果我在Perl做到了,它會是這樣的這樣的:
my %databases = (
"local" => {
"sql-product" => "mysql",
"sql-server" => "localhost",
"sql-user" => "user",
"sql-password" => "",
"sql-database" => "",
"sql-port" => "3306",
},
);
$databases{local}->{sql-database} = $symbol;