database

Need for speed: Best database solution...

What I want to create is a huge index over an even bigger collection of data. The data is a huge collection of images (and I mean millions of photo's!) and I want to build an index on all unique images. So I calculate a hash value of every image and append this with the width, height and file size of the image. This would generate a very...

How to store masses of data offline and then update it into an SQLite database in batch?

Currently, I am trying to fill an SQLite database with tens of thousands of text data using this this method: SQLiteConnection = new SQLiteConnection(cntnStr); connection.Open(); foreach(Page p in pages) { using (SQLiteCommand command = new SQLiteCommand(String.Format("Insert Into Pages (ID, Data, Name) Values ({0}, '{1}', '{2}')"...

Django-queryset get one object per field=foo

I have a basic FK to user, call it owner class Baz(models.Model): owner = models.ForeignKeyField(User) .... .... Now, with a queryset of Baz's, is there something that I can chain that will give me only one Baz per owner? ...

What strategies can an ORM use to cache data while minimizing complexity?

If the application asks for a similar result set to one that has recently been requested, how might the ORM keep track of which results are stale and which can be reused from before without using too many resources (memory) or creating too much architectural complexity? ...

What data generators?

I'm about to release a FOSS data generator that can generate random yet meaningful data in CSV format. Rather belatedly, I guess, I need to poll the state of the art for such products - because if there is a well known and useful existing tool, I can write my work off to experience. I am aware of of a couple of SQL Server specific tools,...

how to execute php from a database?

I've got a bit of an awkward problem. Normally when putting stuff in a database, this will be saved in the way it is. So, if the saved stuff is: <?php echo "hi!"; ?> This will just be output as 'hi!' when called. However, in my case I'm saving plain text into a database. I'm not doing any verifying to check for these codes and I've t...

Database web application for admin

Hi Does anyone know of any good web application(ideally free!) for administrating Microsoft SQL & other db applications? thanks in advance. ...

SQL - How to use SUM and MAX in same query?

I am working with a MySQL database version 5.0.41 (and PHP 5.2.6, though that may not be relevant to this question). I have a table called votes with the following fields: id, item_id, vote_value. Each time a user on the site submits a positive vote for an item, a new row is created with the corresponding item_id and a positive number (...

Sql Server Compact Edition database deployment strategy

Hello, I have a question about the most appropriate way to deploy a SQL Server CE database with our client application. I understand we need to install the SQL Server CE prerequisites etc., so this isn't a question about getting it to work. It already does. Right now the way we have it is that we just ship a copy of the .mdf file (co...

In my sql set condition for table?

In mysql can I set a condition that a combination of two fields can never be the same??? Example: id-1 name-abc grade-A Now, another entry with name='abc' and grade='A' can not be added into that table ???? ...

Is Wikipedia incorrect to say that an ORM just does type translation and not necessarily transfer of data?

According to the Wikipedia article object relational mapping: is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages I thought an ORM also took care of tranferring the data between the application and the database. Is that not necess...

What use does an ORM have for database metadata?

I was reading about ORMs and one of the descriptions I read said that the ORM interacts with database metadata. Why is this important or relevant? Metadata, as I understand, is just a way of describing what the database contains. So, for example, the database might have an internal table that lists what user tables have been created....

which data model storage strategy ?

I am trying to come out with a good design for the storage of a data model. The language is python, but I guess this is fairly agnostic. At the moment I envision three possible strategies: Object database The datamodel is a network of objects. When I create them, I specify them as descendant from a persistence object. Example: class ...

sql unique and setting constraints on inserts

I have a database where I need to avoid inserting duplicates. The requirements are: For the subset of rows with matching column 1, there can not be any that have the same column 2. For the subset of rows with matching column 1, there can not be any that have the same column 3 and 4. I'm new to SQL so is there a way of setting these re...

trigger for when a sale is made to update the despatch table

I was wondering how I would go about creating a trigger to update the despatch table once a new sale has been inserted into the sales table. I am guessing that the first few lines of the code will look like this: create trigger sale_trig after insert of sale_id on sales ..... But I am not sure how to do the rest. I am using iSQL Plus. ...

MySQL naming conventions, should field name include the table name?

Hi, A friend told me that I should include the table name in the field name of the same table, I wondering why? And should it be like this? Example: (Table) Users (Fields) user_id, username, passowrd, last_login_time I see that the prefix 'user_' is meaningless since I know it's already it's for a user. But I'd like to hear from y...

multi_schema and side effect problems

I am working on a project in which we need to define agencies in other cities. We have the same application but separate database schema for each agency. I used one session factory. For each request we get the person's username and therefore we can recognize which agency they belongs to. We change the PostgreSQL search_path for that....

Group by MySQL mess

I am really having a trouble figuring this one out. I have a table 'Comments': cmt_id (primary key, auto incr), thread_id, cmt_text And I have these records in it: cmt_id thread_id cmt_txt 5002 1251035762511 Alright, I second this. 5003 1251036148894 Yet another comment. 5001 1251035762511 I am starting a ...

Is it inefficient that linq to sql translates this query into the format: "select *"?

I'm not super familiar with Linq to SQL yet but something that strikes me is that this: var articles = (from a in DB.Articles where a.ArticleId == ArticleId.Question && a.DeletedAt == null && a.Votes >= minVotes orderby a.UpdatedAt descending select a). Take(maxarticles); gets translated to this: string query = "...

How to handle an immutable table referencing mutable tables?

In making a pretty standard online store in .NET, I've run in to a bit of an architectural conundrum regarding my database. I have a table "Orders", referenced by a table "OrderItems". The latter references a table "Products". Now, the orders and orderitems tables are in most aspects immutable, that is, an order created and its orderitem...