Name

EXECUTE-COMMAND — Execute an SQL command which returns no values.

Function

Syntax

execute-command sql-expression &key database => t

Arguments and Values

sql-expression

An sql expression that represents an SQL statement which will return no values.

database

A database object. This will default to the value of *default-database*.

Description

This will execute the command given by sql-expression in the database specified. If the execution succeeds it will return t, otherwise an error of type clsql-sql-error will be signalled.

Examples

(execute-command "create table eventlog (time char(30),event char(70))")
=> T

(execute-command "create table eventlog (time char(30),event char(70))")
>> 
>> While accessing database #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE {480B2B6D}>
>>   with expression "create table eventlog (time char(30),event char(70))":
>>   Error NIL: ERROR:  amcreate: eventlog relation already exists
>>   has occurred.
>> 
>> Restarts:
>>   0: [ABORT] Return to Top-Level.
>> 
>> Debug  (type H for help)
>> 
>> (CLSQL-POSTGRESQL::|(PCL::FAST-METHOD DATABASE-EXECUTE-COMMAND (T POSTGRESQL-DATABASE))|
>>  #<unused-arg>
>>  #<unused-arg>
>>  #<unavailable-arg>
>>  #<unavailable-arg>)
>> Source: (ERROR 'CLSQL-SQL-ERROR :DATABASE DATABASE :EXPRESSION ...)
>> 0] 0

(execute-command "drop table eventlog")
=> T
	

Side Effects

Whatever effects the execution of the SQL statement has on the underlying database, if any.

Affected by

None.

Exceptional Situations

If the execution of the SQL statement leads to any errors, an error of type clsql-sql-error is signalled.

See Also

query

Notes

None.