database

Postgres discrepency in trigger execution speed?

I have a trigger that executes a function on table insert or update. It looks like this: CREATE OR REPLACE FUNCTION func_fk_location_area() RETURNS "trigger" AS $$ BEGIN IF EXISTS ( -- there was a row valid in area when location started SELECT * FROM location WHERE NOT EXISTS ( SELECT * FROM area...

sqlite database disk image malformed on iPhone SDK

I'm having an issue with a new application on the iPhone SDK using SQLite as the DB backend. Occasionally, my app will stop loading data to my UITableViews and after downloading the device DB via the Organizer I can access the SQLite DB via the command line. I can query certain tables fine but not others without getting an "SQL error: ...

Product Specifications

Hi Everyone, Anyone know where sites like amazon and ebay get their product specifications from? Surely they don't all have a large database of specifications for every product. I could do with one for cameras that I can plug into my site. Thanks ...

Normalising a form

Hi, I am really struggling to normalise a Client Meeting form. The details are as follows Client_Name, Client_phone (Normalised) Date, Time, Location, Person_met, location, key_notes, Staff (repeating groups) In 1st NF, I know the Client_Name (given a client_ID key) would be the foreign key in the repeated group, but I don't know w...

How to create basic pages with Symfony and Doctrine

Hello, I'm completely new with Symfony and Doctrine. I have generated a project with a the Doctrine ORM, my database schema is fully well generated. Now I just want to create basic services (in simple .php pages) that do some actions according to parameters in a HTTP POST request. I tried to create an app through the generate:app comma...

H2 database: What is and why appears database.xx.log.db.corrupt binary file

I am extensively using H2 database for my project (lots of inserts and selects) and I have noticed that in the database directory appear binary files which have the name: database.xx.log.db.corrupt, where xx - a number. Does anybody know if there are possibility to understand what this file stands for and why it appears? ...

Raw Data or Pre-Calculated Values in Database?

In general, is it better to store raw data with pre-calculated values in the database and concentrate on keeping the database up-to-date if I remove or delete a row while using the pre-calculated values for display to the user OR is it better to store the raw data and calculate the correct display values on-the-fly? An example (whic...

Inserting into HTML5 database with jQuery loop

Hi, Javascript is not my forte, so excuse me if this is incredibly obvious. I'm working on some code that creates a local database and table, retrieves an RSS feed, parses it, and adds information from each entry to the database. $.ajax({ type: "GET", url: feedurl, dataType: "xml", success: parseXml }); function parse...

What is the best practice when saving passwords using the C# Settings feature?

I am using Visual C# built in feature Settings to save some of my program's options. I also want to store one password, but then it comes public... is it possible to encrypt the password before saving it using this settings method and then decrypt it back? ...

sql nested select invalid column

Hey all, I've been struggling with a select statement for a bit now and I was hoping to get some help. I currently have a list IPs in a temporary table and I want to calculate how many times this IP acts as a server and how many times it acts as a client. No matter how I manipluate this select statement I always get the same error ...

Is there any way to send more than one postgresql sql prepared statement in one call in php?

Is there any way to execute more sql prepared statements at once? Or at least use something to achieve this result, can it be emulated with transactions? pg_send_query can execute more statements (from php docs "The SQL statement or statements to be executed.") but pg_send_execute and pg_send_prepare can work only with one statement. ...

How to use OR in MySQL query and ignore second condition if first is true?

I am using a query like this: SELECT * FROM table1 WHERE countries LIKE '%US%' OR countries LIKE '%ALL%'; This returns all the entries that have "US" or "ALL" in countries column, but I want it to return ONLY those rows that contains "US", and if non is found then use the next condition and return all that contains "ALL". Is it possi...

Creating a SQL Server trigger to transition from a natural key to a surrogate key

Backstory At work where we're planning on deprecating a Natural Key column in one of our primary tables. The project consists of 100+ applications that link to this table/column; 400+ stored procedures that reference this column directly; and a vast array of common tables between these applications that also reference this column. The ...

Codeigniter database issue

Hello chaps, Having a spot of bother trying to grab some data out of my database. I have the following model: function GetRestaurants($options = array()) { // Qualification if(isset($options['restaurantID'])) $this->db->where('restaurantID', $options['restaurantID']); if(isset($options['restaura...

Dynamic Validation: 0 or more per field, how to AND or OR validation rules?

Furthering: http://stackoverflow.com/questions/3910250/database-design-for-dynamic-form-field-validation/ How would I model the database when a particular field can have 0 or more validations rules AND that each validation rule is "related" to another rule via AND or OR. For example, say I have field1 that needs to be minimum of 5 char...

Optimal way to store units of measure for Stock items

Hi all, Assuming a schema structure as such. ----------------------------------------- Stock (ID, Description, blah blah) ----------------------------------------- StockBarcode (ID, StockID, Barcode, Price, blah blah) ----------------------------------------- What is the optimal way of storing units of measure for your stock items? G...

Need some help optimizing a complex SQL Query

Hi Guys, I was wondering if anybody would have some input on how I could possibly optimize this MySQL query. I think I'm doing the right thing with indexes so don't think I can get this query any faster (it's currently taking more than 3 seconds to run) but would really love somebody with more experience to prove me wrong. Here's the q...

Database Design - Should one-to-one relationships be avoided?

Possible Duplicate: Is there ever a time where using a database 1:1 relationship makes sense? For the sake of simplicity, I'll ask the question straight out: should one-to-one relationships in database design be avoided or this acceptable? I know all of the attributes of this "item" can be all hosted in ONE table, but I fee...

Efficient substring searching in Python with MySQL

I'm trying to implement a live search for my website. One that identifies words, or parts of a word, in a given string. The instant results are then underlined where they match the query. For example, a query of "Fried green tomatoes" would yield: SELECT * FROM articles WHERE (title LIKE '%fried%' OR title LIKE '%green%' OR ...

Stopping SQL code execution

We have a huge Oracle database and I frequently fetch data using SQL Navigator (v5.5). From time to time, I need to stop code execution by clicking on the Stop button because I realize that there are missing parts in my code. The problem is, after clicking on the Stop button, it takes a very long time to complete the stopping process (so...