So today presented my with an interesting issue.  A simple INSERT statement being run by a functional account in my local mySQL install failed with the following message:

1227Access denied; you need the SUPER privilege for this operation

Mind you, this is working fine in production, and granting SUPER to a functional account defeats the entire purpose of database security.

After digging, it was brought to my attention that in my version of mySQL (5.0.67), the SUPER privilege is required to execute TRIGGERs, which this table did have.

Sure enough, dropping the TRIGGER allowed the query to be performed without issue.  The really interesting part is that after re-adding the TRIGGER, the query STILL worked.  I’m guessing there was something wrong with the time of the user creation vs. the TRIGGER creation in my local environment.

The bottom line is, if you are receiving an error about not having SUPER privileges for a simple query, try dropping any triggers and re-adding them.

Written on May 8th, 2013 , mySQL

One of the most time-consuming “busy work” tasks of developing a project always seems to be coding the data layer.  Using an ORM framework seems to help keep this work high-level and flexible (as well as giving you transactional support and other perks for free).  On one of my current PHP projects, I have been experimenting with using Propel as an ORM framework and have been very impressed so far.  It is relatively easy to set up and use (but don’t take my word for it; take a look for yourself).

I ran into a problem today that was deceptively easy to solve, although not so easy to find help with.  I had two foreign keys in my query that both referred back to the UserDirectory table and required multiple JOINs to the table.

It is farily easy to do this in plain SQL:


SELECT *
FROM unit u
INNER JOIN directoryUser dOwner ON Unit.UserId = dOwner. id
LEFT OUTER JOIN unitApproval ua ON u.id = ua.UnitId
LEFT OUTER JOIN directoryUser dByWhom ON ua.ByWhom = dByWhom.id
WHERE u.id = $_REQUEST["id"]

The real strength of Propel’s API is how dirt simple it is.  A basic join on a table is super easy, although what threw me off a bit is that it uses the PHP table name:


$u = UnitQuery::create()
->joinWith("DirectoryUser")
->findById($_REQUEST["id"]);

I was Googling up a storm.  I was digging around the ModelCriteria class.  All the time the answer was painfully simple and intuitive.


$u = UnitQuery::create()
->joinWith("DirectoryUser dOwner")
->leftJoinWith("UnitWeeks")
->leftJoinWith("UnitApproval")
->leftJoinWith("UnitApproval.DirectoryUser dByWhom")
->findById($_REQUEST["id"]);

Works like a champ!  Now that was easy!

Written on December 6th, 2012 , Tech

So I’ve got an application that includes several tooltips for providing a bit of “help” information to users.  Basically, the user hovers over a question mark image and then the help text is displayed in a stylized widget that behaves like the browser tooltip.

Being generally all about using jQuery for my ajax / UI needs, and also being generally lazy about writing more code than I have to or reinventing the wheel, I was using a jQuery tooltip plugin by Jörn Zaefferer: nice and easy to set up; simple, clean interface — works great in the simple case, where everything is visible and static on the page.

Read the rest of this entry »

Written on April 9th, 2012 , Javascript, jQuery, Tech

I’ve been thinking a lot about programming pedagogy lately and today had the occasion to start looking for a good “first book” for a friend who wanted to introduce his son to programming.  Along the way, I came across an old post from the Joel on Software blog on getting “Back to Basics.”

Do take a look at the original post, especially if you are interested in programming.  I find it interesting for at least a few reasons:

Read the rest of this entry »

Written on March 31st, 2012 , Tech

At work we are working on a project that involves pushing out correspondence to students.  This necessitates sorting by multiple factors, including name, homeroom, etc.  This is trivial when using SQL ORDER BY, but I already had all the information I needed in the business objects, so I really needed to implement a mult-field sort in Java.

The algorithm works off of the same principals as ORDER BY.  A list of field names and objects are passed in and then the objects are hierarchically (i.e. recursively) sorted using reflection and each of the field names passed in.  It’s pretty sweet in that the field list can be arbitrarily deep and it is not tied to a specific object type.

As I was trying to solve a specific problem, there are several limitations: Read the rest of this entry »

Written on December 22nd, 2011 , Java, Tech

Rehearsing Creation is proudly powered by WordPress and the Theme Adventure by Eric Schwarz
Entries (RSS) and Comments (RSS).

Rehearsing Creation

Musings on faith, technology, the arts, and life