mysql

Why isn't PostgreSQL as widespread as MySQL?

I'm currently developing a pretty big project, and I'm considering open source databases to use. One of the main factors I consider is support, and it seems like there is not much support/community for PostgreSQL compared to MySQL, even though MySQL seems like a much less fully featured product than PostgreSQL. Should this fact shape m...

MySQL transaction support with mixed tables

It seems like I will be needing transaction with MySQL and I have no idea how should I manage transactions in Mysql with mixed InnoDB/MyISAM tables, It all seems like a huge mess. You might ask why would I ever want to mix the tables together... the anwer is PERFORMANCE. as many developers have noticed, InnoDB tables generally have bad ...

Change date format that MySQL reads

I have a batch file that was created for an Oracle database that I'm now trying to import to a MySQL database. I've had to deal with all sorts of inconsistencies between the two. The file has all the dates as '17-NOV-1981' rather than '1981-11-17' as MySQL expects. The batch file had the command *ALTER SESSION set nls_date_format='DD-M...

How can I pass an "array" of values to my stored procedure?

I want to be able to pass an "array" of values to my stored procedure, instead of calling "Add value" procedure serially. Can anyone suggest a way to do it? am I missing something here? Edit: I will be using PostgreSQL / MySQL, I haven't decided yet. ...

Zend Pagination - Seems Not to be limiting number of results on each page

Hello, I am relatively new to The Zend framework having only been working with it probably two months at the most. I am now trying to get a list of results from a query I run, send it through the zend paginator class and display 4 results per page, however it does not seem to be recognising when it has got 4 results, I believe there is...

What to use for SQL Server instead of "Key"?

Hi! I have a script of MySQL queries that I use and that work. I'm trying to execute the same queries in Microsoft SQL server and there's one thing I don't understand. MySql uses "key" to define a key made up of different fields. What is the way to do the same thing in SQL Server? Thanks! -Adeena ...

Mysql connection pooling question: is it worth it?

I recall hearing that the connection process in mysql was designed to be very fast compared to other RDBMSes, and that therefore using a library that provides connection pooling (SQLAlchemy) won't actually help you that much if you enable the connection pool. Does anyone have any experience with this? I'm leery of enabling it because o...

How do I connect a database to a website so that the user can access the database and make changes to it?

I am trying to make a website that allows the user to make changes to their individual mysql database. The website is written in PHP. How do I connect one of the web pages to a database? Any advice would be appreciated. ...

How do I connect to my mysql databases, which I used heidsql to make, from a website?

I am using heidisql to create my mysql databases. How do i connect to those databases from the website I'm using. I need to be able to change the databases from the website. I am writing the website in php and writing the program that interacts with the databases in python. Can anyone help me? Thanks ...

Using an IN clause with MySQL with stated values

I'm trying to write a query that updates rows in a table if a certain column has a value in a list I'm providing: UPDATE MY_TABLE SET COL1 = 'xyz' WHERE COL2 IN ('x', 'y', 'z'); I'm getting a syntax error, but I know that this should be possible. It's essentially a single command to execute the following 3 commands: UPDATE MY_TABLE S...

insert two values from an mysql table into another table using a python program

I'm having a small problem with a Python program (below) that I'm writing. I want to insert two values from a MySQL table into another table from a Python program. The two fields are priority and product and I have selected them from the shop table and I want to insert them into the products table. Can anyone help? Thanks a lot. Mar...

PHP/MySQL with encoding problems

I am having trouble with PHP regarding encoding. I have a JavaScript/jQuery HTML5 page interact with my PHP script using $.post. However, PHP is facing a weird problem, probably related to encoding. When I write htmlentities("í") I expect PHP to output í. However, instead it outputs í At the beginning, I thought ...

PDO query problem

I am updating some code from the old mysql_* functions to PDO. It connects without a problem, runs the query without a problem, but the resultset is empty. PDO::query() is supposed to return a PDOStatement object, yet I am getting true in return. No errors are reported. Here is my code: try { $DB = new PDO("mysql:host=localhost...

MySQL versus SQL Server Express Performance Comparison

I have a somewhat complex query with roughly 100K rows. The query runs in 13 seconds in SQL Server Express (run on my dev box) The same query with the same indexing and tables takes over 15+ minutes to run on MySQL 5.1 (run on my production box - much more powerful and tested with 100% resources) And sometimes the query crashes the ma...

Get the id of inserted row using C#

I have a query to insert a row into a table, which has a field called ID, which is populated using an AUTO_INCREMENT on the column. I need to get this value for the next bit of functionality, but when I run the following, it always returns 0 even though the actual value is not 0: MySqlCommand comm = connect.CreateCommand(); comm.Command...

BEFORE or AFTER trigger for maintaining audit log

I've been reading the MySql 5.0 comment stream on the create trigger page and I would like to ask the community if the recommendations are good & whether they still apply to 5.1. What I've noticed playing with triggers today is that it is impossible to update a field in the old table using a AFTER UPDATE. Be careful with BEFORE trigge...

Php/ MySql 'Advanced Search' Page

I'm working on an 'advanced search' page on a site where you would enter a keyword such as 'I like apples' and it can search the databse using the following options: Find : With all the words, With the exact phrase , With at least one of the words, Without the words I can take care of the 'Exact phrase' by: SELECT * FROM myTab...

Fetch two next and two previous entries in a single SQL query

Hi, I want to display an image gallery, and on the view page, one should be able to have a look at a bunch of thumbnails: the current picture, wrapped with the two previous entries and the two next ones. The problem of fetching two next/prev is that I can't (unless I'm mistaken) select something like MAX(id) WHERE idxx. Any idea? no...

Best Update Method for MySQL DB

I have read through the solutions to similar problems, but they all seem to involve scripts and extra tools. I'm hoping my problem simple enough to avoid that. So the user uploads a csv of next week's data. It gets inserted into the DB, no problem. BUT an hour later he gets feedback from everyone, and must make updates accordingly. H...

Best practice for backing up a production MySQL database?

What is best practice for backing up a production MySQL database (i.e. on a live website and potentially being updated)? Some goals I have in mind are: the DB backup should be an internally consistent snapshot not lock out the website while the backup is in progress (nice to have) incremental backups of changes only automated able to ...