Planet MySQL Planet MySQL: Meta Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 10 of 103 10 Older Entries

Displaying posts with tag: coding (reset)

MySQL Workbench 6.0: Help is on the way…
Employee_Team +2 Vote Up -0Vote Down

Do you know this scenario: you are writing down  a stored procedure but you can’t for the life of you remember the exact syntax of that CASE statement? Has it to end with CASE or not? Can I use more than one WHEN part and how should that be written? Usually you end up opening a web page and read through the excellent MySQL online docs. However, this might cost too much time if you quickly need different statements and other detail info. Here’s where MySQL Workbench’s context help jumps in.

The server can help

It’s probably only known to the die-hard terminal operators who write most of their SQL queries in a MySQL console window: the MySQL server already has a stripped down set of help topics produced by the Docs team. That means you can always get at least the syntax but often

  [Read more...]
Building MySQL Database Applications with Go
+1 Vote Up -0Vote Down

Last night at the Golang-DC meetup I spoke about building (MySQL) database applications with Go. The meetup was well attended and people were very enthusiastic about Go. I spent a few minutes talking about Go in general, how VividCortex uses Go (we’ve built our agents, API servers, and all backend processes with Go), why we like it, some of the nice things it enables like making it easy to build very resilient programs, and then I gave the presentation, which I’ve embedded below.

Afterwards the discussion ranged to a lot of related topics. This was the best part of the evening for me. There were really great questions on a variety of topics, and insightful answers from everyone.

MySQL Workbench: Script for adding columns to all tables in a model
Employee_Team +0 Vote Up -0Vote Down

Here’s a quick Python script for adding columns for all tables in your EER model. This will create a create_time and update_time columns in all tables, but you can modify it to your needs. To execute:

  • go to Scripting -> Scripting Shell…
  • click the New Script toolbar icon at the top left corner
  • select Python Script and specify some name for the script file
  • click Create
  • copy/paste the script there
  • click the Execute toolbar button
  • Make sure to backup your model before running this!

    The code

    # get a reference to the schema in the model. This will get the 1st schema in it.
    schema = grt.root.wb.doc.physicalModels[0].catalog.schemata[0]
    # iterate through all tables
    for table in schema.tables:
        # create a new column object and set its name
        column = grt.classes.db_mysql_Column()
        column.name = "create_time"
        # add it
      [Read more...]
    mysqlnd_qc and Symfony2
    Employee +1 Vote Up -0Vote Down

    Previously I was writing about combining Symfony2 and mysqlnd to get more statistics on what is going on below the surface in the database communication when using a Symfony2 application via the Symfony2 profiler. Now that's not all that can be done and I gave some ideas for extending this. One idea was adding mysqlnd_qc support. mysqlnd_qc is the client side query cache plugin for mysqlnd. This provides a client-side cache for query results transparently without changing the application.

    <span id="XinhaEditingPostion"></span><span

      [Read more...]
    Symfony 2 and mysqlnd
    Employee +0 Vote Up -0Vote Down

    In a previous blog posting I was mentioning that I'm working on a small hobby PHP project. As I'm using this project to update myself to current frameworks I've decided to use Symfony2. Symfony provides a nice feature, which is the Symfony Profilier, an extensive logging and reporting system for Symfony2 developers to understand what's going on. A part of it is the Doctrine query logger which lists all database queries executed by Doctrine and their execution time.

    This is nice but when we're using mysqlnd in our PHP build we have more information available. "So why not use that information," I thought and built

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

    Roughly three years ago I was writing about Direct MySQL Stream Access - a way to access the low-level stream PHP's mysqlnd library is using. Back then this had been a patch against PHP's mysqli extension. As such a feature is quite dangerous (you can easily mess with the connection state which confuses mysqlnd and/or the MySQL server) we didn't push it into the main PHP tree. Now three years later it's time to look at this again as we don't need to patch PHP anymore.

    Since the mentioned patch was written mysqlnd got a plugin interface about which I was talking before. This plugin-interface, especially in the version of PHP 5.4, makes it trivial to implement this feature.

      [Read more...]
    mysqlnd plugins and json
    Employee +3 Vote Up -0Vote Down

    Some time ago I was already writing about the power included with mysqlnd plugins and how they can they can be used transparently to help you with your requirements without changing your code. But well, as mysqlnd plugins in fact are regular PHP extensions they can export functions to the PHP userland and providing complete new functionality.

    In my spare time I'm currently writing a shiny Web 2.0 application where I'm heavily using AJAX-like things, so what I do quite often in this application is, basically this: Check some pre-conditions (permissions etc.) then select some data from the database, do a fetch_all to get the complete result set as an array and run it through json_encode; or to have it in code:

    <?php
    $m = new MySQLi(/*...*/);
      [Read more...]
    Improvements for PHP application portability in PHP.next
    Employee +0 Vote Up -0Vote Down

    I was writing about PHP.next before, many things improved there meanwhile. Most notably we have a committed version number: The next PHP release will be called PHP 5.4. The topic I want to talk about today is "Improved application portability" which covers multiple small changes which aim at making it simpler for developers to write applications working on any PHP setup.

    Separating <?= from short_open_tags

    PHP knows quite a few ways to separate PHP code from surrounding text (usually HTML), most applications use <?php as that works on every system. There is a short form of this, <?, which can be disabled using php.ini's short_open_tags setting. Being able to disable this is important when embedding PHP

      [Read more...]
    Escaping from the statement mess
    Employee +2 Vote Up -0Vote Down

    One of the issues Web Developers face is making their application robust to prevent SQL injection attacks. Different approaches exist which help. Sometimes people use large abstraction layers (which, sometimes, don't make anything safe ...) and sometimes people use prepared statements as a way to secure queries. Now prepared statements were a nice invention some 30 years ago abut they weren't meant for making things secure and so they do have some shortcomings: One issue is that preparing and executing a query adds a round-trip to the server where it then requires resources. In a classic application this is no issue. The users starts the application up early in the morning and processes data multiple times so the prepared statement handle is re-used quite some time. The system benefits from early optimisations.  In a typical PHP Web application this isn't the

      [Read more...]
    What’s wrong with MMM?
    +5 Vote Up -0Vote Down

    I am not a fan of the MMM tool for managing MySQL replication. This is a topic of vigorous debate among different people, and even within Percona not everyone feels the same way, which is why I’m posting it here instead of on an official Percona blog. There is room for legitimate differences of opinion, and my opinion is just my opinion. Nonetheless, I think it’s important to share, because a lot of people think of MMM as a high availability tool, and that’s not a decision to take lightly. At some point I just have to step off the treadmill and write a blog post to create awareness of what I see as a really bad situation that needs to be stopped.

    I like software that is well documented and formally tested. A lot of software is usable even if it isn’t created by perfectionists. But there are two major things in the MySQL world for which I think we can

      [Read more...]
    Showing entries 1 to 10 of 103 10 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.