database

Automatic database schema generation and migration with Perl

In Ror or Django or web2py you can "describe" a database (as a set of classes that remaps to tables) and the framework (having being provided with a connection string to the desired database) generates the tables, fields, relations and in the case of RoR and web2py it also keeps it up-to-date (eg, removing a class drops the table, adding...

Django Backend-neutral DictCursor

Is there any way to get a backend-neutral dictionary cursor in Django? This would be a cursor that is a dict rather than a tuple. I am forced to use Oracle for the school project I'm working on. in Python's MySQLDb module it's called a DictCursor. With WoLpH's inspiring suggestion I know I am very close.. def dict_cursor(cursor): ...

Disable transactions in ActiveRecord

How do I disable transactions in Rails' ActiveRecord? I have a specific situation where I want them to go away I can't seem to find anything useful out there. Is it even possible? ...

What is the most efficient procedure for implementing a sortable ajax list on the backend?

The most common method is to assign a sequential order field for each item in the list and do an update that maintains the sequence with every ajax sort operation. Unfortunately, this requires an update to each item of the list every time someone sorts. This is fine for small lists, but what's the best way to implement sorting for larger...

Using Entity Framework, how do I specify a sort on a navagation property?

I have two tables: [Category], [Item]. They are connected by a join table: [CategoryAndItem]. It has two primary key fields: [CategoryKey], [ItemKey]. Foreign keys exist appropriately and Entity has no problem pulling this in and creating the correct navigation properties that connect the entity objects. Basically each category can have...

Zend_Auth using multiple tables

What I'm trying to do is use Zend_Auth for authentication with the issuing being that the 'identity' is stored in a different table then then 'credential.' I'm able to pass an array for the credential and the identity but when it comes to the actual tables I'm not able to get it to accept the array. It ignores the 2nd table name. I was w...

MySQL How to select friends from a friendship table?

Hi I have a simple database for storing friendship, with just two columns person_a, person_b , denoting that person_a and person_b are friends. From a big list like this what query should I run to get say get all friends of 'sam'. Thank you. ...

Taking Database backup: How to skip '/' from getdate so that it is not considered to be in a folder

I am trying to take database backup. How can I do that when getdate is being appended with file name with format dd/mm/yyyy. declare @dbName VARCHAR(100) declare @path VARCHAR(100) set @dbName='CallMeIndia' set @path='F:\'+@dbName +'-'+convert(varchar(50),getdate(),103)+'.bak' BACKUP DATABASE @dbName TO DISK= @path ...

Architecture for database analytics

Hi, We have an architecture where we provide each customer Business Intelligence-like services for their website (internet merchant). Now, I need to analyze those data internally (for algorithmic improvement, performance tracking, etc...) and those are potentially quite heavy: we have up to millions of rows / customer / day, and I may w...

Is it possible to create a global stored procedure at Sql server level

I created a query that takes a database backup at certain specified location. I want to use it as a stored procedure but this should act as a global stored procedure so that whenever this SP is called. Then database backup is taken. It uses DB_Name() to take database backup of owner database. Is it possible to create any such SP or Fun...

Storing "derived" values vs calculating them on extraction

When you have values which only depends on one or more other fields +/- constants (say retail price & discount price), is it better to store those values too or to calculate them "on the fly" when retrieving the data? ...

The right method of sharing database variables (asp.net)

I have been sharing database variables using the following code: Namespace DataAccessVariables Public Class Vars Public Shared s As String Public Shared con As String = WebConfigurationManager.ConnectionStrings("Dev").ToString() Public Shared c As New SqlConnection(con) Public Shared x As New SqlComma...

Query to find the records from a table which are updated or added in the last one month ?

Hi, I want to select the records from a table which are updated or added in the last one month (table doesn’t have any datetime field and I can’t change the table structure). Is it possible to write a sql query for that? how to fetch those records from table. regards, kumar ...

Complex Query on cassandra

I have heard on cassandra database engine few days ago and searching for a good documentation on it. after studying on cassandra I got cassandra is more scalable than other data engine. I also read on Amazon SimpleDB but as SimpleDB has a limitation 10GB/table and Google Datastore is slower than Amazon SimpleDB, I prefer not to use them ...

Patterns for implementing field change tracking.

Hi all For one of my recent projects, I had to implement field change tracking. So anytime the user changed a value of a field, the change was recorded in order to allow full auditing of changes. In the database, I implemented this as a single table 'FieldChanges' with the following fields: TableName, FieldName, RecordId, DateOfChange,...

How to open multiple encrypted database adobe air?

I need to open multiple encrypted database by using one sql connection. I use "attach" method for attach the database with opened connection. But it throws the error.“Error #3125: Unable to open the database file.” even I gave the valid encryption key. Please gave some ideas. Thanks in advance. ...

Spring Security 3 database authentication with Hibernate

I need to authenticate users from database, Spring Security documents don't tell how to authenticate with hibernate. Is that possible and how can I do that? ...

Oracle XE as local recovery database and Oracle Standard as main db

Hi, I just wanted to know what you guys think about this. I have an app written in Visual Basic .Net as my front end and and Oracle 11g Standart database as the back-end. So I have like 20 pc's running this app locally. They're all inserting, updating, deleting data on this single database. I want to develop a solution in the case that ...

Getting age from an encrypted DOB field

Hi all Due to certain compliance requirements, we have to encrypt the user DOB field in the database. We also have another requirement to be able to search a user by his age. Our DB doesn't support transparent encryption so encryption will handled by the application. Any good ideas on how to allow for searching by age? One thought is t...

View all foreign key constraints for entire MySQL database

I have a large database with over 150 tables that I've recently been handed. I'm just wondering if there is an easy way to view all foreign key constraints for the entire DB instead of on a per-table basis. ...