Posts Tagged ‘SQLEditor’

Rails Migrations and Schemas

Friday, February 26th, 2010
  • A schema.rb file is typically a ruby script containing a call to the ActiveRecord::Schema.define method.
  • A rails migration is a ruby class which inherits from ActiveRecord::Migration and contains a method called up

The useful fact that I realized only after doing some ultimately unnecessary work today is that because the schema file contains a method call, it’s actually easier to extract the information from it than with a migration (which needs SQLEditor to figure out a class name and then call the up method)

Hopefully this new work will appear soon in SQLEditor

SQLEditor 1.6 final

Wednesday, January 6th, 2010

So, if you’ve seen SQLEditor recently, you’ll hopefully have seen that there is a new version out: version 1.6. This got released just at the beginning of December 2009

1.6 is something that I’ve been working on now for a long time, it is essentially (the unreleased) version 1.5 with improvements and updates. In particular it contains a SQL parser that was written using ANTLR and a new JNI based system for using JDBC drivers with support for Java 6 JDBC drivers.

It’s also the first release version of SQLEditor that is compatible with Snow Leopard. SQLEditor 1.4.7 and earlier had an unusual architecture. When I originally started writing SQLEditor, it was a Java application with a Swing user interface. After some development it seemed clear that java swing was proving limited in some ways. I rewrote the user interface layer in Cocoa, leaving the model layer in Java and using Cocoa Java to connect the two parts together. The application development continued and new versions were released. Eventually though, Apple decided that Cocoa Java was not the future and decided to deprecate it.

Work began immediately on rewriting the crucial components of SQLEditor, although there were some issues.

The first was the model code. Every object in an SQLEditor document is represented by an object and all of the code for these objects was written in Java. All of the object code was rewritten and tested against the earlier versions to check that it still worked. It was very important that files from previous versions continued to work (and as far as I know all of them so far do). New code was written to read and write the SQLEditor document xml format.

The second major issue was that the database interface used JDBC drivers, which are written in Java. Native code would use ODBC drivers. Although similar this might mean that users wouldn’t be able to use existing arrangements to access databases.

Eventually code was written to bridge between SQLEditor native code and the JDBC drivers using the Java Native Interface (JNI).

The other crucial problem was the SQL parser. This is used if you paste SQL code into SQLEditor or if you import a file. The SQL parser was written using JavaCC, a parser generator that is written in and produces Java code. Several parser generators were looked at to replace JavaCC and eventually ANTLR was chosen.

A new SQL parser was written and tested during 2009 in ANTLR and is included in SQLEditor 1.6. The new parser is completely rewritten compared to the one that existed in SQLEditor 1.4.7 and no code is shared between them.

A major step in developing the new parser was to port all of the SQL test cases from Java (in 1.4.7) to objective C (in 1.6). These automated unit tests are run against the parser to ensure that the new parser behaves correctly compared to both the 1.4.7 parser and the assorted SQL standards.

It is still something of a work in progress though, there are things it doesn’t support and it’s still being actively worked on. One particular thing that makes this somewhat harder than it might otherwise be is that it must accept SQL in several different dialects, not just a single standard.

SQLEditor 1.6 also included user interface improvements and various performance fixes.

Overall it’s an improved program, although I do wish that it had been released sooner.

Thanks to everyone using SQLEditor for your patience and also for trying the beta versions.

SQLEditor 1.4.4 Released

Thursday, April 30th, 2009

SQLEditor 1.4.4 was just released on Tuesday, the main feature improvement is the support for compound foreign keys. I posted a bit about this before and the final version is pretty much the same as I described.

Unfortunately there were a couple of bugs that slipped through relating to clicking objects. :-(

These are going to be fixed in a point release that should appear soon.

The new version is available from the automatic update system or download here:


3.9MB dmg File
Change Log
Product Notes
Expires
21st January 2009

SQLEditor: Compound Foreign Keys

Thursday, April 9th, 2009

The newest version of SQLEditor (1.4.4b1) now has support for compound foreign keys. This is something that people have been asking about for a while now, so I’m pleased that it got included.

There are some things that may need to be improved, but I’m fairly happy with the first revision of this.

Diagram showing compound foreign key

Diagram showing compound foreign key

The compound foreign key object is a new table level object that you can add from the Object menu just like a field or index. Then you drag from the foreign key to the target table. Finally you use the inspector to create pairs of columns to link together.

When importing from a database SQLEditor will try to create field-to-field links on foreign keys with only 1 pair of columns unless you tell it otherwise. (There is a new preference to do this)

Support is fairly complete, SQL parsing, database import, database export and SQL export are all available so it should work fairly well. I think the only thing it doesn’t do is auto-create indexes, so you may need to do this by hand on referenced columns (for those databases that need this)

There is naturally a new inspector palette to go with the table object.

Compound foreign key inspector

Compound foreign key inspector

This allows you to add pairs of columns using the + button at the bottom. Choose your columns using the little popup menus.

The whole thing is completely new, so please send in your thoughts to the usual address.

Download SQLEditor 1.4.4b1

(or enable the “Check for beta versions” preference and then use the check for updates feature)

SQLEditor 1.4.3b3

Monday, December 22nd, 2008

So, it’s coming up to the holidays, but there is time for another SQLEditor release.

1.4.3b3 (snappy numbering, yes?) is pretty much a bug fix release. I think that the index creation problems that were happening have now been fixed, plus better handling of when to create indexes. It should now correctly figure out if fields are indexed and shouldn’t now add duplicates (or worse attempt to add duplicates)

There is also the addition of the simulate mode for database export. This isn’t exactly new, because it’s been available in some development builds, but it has now appeared in a release version. Simulate mode runs the entire export as normal, except that instructions that alter the database aren’t actually sent to the database to be executed. The instructions are recorded though, so you can see what would have happened in the status window log view.

There is also a new feature which prevents fields and indexes being dropped (although it doesn’t prevent modification, use simulate if that’s what you want)

SQLEditor also now adds a line in the status window when an export fails complete with the instructions that were actually executed and the error that occurred. This information was always in the log, but it should be easier to see how SQLEditor has gone wrong (in the event that it does of course)

Finally some fixes for a few (hopefully unlikely) crashing bugs.

3.6MB dmg File

Change Log
Product Notes
Expires
21st January 2009

MySQL before 4.1?

Tuesday, December 2nd, 2008

This graph appears to show that most people polled (97%) are using MySQL 4.1 or later

This second poll shows, again, that most people (89%) are using 4.1 or later.

The thread at the PunBB forum gives 95% of people polled using 4.1 or later.

The Mambo forum poll from 2006 gives 80% using versions after 4.1 (with 8.5% don’t know or other)

Admittedly not scientific surveys (self selection, etc) but somewhat convincing.

This has an obvious implication on how to handle MySQL support, in particular special casing to work around particular issues in early versions. This code adds complexity and in some unfortunate cases also bugs. The less there is, the better.

SQLEditor updates

Saturday, November 15th, 2008

I’ve just released a new version of SQLEditor yesterday, mainly as a bug fix release, but it’s definitely recommended to upgrade.

The new beta is 1.4.3b1 which was released 14th November. It fixes a number of bugs, including MySQL comments and some odd bugs relating to selecting tables using the drag selection method.

Download 1.4.3b1 (3.6MB DMG)

The current stable version is 1.4.2 which came out at the end of October. It fixed several significant bugs that people reported and made a few minor improvements.

Download 1.4.2 (3.6MB DMG)

Django Support

Thursday, November 6th, 2008

Several people have now asked for this, so it’s being really seriously looked at.

Plus I’m hopeful that it will be able to support the somewhat different but quite similar Google app engine model class format too

Having been working on this for the last few days, I can say that the Django plugin is moving towards a working state, the development version is now somewhat able to create and export a suitable python file.

Although this mustn’t be taken to mean that it’s near to release, because there are still several major things that are needed before it will be complete.

I think there will probably be two releases, the first will be export only, then a later release will add the import features.

And it should be a free upgrade for SQLEditor :-)

SQLEditor releases

Thursday, October 16th, 2008

This is another quick update about SQLEditor releases in the near future.

1.4.2b1

Currently version 1.4.2b1 is in beta release, it offers a few specific improvements

  • Added support for editing MySQL character set and collation settings on fields and tables
  • Modified inspector on fields to use popup menu for selecting tabs
  • Fixed bug that prevented saving files after creating new foreign keys when referencing primary keys in tables with indexes under certain circumstances.

1.4.2b2

1.4.2b2 is due fairly soon. The following improvements should definitely appear

  • Modified MySQL exporter to use ENGINE instead of TYPE for better compatibility
  • Comments now attached to fields when exporting MySQL
    (i.e COMMENT ‘xyz’ style)
  • Connector inspector is now displayed automatically when a new connector is created
  • More padding added to line click detection to make it easier to click on connectors
  • Better parsing of comments attached to mysql field

There is also a bug relating to identifying objects in Postgresql when there is no schema when using some versions of that database system.This is currently planned to be included but hasn’t actually been finished yet. If the work on this bug gets completed this week it will appear in 1.4.2b2, otherwise it will get pushed to the next release.

I think that’s everything that’s coming in the near future, there are some other things that I’ve been working on, but they’re more long term (mainly for 1.5), so not much to say yet.

SQLEditor 1.4 Final Released

Saturday, August 2nd, 2008

In case you missed it version 1.4 of SQLEditor was released back on July 8th.

If you’re using 1.3.9 you might like to consider upgrading.

The 1.3.9 upgrade system will be set soon to recommend this upgrade
(though 1.3.9 doesn’t use sparkle, so it can’t actually do the upgrade for you)

SQLEditor 1.4
(3.6 MB DMG File)

Lots of great new features and various bug fixes and improvements to the existing ones.

SQLEditor 1.4b2

Friday, August 17th, 2007

Another day, another beta. (Kind of)

SQLEditor 1.4b2 is now available, which is pretty much bug fixing against 1.4b1.

There were several issues with 1.4b1 including an annoying bug that would sometimes delete foreign key connectors when you deleted an unrelated table.

There are some fixes for other bugs which turned up and some improvements to undo/redo, to make it more stable when you undo or redo lots of things, one after the other.

I’ve also moved SQLEditor to Sparkle. Sparkle replaces an update system that I wrote myself and it should offer better update support as well as a nice html based ‘what’s changed’ window.

SQLEditor also now tells people that it is a beta and exactly when it will expire. It probably should always have done this, but it does it now, which is probably good.

There are also some minor fixes to the live source view, so that it changes with the document sql dialect and appears correctly when reopening existing documents.

[Download] (3.4MB DMG File, changelog)

What have I been doing recently?

Monday, June 11th, 2007

Well no updates for a bit. Humm?

The main things I’ve been working on:

1) SQLEditor. Lots of things are being worked on. The user interface is being rewritten to improve speed and increase flexibility, the data layer is being rewritten to switch it to cocoa (instead of java), the JDBC code is being rewritten to make it use JNI instead of cocoa/java and a new crash reporting system based on Google BreakPad is being worked on. There are also some other things too like live source view and assorted bug fixes.
2) HTMLValidator. Also undergoing development. It recently moved across to use Sparkle (yey!) instead of the SQLEditor derived update system (which will also be replaced eventually). The final 1.0 release is due very soon now and several people have set in nice comments.
3) A new idea (still secret) :-)

4) Web site improvements for malcolmhardie.com. Some have been deployed, others are still waiting to be deployed. Although the biggest one which is almost entirely invisible is the rewritten order processing system, which now supports multiple different products and better management features. But only I (and my somewhat-trusted minions) will ever see it. ;-)

Then when I’ve not been working I’ve been playing Pikmen on my new gamecube. (Many thanks to Leynos!). I’ve wanted to play this game properly for years and years and it definitely meets and exceeds my expectations.

Although I also played some theme hospital this morning using Parallels 3.0 (new release). It runs really nicely, although since it is an ancient game (1997) this shouldn’t be too surprising. I hope to try out some of my other really old games to see how they perfom under parallels.

SQLEditor 1.3.2

Wednesday, January 17th, 2007

SQLEditor 1.3.2 received a very limited release to a few selected testers at the end of 2006. However there were some additional issues that needed a bit more work, so the current plan is for a 1.3.3 release before the end of January.

SQLEditor 1.3.1

Sunday, December 10th, 2006

SQLEditor 1.3.1 got released on Friday afternoon, this was really just a bug fix release which fixed a handful of problems that were identified. I think the only major fix was that the new UID system was slightly broken in that if you copied an object, or duplicated it in some cases, then SQLEditor would not always recreate the unique ID numbers that represent each object. This had the effect that if you copied an object, SQLEditor couldn’t distinguish between the objects when reloading and so all connectors would be attached to the original object and not the new one. An unfortunate bug. :-(

It has now been fixed, along with slight improvements to image saving and a fix for a menu shortcut not being correct. The latter was an odd problem in that a shortcut was set, but it actually conflicted with an existing shortcut and the cocoa menu system is smart enough not to display the same shortcut for more than one menu.

[Download] 2.8MB DMG

For some reason also I don’t think I posted about the 1.3 release. But the 1.3 release was posted on November 23rd and is the first non-beta release to be released since May 2006. It rolled all of the improvements that had been made during the beta testing phase into a new release and is definitely worth upgrading (especially since the upgrade is free). However the 1.3 release has been superceded by the 1.3.1 release, so download that instead.

MalcolmHardie Solutions Weblog

Tuesday, October 31st, 2006

About the new MalcolmHardie Solutions weblog.

The new weblog will contain posts about SQLEditor and other products.

If you already reading Angus Thinks you probably don’t need to read the MalcolmHardie weblog as well because all the posts on the MalcolmHardie Solutions weblog will appear on Angus Thinks.

This mirroring is done using the xmlrpc api and code from the blogger api plugin for wordpress

static link library to replace dylib in mac os x

Thursday, October 26th, 2006

This post on the xcode-users list explains a neat trick on how to get xcode to link a static library instead of a dynamic library.

Imagine the circumstance: you want to use a particular non-standard version of a native library which is already part of the system; perhaps you want to use an old version with better compatibility, or a newer version with more features. The obvious thing to do is to take a static build of the library and add it your xcode project.

However this typically won’t work. The linker will choose the system version instead because by default it looks in all possible locations for a dynamic library first before looking through the same list of locations for a static library. If there is a dynamic library in any of the search locations it will always get chosen. There are some good reasons for this, but what if you really want to include your own statically linked version?

The answer is to add the -Wl,-search_paths_first flag to the other link flags option (under linking in target settings).

When this is set each possible location for a library is inspected first for a dynamic library and then for a static library. This means that the static library will get linked correctly.

It’s not exactly something that will be needed frequently though.

Edit: Apple have a technical Q&A article (1393) on this very subject which appeared a couple of days back and which I somehow missed.
It offers this exact method. [Link]

Running Oracle – The Solution

Wednesday, May 10th, 2006

This follows on from my previous posting. Searching for an Oracle

This is kind of old news now, because it’s been in use since SQLEditor 1.2 was released. However I though I would explain how I solved the problem that I was having with installing Oracle.

The problem was that I didn’t have a linux machine with enough memory and at the time, qemu wasn’t really fast enough to run Oracle in a virtual machine.

The first strategy I used was to upgrade the memory in my linux box (Cetaganda) to 512 MB. This solved the memory problem and meant that the testing could continue.

Then Parallels Workstation was released, which was able to run Oracle XE in a virtual machine fast enough for regular use. It also uses a different IP address than the host machine, which is useful in itself for testing.

Parallels is definitely the answer to this problem, I don’t need to switch on another machine, there is no additional noise and the performance is excellent for my purposes. I’m even considering adding the loading of the VM to the unit test setup so it will load automatically before the test cycle starts.

I’ve also got MySQL and Postgres running inside virtual machines.