mysql

Converting a MySQL query, to a routine which takes parameter

Hi! I'm using VSC++ and MySQL ver.5.2.25 database, I've tested a query In MySQL that is like this: select Name from test.virus where Name LIKE 'b' '%' ORDER BY Name; It works well and return all Names that starts with 'b',I want to use a routine instead of this query, so that I can call the routine from my program. I've tried this...

Help! keyword's priority in MySql fulltext search!

In my this query: SELECT *, MATCH(keywords) AGAINST ('get back future 2 ' IN BOOLEAN MODE ) AS score FROM movie WHERE MATCH (keywords) AGAINST ('get back future 2 +movie' IN BOOLEAN MODE) HAVING score > 0 ORDER BY score DESC, in_cinema DESC when the record match the all keywords:' get back future 2',it return the right record.But wi...

How to insert partial data into a Mysql table?

INSERT INTO sitelist(id,rank,websiteaddress,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10) VALUES ('','','','search','searchengine','discover','find','tag5','tag6','tag7','tag8','tag9','tag10') WHERE `id`=1 The thing is that the first row is like this 1 1 google.com nothing nothing etc I want to insert search searchengine disc...

The unicode character from a rails app appears as ??? in the mysql databasse ,

The unicode character from a rails app appears as ??? in the mysql databasse (ie when I view through putty or linux console), but my rails app reads it properly and shows as intended.I have another java application which reads from the rails database and stores the values in its own database. and try to show in from its database. But in ...

How to get the list of table names from database in Drupal

Hi, I want to get tables list into array from database and the column names of a specific table into array in Drupal. Please mention the queries in Drupal. Thanks ...

Possible to programmatically ALTER multiple MySQL tables?

I have multiple MySQL tables with names of the form "Shard_0", "Shard_1", "Shard_2" ... "Shard_n" All of them have identical table structure. They all live in the same database. Say I want to add a column to all those tables. Is there a way to do that programmatically? Something like: # pseudo code for i in range(n): tablenam...

Mysql_real_escape_string...is there an auto setting else where?

Hey ya all Got an odd situation here. On my local mysql database (v5.1.41), I am required to use this escape command if I am to handle users' quotation syntaxs without any problems. However I cannot use this command on my web server's mysql database (v5.0.91-community). If this command is used on the web server (apache v2.2.13), an ext...

Why I got this error: "SQL Error 1025: Error on rename of '...' to '...' (errno: 150)"?

I want to rename a field of a table in MySQL ver 5.2.25, from "alter table", but I got this error: SQL Error 1025: Error on rename of '.\Packers\#sql-804_3' to '.\Packers\pattern' (errno: 150) but on other table I had not this problem, I don't know why, is it caused by foreign key? ...

basic performance comparison

Do you know which table srtucture is better : table user id INT pk autoincrement name VARCHAR(255) email VARCHAR(255) statut TINYINT(4) The statut can only hold 2 states : 1/2 OR table user id INT pk autoincrement name VARCHAR(255) email VARCHAR(255) statut VARCHAR(45) The statut can only hold 2 states : ac...

Zend master slave mysql

I want to switch slave db if master fails. I found Master/Slave switch, but its for reading writing (seems very logical, but not this case). Can you give " db failure" strategy in zend? ...

PHP form enter will not give me the text fields.. [http-auth login for security]

<?php $prev_path = "./../../."; $dont_redirect = true; require_once "${prev_path}./config.php"; session_start(); function http_digest_parse($txt){ $needed_parts = array("nonce"=>1, "nc"=>1, "cnonce"=>1, "qop"=>1, "username"=>1, "uri"=>1, "response"=>1); $data = array(); $keys = implode("|", array_keys($n...

How to execute query based on passed operators <,= by param using Stored Procedures?

I have a stored procedure(SP) where one of it's param passes the operator. The operator can be: <=, >=, = How can I use this in the query? How the operators are passed is not built yet, it can be string represented <= or by using a custom code 1, 2 or 3. What do you think? ...

Want to show data in group using group by

I have a table where there is composite key of id and emp_no. I want to show record of all tids against one emp_no like this (not using any aggregate functions because no need to show any thing like that): emp_no tid tid tid emp_no2 tid tid tid Thanks in advance ...

[mysql] simplify this query

SELECT COUNT( sendbook.id ) AS total, SUM( sendbook.num ) AS num, ( SELECT COUNT( sendbook.id ) FROM sendbook INNER JOIN clients ON clients.id = sendbook.clientid WHERE sendbook.issueid = '29' AND clients.area >1000 AND clients.area <2000 ) AS area1000, ( SELECT COUNT( sendbook.id ) FROM sendbook INNER JOIN clients ON clients.id = send...

Ant couldn't connect to mysql (access denied), but mysql client could

I hava the next task in my ant file: <target name="initdb"> <sql driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/dtest" userid="root" password="oksaoksaoksa" > <classpath> <pathelement path="./lib/mysql-connector-java-5.1.13-bin.jar"/> </classpath> <transaction src="./init.sql"/...

How to purge the Database data and log files in MySQL ?

I want to purge the ibdata1, ib_logfile0 and ib_logfile1 files in MySQL. Because these files are taking too much space of my C:\ disk. And I don't want to move these files anywhere else in the Hard disk. I heard about purging which can shrink the data. I am using Windows Vista. What are the steps to be done to purge the data ? ...

How to retrieve a set of table data in SQL?

Hi, everyone, I want to ask a question about the SQL. I have the following table. Name Phone a 1 b 2 c 3 d 4 e 5 I have an ArrayList(java) which contains the [a,b,c,d,e]. Is it possible to put the ArrayList into the mySQL statement to retrieve the all the phone numbers? Thank you. ...

what is the fastest way to update thousands rows in mysql

lets assume you have a table with 1M rows and growing ... every five minutes of every day you run a python programm which have to update some fields of 50K rows my question is: what is the fastest way to do the work? runs those updates in loop and after last one is executed than fire up a cursor commit? or generate file and than ru...

Is it okay to move my MySQL database without moving Information_Schema?

I am moving all my websites to one server, and I was wondering if it is okay to leave out the information_schema because I have multiple different ones from different servers. ...

how to get remote mysql database dump to my local machine ?

Hi, I have remote server credentials and mysql root password. When I access remote machine and trying to take dump it throws "'Got error 28 from storage engine' when trying to dump tablespaces". So I plan to take the dump from my local machine. So,how can I take the database dump. Thanks in advance! ...