database

NSURLConnection Data broken in asynchronous connection

Hello, I have a NSURLConnection that receives data output from a url pointing to a php script on my server. Most of the time everything works fine and the data is retrieved in its complete form. However, sometimes I receive NULL or broken (ie the bottom half) of data at: - (void)connection:(NSURLConnection *)connection didReceiveData...

os.walk() caching/speeding up

I have a prototype server[0] that's doing an os.walk()[1] for each query a client[0] makes. I'm currently looking in to ways of caching this data in memory, speeding up queries and hopefully allowing for expansion in to storing metadata and data persistence later on. I've experimented with SQLite before, but I find SQL complicated for ...

Repository integration tests

I want to implement integration tests of my Entity Framework driven repositories. The problem is how to rollback database state after tests are done. At the moment I'm planning to start transaction at test SetUp and roll it back at test TearDown. Are there any other solutions excepting manual database clearing? ...

What is wrong with my sql query of odata?

I am trying to get the number of users for each age. What is wrong with this sql query for odata.stackoverflow.com? select age, count(*) from users order by age group by age ...

How does SELECT from two tables separated by a comma work? (SELECT * FROM T1, T2)

Given 2 tables T1 and T2. T1 T2 --------- A 1 B 2 C 3 You make a query: SELECT * FROM T1, T2 What is the no: of rows that are fetched from this query? (a) 4 (b) 5 (c) 6 (d) 9 Answer is : 9 Question: Why is the answer "9"? ...

How do you export all tables to a CSV file using SQL Management Studio?

When I right click on the database I want to export data from, I only get to select a single table or view, rather than being able to export all of the data. Is there a way to export all of the data? If this is not possible, could you advise on how I could do the following: I have two databases, with the same table names, but one has ...

Select Difference Between Rows (Postgres)

i'm aggregating facebook "like" counts for urls over time. each hour, i check the "like" count and insert it into a timestamped row. how can i get the difference in total between the new row and the previous hour's row? eg, insert total=5 for id=1 at 2pm insert total=12, diff_since_last=7 for id=1 at 3pm thanks! ...

How do I connect to the DB?

Ok I creating an application that needs to query records from my remote database. I am logged into phpmyadmin and I need to connect to this from my new PHP application. I have the cpanel access and the phpmyadmin tab. Is there something i can do to get the info needed to do this $connection = mysql_connect(DB_HOST,DB_USER,DB_PASS,true);...

Display my DB queries on other websites

What can I make to allow people to display data from my own website's database on their website using a query? For example if I have a table named "movie_quotes" which is comprised of various movie quotes.. How can other people query them on their own sites by either genre or dates. For example they can modify the "category" parameter t...

help with a sql query joining 2 many-many tables

i want help how to solve this sql problem. suppose i have 3 tables Movie ID Name Genre ID Name Movie_Genre (this one is the link for many to many) FK_MovieID FK_GenreID i want to select all the movies that are of genre 1 and genre 3 how is this possible? i can only select the movies of 1 genre but not the movies...

Tips on writing SQL for multiple databases

Different databases have differences in SQL support & implementation. Sometimes there is a difference in SQL syntax, sometimes support for some SQL commands is missing, sometimes the database has a feature that other databases do not have. What are considered to be good practices in writing SQL queries that are good for different databa...

Best way to store tags in a database?

I have a database that contains two tables: entries tags The entries table contains posts that each have one or more tags. The problem is, each post can have any number of tags. In other words, I can't have a 'tag1', 'tag2', etc. column and do a LEFT JOIN. How should I set up entries so that each post can have any number of tags? ...

Error Creating Table on Android

I'm trying to create a table in android database, but when i try to run the application the LogCat returns the following error: 08-22 02:39:29.098: ERROR/AndroidRuntime(277): Caused by: android.database.sqlite.SQLiteException: near "auto_increment": syntax error: CREATE TABLE words(id INTEGER PRIMARY KEY, word TEXT, count INTEGER not nu...

How to increment field in sqlite android database

Hey, I want to increment a column in a sqlite android database. Im doing like this: public void atualiza(String word){ this.db.rawQuery("UPDATE words SET count = count + 1 WHERE word= ? ", new String[] {word}); } And I call this method on another class like this: this.dh.atualiza(word); But when i pull the database from t...

Is it okay that database credentials are stored in plain text?

By default, the Django database host/user/password are stored in the project settings.py file in plain text. I can't seem to think of a better way at the moment, but this seems to be against best practices for password storage. Granted, if an attacker has access to the settings file, then all is probably already lost. Even if the the fi...

Trying to generate tables from Doctrine models and getting MySQL errors

Doctrine_Core::createTablesFromModels() is failing with the following error: Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newmexicocreates.address_type' doesn't exist. Failing Query: "SELECT a.id AS a__id, a.title AS a__title FROM address_...

Can I enter formula in the column for MySQL database?

I wonder if the above can operate the column like the excel. eg. same row. column 1 : A, column 2 : b, column 3 : A + b. ...

Which DBMSs offer index-organized tables?

My current knowledge: Oracle does offer index-organized tables and defaults to heap-organized. I heard that SQL-Server uses only index-organized tables I am especially interested in answers for MySQL, Informix and DB2. ...

Connecting my Android service with the db

Hi i'm working on a service that collect data from sensor and save a fast fourier trasform in to the db, but when i press the red phone button (to make the screen black) it don't save anything. Any idea? In addition i noticed that when i stop the service, it continues to read sensors, how should I do? This is the code that i use to con...

What features should a new SQL-based Rapid Development tool have?

I am interested in developing a new SQL-based RDS which can generate prototype CRUD-oriented 4GL code which can then be easily customized. So I am looking for opinions, suggestions, etc. in what features should a new RDS have? I have looked at several products. FileMaker is more or less the type of product I'm looking for, but it's no...