Query

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with "$Query is a Database Command. - This command is used for running a query against a database. - It is only usable inside of a connect to database Command...")
 
Line 1: Line 1:
 
$Query is a [[Database Commands|Database Command]].
 
$Query is a [[Database Commands|Database Command]].
  
- This command is used for running a query against a database.
+
* This command is used for running a query against a database.
- It is only usable inside of a connect to database Command.
+
* It is only usable inside of a connect to database Command.
- No results are returned from running this command, so it can be used for INSERT/UPDATE/DELETE queries.
+
* No results are returned from running this command, so it can be used for INSERT/UPDATE/DELETE queries.
- The Query parameter is used for typing your SQL query such as DELETE FROM table_name;
+
* The Query parameter is used for typing your SQL query such as DELETE FROM table_name;
 +
 
 +
 
 +
== Example ==
 +
 
 +
<pre>
 +
plugin command("DatabaseCommands.dll", "connect to database", "server=localhost;uid=test; pwd=testing; database=mysql; port=3306; pooling=false") {
 +
    plugin command("DatabaseCommands.dll", "query", "INSERT INTO users VALUES (\'ubot\', \'studio\');")
 +
    plugin command("DatabaseCommands.dll", "query with results", "SELECT * FROM users WHERE username = \'ubot\';", &users)
 +
}
 +
</pre>

Revision as of 23:27, 5 December 2012

$Query is a Database Command.

  • This command is used for running a query against a database.
  • It is only usable inside of a connect to database Command.
  • No results are returned from running this command, so it can be used for INSERT/UPDATE/DELETE queries.
  • The Query parameter is used for typing your SQL query such as DELETE FROM table_name;


Example

plugin command("DatabaseCommands.dll", "connect to database", "server=localhost;uid=test; pwd=testing; database=mysql; port=3306; pooling=false") {
    plugin command("DatabaseCommands.dll", "query", "INSERT INTO users VALUES (\'ubot\', \'studio\');")
    plugin command("DatabaseCommands.dll", "query with results", "SELECT * FROM users WHERE username = \'ubot\';", &users)
}
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox