database

Perl DBI fetch portion of database?

I'm working on a database, where the number of rows is somewhere above 1,000,000. I have my select statement, but if I fetchall to begin with, I run out of memory quickly. Here are my 2 questions: Since I dont know the exact size of the database to start, is there any way to find out the size of the database without doing a fetchall?...

Database charset conversion

Hi there. I've moved database from one host to another. I've used PMA to export and bigdump to import. The whole database have latin2 charset set everywhere where it's possible. However in database, special chars (polish ąęłó, etc.) are broken. When I used SELECT i see "bushes" - "Ä�" insetad of "ą". Then I've set document encoding to ...

Error when inserting into SQL table with php

So this is my code: function function() { $isbn = $_REQUEST["isbn"]; $price = $_REQUEST["price"]; $cond = $_REQUEST["cond"]; $con = mysql_connect("localhost","my_usernam", "password"); if (!$con) die('Could not connect:' . mysql_error()); mysql_select_db("my_database",$con); $sql="INSERT INTO 'Books' (isbn, price, condition) VALUES ('...

Problem getting the progress status of a SQL-Server restore job

I want to use the script from http://www.wisesoft.co.uk/articles/tsql_backup_restore_progress.aspx to get progress information of a specific running SQL-Server restore job. To achive this, I have changed it a little bit: SELECT command, s.text, start_time, percent_complete, CAST(((DATEDI...

What is the difference between a database and a data warehouse?

What is the difference between a database and a data warehouse? Aren't they the same thing, or at least written in the same thing (ie. Oracle RDBMS)? ...

Password change: Best practice

I'm writing Baby's First Web Application. My first task has been to set up an authentication system, which I think I've done okay on. I'm new to the whole thing, though, so: When the user reports that he's forgotten his password, I e-mail him a temporary replacement password in plain text. It's perhaps not the most secure way to handle ...

MySQL stored procedures or php code?

A general question, without a specific case in mind - is it usually preferred to use MySQL stored procedures over writing a PHP script that performs the same calculations and queries? What are the benefits of each method? ...

DatabaseMetaData.getTables() returns how many columns?

I was playing around with the DatabaseMetaData class to see how it works. The java doc comments seem to state one thing, while the code does a different. I know it is an interface, so it is really up to the vendor that supplied the JDBC driver to implement this correctly. But I was wondering if I am missing something or not? I am using...

Complex DB tables problem

hi everyone .. I am developing a student results website in which :- Every year has its own subjects ( 1st year has sub1 , sub2 , sub3 and 2nd year other subjects and so on ) which will be added , deleted by the admin of the site . I designed three tables :- "Students" : contains info about students and their current year . "Subjec...

What is a lookup table?

I just gave a database diagram for a DB I created to our head database person and she put a bunch of notes on it suggesting that I rename certain tables so it is clear they are lookup tables (add "lu" to the beginning of the table name). My problem is that these don't fit the definition of what I consider a look up table to be. I have ...

Drupal Serial Number

I'm new to drupal, had a good start with basic functionality but I need to do some specific tasks and I'm starting to struggle. I want a form with a drop down list, that selects a string. I also want to create a serial number thats unique, and append it to the string. I was thinking that I'd create a document type "index", then as as d...

iPhone SQLite Database Reading And Writing

So I am trying to work with SQLite in one of iPhone applications and I am using the sqlite3 library. I am able to access the database and even make a query; in fact the query accesses the exact data but for some reason the string I am getting back is a long integer and not the string I was looking for. Here is the database and code: Fi...

What is A Domain Model class? How do you create one?

I have seen the ideas of domain models in UML, but I never got the chance to work with them in actual code. Now I see them in databases, particularly SQL coding, from this article And there was a quote that mentions domain model classes: I can design Domain Model classes containing plain SQL as easily as I can design classes tha...

Amazon SimpleDB Query to Find "Post By Friends"

I have been developing an iPhone app which queries a server that relays data I store in Amazon SimpleDB. I have a database table of "Submissions" by various users. I am interfacing with Facebook to retrieve Facebook Friends and wish to make a query to "Submissions" to find posts by friends - like: SELECT * FROM submissions WHERE userI...

Best DB abstraction class for PHP

I'd like to start building my own framework. Everything is fine, but I can't build the most important part (from my point of view): DB controller. I've seen so many project codes and some uses ADOdb, others have built its own. I don't want compatibility, just an easy class that obviously filters SQL injections but also allows the user t...

Opposite of inner join

What will be the opposite of inner join? For a table table Person (int PersonId, varchar PersoName, int AddrId), I want to know the rows in Person with bad AddrId which don't have a row in the Address table. ...

Database is locked

hey my problem is when i try to update my database it goes through the update query fine but then it crashes giving me a error in the console saying "Error while updating 'Database is locked'". Does any one have a clue why is it so? ...

How to sort string in sql server

How to sort this data in sql server as Pre-OP 1, Pre-Op 2 like wise Pre-OP 1 Pre-OP 10 Pre-OP 11 Pre-OP 12 Pre-OP 13 Pre-OP 14 Pre-OP 15 Pre-OP 16 Pre-OP 17 Pre-OP 18 Pre-OP 19 Pre-OP 2 Pre-OP 20 Pre-OP 21 Pre-OP 22 Pre-OP 23 Pre-OP 24 Pre-OP 25 Pre-OP 26 Pre-OP 27 Pre-OP 28 Pre-OP 29 Pre-OP 3 Pre-OP 30 Pre-OP 4 Pre-OP 5 Pre-OP 6 Pre-OP...

What is the difference between these three Oracle datatypes?

char varchar varchar2 I understand that varchar2(10) will allocate space dynamically upto 10 bytes. char(10) will allocate 10 bytes at the beginning and fill it with junk if the actual datalength is less. If this is correct, what does varchar(10) do? ...

Avoid NULL columns using DEFAULT Empty String

Hi, how can I create a Column with the default value being an empty string? thanks guys! ...