Technical References - [SQLexecute]

Executes and persits the results of an SQL statement.

numero = 278
interpreted = N
texte = [SQLExecute Params]WebDNA to evaluate to a single SQL statement[/SQLExecute] Once you have made a successfull connection to a SQL server, using the [SQLconnect] context, you can use the [SQLexecute] context to execute all manner of native SQL commands and to create result sets from SQL queries ("select" statements). Example:
[SQLconnect dbType=MySQL&host=192.168.1.1&database=base&uid=sa&pwd=pass&conn_var=conn1]Connected successfully[/SQLconnect][SQLexecute conn_ref=conn1&result_var=rs1]select firstName,lastName from employees;[/SQLexecute]
[SQLexecute] expects its content to resolve or evaluate to a single SQL command of some sort. You can place WebDNA here if you wish but [SQLexecute] will fail if its contents are not limited to a valid SQL statement after the inner parse is complete. Refer to the documentation of your particular SQL server software to determine what a "valid" SQL statement is. After a successfull execution, you would then normally use the [SQLresult] and [founditems] contexts to retrieve the results of the SQL statement.
ParameterDescription
conn_ref (or just 'ref')(Required) - The name of the connection variable you created with a prior execution of [SQLconnect] (the value you set for the "conn_var" or "var" parameter)
result_var (or just 'var')(Optional) - The name of the SQLresult variable you wish to create on successful execution. This 'result' variable can be used later by setting the "result_ref" (or "ref") parameter of [SQLresult] to this value. If you do not specify a variable name, none will be created and it is assumed you wish to execute non-Select SQL commands. Even if you do execute a non-Select command, you may still want to 'save' the result. For example, if you execute a delete command, you can still specify a result variable, so that you can access other information, such as the number of rows affected.
[SQLExecute Params]WebDNA to evaluate to a single SQL statement[/SQLExecute]

Once you have made a successfull connection to a SQL server, using the [SQLconnect] context, you can use the [SQLexecute] context to execute all manner of native SQL commands and to create result sets from SQL queries ("select" statements).

Example:
[SQLconnect dbType=MySQL&host=192.168.1.1&database=base&uid=sa&pwd=pass&conn_var=conn1]
Connected successfully
[/SQLconnect]

[SQLexecute conn_ref=conn1&result_var=rs1]
select firstName,lastName from employees;
[/SQLexecute]

[SQLexecute] expects its content to resolve or evaluate to a single SQL command of some sort. You can place WebDNA here if you wish but [SQLexecute] will fail if its contents are not limited to a valid SQL statement after the inner parse is complete. Refer to the documentation of your particular SQL server software to determine what a "valid" SQL statement is.

After a successfull execution, you would then normally use the [SQLresult] and [founditems] contexts to retrieve the results of the SQL statement.

ParameterDescription
conn_ref (or just 'ref')(Required) - The name of the connection variable you created with a prior execution of [SQLconnect] (the value you set for the "conn_var" or "var" parameter)
result_var (or just 'var')(Optional) - The name of the SQLresult variable you wish to create on successful execution. This 'result' variable can be used later by setting the "result_ref" (or "ref") parameter of [SQLresult] to this value. If you do not specify a variable name, none will be created and it is assumed you wish to execute non-Select SQL commands. Even if you do execute a non-Select command, you may still want to 'save' the result. For example, if you execute a delete command, you can still specify a result variable, so that you can access other information, such as the number of rows affected.

DOWNLOAD WEBDNA NOW!

Top Articles:

Tips and Tricks

A list of user-submitted tips ...

F.A.Q

A compilation of some user's questions...

Download WebDNA Applications

WebDNA applications...

WebDNA Libraries

A list of available libraries for WebDNA...

[biotype]

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[xmlparse]

Enable the WebDNA programmer to input XML data into a WebDNA variable...

[listfiles]

When listing files...

[middle]

Extracts middle portion of the text between any two strings...

[waitforfile]

The server waits until the file appears on disk...

[cart]

Putting [cart] in your template automatically creates a unique shopping cart...

[delete]

[delete db=some...