Version 1.1.3, June 26 1998
This Handbook describes KMySql Version 1.1.3
KMySql is a database client primarily designed for MySQL. Since it uses a plugin system to access database, it may be used to access others databases.
The first goal of KMySql is to provide a fully usable client in remplacement of the standard text mode client of mysql. This is mostly complete since KMySql lets the user sens any SQL requests to the server. On top of that, KMySql can manage several servers at the same time.
Secondary, KMySql is indented to provide easy GUI access to database. This is far from being complete, but some features are already present: tree view making databases easy to browse, a tabular view displaying query results, a mostly completed table editor, a form feature.
What KMySql is not: A database server. MS Access. A finished stable application.
KMySql archives are available from the main KMySql site. You can also find it at the KDE ftp site. KMySql is available in source format (tar.gz) and i386 binary format (rpm). To install binary archive, the following instruction should work fine (if not refer to rpm manual page):
rpm -Uvh kmysql-x.x.x-i386.rpmTo compile and install source package, follow these simple steps:
tar zxfv kmysql-x.x.x.tar.gz cd kmysql-x.x.x ./configure make make install (as root)You must also install one or more plugins to make KMySql working. Please refer to their specific manuals to install them.
After installation, you can run KMySql just typing kmysql &
at the command line.
You can also run it from the panel, after restarting it if necessary.
In all cases, this will only work if your KDE bin dir (probably /opy/kde/bin) appears in your PATH.
If you need help on this subject, please refer to your KDE documentation
Before anything else, you must say to KMySql which plugin you want to use. To install one, select the File/Modules... menu, and then click Add. The you must indicate the plugin path. A plugin name is of the form: kmp_xxxxxx.so. By default they are installed in $KDEDIR/apps/kmysql/plugins.
After installing at least one plugin, you can connect to a server selecting File/Add server and filling the appearing form. Use the combo box to select the server type you want to connect. Each plugin corresponds to a specific server type. After clicking on Ok and if everything goes ok, you will see a new element in the tree view on the left. To connect to this server, use the context menu (right click on it) and select Connect, or double click on it. You will then be able to browse this server in the tree view.
The tree view is the control center of KMySql, via context menus. Each element of the tree view has a specific context menu, please try them out! You can also double click on some of them. For example, double-clicking a a table does a select * on it. You can also create/drop bases and tables via context menus. Note that you only see databases you can connect to.
When an action returns data (select ... for example), it is displayed in the tabular view on the right side on the main window. You can also look at the status bar for informations about what happens.
So far only basic features are GUI-accessible. You will surely want to send hand-made queries to your server. To do that, just type them in the edit box just under the tree view and click the Submit button. You can also press Ctrl-Enter to submit your query. You will notice that every new and correct query you send is displayed in the list at the bottom of the main window, which is the queries history. To send one again, just double-click on it.
Select File/Settings menu to set up KMySql. Note that setting includes current plugins and servers configurations, and if you save settings, KMySql will remember installed settings and servers which are present in the tree view.
Forms are useful when you want to make queries from data submiteted in a nice GUI window. This can be useful for several reasons:
In KMySql forms are associated with bases. To create a form, right-click on a base and select New form. A dialog box appears. You can give a name to your form. Then you will add as many fields as you want, clicking the Add button. So far there are only two types of fields: text and combo box. Try them out!
After creating all fields of your form you can select File/Preview to see what your form will look.
Then you must enter the query that will be executed when your form will be submited. Type it in the edit box on the bottom. Of course, this will be usefull only if you use data submited in the form. In order to do that, you can use the value of each field in the query, just type its name between '%'. For example, if you have a field named Name, you can get the value entered in this field by the user of your form by %Name%.
When your form is completed, select the Form/Save menu. If nothing goes wrong, you will see a new form in the tree-view appearing under the selected base. Right click on it and a contextual menu will appear.
To execute your form, select Execute in the contextual menu, or double-click on your form.
Note that the forms are stored in the database itself. So you must set rights correctly to be able to
create forms in a given base. If you want to control access to forms specifically, you must know that KMySql
uses two tables to store forms: __KmysqlForms
and __KmysqlFields
.
They are not shown in the tree view but you can access them via SQL queries. These two tables are
created in every base where forms are used. Please contact your database administrator if you encounter problems.
A good idea would be to give only read-access to these two tables for the final user, and give write access to a
forms manager.
Let's say you have a very simple table named Friends, with two fields named name and city containig text (VARCHAR(127) for example). Of course, you can enter rows in it by hand,entering a INSERT INTO Friends VALUES... query. But let's see how this could be done via a form.
Right-click on the base containing our table and select New form. Give it a name like New friend. Then add two text fields named Name and City. Then enter the following query:
INSERT INTO Friends (name, city) VALUES ('%Name%', '%City%')This will add a new entry in your table using the data collected in the form. Note that if you expect the form's user to enter text in a field you must supply quotes by yourself in the query, otherwise you will get a syntax error. Now save your form and try it!
We will now create a form to find users within your table. Let's create a new form named Look for friend and containing the same two fields Name and City. Then enter the following query:
SELECT * FROM Friends where ('%Name%'='' or name='%Name%') and ('%City%'='' or city='%City%')Note that this query lets the form's user to left one or more fields blanks using
'%Field%'=''
in a OR
statement.
Before adding a server, you must install a plugin via the File/Modules menu. See chapter 2.1.
Please send me a mail describing precisely your system and the reported error. KMySql is supposed to work properly with Qt >= 1.42 and KDE >= 1.1.1. If you use older versions, please upgrade before sending emails ;)
There is no way to do this via the GUI so far, this is planned to be done very soon. Of course, that can be done via hand-typed queries and forms.
There is no other plugin so far ;( But a plugin for mSQL will be available very soon, and plugins for other databases will probably come one day!
Cool! Just mail me before, in order to prevent the same plugin to be written several times! I recommend to look at the mysql plugin to see how to do that. Note that KMySql installs all needed headers files in $KDEDIR/include/kmysql/.
Please don't ask me questions about MySQL itself. Please consult its very complete manual or contact http://www.mysql.org. I don't have time enough to answer such questions, and I surely don't know everything about MySQL!
Here is the KMySql hompage: www.penguinpowered.com/~kmysql.
If you have problems with KMySql, please mail here: kmysql@penguinpowered.com
There is a mailing list for KMySql, where I send KMySql related messages. Please send a mail here with 'subscribe' in the subject.
Author: Frédérik BILHAUT bilhaut_f@mail.cpod.fr
Some links: KDE, MySQL, Freshmeat.net