mysql

Mantis - Integrate Wiki

I am using Mantis (PHP and MysQL) as a bug tracking tool and I would like to extend it in order to document requirements and technical specifications. Ideally, I should be able to link a defect with a requirement. Is there a way to integrate a Wiki tool (preferably PHP and MySQL based) into Mantis? EDITED: Instructions how to integra...

Common-practice in dealing with high-load tables in MySQL

Hi, I have a table in MySQL 5 (InnoDB) that is used as a daemon Processing Queue, thus it is being accessed very often. It is typical to have around 250 000 records inserted per day. When I select records to be processed, they are read using a FOR UPDATE query to eliminate race conditions (everything is Transaction Based). Now I am dev...

mysql if condition

in my query i have IF(friend.block, 'yes', 'no') and friend.block value is 0 or 1.. but eaither way its putting 'yes'.. any idea? ...

MySQL Deadlock Detection via PHP

What is the best-practice in dealing with MySQL Dead-Locks in PHP? Should I wrap all database calls in a try{}catch{} block and look for the DeadLock error code from the database? Do I then reissue the whole transaction again (I presume the one that failes rolled back)? ...

Mysql Plug-in for Qt

I've installed recent Qt (4.5.3) sdk windows version. I'm want to use mysql in my app. Since Qt Mysql plugin in not available, so I compiled it from the included source. I copied compiled files D:\\Qt\2009.01\qt\plugins\sqldrivers. Now when I run my application it still error "QMYSQL driver not loaded". ...

how to do a select on like values from multiple columns in sql

I have two tables with columns: Genres: ID, genre Adjectives: ID, adjective_title I need to do a select that returns the matching values from both tables columns with the 'like' syntax. For example if "ep" was the value entered using 'like' the results would look like: result_column: epiphonic (from genres table) epic (from adjecti...

Index on UNION query?

i've got this union query: (SELECT INSTALLER, INSTALLTIME, RESULT, JOBNUMBER, HONAME, ADDRESS, CITY, STATE, ZIP, NOTES, SMNOTES, '' as priority, PAFS, upsell, TERM, MMRUPGRADE, WARRANTY, EFT FROM ACCOUNTS WHERE INSTALLDATE = '$date' && FUNDINGSTATUS !='DEAD') UNION (SELECT technician, servicetime, result, ID, Customername, address, c...

Pulling RegEx from MySQL into PHP

I am trying to get the regex string from a table, but as soon as I put it into preg_match it throws an error about an unexpected "\". If I use the exact same string directly there is no issue. ...

MySQL - second sequence in table (e.g. by category)

Hi all, I'm trying to find the most efficient way to do something and would appreciate your advice! I have a table with the following columns: id category category_sequence other_columns id is an auto-increment column and the primary key. The category is selected by the user on the UI. What I'd like to do is generate a category_seq...

how to optimize this query (4 mm tables involved)

I am working with a legacy database schema that looks like this: product_table table has fields: uid (int, primary key) name (varchar 50) category table has fields: uid (int, primary key) name (varchar 50) Allright, now the product_table has 4 MM relations to the category table: product_table__category_1__mm has fields: uid_l...

Using backquote/backticks for mysql queries

Hi, I've been having a dilemma for a while now, so I said I'd see what you guys thing before I rest my case. Ever since I started playing with MySQL I was building query how I though was "the right way", with backticks. Example: SELECT `title` FROM `table` WHERE ( `id` = 3 ) As opposed to: SELECT title FROM table WHERE ( id = 3 ) ...

Algorithm that searches for related items based on common tags

Lets take StackOverflow questions as example. Each of them has multiple tags assigned. How to build an algorithm that would find related questions based on how many common tags they have (sorted by number of common tags)? For now I can't think about anything better than just selecting all questions that have at least one common tag into...

Is there a perfomance gain on the language chosen and DB?

Hello all, We have our current system using PHP and Microsoft SQL Server. I am trying to work out if there will be a performance gain in using PHP and MySQL? It will require some effort to change to this platform so I am hoping to find out as much as I can. Are there any questions I should be asking myself to determine the correct cho...

Is it possible to check if pdostatement::fetch() has results without iterating through a row?

I have a page which needs to check for results, and the way I came up with to do it is successful, but iterates through the first row of results. Is there a way I can check without iterating, or to go back to that first row without executing the query again? I was doing this: $q = pdo::prepare($SQL); $q->execute(array(':foo'=> foo, '...

Django ForeignKey(User), autocomplete

When some user create an object in the admin panel, I want that the author field of that object to be the user's name (The user that created it). How can I do it ? I have something like this : author = models.ForeignKey(User) I want to know what user created each object. ...

What is best approach for Storing data into MySQL after Parsing XML file using SAX Parser ?

Hi, I have student.xml file and am parsing this file using SAX Parser and now I need to store data into MySQL Database and so what approach is recommended. Code: package sax; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXExceptio...

How Many Days have occured during a Given Timespan

If we have date range such As: 1st October 2009 - 20th October 2009 Can we calculate how many Mondays have occured during The answer to this would be (3) M T W T F S S *1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 *20 21 22 23 24 25 26 27 28 29 30 31 Can we do this...

Conditional SELECT MySQL

Don't know if this is possible, but I'd like to select records based on the field value of recur_type, where the 'm' is the day of the week. If it's a weekly recurring event, I need to make sure this is a day it recurs on, otherwise, I want to return all days. however, I'm getting an empty result set: SELECT * FROM wp_fun_bec_events W...

MySQL driver for Rails in Windows 7 x64

I've got problem with connecting to MySQL database on my freshly installed Windows 7 machine. I'm getting this error when I try to migrate my database. !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! 193: %1 is not valid Win32 application - C:...

How can I use multidimensional arrays in PHP with MySQL-based sessions?

So I started using MySQL-based sessions with session_module_name("user"); and I love it, and I might as well because I have to. The only thing I'm missing are my beloved multidimensional arrays, and I'm at a juncture where they are most desired. How can I still use them, or is it a lost cause? ...