Database posts

Sorting with `FIELD()` function in Doctrine

I recently needed to sort query results to match the order of IDs passed to it for use in a WHERE … IN() clause. In MySQL, this can be done using the FIELD() function in the ORDERY BY clause. For Doctrine, which doesn’t have the FIELD() function and doesn’t allow functions in the ORDER BY clause, there’s a little more work needed to make use of it.

Continue reading post "Sorting with `FIELD()` function in Doctrine"

Objective File System

This is a modification of part of a previous post.

each file is stored in two databases: the normal hierchical db and an objective db. The hierarchical db is used for speed and for compatibility with current file systems. The objective db is used for metadata and other information less critical to basic file operations.

The objective db contains much of the metadata (non file operation related stuff). Each file type is an object type in the database, inheriting from the basic file object or one of its children. Each file type will have its own attributes as well as actions related to it. The actions may consist only of OS functions related to it, may also include application calls, and could even include user/other created scripts and functions related to the file type. The actions would provide the data from the file to the system or other function that is necessary for it to operate (functions and applications would all have a defined standard interface to them).