mysql

Is it possible to break out of a mysql stored procedure with something like return?

Apparently in mysql, you cannot use RETURN in a stored proc which is ridiculous because you can do it in mssql. ...

PHP mysql_query not returning false...

Just learning PHP and I'm having some trouble understanding mysql_query. My understanding is that mysql_query is supposed to return FALSE if the record is not found. However, it seems that it always returns true because "FOUND!" is always the result: $q = "SELECT * FROM users WHERE username = 'doesnotexist'"; $r = mysql_query($q); if ...

Is it possible to use a MySql User Defined Variable in a .NET MySqlCommand?

I'm trying to execute a query that currently works in phpMyAdmin but it does not working when executing it in .NET using the MySqlAdapter. This is the Sql statement. SELECT @rownum := @rownum +1 rownum, t . * FROM ( SELECT @rownum :=0 ) r, ( SELECT DISTINCT TYPE FROM `node` WHERE TYPE NOT IN ('ad', 'chatroom') )t It is using...

Help! Why did MySql just screech to a halt?

Our relatively high traffic website just screeched to a halt, and we're totally stumped. We run on Django and Mysql (InnoDB), and we're trying to figure out why it's all of a sudden totally slow. Here's what we know so far: On our mysql server, a simple query (from django shell) runs fast. On our app server, a simple query (from django ...

MySQL: Get a certain row

I have this table on MySQL. I want to query the port number for user_ids 1 and 2. umeta_id user_id meta_key meta_value ------------------------------------------ 1 1 nickname admin 8 1 userDir D 9 1 port 8080 10 1 paymentopt bankin 13 2 po...

Robust fault tolerant MySQL replication

Is there any way to get a fault tolerant MySQL replication? I am in an environment that has many networking issues. It appears that replication gets an error and just stops. I need it to continue to work and recover from these faults. There is some wrapper software that checks the state of replication and restarts it in the case of losin...

Table entries order.

Well this is going to sound like a lame question, I know. This is probably one of the most obvious things to do, but I've been trying to come up with a good way of sorting entries in database. Image table looking like this: entry_id | entry_data ------------------------- 1 | data1 2 | data2 ... | ... n ...

Is it worth using MYSQLI_CLIENT_COMPRESS when the db is on another machine?

I have two machines on amazon ec2, one with a drupal installation and another one with the mysql database. I wonder if it's worth to patch drupal to activate mysql client compression. Are there any caveats? ...

connection of MATLAB 7.0 and MYSQL

I want to connect MATLAB with MYSQL.I dont know the procedure.In MATLAB help it says about some drivers which confuses me alot.Can someone please guide me!please tell me the complete process.I shall be very very thankful!!! ...

Check Constraints in MySQL

Hi guru We have a bunch of tables in Microsoft SQL so that each table has its own check constraint. At the end we have created a partition view that does a "UNION ALL" against these tables. Our attempts to insert into this partition view is quite successful. Select, update and delete all work properly. We want a similar functionality in...

MySQL INTO OUTFILE overide existing file?

I've written a big sql script that creates a CSV file. I want to call a cronjob every night to create a fresh CSV file and have it available on the website. Say for example I'm store my file in '/home/sites/example.com/www/files/backup.csv' and my SQL is SELECT * INTO OUTFILE '/home/sites/example.com/www/files/backup.csv' FIELDS TE...

How to validate database backups

I have a few remote databases, hosted at my web hosts. For mysql, I use periodic mysqldump and for MSSQL, I use bcp to back them up. How do I validate those backups? How do I make sure that the backup was not partial (its done over the public network). ...

PHP: User Login System / Check if User has acess to a page

Hello guys. This is a bit noob question but.. Its happens sometimes to everybody. I never worked with $_SESSION so once i need a login system i've used Dreamweaver to do one for me. I have a page where he asks for user name and password. And if loggin successful its goes to other page. Else it says in the login page. The problem its t...

How do I build a query for this?

I have this table: +--------+---------+-----------+------------+ | bed_id | bed_num | place_id | bed_date | +--------+---------+-----------+------------+ | 1 | 150 | 1 | 1244344305 | | 2 | 250 | 1 | 1244345469 | | 3 | 145 | 2 | 1244348496 | | 3 | 146 | 2 | 124434849...

Using column alias in inner select in MySql

hello, It seems that I can't alias a column and use it in the inner select in MySql. How do I do the following in MySql for example? SELECT NAME,ID AS M_ID FROM EMPLOYEES WHERE EXISTS (SELECT 1 FROM MANAGERS WHERE MANAGERID = M_ID) MySql would not recognize M_ID alias! EMPLOYEES (ID,NAME) MANAGERS (MANAGERID,...) Thanks ...

SubSonic MySQL Version

SubSonic 2.2 requires MySQL Connector 5.3.2.0. This is not included in the download package, nor is it any longer available from the MySQL download site. I know I can build SubSonic again from source to get around this, but this is a pain. Can someone on the SubSonic project please change the "Specific Version" flag on the MySQL assemb...

MySQL C API libraries for iPhone

Hi! Does anybody know where to get a MySQL libraries compiled for the arm iPhone architecture? Or how to cross-compile MySQL for arm? Thanx ...

MySql Primary Key > 900/1000 bytes?

I have a composite primary key, which together turns out to be rather large (~2000 bytes). I have no performance considerations, I just would like a primary key to enforce uniqueness. MySql doesn't like long primary keys. Is there a way around this? Perhaps to only enforce uniqueness, without building an index? I wouldn't want to use A...

Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I am running a Rails app so now I am trying to remote connect to mysql and I am getting this error Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 ...

PHP MySQL query with %s and %d

SELECT COUNT(*) AS test FROM %s WHERE id = %d AND tmp_mail <> '' What are %s and %d for? ...