database

What do I need to keep in a database to record the history of orders?

I want to keep customers' order history. I am thinking of keeping names of product, number of product ordered, price of product, date of order, name, address etc Table can be order_history and there will be field for id, date, cutomer_id,.. Then a question regarding names and number of products came in my mind. How should I keep them...

Error in android database... me != understand!

Hello, I'm just writing a SQLite powered android applications however I keep getting a NullPointerException when I call my DatabaseHelper class. The code which appears to be causing the error is below: public Cursor GetAllRows() { try { return db.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_PHRASE}, ...

How to backup database file to sdcard on android?

I'd like to add a feature to my android app that automatically backs up the sqlite database to the sd card. What's the best way to go about this? Any examples/tutorials available? ...

Looking a lightweight PHP ORM

At first I was going to use doctrine ORM as the main one but it was an overkill, unneeded features and probably excessive calls. One of the main reasons was the "helper" that handled traverse trees (the hierarchy tree) easily but I'm starting to prefer building my own class. This is what I'm looking for: 1) Can manage multiple databa...

Best Database for Computational Problem

I'm trying to decide what database system to use for storing information that is relatively static but needs to be computed in a number of different (runtime specified) ways. The basic contours of the data are votes in the US Congress: A bill: has many roll calls has a name, and other short metadata has text, and other potentially lon...

Storing attendance records in the database.

I found a similar question asked previously (School attendance database) I have to deal with these additional conditions. Total number of users recording attendance would be 100,000. Each user will have swipe-in swipe-out entry. A user may do multiple swipe-in swipe-out incase s/he is not sure data was captured. A record of 1 year at...

Java: ResultSet closing strategy, apart from closing it in finally

I am facing ORA-01000: maximum open cursors exceeded although I am closing the resultsets in finally block. But I suspect there is some trouble with my legacy code, below is my pseudo-code while (someCondition) { rs1=executePreparedStatementNew(query1,param1,""); //do something with rs1 rs1=executePreparedStatementNew(query2,param2,"")...

Structurally and visually organising DBs and tables in SSMS

Hi Within the next few weeks I plan to introduce SQL server to an office that is in dire need of a proper data server. Currently there is a heavy reliance on loose Excel and Access file (supplemented with frighteningly large amount of impenetrable VB code to do data manipulations) strewn all over the internal network. We need SQL serve...

Is there an conceptual difference between a so called "record set" and an so called "statement"?

I wonder why the result of an SQL query in PHP PDO is called "statement". I'd expect "record set". My english is pretty bad as I'm not a native speaker. So: I craeate a "query" to "ask the database to do/retrieve something". Sometimes I use "prepared statements" to ask that (blue confusion alert!). Then, PDO returns me an object of clas...

model update method in rails

for example, I have a table 'post' and column 'views'. When people view the post each time, the 'views' will be added 1. Now my step is @post = Post.find_by_id(params[:id]) @post.views += 1 @post.save Is there any better way to add 'views'? ...

how to rescrict JS script being inserted in DB with php

Hi all, I have one problem regarding the data insertion in php. In my site there is a message system. so when my inbox loads it gives one javascript alert. I have search a lot in my site and finally i found that some one have send me message with below text. <script> alert(5) </script> So how can i restrict the script code bein...

Right DBMS for the job?

I need a DBMS, but do not know which to choose. Basically, the application makes many INSERT / UPDATE, but also many SELECT. SELECT mostly very simple, one field only. I am using MySQL + InnoDB at the moment, but as the database is growing, I need the best solution. The table can grow indefinitely, and the time +- 2GiB EDIT: Will run ...

How to force Grails to use proper column type in MySQL for Map field

Hi, I have a problem in Grails 1.1.2 + MySQL. My domain class Something contains field Map<String, Map<Integer, Integer>> priceMap When I run the app, Grails creates table 'something' and sub-table 'something_price_map'. 'something_price_map' contains BIGINT(20) price_map VARCHAR(255) price_map_idx TINYBLOB price_map_elt The pr...

How to access model to query database from a helper function?

Hi, I am trying to create authentication for my php website. I am using the codeigniter framework. I will have to validate the session in all the pages of my website. So to avoid the code repetition, i am planning to do it in a helper function. Now that my user credentials are in my database i would like to access the model to query th...

When to begin T-SQL query with USE?

I'm a T-SQl and database newbie, and a little confused. In the T-SQL book I'm reading it says that a USE statement is written to set the database context of the session. Does that mean that there can be more than one database in an instance of SQL-server and the USE statement tells SQL server which database the query will be on? ...

FULL-TEXT Search in SQLite

Simple question: does SQLite support FULL-TEXT searches? If not, is there any way I can implement that feature? ...

Php drop down menu

i am using following code to insert data into mysql database <?php $refselect = $_POST['refselect']; $refname = $_POST['refname']; $refemail = $_POST['refemail']; $refcnt = $_POST['refcnt']; $refdes = $_POST['refdes']; $referror = $cberror = "<h1>Data not Added</h1><br/><br/><h3>Please Follow The Instructions</h3>"; $ure...

Clone entire database with a SP

Hi guys, I'm trying to find out if this is possible, but so far I haven't found out any good solutions. What I would like to achieve is write a stored procedure that can clone a database but without the stored data. That means all tables, views, constraints, keys and indexes should be included but without any data. Can it be done? ...

Postgres/PHP - What is the standard way to retrieve the ID of an inserted row?

I have searched on Google and read a couple of articles on how different people approach this problem, but I was wondering what the standard way of solving it is and also, which one will work best for my situation. I have an AJAX page that creates a new question and I need to know how to retrieve the ID from the insert query within the ...

Best structure for "Orders" table having multiple Items per order number.

What is the best structure for an Orders table having OrderNumber, ItemNumber and CustID that allows for 1 or more item numbers for each order number? ...