query cache about the federated engine

2006-08-09 Thread wangxu
It bring great effect in performance if federated engine can't use the cache.

If mysql intend to support it in the future?

- Original Message - 
From: Michael Loftis [EMAIL PROTECTED]
To: wangxu [EMAIL PROTECTED]; mysql@lists.mysql.com
Sent: Thursday, August 03, 2006 1:27 AM
Subject: Re: query cache about the federated engine


 
 
 --On August 2, 2006 5:25:51 PM +0800 wangxu [EMAIL PROTECTED] wrote:
 
  I have a problem about the performance of federated engine. The
  mysql5.0 reference manual says that the FEDERATED tables do not work with
  the query cache, aren't they? How about the query cache used by the
  federated engine in the mysql5.1?  If the query cache cann't be used
  with the federated engine tables still, how to enhance the query
  performance against to the federated tables effectively?
 
 Well for one if the machine isn't on the same LAN you'll never have good DB 
 performance -- not sure if this is the case or not, just a helpful hint.
 
 For two, the reason why federated doesn't use the query cache is then you 
 have to somehow invalidate the remote cache(s) which would require some 
 form of protocol extension, either in the SQL or the over the wire protocol 
 so that the server with the federated table could ask if it could cache a 
 result, and the server that's serving to the federated client could inform 
 that server when it's cache isn't valid.
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 
 

question about the query against to the federated engine tables

2006-08-09 Thread wangxu
who can help me?
- Original Message - 
From: wangxu [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Wednesday, August 02, 2006 5:29 PM
Subject: question about the query against to the federated engine tables


 I have a question about the query against to the federated engine tables. 
 As the following example:
 
 select Id,name from e01_system.category 
 Note: the e01_system.category is a federated table.
 
 I select only tow fields from the federated table category with the 
 above sql statement. But it seemed as if gets all the fields of the table 
 (the table has more then ten fields actually), so the performance of the sql 
 stetement is very slow when the table's size is very big.I conclude this 
 through monitoring the throughput of the network with a network tool named 
 sniffer. I think the federated table works not as what i expected.

How does the federated engine table work

2006-08-09 Thread wangxu
please help me thanks.
- Original Message - 
From: wangxu [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Wednesday, August 02, 2006 5:27 PM
Subject: How does the federated engine table work 


 How does the federated engine table work when the query statement include 
 a join  substatement, it joins a local table with innodb engine and a 
 federated table. How does the server deal with the query substatement like 
 this?

Re: question about the query against to the federated engine tables

2006-08-09 Thread Paul McCullagh
As a storage engine, federated does not have the information as to 
exactly which columns have been selected. This information is simply 
not passed down to the engine.


However, if there is index support for a query then MySQL will indicate 
to the engine if it is only interested in the columns of the index, or 
in all columns. In this case the engine can optimize the retrieval by 
only returning the rows of the index (in most engines this saves 
accessing the data record).


So I am not sure how federated works, but you could try creating an 
index on the e01_system.category (Id,name). Then you may need to force 
the use of the index by modifying your query, for example:


select Id,name from e01_system.category where id  0

On Aug 9, 2006, at 8:26 AM, wangxu wrote:


who can help me?
- Original Message -
From: wangxu [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Wednesday, August 02, 2006 5:29 PM
Subject: question about the query against to the federated engine 
tables



I have a question about the query against to the federated engine 
tables. As the following example:


select Id,name from e01_system.category
Note: the e01_system.category is a federated table.

I select only tow fields from the federated table category with 
the above sql statement. But it seemed as if gets all the fields of 
the table (the table has more then ten fields actually), so the 
performance of the sql stetement is very slow when the table's size 
is very big.I conclude this through monitoring the throughput of the 
network with a network tool named sniffer. I think the federated 
table works not as what i expected.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Probably naive update question

2006-08-09 Thread Chris Sansom
I have a field representing the chances the user has to get a 
password right, which is initially 3. I would like, if possible in a 
single query, to be able to decrement it if it's still  0 and return 
the value. Something like this:


UPDATE table
SET chances = IF(chances  0, chances - 1, 0)
WHERE id = xxx

SELECT chances
FROM table
WHERE id = xxx

Is there some tidy way to do that with, say, a subquery (something to 
which I'm still quite new, having been stuck with MySQL 3 until 
recently)? I don't even know for certain that I have the IF syntax 
right, but I think I have.


I'm using MySQL 5, btw.

--
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

Never trust a man who, when left alone in a room
with a tea cosy, doesn't try it on.
   -- Billy Connolly

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How to set User variables (not system/session ones) at database startup

2006-08-09 Thread Asif Lodhi

Hi,

I want to set certain _user_ variables, which I will create myself, at
the database startup time so that all clients can use the values
stored [only one time at the beginning] in those variables instead of
computing the same each time in triggers or other code.

It's just like the package-level host variables of Oracle.  How can
I do the same in MySQL?  I am using 5.0.22 and will switch to 5.0.24
soon.

--
Thanks in advance,

Asif

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Expressions, SQL Aggregate functions SELECT Performance - index usage

2006-08-09 Thread Asif Lodhi

Hi,

I am having to write queries that contain operators such as MOD and
DIV in addition to other normal arithmetic operators to add, multiply,
divide, etc.  I am also using MAX(), MIN() in the same queries.
Actually, I am using INSERT ... SELECT MAX() * X ... FROM TABLE idiom
to calculate the max key value to be inserted in the table instead of
using the auto-increment (because it's rollback-unfriendly).  However,
I wonder if using such expressions (I not using any  other functions
except SQL Aggregate functions) in the select column-list would slow
down the INSERTs and what the performance implications are if there
are around 75 users.

--
Thanks in advance,

Asif

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



MySQL 5.0.24 hard time with VB 3.5.4 and 3.6

2006-08-09 Thread Abdullah Ibn Hamad Al-Marri
Hello folks,

I'm having hard time with MySQL, I posted this issue t the vb board, and they 
claimed it's MySQL issue.

I have this issue since I upgraded to MySQL 5.0.22 and now it's still I going 
on since I upgraded to MySQL 5.0.24 too.

Database error in vBulletin 3.6.0:

Invalid SQL:

INSERT IGNORE INTO session
(sessionhash, userid, host, idhash, lastactivity, location, 
styleid, languageid, loggedin, inforum, inthread, incalendar, badlocation, 
useragent, bypass, profileupdate)
VALUES
('49778b903012cc3dba1481897dcb5749', 0, '62.68.61.2', 
'ab1219e33a7fca1808ca880a806b6383', 1155125518, 
'/showthread.php?t=5311amp;page=4', 0, 0, 0, 21, 5311, 0, 0, 'Mozilla/4.0 
(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)', 0, 0);

MySQL Error  : MySQL server has gone away
Error Number : 2006
Date : Wednesday, August 9th 2006 @ 12:13:16 PM
Script   : http://bb.wearab.net/showthread.php?t=5311page=4


--

Database error in vBulletin 3.6.0:

Invalid SQL:

UPDATE session
SET lastactivity = 1155128141, inforum = 0, inthread = 0, 
incalendar = 0, badlocation = 0
WHERE sessionhash = '72acdfba168f0c3d33e0728f4eff5326';

MySQL Error  : MySQL server has gone away
Error Number : 2006
Date : Wednesday, August 9th 2006 @ 12:56:14 PM
Script   : 
http://bb.wearab.net/online.php?order=ascsort=usernamepp=200page=1
Referrer : 
IP Address   : 82.148.97.67



--

Here is my server profile.

 Server TypeFreeBSD
 Web Server Apache v2.2.2
 PHP5.1.4
 PHP Max Post Size  8.00 MB
 PHP Maximum Upload Size2.00 MB
 PHP Memory Limit   16.00 MB
 MySQL Version  5.0.24
 MySQL Packet Size  32.00 MB
 Data Usage 70.57 MB
 Index Usage34.93 MB
 Attachment Usage   17.01 MB
 Avatar Usage   414.5 KB
 Profile Picture Usage  429.2 KB

Thank you,

-Arabian




Re: MySQL 5.0.24 hard time with VB 3.5.4 and 3.6

2006-08-09 Thread Renato Golin

Abdullah Ibn Hamad Al-Marri wrote:

Invalid SQL:

INSERT IGNORE INTO session
(sessionhash, userid, host, idhash, lastactivity, location, 
styleid, languageid, loggedin, inforum, inthread, incalendar, badlocation, 
useragent, bypass, profileupdate)
VALUES
('49778b903012cc3dba1481897dcb5749', 0, '62.68.61.2', 
'ab1219e33a7fca1808ca880a806b6383', 1155125518, 
'/showthread.php?t=5311amp;page=4', 0, 0, 0, 21, 5311, 0, 0, 'Mozilla/4.0 
(compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)', 0, 0);

MySQL Error  : MySQL server has gone away
Error Number : 2006
Date : Wednesday, August 9th 2006 @ 12:13:16 PM
Script   : http://bb.wearab.net/showthread.php?t=5311page=4


There's nothing wrong with this query as far as I can see (maybe 
misaligned quotes, didn't check), but I don't think that's the problem.


Check:
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

It's probably timeout from the server and it usually comes out of TCP 
timeout (the admin should take care of it) or executing queries with 
closed db handles in your code (you should care for it).


If you're sure it's not your fault, (and you do have privileges) send 
that page to the admin and ask him for a better network! ;)


cheers,
--renato

PS: This error message is subject to forums like this quite often, if 
you had googled for the error message you'd check that the page I'm 
referring to is the first match.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Probably naive update question

2006-08-09 Thread Dan Buettner

Chris, I'm not aware of a way to use ordinary SQL (insert, update)
for this, but the use of a stored procedure would work for you.  I've
not done it with MySQL (never had a need) but did things like this
extensively with Sybase.

In rough terms:

CREATE PROCEDURE sp_chances(IN xxx INT) RETURNS INT
BEGIN
   UPDATE table SET chances = IF(chances  0, chances - 1, 0) WHERE id = xxx;
   SELECT chances FROM table WHERE id = xxx;
END;

Then you would execute  this SQL:
CALL sp_chances(xxx)
and it should return the number of chances left for user id xxx,
having decremented the counter as well (if  0).

See
http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
for more info

Dan

On 8/9/06, Chris Sansom [EMAIL PROTECTED] wrote:

I have a field representing the chances the user has to get a
password right, which is initially 3. I would like, if possible in a
single query, to be able to decrement it if it's still  0 and return
the value. Something like this:

UPDATE table
SET chances = IF(chances  0, chances - 1, 0)
WHERE id = xxx

SELECT chances
FROM table
WHERE id = xxx

Is there some tidy way to do that with, say, a subquery (something to
which I'm still quite new, having been stuck with MySQL 3 until
recently)? I don't even know for certain that I have the IF syntax
right, but I think I have.

I'm using MySQL 5, btw.

--
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

Never trust a man who, when left alone in a room
with a tea cosy, doesn't try it on.
-- Billy Connolly

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



List-Unsubscribe

2006-08-09 Thread [EMAIL PROTECTED]

List-Unsubscribe



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Probably naive update question

2006-08-09 Thread Chris Sansom

At 8:49 -0500 9/8/06, Dan Buettner wrote:

Chris, I'm not aware of a way to use ordinary SQL (insert, update)
for this, but the use of a stored procedure would work for you.  I've
not done it with MySQL (never had a need) but did things like this
extensively with Sybase.

In rough terms:

CREATE PROCEDURE sp_chances(IN xxx INT) RETURNS INT
BEGIN
   UPDATE table SET chances = IF(chances  0, chances - 1, 0) WHERE id = xxx;
   SELECT chances FROM table WHERE id = xxx;
END;

Then you would execute  this SQL:
CALL sp_chances(xxx)
and it should return the number of chances left for user id xxx,
having decremented the counter as well (if  0).


Hi Dan

Thanks for this, but it's clear to me that all the stored procedure 
is doing is running the two queries I was running otherwise. It would 
save me a couple of lines of PHP code, but is it really any more 
efficient? Especially as this will be on a /very/ small database (at 
least, by the standards of some of the people on this list!) and 
won't happen particularly often. It'll only get called of the user 
doesn't get the password right first time, which most of them will do 
- and there won't be many anyway, at least not at first.


What I was really hoping for was some equivalent of 
mysql_insert_id(), but returning some other value from the last query.


Not to worry - two quick queries it is... or maybe it would do me 
good to start learning about stored procedures. :-)


Thanks again!

--
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

10 percent of computer users are Mac users, but remember,
we are the top 10 percent.
   -- Douglas Adams

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SSH Server for MySQL-5.0.22 Server on WinXP-SP2

2006-08-09 Thread Asif Lodhi

Hi Alan and others,

On 8/7/06, Alan Vinh [EMAIL PROTECTED] wrote:

I would like to 
know how
they got MySql to work with SSL...


:)

Sorry fellows.  I should have gone through the docs first.  As it
happens, MySQL-5.0.22 comes bundled with SSL support - albeit with
yaSSL - not OpenSSL.  The SSL files are supposed to be in PEM format.
In docs, it's mentioned that the connection to an SSL-enabled server
can be established via the C API.  As far as I am concerned, that
means writing a static DLL in C and call the functions written to
connect securely (via SSL, that is) to MySQL in VB6.  Am I right?
Please comment.

I did register on CACert.org a couple of days back.  Would any of you
guys tell me __how__ MySQL is going to work with the public key,
private key and CA file of the CACert.org?

Any help?

--
TIA,

Asif

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



inner outer joins

2006-08-09 Thread Brian E Boothe

hi all
Can someone provide a small project using inner and outter joins with
querys thanks alot

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



manual on stored procedures and triggers

2006-08-09 Thread Vittorio ZuccalĂ 

Hello,
i'm searching for a manual about stored procedures and triggers.
I'm new about this arguments but i want to study them.
Unfortunally, mysql online manual is not rich about examples so, can you 
suggest me

some online manuals on stored procedures and triggers?

Thank you,
   Vittorio


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: manual on stored procedures and triggers

2006-08-09 Thread Chris White
On Wednesday 09 August 2006 07:27 am, Vittorio ZuccalĂ  wrote:
 Hello,
 i'm searching for a manual about stored procedures and triggers.
 I'm new about this arguments but i want to study them.
 Unfortunally, mysql online manual is not rich about examples so, can you
 suggest me
 some online manuals on stored procedures and triggers?

There's actually a MySQL dev article on it.  Get the PDF here:

http://dev.mysql.com/tech-resources/articles/mysql-storedprocedures.pdf

I found it really helpfull when starting out on stored procedures with MySQL.  
If you're looking for book form, I found The Definitive Guide to MySQL 5 by 
Michael Kofler (Apress) to be a good resource.

 Thank you,
 Vittorio

-- 
Chris White
PHP Programmer/DBarbaric
Interfuel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



how to store quotes in mysql?

2006-08-09 Thread afan
hi to all.

battling this problem on several forums and mailing lists, I got confused:
when store string that contains quotations (ie afan's php shop) in mysql
does it have to be stored with backslashes (afan\'s \php\ shop) or just
the way it is? my login's telling me the way it is. am I wrong?

thanks for any help.

-afan




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Support for JDBC 4.0?

2006-08-09 Thread Steven Buroff
Does anyone know if there are plans to add support for JDBC 4.0 to the java
connector? I'm particularly interested in support for the
Connection.createQueryObject(Class cls) method.
Thanks.
 
Steve Buroff


Re: how to store quotes in mysql?

2006-08-09 Thread Chris White
On Wednesday 09 August 2006 07:49 am, [EMAIL PROTECTED] wrote:
 hi to all.

 battling this problem on several forums and mailing lists, I got confused:
 when store string that contains quotations (ie afan's php shop) in mysql
 does it have to be stored with backslashes (afan\'s \php\ shop) or just
 the way it is? my login's telling me the way it is. am I wrong?

Yes, MySQL stores it that way for a specific reason.  That is strings are 
generally input in the form:

INSERT INTO table (blah) VALUES('blah');

That said, if you didn't have the slash escape, you'd have something like:

INSERT INTO table (blah) VALUES('I'm blah);

Which MySQL would choke on, not knowing what to do with m blah.  Also, this is 
done to prevent SQL injection, like:

INSERT INTO table (blah) VALUES('[bl' ; DELETE FROM table; SELECT('ah]');

where [] is what the user inputs.  Now when displaying, you'll have to 
unescape the slashes generally.  Unfortunately I can't remember in PHP if 
that's because of magic quotes or just the way the db has it stored.  My gut 
instinct is the former.

 thanks for any help.

 -afan

-- 
Chris White
PHP Programmer/DBaboon
Interfuel

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: how to store quotes in mysql?

2006-08-09 Thread Kristen G. Thorson
  battling this problem on several forums and mailing lists, I got
 confused:
  when store string that contains quotations (ie afan's php shop) in
 mysql
  does it have to be stored with backslashes (afan\'s \php\ shop) or
 just
  the way it is? my login's telling me the way it is. am I wrong?
 
 Yes, MySQL stores it that way for a specific reason.  That is strings
are
 generally input in the form:
 
 INSERT INTO table (blah) VALUES('blah');
 
 That said, if you didn't have the slash escape, you'd have something
like:
 
 INSERT INTO table (blah) VALUES('I'm blah);
 
 Which MySQL would choke on, not knowing what to do with m blah.  Also,
 this is
 done to prevent SQL injection, like:
 
 INSERT INTO table (blah) VALUES('[bl' ; DELETE FROM table;
SELECT('ah]');
 
 where [] is what the user inputs.  Now when displaying, you'll have to
 unescape the slashes generally.  Unfortunately I can't remember in PHP
if
 that's because of magic quotes or just the way the db has it stored.
My
 gut
 instinct is the former.


No no no no.  If you have to unescape your data before you display it,
then you escaped it too many times.

If you have the following query:

INSERT INTO myTable VALUES ('I\'m Happy');

MySQL does NOT store this value as 

I\'m Happy

it is stored as 

I'm Happy

The escape character is needed so that the interpreter that reads your
SQL commands can understand the query.  MySQL does not choke on
apostrophes or quotes.  It has no problem with them.  They're just
characters.  The interpreter needs to know the difference between a
string-defining quote and a quote that is part of the data.  Hence the
escape characters.  Just as if you have the following PHP code:

?php
echo 'I\'m Happy';
?

PHP does not print out

I\'m Happy

it prints out

I'm Happy

The problem is indeed caused by magic quotes.  Magic quotes
automagically escapes data for you.  When you escape your escaped data
with addslashes or the like, you're escaping your escape characters as
well.  



kgt

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: how to store quotes in mysql?

2006-08-09 Thread Chris White
On Wednesday 09 August 2006 08:37 am, Kristen G. Thorson wrote:

 [ stuff here ]

 kgt
I'm confused.. did you read my email?  Most of what you said doesn't seem to 
correlate with what I said.  Can you quote the specific lines that you're 
disagreeing with?
-- 
Chris White
PHP Programmer/DBacillus
Interfuel

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Probably naive update question

2006-08-09 Thread Dan Buettner

Agreed, in your case it may be 6 of one, half a dozen of the other.

If you were calling a stored procedure to autheticate someone, as in
CALL autheticate(username, password)
then you could conceivably later alter your entire authentication
database model without ever having to touch your application code.

In theory, it's great.  In practice, it is useful but not like sliced bread.

Dan


On 8/9/06, Chris Sansom [EMAIL PROTECTED] wrote:

At 8:49 -0500 9/8/06, Dan Buettner wrote:
Chris, I'm not aware of a way to use ordinary SQL (insert, update)
for this, but the use of a stored procedure would work for you.  I've
not done it with MySQL (never had a need) but did things like this
extensively with Sybase.

In rough terms:

CREATE PROCEDURE sp_chances(IN xxx INT) RETURNS INT
BEGIN
UPDATE table SET chances = IF(chances  0, chances - 1, 0) WHERE id = xxx;
SELECT chances FROM table WHERE id = xxx;
END;

Then you would execute  this SQL:
CALL sp_chances(xxx)
and it should return the number of chances left for user id xxx,
having decremented the counter as well (if  0).

Hi Dan

Thanks for this, but it's clear to me that all the stored procedure
is doing is running the two queries I was running otherwise. It would
save me a couple of lines of PHP code, but is it really any more
efficient? Especially as this will be on a /very/ small database (at
least, by the standards of some of the people on this list!) and
won't happen particularly often. It'll only get called of the user
doesn't get the password right first time, which most of them will do
- and there won't be many anyway, at least not at first.

What I was really hoping for was some equivalent of
mysql_insert_id(), but returning some other value from the last query.

Not to worry - two quick queries it is... or maybe it would do me
good to start learning about stored procedures. :-)

Thanks again!

--
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

10 percent of computer users are Mac users, but remember,
we are the top 10 percent.
-- Douglas Adams



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: how to store quotes in mysql?

2006-08-09 Thread Kristen G. Thorson

 -Original Message-
 From: Chris White [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 09, 2006 11:43 AM
 To: mysql@lists.mysql.com
 Subject: Re: how to store quotes in mysql?
 
 On Wednesday 09 August 2006 08:37 am, Kristen G. Thorson wrote:
 
  [ stuff here ]
 
  kgt
 I'm confused.. did you read my email?  Most of what you said doesn't
seem
 to
 correlate with what I said.  Can you quote the specific lines that
you're
 disagreeing with?
 --
 Chris White
 PHP Programmer/DBacillus
 Interfuel





Sure:

Yes, MySQL stores it that way for a specific reason.

MySQL does not STORE escape characters, unless you have escaped an
escape character.  The following query:

INSERT INTO myTABLE VALUES ('I\'m Happy');

is instructing MySQL to store the string value I'm Happy.  It does not
store I\'m Happy.

Now when displaying, you'll have to unescape the slashes generally.

A clear indication that you have over-escaped your data.  If you have
properly escaped your queries, then you should never need to unescape
them.

If

SELECT string_value FROM myTable;

returns

I\'m Happy

then you have inserted your data as follows:

INSERT INTO myTable VALUES( 'I\\\'m Happy' );

This happens because magic quotes produced escaped data:

I\'m Happy

You then run addslashes() or similar and end up with this:

I\\\' Happy



kgt


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: how to store quotes in mysql?

2006-08-09 Thread Renato Golin

[EMAIL PROTECTED] wrote:

hi to all.

battling this problem on several forums and mailing lists, I got confused:
when store string that contains quotations (ie afan's php shop) in mysql
does it have to be stored with backslashes (afan\'s \php\ shop) or just
the way it is? my login's telling me the way it is. am I wrong?


most programming languages have specific functions to scape properly all 
strings and also most of them to protect you from SQL injection (PHP is 
one example).


You should search your language's documentation on how to prepare your 
queries passing arguments instead of concatenating it your self on the 
query and how to quote properly the strings so you can stop worrying 
about it once and for all... ;)


cheers,
--renato

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: how to store quotes in mysql?

2006-08-09 Thread afan
thanks for your response.

I'm already working on the php part but just wondered how bad is to
have backslash in front of quotes.

thanks.

-afan


 [EMAIL PROTECTED] wrote:
 hi to all.

 battling this problem on several forums and mailing lists, I got
 confused:
 when store string that contains quotations (ie afan's php shop) in
 mysql
 does it have to be stored with backslashes (afan\'s \php\ shop) or
 just
 the way it is? my login's telling me the way it is. am I wrong?

 most programming languages have specific functions to scape properly all
 strings and also most of them to protect you from SQL injection (PHP is
 one example).

 You should search your language's documentation on how to prepare your
 queries passing arguments instead of concatenating it your self on the
 query and how to quote properly the strings so you can stop worrying
 about it once and for all... ;)

 cheers,
 --renato



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



cell colors PHP/MySQL

2006-08-09 Thread Brian E Boothe

i'm needing assistance in table Cell color thru MySQL
i have a project were im listing a projects in a table  either Complete 
/ Active / Pending /  now im needing these refrances cells to change 
Color whenver its lists them out on a page,
 [Complete] =  green[Active] = Blue[Pending] = yellow 
Can someone Give me refrences or Code in PHP to how to accomplish this

thanks


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: cell colors PHP/MySQL

2006-08-09 Thread Chris White
On Wednesday 09 August 2006 12:24 pm, Brian E Boothe wrote:
 i'm needing assistance in table Cell color thru MySQL
  i have a project were im listing a projects in a table  either Complete
 / Active / Pending /  now im needing these refrances cells to change
 Color whenver its lists them out on a page,
   [Complete] =  green[Active] = Blue[Pending] = yellow
 Can someone Give me refrences or Code in PHP to how to accomplish this

Well, I'd just have 3 css classes: complete, active, and pending.  When it's 
outputting these cells, have the cells use the class attribute, setting them 
to the respective values.

 thanks

-- 
Chris White
PHP Programmer/DBanjo
Interfuel

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: cell colors PHP/MySQL

2006-08-09 Thread Nicholas Vettese
Wouldn't using a 'switch' statement work better?  Just please do not ask me 
to show an example.  :)


- Original Message - 
From: Chris White [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Wednesday, August 09, 2006 3:30 PM
Subject: Re: cell colors PHP/MySQL



On Wednesday 09 August 2006 12:24 pm, Brian E Boothe wrote:

i'm needing assistance in table Cell color thru MySQL
 i have a project were im listing a projects in a table  either Complete
/ Active / Pending /  now im needing these refrances cells to change
Color whenver its lists them out on a page,
  [Complete] =  green[Active] = Blue[Pending] = yellow
Can someone Give me refrences or Code in PHP to how to accomplish this


Well, I'd just have 3 css classes: complete, active, and pending.  When 
it's
outputting these cells, have the cells use the class attribute, setting 
them

to the respective values.


thanks


--
Chris White
PHP Programmer/DBanjo
Interfuel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: 
http://lists.mysql.com/[EMAIL PROTECTED]





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



forcing leading 0 for numeric fields

2006-08-09 Thread George Law
Hello All,

I have what is probably a simple question.

I have a table of phone numbers, broken into npa,nxx,station

So, 8001231234npa =800  nxx=123  station=1234

Some queries pull data from this table in the format:

select * from table where concat(npa,nxx,station)=8001231234


That is all good.

The problem I ran into today is where the station column is  1000, 
ie 8001230123

station =0123 which gets stored as 123 by mysql



Is there a quick and easy way to force station to 4 digits when I do the
query
select * from table where concat(npa,nxx,station)=8001230123

This query does not work, butselect * from table where
concat(npa,nxx,station)=800123123
does.

TIA!

--
George

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: forcing leading 0 for numeric fields

2006-08-09 Thread Jonathan Mangin

- Original Message - 
From: George Law [EMAIL PROTECTED]
To: MYSQL General List mysql@lists.mysql.com
Sent: Wednesday, August 09, 2006 3:40 PM
Subject: forcing leading 0 for numeric fields


Hello All,

I have what is probably a simple question.

I have a table of phone numbers, broken into npa,nxx,station

So, 8001231234npa =800  nxx=123  station=1234

Some queries pull data from this table in the format:

select * from table where concat(npa,nxx,station)=8001231234


That is all good.

The problem I ran into today is where the station column is  1000, 
ie 8001230123

station =0123 which gets stored as 123 by mysql



Is there a quick and easy way to force station to 4 digits when I do the
query
select * from table where concat(npa,nxx,station)=8001230123

This query does not work, butselect * from table where
concat(npa,nxx,station)=800123123
does.

TIA!

--
George


If no arithmetic is to be performed, I'd store them
as char fields.  May not help you much :)



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



PHP code for Record Table Cell color

2006-08-09 Thread Brian E Boothe

My Record Display Code  :


  
table border=1 cellpadding=0 cellspacing=0

 tr bgcolor=#CC
   td width=81div align=center class=style1id/div/td
   td width=83div align=center class=style1Projectid/div/td
   td width=83div align=center class=style1Date/div/td
   td width=115div align=center class=style1Company/div/td
   td width=106div align=center class=style1Location/div/td
   td width=235div align=center class=style1Issue/div/td
   td width=51div align=center class=style1Status/div/td
   td width=152span class=style1Notes/span/td
   td width=87div align=centerspan 
class=style1/span/div/td

 /tr
 ?php do { ?
 tr
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo $row_issues['id']; 
?/span/td
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo 
$row_issues['Projectid']; ?/span/td
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo $row_issues['Date']; 
?/span/td
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo 
$row_issues['Company']; ?/span/td
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo 
$row_issues['Location']; ?/span/td
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo $row_issues['Issue']; 
?/span/td
   td bgcolor=#FFspan 
class=style1nbsp;nbsp;nbsp;nbsp;?php echo $row_issues['Status']; 
?/span/td
   td bgcolor=#FFspan class=style1nbsp;?php echo 
$row_issues['Notes']; ?/span/td

   tdspan class=style1nbsp;nbsp;Update | Delete/span/td
 /tr
 ?php } while ($row_issues = mysql_fetch_assoc($issues)); ?
/table
/body
/html
?php
mysql_free_result($issues);
?


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: forcing leading 0 for numeric fields

2006-08-09 Thread Mark Leith

Jonathan Mangin wrote:
- Original Message - 
From: George Law [EMAIL PROTECTED]

To: MYSQL General List mysql@lists.mysql.com
Sent: Wednesday, August 09, 2006 3:40 PM
Subject: forcing leading 0 for numeric fields


Hello All,

I have what is probably a simple question.

I have a table of phone numbers, broken into npa,nxx,station

So, 8001231234npa =800  nxx=123  station=1234

Some queries pull data from this table in the format:

select * from table where concat(npa,nxx,station)=8001231234



That is all good.

The problem I ran into today is where the station column is  1000, 
ie 8001230123


station =0123 which gets stored as 123 by mysql



Is there a quick and easy way to force station to 4 digits when I do the
query
select * from table where concat(npa,nxx,station)=8001230123

This query does not work, butselect * from table where
concat(npa,nxx,station)=800123123
  


Store them as INT with ZEROFILL:

mysql CREATE TABLE zeros (i INT(4) ZEROFILL, j INT(4) ZEROFILL, k 
INT(4) ZEROFILL);

Query OK, 0 rows affected (0.09 sec)

mysql INSERT INTO zeros VALUES (23,3244,0123);
Query OK, 1 row affected (0.01 sec)

mysql select * from zeros;
+--+--+--+
| i| j| k|
+--+--+--+
| 0023 | 3244 | 0123 |
+--+--+--+
1 row in set (0.08 sec)

Make sure you specify the length of the digits that you would like 
padded to within the INT specification.


Best regards

Mark

--
Mark Leith, Support Engineer
MySQL AB, Worcester, England, www.mysql.com
Are you MySQL certified?  www.mysql.com/certification


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Moving Databases from v4.0.23 to v5.0.24

2006-08-09 Thread Kurt Cypher
I'm in the process of setting up mysql v5.0.24 on a new server.  The 
server it's replacing is running mysql v4.0.23.


I've run mysqldump to get a text file of SQL statements to read into 
mysql on the new server, and everything seems to work fine until it gets 
to a particular section of the mysqldump output.


I turned on logging on the new server, and found that the last few lines 
in the log look like (preceded by literally hundreds of similar INSERT 
INTO lines):


  1 Query   INSERT INTO permission VALUES (80,80,'W')
  1 Query   DROP TABLE IF EXISTS repeat
  1 Quit

I checked a little earlier in the log, and found plenty of lines where 
the DROP TABLE command had worked fine for other table names.


It would appear that it's getting ready to create a table called 
repeat and bombing.  Looking at a text file containing the mysqldump 
output, I find that there are plenty of lines of SQL after the repeat 
statement.  I'm thinking repeat might be a reserved word in mySQL 
v5.0.24, especially after the following test:


mysql DROP TABLE IF EXISTS repeat;
ERROR 1064 (42000): You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right 
syntax to use near 'repeat' at line 1

mysql DROP TABLE IF EXISTS permission;
ERROR 1046 (3D000): No database selected

That would seem to indicate that v5.0.x of mysql expects repeat to be 
something special.  If this is the case, then it would seem that we 
would need to rename this table in order for the database to work with 
mysql v5.0.24, no matter what method I use to transfer the data.


Am I on the right track, or am I missing something obvious?

Thanks,
Kurt


--
Kurt Cypher
Senior Systems Programmer, CaTS
Wright State University

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Moving Databases from v4.0.23 to v5.0.24

2006-08-09 Thread Jimmy Guerrero
Hello,

REPEAT is indeed a reserved word in MySQL in 5.0

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Jimmy Guerrero
Sr Product Manager
MySQL, Inc


 -Original Message-
 From: Kurt Cypher [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 09, 2006 3:13 PM
 To: mysql@lists.mysql.com
 Subject: Moving Databases from v4.0.23 to v5.0.24
 
 I'm in the process of setting up mysql v5.0.24 on a new 
 server.  The server it's replacing is running mysql v4.0.23.
 
 I've run mysqldump to get a text file of SQL statements to 
 read into mysql on the new server, and everything seems to 
 work fine until it gets to a particular section of the 
 mysqldump output.
 
 I turned on logging on the new server, and found that the 
 last few lines in the log look like (preceded by literally 
 hundreds of similar INSERT INTO lines):
 
1 Query   INSERT INTO permission VALUES (80,80,'W')
1 Query   DROP TABLE IF EXISTS repeat
1 Quit
 
 I checked a little earlier in the log, and found plenty of 
 lines where the DROP TABLE command had worked fine for 
 other table names.
 
 It would appear that it's getting ready to create a table 
 called repeat and bombing.  Looking at a text file 
 containing the mysqldump output, I find that there are plenty 
 of lines of SQL after the repeat statement.  I'm thinking 
 repeat might be a reserved word in mySQL v5.0.24, 
 especially after the following test:
 
 mysql DROP TABLE IF EXISTS repeat;
 ERROR 1064 (42000): You have an error in your SQL syntax; 
 check the manual that corresponds to your MySQL server 
 version for the right syntax to use near 'repeat' at line 1
 mysql DROP TABLE IF EXISTS permission;
 ERROR 1046 (3D000): No database selected
 
 That would seem to indicate that v5.0.x of mysql expects 
 repeat to be something special.  If this is the case, then 
 it would seem that we would need to rename this table in 
 order for the database to work with mysql v5.0.24, no matter 
 what method I use to transfer the data.
 
 Am I on the right track, or am I missing something obvious?
 
 Thanks,
 Kurt
 
 
 --
 Kurt Cypher
 Senior Systems Programmer, CaTS
 Wright State University
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/[EMAIL PROTECTED]
 
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Moving Databases from v4.0.23 to v5.0.24

2006-08-09 Thread Kurt Cypher

Jimmy Guerrero wrote:

Hello,

REPEAT is indeed a reserved word in MySQL in 5.0

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Jimmy Guerrero
Sr Product Manager
MySQL, Inc



Thanks for the quick response. As it turns out, this may be a moot 
point, as the database in question hasn't been modified since June of 
2005, so I may not have to migrate it to the new server anyhow.  If it's 
decided that we have to keep the database, I'll just tell the database 
developers that they'll need to rename the table and modify their code 
accordingly.


Thanks,
Kurt

--
Kurt Cypher
Senior Systems Programmer, CaTS
Wright State University

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: cell colors PHP/MySQL

2006-08-09 Thread Logan, David (SST - Adelaide)
http://www.php.net there are many code examples here. That is a probably
more appropriate place for such a question

Regards

---
** _/ **  David Logan 
***   _/ ***  ITO Delivery Specialist - Database
*_/*  Hewlett-Packard Australia Ltd
_/_/_/  _/_/_/    E-Mail: [EMAIL PROTECTED]
   _/  _/  _/  _/     Desk:   +618 8408 4273
  _/  _/  _/_/_/  Mobile: 0417 268 665
*_/   **
**  _/    Postal: 148 Frome Street,
   _/ **  Adelaide SA 5001
  Australia 
invent   
---

-Original Message-
From: Brian E Boothe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 10 August 2006 4:55 AM
To: mysql@lists.mysql.com
Subject: cell colors PHP/MySQL

i'm needing assistance in table Cell color thru MySQL
 i have a project were im listing a projects in a table  either Complete

/ Active / Pending /  now im needing these refrances cells to change 
Color whenver its lists them out on a page,
  [Complete] =  green[Active] = Blue[Pending] = yellow 
Can someone Give me refrences or Code in PHP to how to accomplish this
 

thanks

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



MySQL Replication Binary Logs - How Long to Keep?

2006-08-09 Thread Warren Crigger
I've just recently set up MySQL replication amongst two servers so I'm not
too familiar with it.  I was cleaning up my /var filesystem and found the
binary data below being stored in /var/lib/mysql, taking up 1.5gb.  

I did a little reading on mysql.org docs.  My interpretation was that you
can have it replicate every so often, then you can purge these after that
happens..however, my replication is instantaneous.  I can insert a record on
the master and then go select it on the slave immediately.  Is there any
reason to keep this data?  It's replicated to the 2nd server, in addition to
dumps of the more important databases nightly, and dumps of the entire
server weekly, which go to different physical drives and then ultimately
off-site.  I like redudancy obviously, however, this seems pretty useless to
me.

If it is of use, is there a way I can put this on a different filesystem,
keeping the databases themselves within /var/lib/mysql?

Thanks,
Warren

[EMAIL PROTECTED] mysql]# pwd
/var/lib/mysql
[EMAIL PROTECTED] mysql]# ls -lart |grep repl
-rw-rw1 mysqlmysql 3088434 Jun 11 04:02 repl.001
-rw-rw1 mysqlmysql 107 Jun 11 04:02 repl.002
-rw-rw1 mysqlmysql188387006 Jun 18 04:02 repl.003
-rw-rw1 mysqlmysql 107 Jun 18 04:02 repl.004
-rw-rw1 mysqlmysql 107 Jun 25 04:02 repl.006
-rw-rw1 mysqlmysql156749380 Jun 25 04:02 repl.005
-rw-rw1 mysqlmysql153489679 Jul  2 04:02 repl.007
-rw-rw1 mysqlmysql 107 Jul  2 04:02 repl.008
-rw-rw1 mysqlmysql 107 Jul  9 04:02 repl.010
-rw-rw1 mysqlmysql140922795 Jul  9 04:02 repl.009
-rw-rw1 mysqlmysql58638790 Jul 11 17:30 repl.011
-rw-rw1 mysqlmysql   38410 Jul 11 17:46 repl.012
-rw-rw1 mysqlmysql 5927431 Jul 12 09:00 repl.013
-rw-rw1 mysqlmysql80007235 Jul 16 04:02 repl.014
-rw-rw1 mysqlmysql 107 Jul 16 04:02 repl.015
-rw-rw1 mysqlmysql 107 Jul 23 04:02 repl.017
-rw-rw1 mysqlmysql155468996 Jul 23 04:02 repl.016
-rw-rw1 mysqlmysql 107 Jul 30 04:02 repl.019
-rw-rw1 mysqlmysql155806419 Jul 30 04:02 repl.018
-rw-rw1 mysqlmysql 107 Aug  6 04:02 repl.021
-rw-rw1 mysqlmysql159420166 Aug  6 04:02 repl.020
-rw-rw1 mysqlmysql 6366383 Aug  6 13:33 repl.022
-rw-rw1 mysqlmysql 1138297 Aug  6 17:36 repl.023
-rw-rw1 mysqlmysql 264 Aug  6 17:40 repl.index
-rw-rw1 mysqlmysql43014905 Aug  9 00:03 repl.024



Group by base on latest time field, possible?

2006-08-09 Thread The Nice Spider
I want the group by result take the latest field, but
my query result look 
like get the random row.
Here I described:

Thread SubjectTime
-
5 Re:test 33 1155203794
5 test 33  1155203772
8 test 4441155203882
8 Re:test 444   1155203897

note: time field is INT(11) to store datetime in
integer value

QUERY
-
select thread, subject, time
from jos_sb_messages
group by thread
order by time

RESULT
--
5 Re:test 33 1155203794
8 test 4441155203882

What do I need is:
--
5 Re:test 33 1155203794
8 Re:test 4441155203897

I am using 3.23.58 for Windows.
How to get the result as I expected? 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Group by base on latest time field, possible?

2006-08-09 Thread Quentin Bennett
Try 

select thread, subject, max(time)
from jos_sb_messages
group by thread
order by 3

-Original Message-
From: The Nice Spider [mailto:[EMAIL PROTECTED]
Sent: Thursday, 10 August 2006 4:10 p.m.
To: mysql@lists.mysql.com
Subject: Group by base on latest time field, possible?


I want the group by result take the latest field, but
my query result look 
like get the random row.
Here I described:

Thread SubjectTime
-
5 Re:test 33 1155203794
5 test 33  1155203772
8 test 4441155203882
8 Re:test 444   1155203897

note: time field is INT(11) to store datetime in
integer value

QUERY
-
select thread, subject, time
from jos_sb_messages
group by thread
order by time

RESULT
--
5 Re:test 33 1155203794
8 test 4441155203882

What do I need is:
--
5 Re:test 33 1155203794
8 Re:test 4441155203897

I am using 3.23.58 for Windows.
How to get the result as I expected? 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
The information contained in this email is privileged and confidential and
intended for the addressee only. If you are not the intended recipient, you
are asked to respect that confidentiality and not disclose, copy or make use
of its contents. If received in error you are asked to destroy this email
and contact the sender immediately. Your assistance is appreciated.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: MySQL Replication Binary Logs - How Long to Keep?

2006-08-09 Thread Logan, David (SST - Adelaide)
Hi Warren,

I would generally keep the binary log until you have done a full backup.
Once that is done, all the transactions that are contained in those logs
are now committed and saved in your database backup.

All binary logs may be deleted that were created before that backup took
place. The main reason for this is that it allows you to restore from
your last backup and then roll forward all transactions (I use the
term to describe anything modifying the database and logged in the
binary log) until the database is back up to date.

Regards


---
** _/ **  David Logan 
***   _/ ***  ITO Delivery Specialist - Database
*_/*  Hewlett-Packard Australia Ltd
_/_/_/  _/_/_/    E-Mail: [EMAIL PROTECTED]
   _/  _/  _/  _/     Desk:   +618 8408 4273
  _/  _/  _/_/_/  Mobile: 0417 268 665
*_/   **
**  _/    Postal: 148 Frome Street,
   _/ **  Adelaide SA 5001
  Australia 
invent   
---

-Original Message-
From: Warren Crigger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 10 August 2006 9:52 AM
To: mysql@lists.mysql.com
Cc: [EMAIL PROTECTED]
Subject: MySQL Replication Binary Logs - How Long to Keep?

I've just recently set up MySQL replication amongst two servers so I'm
not
too familiar with it.  I was cleaning up my /var filesystem and found
the
binary data below being stored in /var/lib/mysql, taking up 1.5gb.  

I did a little reading on mysql.org docs.  My interpretation was that
you
can have it replicate every so often, then you can purge these after
that
happens..however, my replication is instantaneous.  I can insert a
record on
the master and then go select it on the slave immediately.  Is there any
reason to keep this data?  It's replicated to the 2nd server, in
addition to
dumps of the more important databases nightly, and dumps of the entire
server weekly, which go to different physical drives and then ultimately
off-site.  I like redudancy obviously, however, this seems pretty
useless to
me.

If it is of use, is there a way I can put this on a different
filesystem,
keeping the databases themselves within /var/lib/mysql?

Thanks,
Warren

[EMAIL PROTECTED] mysql]# pwd
/var/lib/mysql
[EMAIL PROTECTED] mysql]# ls -lart |grep repl
-rw-rw1 mysqlmysql 3088434 Jun 11 04:02 repl.001
-rw-rw1 mysqlmysql 107 Jun 11 04:02 repl.002
-rw-rw1 mysqlmysql188387006 Jun 18 04:02 repl.003
-rw-rw1 mysqlmysql 107 Jun 18 04:02 repl.004
-rw-rw1 mysqlmysql 107 Jun 25 04:02 repl.006
-rw-rw1 mysqlmysql156749380 Jun 25 04:02 repl.005
-rw-rw1 mysqlmysql153489679 Jul  2 04:02 repl.007
-rw-rw1 mysqlmysql 107 Jul  2 04:02 repl.008
-rw-rw1 mysqlmysql 107 Jul  9 04:02 repl.010
-rw-rw1 mysqlmysql140922795 Jul  9 04:02 repl.009
-rw-rw1 mysqlmysql58638790 Jul 11 17:30 repl.011
-rw-rw1 mysqlmysql   38410 Jul 11 17:46 repl.012
-rw-rw1 mysqlmysql 5927431 Jul 12 09:00 repl.013
-rw-rw1 mysqlmysql80007235 Jul 16 04:02 repl.014
-rw-rw1 mysqlmysql 107 Jul 16 04:02 repl.015
-rw-rw1 mysqlmysql 107 Jul 23 04:02 repl.017
-rw-rw1 mysqlmysql155468996 Jul 23 04:02 repl.016
-rw-rw1 mysqlmysql 107 Jul 30 04:02 repl.019
-rw-rw1 mysqlmysql155806419 Jul 30 04:02 repl.018
-rw-rw1 mysqlmysql 107 Aug  6 04:02 repl.021
-rw-rw1 mysqlmysql159420166 Aug  6 04:02 repl.020
-rw-rw1 mysqlmysql 6366383 Aug  6 13:33 repl.022
-rw-rw1 mysqlmysql 1138297 Aug  6 17:36 repl.023
-rw-rw1 mysqlmysql 264 Aug  6 17:40 repl.index
-rw-rw1 mysqlmysql43014905 Aug  9 00:03 repl.024


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Adding index -- Need help

2006-08-09 Thread Ratheesh K J
Hello All,

Need a suggestion for this:

We have tables which have very few number of rows ( less than 600 ). For a long 
period of time the number of rows are going to remain almost the same. 

1) Is it better to index the columns of such tables?

2) There are Joins on this table and then a search on certain fields of this 
table in the where clause. Does index make a difference?

Example: TBL_XXX and TBL_YYY are related through FLD_ACC_ID. This fld is indxed 
on both the tables. None of the others are. Would adding indexes help on such 
tables ( only 342 rows in both )

DESC TBL_XXX;342 Rows
-
FLD_EMAIL_ID varchar(150)  PRI  
FLD_ACC_ID int(11) unsigned  PRI 0 
FLD_PRIMARY_FLAG tinyint(1) YES  0 
--

DESC TBL_YYY;  342 Rows

FLD_ACC_ID int(11) unsigned  PRI 0 
FLD_ACC_NAME varchar(32) YES  \N 
FLD_MAIN_ZONE tinyint(1)   0 
FLD_FOR_ZONE_ID int(10) unsigned YES  0 
FLD_STATE tinyint(1) unsigned   0 
FLD_DOMAIN_ID tinyint(4) unsigned YES  0 
FLD_SCAN_CUST_SERIAL_NUM_FLAG tinyint(1) unsigned YES  0 
FLD_SCAN_CUST_NO_SUPPORT_FLAG tinyint(1) unsigned YES  0 
FLD_INBOX varchar(64) YES  \N 
FLD_INBOX_PASSWD varchar(16) YES  \N 
FLD_INBOX_LOCK_FLAG tinyint(1) YES  0 
FLD_INBOX_LOCK_DATE_TIME datetime YES  \N 
FLD_EMAIL_INBOX_OUTWARD varchar(32) YES  \N 
FLD_WEBMAIL_INDIVIDUAL_FLAG tinyint(1) unsigned YES  0 
FLD_WEBMAIL_INDIVIDUAL_TYPE tinyint(5) unsigned YES  0 
FLD_EMAIL_DONT_PROCESS_FLAG tinyint(1) unsigned   0 
FLD_ATTACH_MAX_UPLD_SIZE tinyint(2) unsigned YES  0 
FLD_ATTACH_MAX_RECV_SIZE tinyint(2) unsigned YES  0 
FLD_ADD_BY int(11)   0 
FLD_ADD_DATE_TIME datetime   -00-00 00:00:00 
FLD_UPDATE_BY int(11) YES  \N 
FLD_UPDATE_DATE_TIME datetime YES  \N 
FLD_PARENT_ID int(11) unsigned YES  0 
FLD_THREAD_ID int(11) unsigned YES  0 
FLD_POS tinyint(5) unsigned YES  0 
FLD_LEVEL tinyint(5) unsigned YES  0 
FLD_OWNER_COMPANY_ID int(10) unsigned   0 
FLD_FOR_COMPANY_ID int(10) unsigned YES  0 
FLD_NO_DIRECT_SUBMISSION_FLAG tinyint(1) YES  0 


Thanks,

Ratheesh Bhat K J


Re: cell colors PHP/MySQL

2006-08-09 Thread Ligaya Turmelle

Brian E Boothe wrote:

i'm needing assistance in table Cell color thru MySQL
i have a project were im listing a projects in a table  either Complete 
/ Active / Pending /  now im needing these refrances cells to change 
Color whenver its lists them out on a page,
 [Complete] =  green[Active] = Blue[Pending] = yellow 
Can someone Give me refrences or Code in PHP to how to accomplish this

thanks


Probably have better luck asking this on the PHP general mailing list. 
Or any of the various PHP sites with forums.


--

life is a game... so have fun.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]