SQL Plugin |
Prev | Working with Plugins | Next |
The Structured Query Language (SQL) is a specialized language for updating, deleting, and requesting information from databases.
The Kate SQL Plugin allows you to:
Create a database
Connect to existing databases
Insert and delete data in the database
Execute queries
Display results in a table
Select from the menu or toolbar, and then select the Qt database driver you want to use (including QSQLITE, QMYSQL3, QMYSQL, QODBC3, QODBC, QPSQL7, and QPSQL). If you can't see the desired driver, you need to install it. Then, press
If the database you selected uses a file, simply indicate the database's location and press the button. If it requires connecting to a server, you must enter the hostname of the server, your username and password, and any other information that particular driver may require. Then press
Finally, give a name to your connection, and press .
You can insert, delete, and update data using the SQL plugin just like you would from the command line or from within a program. Simply enter a query and press the .
Example 4.1. Some Example Queries
INSERT INTOtable_name
("feature1
", "feature2
", "feature3
", "feature4
", "feature5
") VALUES ("value1
", "value2
", "value3
", "value4
", "value5
" )
DELETE FROMtable_name
WHERE name = "text
"
UPDATEtable_name
SET "feature1
" = "text
", "feature2
" = "text
", "feature3
" = "text
", "feature4
" = "text
", "feature5
" = "text
"
After running a SELECT query, you can view the results as a table that will appear in the SQL Data Output tool view at the bottom of Kate, or as text in the SQL Text Output. If there is an error, you can see it in the text output.
In the SQL Data Output tool view, there are some buttons:
Changes the size of columns to fit their contents.
Changes the size of rows to fit their contents.
Selects all table contents and copies them to the clipboard buffer.
Exports all table contents to a file, the clipboard, or the current document in the Comma Separated Values format.
Removes everything from table view
You can now change the colors displayed in the table in the SQL section of → .
You can browse your database using the SQL Schema Browser tool view on the left. The information displayed varies depending on which database driver you are using.
To refresh this list, right-click anywhere in the tool view and select . To generate a query on any entry in the list, right-click on an entry, select , and select the query type (, , , and ) from the submenu that appears.
Adds a new connection using any database driver.
Removes the selected connection.
Edits the current connection's settings.
All database connections you have created are listed between the and menu items. Select one to run queries or make modification to it.
Runs your query.
Prev | Contents | Next |
Build Plugin | Up | GDB Plugin |