QueryScript

QueryScript: SQL scripting language

QueryScript is a programming language aimed for SQL scripting, seamlessly combining scripting power such as flow control & variables with standard SQL statements or RDBMS-specific commands.

What does QueryScript look like? Here are a couple examples:

while (DELETE FROM world.Country WHERE Continent = 'Asia' LIMIT 10)
{
  throttle 2;
}
foreach($table, $schema, $engine: table in sakila)
{
  if ($engine = 'InnoDB')
    ALTER TABLE :$schema.:$table ENGINE=InnoDB ROW_FORMAT=Compact;
}

With QueryScript one can:

  • Use familiar syntax to solve common DBA maintenance problems
  • Loop through number sequences, constants, tables, schemata
  • Easily iterate query results, providing cursor-like functionality with clean syntax
  • Use conditional statements and statement blocks
  • Create and use variables
  • Expand variables in-place, turning them to constants in queries where variables are not allowed

QueryScript programs execute from within the server, or at the very least believe they are. As opposed to scripts written with Perl, Python or PHP, QueryScript code does not need to specify connections, logins nor passwords.

SEE ALSO

Execution, Implementations & downloads

 
Copyright © 2011-2012, Shlomi Noach