mysql

Difference between mysql and sql server? Performance, features,...?

What are the differences between MySQL and Sql server? What are the parameter to chose between the two? ...

MySQL Duplicate rows

I have a table with some repeated information: Id, Name, Lastname, Birth, PersonalKey, Personal Info, Direction, Source. Where source tells me where the information came from. The repeated information has unique id, and I need to erase the duped information. But, I have priority over some Source information that i need to be the one t...

MySQL Batch Updates in C

Hi, Does MySQL's C API support batch updates? I'm writing an application where certain transactions are processed in large batches. It will grossly inefficient if in the logging process I wind up performing a single call DB for each insert. Does C have anything similar to Java's APIs for batch SQL updates? Thanks, N. ...

Django connection pooling and time fields

Has anyone got connection pooling working with Django, SQLAlchemy, and MySQL? I used this tutorial (http://node.to/wordpress/2008/09/30/another-database-connection-pool-solution-for-django-mysql/) which worked great but the issue I'm having is whenever I bring back a time field it is being converted to a timedelta since the Django-speci...

PEAR::DB Error, Extension Not Found

I am attempting to install phpBugTracker on our web server. When I attempt to test the database connection on the installation screen, I get an error screen that reads "DB Test Failure... DB Error: extension not found". The error is being thrown from the following function: function test_database(&$params, $testonly = false) { // ...

multi-user application record locking - best method?

I'm developing a php / mysql application that handles multiple simultaneous users. I'm thinking of the best approach to take when it comes to locking / warning against records that are currently being viewed / edited. The scenario to avoid is two users viewing the record, one making a change, then the other doing likewise - with the po...

MySQL Syntax and 'OR' Performace

This MySQL query works just fine SELECT o.id FROM descriptions_programs d, titles_programs t, programs o WHERE (d.object_id=o.id AND MATCH (d.text) AGAINST ('+china' IN BOOLEAN MODE) AND d.current=1) AND (t.object_id=o.id AND MATCH (t.text) AGAINST ('+china' IN BOOLEAN MODE) AND t.current=1) But if I replace...

Custom XPath in MySQL

I'm wondering if anyone out there as built a custom script or stored procedure that will accept a field and an XPath expression to return. Even if it's really clumsy, I'll take it. Something like this: FindByXPath(fieldName, query); Which I would give values: FindByXPath([xmlContent], '/root/customer/country[@attribute]'); All I ...

can't connect to mysql with php

I can't seem to connect to mysql with a php script, even though I can connect fine with phpmyadmin. I created a user with a password, and gave it the proper priveleges for the db, but everytime it connects it dies saying access denied. I am using xampp on a windows xp box. Firewalls are all disabled, and I've checked the username nad ...

MySQL FULLTEXT Search Across >1 Table

As a more general case of this question because I think it may be of interest to more people...What's the best way to perform a fulltext search on two tables? Assume there are three tables, one for programs (with submitter_id) and one each for tags and descriptions with object_id: foreign keys referring to records in programs. We want th...

Rss Function

I have a function to build a rss feed with PHP: function createRSS() { $currentDate = time(); $sql = "SELECT * FROM ". ADS_TABLE ." WHERE expires > $currentDate ORDER BY enterd DESC LIMIT 0,400"; $results = myExec($sql); // open a file pointer to an RSS file $fp = fopen ("mexautosrss.xml", "w"); if (!$fp) { ...

Query output to a file gives access denied error

Hi I am trying to capture the output of a SQL query in MySQL, to a text file using the following query. select count(predicate),subject from TableA group by subject into outfile '~/XYZ/output.txt'; I get the following error. ERROR 1045 (28000): Access denied for user 'username'@'%' (using password: YES) Any idea, where am I going wr...

How to do this mysql query? (how to get n fields in 1 row)

Following a previous question ( http://stackoverflow.com/questions/652484/how-to-do-this-query-in-mysql ) Lets say I have a message: Id: 1, Message: This is a message 2 subjects: Id:1, Subject: Math Id:2, Subject: Science Id:3, Subject: Numbers And there's 2 message_subject_rel entries that go: Id: 1, message_id: 1, subject_id: ...

When a new row in database is added, an external command line program must be invoked

Is it possible for MySQL database to invoke an external exe file when a new row is added to one of the tables in the database? I need to monitor the changes in the database, so when a relevant change is made, I need to do some batch jobs outside the database. ...

Format DATETIME column using PHP after printing

Hey, I am using DATETIME for my column for my database. I am trying to find the best way to format this date held in the row using PHP. I tried using date() but that would just print the current date. My row looks something like: $row['date_added'] Any ideas? ...

Force mySQL to join a table(to do a unoptimized query, that i need)

This is kinda weird. I have the next query: SELECT * , GROUP_CONCAT( x.tag SEPARATOR ',' ) AS tags FROM tag AS t, tag AS x, tag_message_rel AS r, message m INNER JOIN `user` AS u ON m.user_id = u.id WHERE t.tag IN ( 'kikikiki', 'dsa' ) AND m.id = r.message_id AND t.id = r.tag_id AND x.id = r.tag_id GROUP BY m.id HAVING COUNT( * ) >=2 OR...

In which scenario would you prefeer to use mysql over sql server or viceversa?

In which pratical scenarion would you prefeer one or the other? I know there are a lot of parameter you can compare, can you give me some practical examples? Example: mysql in case of multiple databases with few tables, sql server for single database with lots of tables because.... ...

DATETIME - three hours behind timezone

Hey, I am using DATETIME as a column type and using NOW() to insert. When it prints out, it is three hours behind. What can I do so it works three hours ahead to EST time? I am using php date to format the DATETIME on my page. Thanks, Ryan ...

How to fetch 3 first places of each game from the score table in mysql?

hi I have the following table: CREATE TABLE `score` ( `score_id` int(10) unsigned NOT NULL auto_increment, `user_id` int(10) unsigned NOT NULL, `game_id` int(10) unsigned NOT NULL, `thescore` bigint(20) unsigned NOT NULL, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`score_i...

What is the best approach to monitor site performance in rails

I'd like to have a special part of administrate area which shows a list of pages/queries that was slow for the past week. Is there a gem / plugin or other easy way to implement/automate such functionality for the Rails framework? ...