database

Rspec > testing database views

How can database views be tested in Rspec? Every scenario is wrapped in a transaction and the data does not look like it is being persisted to the database (MySQL in my case). My view returns with an empty result set because none of the records are being persisted in the transaction. I am validating that the records are not being stor...

Store Image data type using PHP

I have SQL Server with following table : table PROMO, column: code , varchar(10) name , varchar(10) image_data, image desc , text How to insert image file as binary into sql server using PHP PDO? the image will be stored in column image_data EDIT: What type of variable should I pass to the PDO parameter $stmt = $conn->prepare($qu...

Skip all databases and run only specific one

I have a sql file generated by "mysqldump --all-databases" . There are many databases in it. What I want to do is to update my local database but only a specific one, not all. I tried to use "mysql -database=db_name < file.sql" but it updated all databases. Is there a way to skip all databases except the one that I want. ...

Good place to look for example Database Designs - Best practices

I have been given the task to design a database to store a lot of information for our company. Because the task is rather big and contains multiple modules where users should be able to do stuff, I'm worried about designing a good data model for this. I just don't want to end up with a badly designed database. I want to have some decen...

Customising Flex datagrid headerText

Gurus, I have a Adobe AIR application which has a datagrid. My requirement is to allow the user to make the column headers and the number of columns of that grid, customizable. 1. How can I get the column headerText values from DB? 2. If the user can enter the column names, it has to be saved to the DB and then loaded. Pl suggest. Re...

How to store tree structures in Java?

Hierarchical data structures are often stored in relational databases. This kind of storage is flexible but flat, so the tree structure has to be build with each query. I want to store forum posts as a tree structure, but it should be possible to query efficiently, say for example selecting posts by date or author. I'd like to have an o...

Android Pre-Populated Database

I am working on an Android application that will need several entries (a single table, with 1000-10000 rows) populated in that app's database before the user can use that app. I've looked around some tutorials and I am unsure of the best way to do this. Should I just check if the database exists each time the app is started and, if it ...

How to sync MySQL server database and SQLite database on server?

Hi All, I am developing an iPhone application that retrieves the data from remote MySQL server. As database is huge i don't want to download data each time application runs, rather then i just want to download the data only one time then sync with SQLite database.(No need to download again and again) If there is an update on remote MyS...

condense logic down to one Sql query

first is the disclaimer, I did not design the database I am now supporting and I would not have designed it this way, but here I am. Problem: My client has a table in his database that contains listings for rentals. In this table is a text field to store the city of the listing. What my client is hoping to see is a dropdown list of all ...

how to open .d01 foxpro file

hey all, I am building a basic POS app for my cousin's pharmacy store so that he can dump the software he is currently using and save on license cost.All the medicines name which he has painfully entered into the software have been stored in a file with .d01 extension. What i want is a way to read the contents of the .d01 file programmat...

MySQL Query Nightmare with RETs data

For those of you who have actually delt with RETS may be able to give me a hand here. The problem occurs when multiple properties are tied into the RETS data even though the property is sold. Basically what I need is to be able to check the database with the SELECT statement against three fields. The fields in question would be C_Stre...

Parameters to tune when retrieving a lot of small BLOBs (2-10kb) from Oracle DB?

We have a table in which we store millions of small BLOBs (2-10kb). And we need to access a portion of this table at a time, iterating through it while retrieving all these BLOBs (this "portion" is usually in the order of 10**5 rows). We use oracle 11g R1. Right now I am thinking about tuning the OracleConnection.setDefaultRowPrefet...

MySql displaying results in same order no matter "array-order"

I am using "solr" search engine to query an index for classifieds that match a given criteria. The results are the ID:numbers of the classifieds, which I then use to find all matches in a MySql database with those ID:s. The ID:s returned are put into an array. As you can see below the array is imploded. Then I use the "IN" to find all m...

Logics of searching for "available hotel rooms" help needed

Say you have a website for users to search for "hotel rooms for rent". I don't know how the logics of current systems work, which is why I am asking you guys. I currently have two fields in the form: Date available from: //example 2010-04-01 // 1st april 2010 Date available to: //example 2010-05-01 // 1st may 2010 Then Submit!...

Postgres: Issue Creating a User

I have a database called ADB. When I create a new user/role, that user cannot, by default SEE ADB and query against the tables in it. How can I change that default? ...

Query points within a given radius in MySQL

I have created the following MySQL table to store latitude/longitude coordinates along with a name for each point: CREATE TABLE `points` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `location` point NOT NULL, PRIMARY KEY (`id`), SPATIAL KEY `location` (`location`) ) ENGINE=MyISAM DEFAULT CHARS...

insert and display image in vb.net from sql server database

i need to upload and display images to and from database. i have written this code for uploading and it uploads fine. except 1 problem. It crashes when i dont select an image. can someone help me fix it for null value? also how do you display an image in IE? code for inserting image - Dim imageInfo As FileInfo = Nothing Dim data() As B...

Storing annually repeatable values in a MySQL database

I've been hammering my head against my desk for the past few days on this, and so I turn to you, Stack Overflow. The software I'm working on has time-sensitive data. The usual solution for this is effective and expiration dates. EFF_DT XPIR_DT VALUE 2000-05-01 2000-10-31 100 2000-11-01 (null) 90 This would be easy. ...

Which is better practice: complex SQL statements or Recordset manipulation in Access VBA?

I'm doing some VBA development and I found creating SQLs quite efficient way of getting everything done (selecting and updating). But I got to this stage where my SQL statements contain complex Switches and WHERE conditions where I have another Selects to update appropriate records. Therefore, I create this SQLs and I simply run it via ...

Should I use multiple databases?

I am about to create an application with Ruby on Rails and I would like to use multiple databases, basically is an accounting app that will have multiple companies for each user. I would like to create a database for each company I found this post http://programmerassist.com/article/302 But I would like to read more thoughts about this ...