Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Previous 30 Newer Entries Showing entries 31 to 60 of 103 Next 30 Older Entries

Displaying posts with tag: coding (reset)

Making Maatkit more Open Source one step at a time
+0 Vote Up -0Vote Down

If you’ve been holding out for that golden opportunity, now’s a great time to get involved in Maatkit.

Until now I haven’t really made a conscious effort to open-source the decision process and get people involved; Maatkit has been largely driven by so-called “real-world needs,” as perceived through my little lens on the world (and emails from the whole Percona team telling me when something’s wrong). I guess I am likely to remain some kind of benevolent dictator, because I created Maatkit and historically I’m the main hacker. But it doesn’t have to stay that way, and the project and users will be better off if it doesn’t.

So I’ve been trying to break out of the rut of just having some little email exchange with

  [Read more...]
Python Scripting in Workbench
Employee_Team +0 Vote Up -0Vote Down

Python support has been added to the latest version of MySQL Workbench.

In addition to Lua, you can now write scripts and modules or interact with the GRT shell using the Python language. The integration allows you to use GRT objects and modules mostly in the same way you would do with normal Python objects. The built-in grt module contains everything related to the GRT that’s exposed to Python, including:

  • custom types for GRT lists, dicts and objects
  • wrappers for GRT classes, that can be used and instantiated as a normal Python class;
  • wrappers for registered GRT modules, that can be used like normal modules;
  • a reference to the root node of the GRT globals tree;

You can inspect these objects with the standard dir() command and in some cases with help(), to access

  [Read more...]
MySQL University: Good Coding Style
Employee +0 Vote Up -0Vote Down

This Thursday (March 5th, 14:00 UTC), Konstantin Osipov will give a MySQL University session on Good Coding Style. Konstantin is the lead of the server runtime environment team, and has been around at MySQL since 2003.

For MySQL University sessions, point your browser to this page. You need a browser with a working Flash plugin. You may register for a Dimdim account, but you don't have to. (Dimdim is the conferencing system we're using for MySQL University sessions. It provides integrated voice streaming, chat, whiteboard, session recording, and more.) All MySQL

  [Read more...]
MySQL Workbench - LUA-Script For Batch Renaming Of Foreign Keys
Employee_Team +0 Vote Up -0Vote Down

Yesterday there was a short discussion on our public IRC channel (#workbench on freenode). It was about how Workbench handles Foreign-Key-Names.

Especially if you intend to use Synchronization feature (available in SE edition only) its good to have names for FKs (and their coresponding Indices). Workbench does that by default if you’re using the Relationship-tools (Hotkeys 1 to 6 when canvas is focused). But if you prefer to create your FKs in a not-so-visual way (entering the values on the FK-Tab in the table-Editor) you are on your own when it comes to naming your FKs. Though Workbench initially only accepts creating keys after you typed a name into the name-field theres still the possibility to rename the FK later to even empty names. If you try to create empty named FKs on a MySQL Server the server will generate a name for the key.

If you want to change FK names later, when your model

  [Read more...]
MySQL Storage Engine based on PHP
Employee +0 Vote Up -0Vote Down

Sometimes one has weird ideas, or am I the only one? - This specific one is at least a year old, now, during the Christmas days, waiting for New Year's Eve I had the time and mood to finally try it out: MySQL 5.1 has a plugin interface to easily add storage engines. PHP can easily embedded into other applications.  So why not combine these two things? - Writing a MySQL Storage Engine which reads data by calling a PHP script.

Let's start with a simple example first:

<?phpfunction create_table($table, $data) {
    return true;
}

function open_table($table) {
    return new ArrayIterator(array(




  [Read more...]
Direct MySQL Stream Access
Employee +0 Vote Up -0Vote Down

Ever wondered what your PHP application and MySQL actually do? An experimental mysqlnd branch will give you full access to the network communication stream. Using a custom PHP stream filter you can then intercept the communication ... but let's start at the beginning:

When talking about mysqlnd - the mysql native driver for PHP - we always mention the fact it's native in a way that we're, when possible, using PHP infrastructure. The most common example here is the memory management. By directly using PHP's memory we can avoid unnecessary copies of data from the MySQL Client Library's memory into PHP memory.

<?php
$mysqli = mysqli_connect("localhost", "root", "",
  [Read more...]
Automate Figure Arrangement In Workbench
Employee_Team +0 Vote Up -0Vote Down

Initiated by a question on the forum I took some time to exercise my Workbench-Scripting-Knowledge. The question was, if it’s possible to do some figure-arrangement/organizing via scripts. To be more precise, the task I had to master was to get tables that have names starting with a given prefix moved into a new layer using scripts.

The function to create a new object - layer in this case - was an easy one. All you have to do is to use the function grtV.newObj(”workbench.model.Layer”). This function returns a handle to the created Layer. Finally, set the visual properties (color, position) and most important, the owner has to be set to the containing Diagram-object. Last step is to add the layer to the “layers” property of the Diagram-object.
The second step, which i put into a separate function, is to ask the user for the prefix to filter the desired tables/objects

  [Read more...]
The power of a good SQL naming convention
+0 Vote Up -0Vote Down
At my previous employer, one of the early decisions that had huge payoffs later was the SQL naming conventions. A good naming convention is more than just a nicety. It lets you write programs that don’t need to be told about the relationships among tables and columns. There are many ways to do this, [...]
More on DTrace ... and MySQL
Employee +0 Vote Up -0Vote Down

Angelo recently showed an easy way to dump SQL queries using DTrace, while reading the articles I felt that some important information is missing: The name of the user executing the query and the selected database. So I sat down a few minutes and tried to collect that data.

For the database name I found a quite simple solution: It is passed as parameter to the check_user() function to MySQL so we can easily add a thread-local variable to keep that name. Simple script for that:

#!/usr/sbin/dtrace -s

#pragma D option quiet

pid$1::*check_user*:entry
{
self->db = arg4 ? copyinstr(arg4) : "(no schema)";
}

pid$1::*dispatch_command*:entry
{
printf("%s: %s\n", self->db,










  [Read more...]
Launchpad improvements
+0 Vote Up -0Vote Down



Launchpad, the development framework created by Canonical, is under constant development.
If you have never used it, have a look at Jay's getting started and code management articles about it. If you know it already, you may be pleased to know that Launchpad has a countinuous edge beta testing



  [Read more...]
Pimp My Workbench
Employee_Team +0 Vote Up -0Vote Down

Some weeks ago there was a request about adding a feature that keeps (or gets) datatypes of colums, which are connected via foreign keys, in sync. While we have added this to our ToDo list, I thought of doing some simple LUA exercises to give the user at least a funtion to check if the FKs in the model all have columns with matching datatypes.
As it turned out such tasks can be done quite easily using our GRT-shell. And by writing some functions you can add features to Workbenchs interface.

To get in touch with the shell/GRT environment inside Workbench click the tiny black prompt-window-icon in the top right area of workbench (or choose ‘View->Advanced->GRT Shell’ from the main menu).  Some items in the UI are swapped/added: the sidebar on the right side gets a new tab named ‘GRT Shell’ featuring some more tool-panes (GRT Tree, Modules, Inspector) and on the bottom


  [Read more...]
How to unit-test code that interacts with a database
+0 Vote Up -0Vote Down

I got some interesting comments on my previous article about unit testing Maatkit, including echoes of my own conversion to the unit-testing religion. One of the objections I’ve heard a lot about unit-testing is how it’s impossible to test code that talks to a database. “It’s too hard,” they say. “Oh, it’s easy to test a module that calculates a square root, but a database? Way too much work!”

Note: As commenters have pointed out, I’m not necessarily using “unit” in the agreed-upon way here. Everything I say can be applied to ultra-pure unit testing too, but I go beyond that. I will hold fast to my assertions about mocking though *grin*

Is it really  [Read more...]

How Maatkit benefits from test-driven development
+0 Vote Up -0Vote Down

Over in Maatkit-land, Daniel Nichter and I practice test-first programming, AKA test-driven development. That is, we write tests for each new feature or to catch regressions on each bug we fix. And — this is crucial — we write the tests before we write the code.* The tests should initially fail, which is a validation that the new code actually works and the tests actually verify this. If we don’t first write a failing testcase, then our code lacks a very important guarantee: “if you break this code, then the test case will tell you so.” (A test that doesn’t fail when the code fails isn’t worth writing.)

Most of the time when I do this, I write a test, it fails

  [Read more...]
MySQL challenge: LIMIT rows accessed, not rows returned
+0 Vote Up -0Vote Down

Dear reader, this is a challenge. How’s your MySQL prowess? You know about LIMIT: it cuts off the results at the specified number.

mysql>s; select actor_id from sakila.actor where actor_id % 5 = 0 limit 5;
+----------+
| actor_id |
+----------+
|        5 | 
|       10 | 
|       15 | 
|       20 | 
|       25 | 
+----------+
5 rows in set (0.00 sec)

But that query actually accessed 25 rows. What if I want to say “return up to 5 rows, but don’t read any more than 20 rows to find them?”

Right now I’ve got the following:

mysql> select actor_id, @rows
    -> from actor, (select @rows := 0) as x where
    ->    ((@rows := @rows + 1) <= 20)
    ->    and actor_id % 5 = 0 
    -> limit 5;
+----------+-------+
| actor_id | @rows |
+----------+-------+
  [Read more...]
MySQL Workbench progress update on Linux port
Employee_Team +0 Vote Up -0Vote Down

As you probably know, or at least heard, we are currently porting Workbench to Linux. Generally speaking the porting process is split in several stages. The first one is to compile non-GUI Back-End which represents about 80% of the total application code. The next stage is to ensure that unit-tests are run correctly for the ported stuff. The third is to create user interface and to bind it to the back-end/core. After that we will have alpha version of Workbench for Linux.
Regarding tests, actually a portion of unit-tests are already passed. These are 121 of 122 going well. At the moment we are working on non-GUI back-end, and core part is compiled and run, so now the modules and plugins are in progress. I must admit that process of porting is pretty smooth, most of the code has already been prepared with Linux/OS X ports in mind. I will be posting our progress on the porting efforts frequently, please keep checking our blog.

Live from the Workbench Kiev Meeting
Employee_Team +0 Vote Up -0Vote Down

It is 23:30 here in Kiev and we are closing the first day of our team meeting.

After my Kick-Off and general discussion of the road-map Tax took over and was discussing the QA aspect of our WB 5.0 releases so far. We analyzed the rate of incoming bugs vs. the number of bug fixes and the time spans between Alpha, Beta, RCs and GA releases. That helps us to make better predictions in the future.

After the lunch break Alfredo presented his conversion of the GRT (WB core system) from the current C implementation to a cleaner C++ version and we forgot about the time discussing all the details of this complex tasks. We will squeeze in the rest of the planned sessions for today (Linux Porting Challenges, Feature Discussion - Visual Query Builder) tomorrow morning - but this was a very important discussion to have.

We went out for dinner and just as we walked outside it started raining. The center

  [Read more...]
MySQL Workbench Team Meeting Coming Up
Employee_Team +0 Vote Up -0Vote Down

After our MySQL Workbench 5.0 GA release and a hotfix release a week later it is time to start our efforts on the next releases. As many of you might already know, my team is highly distributed and when doing planning tasks it is always good to sit together in a single room. So we will be meeting in Kiev, Ukraine next week.We are going to discuss the progress we have already made on the Linux / OS X / Solaris ports but the main focus will be in the new features for the next main release.A big thank you to everybody who posted their ideas on the forum. If you have not posted yet you are welcome to do so. Everything that is submitted before next week will be considered.

Next MySQL Workbench 5.0.20 Release Almost Ready To Ship
Employee_Team +0 Vote Up -0Vote Down

As promised we are continuing our strong efforts after reaching GA and our announcement at the MySQL Users Conference (find a nice press article here).

Alfredo managed to fix a serious bug that almost seemed to be of random nature and happened on certain OnMouseDown and OnMouseUp events on the canvas.

Another thing that got improved is the drawing order of connections between table figures on the canvas. Previously the connections would be drawn on top of tables, resulting in a messy image. Now connections are always drawn behind tables. To make that work we had to remove the nesting of layers - a feature that does not really make sense for a database tool anyway.

The team will meet in the week of May 12th in Kiev where we are going to define the detailed plans for Workbench 5.1

  [Read more...]
Opensource GoogleGears
+0 Vote Up -0Vote Down

The last day I’m suffering from different thoughts. So I’ve decided to share’em with you.

It is really possible to create the application such as gears, but independent from Google, that will run on most platofrms and browsers. What we need:

  • Compile embeded MySQL (very lite edition) for most platforms (Windows, Linux and MacOSX, I believe that would be enough)
  • Create Java Applet and JNI-wrapping library to access MySQL
  • Create JavaScript library that will access MySQL through the applet

And that’s all. To use it you will need just to include the applet and JS-library into your page, after the first load applet will detect platform and will download embeded MySQL and native libraries.

How to install and maintain multiple WordPress blogs easily
+0 Vote Up -0Vote Down

My wife has a site that needs two WordPress blog installations. The URLs differ by a subdirectory name. Both blogs need to be (URL-wise) subdirectories of /blog/. They need to be completely independent of each other, yet use the same custom theme. And there used to be just a single blog, which was not in a subdirectory; its permalinks must not break. (It has nice URLs with the date and title in them, not post ID-style URLs). And because I’m the husband, I get to maintain it, so tack “easy to maintain” onto the requirements (it must be easy to upgrade WP in both blogs, for example). In this article I’ll show you how I did it with a single .htaccess file, a single copy of WordPress, two MySQL databases, and a single configuration file.

Fixing URLs

As I mentioned, there used to be a blog at

  [Read more...]
MySQL Workbench Release Candidate Coming Up
Employee_Team +0 Vote Up -0Vote Down

With the great help we receive from community and SE Beta testers we are marching towards RC quality with large steps. This week we hope to remove the last obstacles (mostly printing, some canvas problems and some synchronization problems) that are holding us back and to be able to close all open P1 & P2 bugs. If we achieve all this we will upload the RC1 (Release Candidate 1) build.

As a bonus we have now added the much requested “direct connection” notation between columns (better know as MS Access style notation) to the Standard Edition - a feature that has been requested since the old DBDesigner4 days. Personally, I am not so found of this notation because it limits the connection points to the left and right of the individual PK- and FK-columns which makes it harder to have a nice looking model. But given the flexibility of Workbench to hold an unlimited number of smaller diagrams

  [Read more...]
A very fast FNV hash function for MySQL
+0 Vote Up -0Vote Down

I wrote a User-Defined Function that implements the FNV (Fowler-Voll-No) hash function for MySQL. I’m not the first person to do this — in fact, I was inspired by the Google patches for MySQL. But my implementation is a little bit different from most, in a very important way that leads directly to much higher performance, especially suited for the Maatkit tools.

A bit of background: FNV hashing is a very fast hash algorithm that operates in fixed memory. It is widely used in lots of important areas in computer science. My implementation requires absolutely no malloc() calls, which is a darn good thing because I am not to be trusted with

  [Read more...]
New MySQL Workbench Release Coming Up
Employee_Team +0 Vote Up -0Vote Down

We are about to release the next Beta version of MySQL Workbench. There are no new additions like in the last release. This will strictly be a bug-fix build. Apart from several smaller fixes this build will see an improved software rendering performance. Alfredo has blogged about the changes in his last post. And the changes are really paying off. Tax tested it on several machines and found the speed to be acceptable even on older machines.

The slow and flickering software rendering has been one of the major points of complain (except from the yet missing Linux and OS X versions that will be released later this year). Now that this is out of the way we are marching towards the RC level, fast.

If there are no new obstacles the release build will happen later today. Markus from the web team will get online on Saturday or early Sunday to update the download pages. Then we will send out the announce emails asap.

Tell me what your code looks like?
Employee_Team +0 Vote Up -0Vote Down

From time to time it is necessary to get a bigger picture of your project in terms of size, test coverage, code vs. comments ratio and others (aka metrics). While it is quite difficult to find a good (and free) code coverage tool for C++ there is already a very nice tool package called DPack, which is not only freely available but also gives us some very useful additions in our IDE. One of those features is code statistics.

(more…)

Next Workbench Beta Release Coming Soon
Employee_Team +0 Vote Up -0Vote Down

We are working hard on the next Workbench Beta release that should be out mid next week. It will include a list of top priority bug fixes as usual but also two new additions that have been requested by our beta testers.

The new Online Update menu item allows to update your current installation to the latest available release right from within the tool. No need manually browse web pages anymore - at least if you are using the MSI based packages. The reason we are not offering this for the zip packages is that an automatic update is tricky since you might have made a custom install based on your needs. If you are using the zip packages you can keep using the normal Version Check menu item that will inform you about the version you have installed and if a new release is available.

The second addition is a better reporting after schema diffs. We added the templating

  [Read more...]
MySQL Workbench: Lua Plugin Support
Employee_Team +0 Vote Up -0Vote Down

The Lua plugin support has been finally fixed and will be working in the next release. Together with a few other improvements, it’s now possible to write your own commands to do all kinds of tasks. Documentation for the plugin system is not yet written (and the previous one is outdated), but it should be straightforward to copy the supplied Lua plugin and change it to do something else. All you need is to know a little Lua (which is a simple scripting language) and explore Workbench internals using the GRT Shell (View -> Advanced -> GRT Shell).The sample Lua plugin is located in the modules folder. You can copy it to the custom plugins folder which is shown in the GRT Shell at startup and change things like the module name and add your own functions. I’ll write more about how to write such functions in a future post, like after the next WB is actually

  [Read more...]
PHP + MySQL on Leopard
+0 Vote Up -0Vote Down

I’ve just tried to run PHP with MySQL on my Leopard and the first problem: “Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’”

I’ve just changed php.ini to:
mysql.default_socket = /tmp/mysql.sock
The same situation with mysqli settings - be default it is not set so you should update it to the real path.
And it works!

What?s New In The Upcoming 5.0.11 Release
Employee_Team +0 Vote Up -0Vote Down

Apart from more than 60 bug fixes the upcoming MySQL Workbench 5.0.11 release will contain a few major improvements in respect to the last release two weeks ago.

  • The partitioning settings are now fully supported during reverse engineering of SQL scripts and live database and CREATE / ALTER generation for synchronizations. We had a preliminary implementation but this has been replaced by full parser support.
  • Addition of Standard Insert grid input. Instead of having to type in the full INSERT statements the initial/test data can now be entered by using a data grid.
  • Improved formatting of generated SQL output.
  • Improved GRT Shell console. This is in preparation of the upcoming tutorials on the scripting- and plugin writing possibilities

The show-stopper bug that is holding back the release is now fixed. We will run detailed tests tomorrow and if nothing else

  [Read more...]
Workbench 5.0.11 Release Delayed
Employee_Team +0 Vote Up -0Vote Down

I prepared the release builds for 5.0.11 yesterday evening and they have been uploaded to the mirrors. All automated tests passed without error and my initial manual tests showed everything working. Nevertheless Tax found a show-stopper bug later today following our manual testing procedures.

The problem is located in the SQL generation code for tables. We introduced a new internal index type for foreign key index columns that is maintained automatically by the tool. This new type caused the generated SQL to be corrupt. We tried a simply fix today but were not able to fully solve it. We will take time tomorrow to properly fix the issue and I will trigger new build after that. Then it will take about 20h till the mirrors have catched up and we can announce the new release.

Sorry for the delay.

Next Release Coming Soon
Employee_Team +0 Vote Up -0Vote Down

We are working hard on the next release of MySQL Workbench and are trying to follow our plan of getting a release out every second week. A lot of things have already been addressed, some new things came up. But we are clearly moving into the right direction and our investments in unit tests and UI tests seems to pay off as expected. More details in a post later this week.

Previous 30 Newer Entries Showing entries 31 to 60 of 103 Next 30 Older Entries

Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.