Re: Finding not quite duplicates

2008-11-19 Thread Bill newton
Ok, I think I understand If there is a product that matches and is not 
discontinued it should only return that one.
I think I just learned about this trick from the mysql manual, although 
I can't seem to remember what section I found it in.


Basically you can join the table again, with the condition on the second 
join that its prod_discount must be lower than the first joins.
Then in the where statement require that the second join fail. So you'll 
only get one row returned that has the minimum value

of prod_discont for a prod_pub_prod_id.

So something like this would work:

SELECT IF(a.prod_num IS NOT NULL,IF(a.prod_discont = 
0,a.prod_num,discontinued),) as prod_num

FROM b
LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
LEFT JOIN a as alias_for_a ON b.prod_pub_prod_id = 
alias_for_a.prod_pub_prod_id 
   AND alias_for_a.prod_discont  a.prod_discont

WHERE
alias_for_a.prod_num IS NULL
ORDER BY b.prod_pub_prod_id;




US Data Export wrote:

-Original Message-
From: Bill newton [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2008 6:49 PM
To: Jerry Schwartz
Cc: 'mysql'
Subject: Re: Finding not quite duplicates

I'm having a little trouble with your naming. Im assuming the query you
listed should be:

SELECT IF(a.prod_num IS NOT NULL,a.prod_num,) as prod_num


FROM b LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
  

WHERE (a.prod_discont = 0 OR a.prod_discont IS NULL)
ORDER BY b.prod_pub_prod_id;



[JS] That is correct, I apologize. I was trying make the changes as I typed,
and obviously missed.
  

And  the third condition is unclear as to the condtion you want to match
a.prod_discont , I'm guessing you mean


3) If there is a match in `b` against `a`, but the ONLY match is a row
where
`a`.`prod_discont` = `1`, return discontinued.

So the query that would accomplish that would be:


SELECT IF(a.prod_num IS NOT NULL,IF(a.prod_discont =
0,a.prod_num,discontinued),) as prod_num


FROM b LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
  

ORDER BY b.prod_pub_prod_id;



[JS] If there were one row that had prod_discont = 1, and another that had
prod_discont = 0, and they both had the same prod_pub_prod_id, wouldn't both
rows be returned? That's not what I need.
  

You can nest IF statements in mysql queries.

Hope it helps,

Bill

Jerry Schwartz wrote:


As usual, my head is twisted around something that I think should be
  

easy.


Suppose I have a table, `a`,  that has three fields:

prod_num
prod_pub_prod_id
prod_discont

I have another table, `b`,  with a list of products of interest:

prod_pub_prod_id


What I need to do is match `b`.`prod_pub_prod_id` against table
`a`.`prod_pub_prod_id` such that:

1) If there is no match at all, return .

2) If there is a match in `b` against a row in `b`, and
  

`a`.`prod_discont` =


0, return `a`.`prod_num`. (There should never be two such rows.)

3) If there is a match in `b` against `a`, but the ONLY match is a row
  

where


`a`.`prod_discont` = `, return discontinued.

1) and 2) are very easily accomplished with a LEFT JOIN:

SELECT IF(prod.prod_num IS NOT NULL,prod.prod_num,) as prod_num
FROM b LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
WHERE (a.prod_discont = 0 OR a.prod_discont IS NULL)
ORDER BY b.prod_pub_prod_id;

The problem is with 3). It seems like I should be able to do this with
  

one


query, but I'm beginning to think that I need a separate query and a
  

third


table.

Suggestions, anyone?


Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com







  

--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850 ext 141/ Tel
(888) 829-3631/ Fax







  



--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850 ext 141/ Tel
(888) 829-3631/ Fax



Re: Finding not quite duplicates

2008-11-18 Thread Bill newton
I'm having a little trouble with your naming. Im assuming the query you 
listed should be:


SELECT IF(a.prod_num IS NOT NULL,a.prod_num,) as prod_num
FROM b LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
WHERE (a.prod_discont = 0 OR a.prod_discont IS NULL)
ORDER BY b.prod_pub_prod_id;


And  the third condition is unclear as to the condtion you want to match 
a.prod_discont , I'm guessing you mean



3) If there is a match in `b` against `a`, but the ONLY match is a row where
`a`.`prod_discont` = `1`, return discontinued.

So the query that would accomplish that would be:


SELECT IF(a.prod_num IS NOT NULL,IF(a.prod_discont = 
0,a.prod_num,discontinued),) as prod_num
FROM b LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
ORDER BY b.prod_pub_prod_id;


You can nest IF statements in mysql queries.

Hope it helps,

Bill

Jerry Schwartz wrote:

As usual, my head is twisted around something that I think should be easy.

Suppose I have a table, `a`,  that has three fields:

prod_num
prod_pub_prod_id
prod_discont

I have another table, `b`,  with a list of products of interest:

prod_pub_prod_id


What I need to do is match `b`.`prod_pub_prod_id` against table
`a`.`prod_pub_prod_id` such that:

1) If there is no match at all, return .

2) If there is a match in `b` against a row in `b`, and `a`.`prod_discont` =
0, return `a`.`prod_num`. (There should never be two such rows.)

3) If there is a match in `b` against `a`, but the ONLY match is a row where
`a`.`prod_discont` = `, return discontinued.

1) and 2) are very easily accomplished with a LEFT JOIN:

SELECT IF(prod.prod_num IS NOT NULL,prod.prod_num,) as prod_num
FROM b LEFT JOIN a ON b.prod_pub_prod_id = a.prod_pub_prod_id
WHERE (a.prod_discont = 0 OR a.prod_discont IS NULL)
ORDER BY b.prod_pub_prod_id;

The problem is with 3). It seems like I should be able to do this with one
query, but I'm beginning to think that I need a separate query and a third
table.

Suggestions, anyone?


Regards,
 
Jerry Schwartz

The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
 
860.674.8796 / FAX: 860.674.8341
 
www.the-infoshop.com

www.giiexpress.com
www.etudes-marche.com






  



--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850 ext 141/ Tel
(888) 829-3631/ Fax


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



Re: normalised designs: customer database

2008-11-14 Thread Bill newton

Hi everybody,

What about simply storing a main user for each company?  So each company 
has a main user that has the basics about the company ( generic address, 
email, phone). I would think you'd want to store that information 
anyways. So the customer table always links to a user. That user could 
be the company's main user or a user that's not affiliated with a company.


There is more general question here as well which would be unavoidable 
if companies and users were not as closely related. I've seen may 
implementations like your three suggestions as well as the fake company. 
If I had to choose one of those, Id go with the dual foreign keys. #3


Thanks for the meaty question,

Bill
metastable wrote:

Hello all,


I have a question that's been bugging me for quite some time.
Let's say we have a small business that has both private and corporate
customers.
We want to store contact and address data about these customers, as well
as invoicing data. Off course, only companies have VAT numbers.
When normalising this design, you would reach something like the following:

- table for contact details (separate, because multiple contact details
may apply)
- table for address  details (separate, because multiple addresses may
apply)
- table for people (first name, last name, etc)
- table for companies (company name and vat number)
- tables that link the above data to each other (people-contact,
people-address, people-company, company-address, ...)
- table for customers, i.e. 'entities' that are invoiced

This is where it gets nasty. A customer may be a human being or a
company. I see different approaches here:
1) keep customer tables separate, based on which type of customer it is
2) create the customer table with a column specifying if we're dealing
with a human being or a company
3) create the customer table with a FK for people and a FK for
companies, and decide on the customer type in the application based on
the presence of that key

Option 1 seems to ridiculous to do: way too much bloody hassle
Option 2 may be viable, but we lose the foreign key constraint
Option 3 seems like the best idea, but this would mean keeping a table
that takes 50% of useless space

Neither option satisfies me. My idea right now is a 'False Company'
approach:
Create a row for a company that is no real company and link all private
customers to that company. This way, the customer table has 1 FK, for
the companies table.
This off course implies that some global variable be present in the
application that is used to identify the 'False Company'. Awkward to say
the least.

What do you guys think about this ? Which option is most viable ? Which
solution have you chosen ?
And finally: am I going about this all wrong, because I was asleep
during most of my formal education years ? :)


Kind regards,


Stijn

-- metastable Stijn Verholen Camille Huysmanslaan 114, bus 2 B-2020
ANTWERPEN +32 (0)3 707 08 08 (phone) +32 (0)3 707 06 06 (fax) +32 (0)473
47 62 88 (mobile) [EMAIL PROTECTED] http://www.metastable.be BTW-BE
0873.645.643 bankrek.nr. ING 363-0106543-77




  



--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850 ext 141/ Tel
(888) 829-3631/ Fax


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



Re: MySQL Sort by Array

2008-10-23 Thread Bill Newton

Pretty standard mysql function. Its been in mysql for a while.

http://dev.mysql.com/doc/refman/4.1/en/string-functions.html#function_field



Jim Lyons wrote:

I'm not familiar with order by field (unless field is a UDF).  I know of
order by binary.  Is this standard mysql syntax?

On Wed, Oct 22, 2008 at 10:42 AM, Peter Brawley [EMAIL PROTECTED]
  

wrote:



  

ORDER BY id(5, 34, 9, 25)


Can anyone tell me the proper syntax to accomplish this task?

  

ORDER BY FIELD( id, 5, 34, 9, 25 )

PB

-

Keith Spiller wrote:



Hi Guys,

I'm trying to sort by a particular order:

SELECT * FROM tablename
WHERE id='5' OR id='9' OR id='25' OR id='34'
ORDER BY id(5, 34, 9, 25)

Can anyone tell me the proper syntax to accomplish this task?

Thanks for your help.

Keith
 


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database:
270.8.2/1739 - Release Date: 10/22/2008 7:23 AM



  



  



--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850 ext 141/ Tel
(888) 829-3631/ Fax


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



Re: Why people don't use engine named BDB?

2008-07-21 Thread Bill Newton
No, its mainly because BDB wasn't very good. Its transactional, but not 
MVCC. Take a look at a contemporary article when the acquisition was made :

http://www.computerworld.com/databasetopics/data/software/story/0,10801,108705,00.html

Curtis Maurand wrote:


Its mainly because it was purchased by Oracle.  BDB provided 
transaction support.  Innodb has been the defacto choice for a ACID 
transactions, but Innodb was also purchased by Oracle in its attempt 
to kill MySQL after its failed attempt to purchase MySQL.  That's why  
MySQL has been working on their own storage engine as well as the 
pluggable storage system.


Curtis

David Giragosian wrote:

On 7/21/08, Moon's Father [EMAIL PROTECTED] wrote:
 

Any reply is appreciated .
--
I'm a MySQL DBA in china.
More about me just visit here:
http://yueliangdao0608.cublog.cn





Maybe something to do with this: *BDB support will be removed. * Note 
that,

as of MySQL 5.1, BDB isn't supported any longer.

http://dev.mysql.com/doc/refman/5.0/en/bdb-storage-engine.html
But you're right that as a storgage engine, there have been very few
questions related to it, on this mailing list anyway.

  






--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850/ Tel
(888) 829-3631/ Fax


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



Re: Find two sets of records

2008-04-15 Thread Bill Newton

Try using the sub query as a derived table ala:

SELECT eo_name_table.eo_name, eo_name_table.eo_pub_date
	FROM eo_name_table LEFT JOIN (SELECT prod.prod_title FROM prod WHERE prod.prod_discont = 0) fake_prod on eo_name_table.eo_name = fake_prod.prod_title 
	WHERE prod.prod_title IS NULL


I'm not sure if the logic is correct, although it seems to be the same as your 
attempt you want eo_name and eo_pub_date from where their are not any matches 
with rows that have prod_discount =0.


Hope that helps.







Try a self join :

SELECT eo_name_table.eo_name, eo_name_table.eo_pub_date
FROM eo_name_table INNER JOIN prod ON eo_name_table.eo_name =
prod.prod_title (SELECT prod.prod_title FROM eo_name_table JOIN prod ON
eo_name_table.eo_name = prod.prod_title
WHERE prod.prod_discont = 0);



Jerry Schwartz wrote:

I'm drawing a blank here.

I need to extract two sets of records from a pair of tables. `eo_name_table`
is a list of titles, `prod` is a list of products having titles and a
discontinued flag. I want all of those records from `eo_name_table` that do
not have a matching title in `prod`. I also want those records from
eo_name_table` where the ONLY matching records in `prod` are discontinued.

- The first part is easy:

SELECT eo_name_table.eo_name, eo_name_table.eo_pub_date
FROM eo_name_table LEFT JOIN prod ON eo_name_table.eo_name =
prod.prod_title
WHERE prod.prod_title IS NULL;

- It's the second part that stumps me. How do I find those products from the
table `eo_name_table` that only match products in the `prod` table that have
been discontinued. In other words, I need to exclude any product match that
doesn't have any current products.

I tried this:

SELECT eo_name_table.eo_name, eo_name_table.eo_pub_date
FROM eo_name_table JOIN prod ON eo_name_table.eo_name =
prod.prod_title
WHERE prod.prod_title NOT IN
(SELECT prod.prod_title FROM eo_name_table JOIN prod ON
eo_name_table.eo_name = prod.prod_title
WHERE prod.prod_discont = 0);

This expresses what I am trying to do, but it is not a legal query because
eo_name_table is in both the inner and outer queries.

Suggestions?

Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com





  



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



Re: LEFT JOIN problem

2008-04-14 Thread Bill Newton

Hi Jerry,

I think the problem is that NULL is not less than or greater than your 
prod_published date.  So you probably have eo_pub_date set to NULL in 56 
of your rows.


so for

eo_name_table.eo_pub_date  prod.prod_published

or

eo_name_table.eo_pub_date = prod.prod_published

mysql will rerturn false if  eo_name_table.eo_pub_date is NULL for 
either test.





Jerry Schwartz wrote:

I have a table, eo_name_table, that has exactly 860 unique titles in it.
Each record also has a date field, eo_pub_date:

+-+--+--+-+-+---+
| Field   | Type | Null | Key | Default | Extra |
+-+--+--+-+-+---+
| eo_name | varchar(255) |  | PRI | |   |
| eo_pub_date | date | YES  | | NULL|   |
+-+--+--+-+-+---+

I have another table, prod, that has many fields in it but the fields of
interest are prod_num, prod_title, prod_discont, and prod_published. The
other fields are irrelevant Here is the structure of the prod table:

+-+---+--+-+-+--
-+
| Field   | Type  | Null | Key | Default | Extra
|
+-+---+--+-+-+--
-+
| prod_id | varchar(15)   |  | PRI | |
|
| prod_num| mediumint(6) unsigned | YES  | MUL | NULL|
|
| prod_title  | varchar(255)  | YES  | MUL | NULL|
|
| prod_type   | varchar(2)| YES  | | NULL|
|
| prod_vat_pct| decimal(5,2)  | YES  | | NULL|
|
| prod_discont| tinyint(1)| YES  | | NULL|
|
| prod_ready  | tinyint(1)| YES  | | NULL|
|
| pub_id  | varchar(15)   | YES  | MUL | NULL|
|
| prod_published  | date  | YES  | | NULL|
|
| prod_pub_prod_id| varchar(255)  | YES  | MUL | NULL|
|
| prod_pub_acct_id| varchar(2)| YES  | | NULL|
|
| prod_pub_doi| date  | YES  | | NULL|
|
| prod_pub_resp   | date  | YES  | | NULL|
|
| prod_pub_prod_url   | varchar(255)  | YES  | | NULL|
|
| prod_rel_freq   | smallint(3)   | YES  | | NULL|
|
| prod_content_info   | varchar(255)  | YES  | | NULL|
|
| prod_info_type  | varchar(5)| YES  | | NULL|
|
| prod_language   | varchar(50)   | YES  | | NULL|
|
| prod_broch_doc  | varchar(255)  | YES  | | NULL|
|
| prod_samp_doc   | varchar(255)  | YES  | | NULL|
|
| prod_samp_pgs   | varchar(255)  | YES  | | NULL|
|
| prod_exec_summ  | varchar(255)  | YES  | | NULL|
|
| prod_toc_doc| varchar(255)  | YES  | | NULL|
|
| prod_e_title_tag| varchar(255)  | YES  | | NULL|
|
| prod_meta_tags  | varchar(255)  | YES  | | NULL|
|
| prod_keywords   | varchar(255)  | YES  | | NULL|
|
| prod_comments   | text  | YES  | | NULL|
|
| prod_if_sample_pdf  | varchar(255)  | YES  | | NULL|
|
| prod_stop_date  | date  | YES  | | NULL|
|
| prod_hide_web   | tinyint(1)| YES  | | NULL|
|
| prod_changed| tinyint(1)| YES  | | NULL|
|
| prod_export | tinyint(1)| YES  | | NULL|
|
| prod_export_pending | tinyint(1)| YES  | | NULL|
|
| prod_scoop_changed  | tinyint(1)| YES  | | NULL|
|
| prod_on_scoop   | tinyint(1)| YES  | | NULL|
|
| prod_added  | datetime  | YES  | | NULL|
|
| prod_updated| datetime  | YES  | | NULL|
|
+-+---+--+-+-+--
-+

I am trying to break eo_name_table into two sets, based upon matching
eo_name_table.eo_pub_date against prod.prod_published. The first query is

SELECT IF(prod.prod_published IS NOT NULL, prod.prod_published, ) AS
pub_date,
IF(prod.prod_num IS NOT NULL, prod.prod_num, ) AS prod_num,
IF(prod.prod_discont = 0 OR prod.prod_discont IS NULL, ,
Discontinued) AS discont,
IF(prod.prod_title IS NOT NULL, prod.prod_title, ) AS match_title
FROM eo_name_table LEFT JOIN prod ON eo_name_table.eo_name = prod.prod_title

AND eo_name_table.eo_pub_date = prod.prod_published
WHERE (prod.prod_discont = 0 OR prod.prod_discont IS NULL)
ORDER BY eo_name_table.eo_name;

As expected, this gives me exactly 860 rows in the result because the left
join should give me (at least) one result row for each row in eo_name_table.
Some of these rows, of course, have 

Re: Auto Fill blank Rows

2008-03-12 Thread Bill Newton
To get a blank line instead of NULL you could simply wrap the reference 
in an IFNULL function:


select dummy.row_id,IFNULL(real.reference,'') as Reference from dummy left join 
real on
real.row_id=dummy.row_id;





Phil wrote:

you could do something like

select dummy.row_id,real.reference from dummy left join real on
real.row_id=dummy.row_id;

would give NULL on the 'missing' rows,

On Wed, Mar 12, 2008 at 12:50 PM, roger.maynard 
[EMAIL PROTECTED] wrote:

  

Anyone got any bright ideas of how to solve this one?

I have documents which can contain up to 15 rows of information.
Each row as it is added to the document reference can have any ROW_ID
from 1 to 15 when it is added.

I want to be able to Auto Fill the blank rows on a SELECT.

eg

data in table is

ROW_ID|Reference
===
1 |Reference Line 1
3 |Reference Line 3
9 |Reference Line 9
11|Reference Line 11
15|Reference Line 15

RESULT REQUIRED is

ROW_ID|Reference
===
1 |Reference Line 1
2 |
3 |Reference Line 3
4 |
5 |
6 |
7 |
8 |
9 |Reference Line 9
10|
11|Reference Line 11
12|
13|
14|
15|Reference Line 15

I've been playing about with joins on a dummy table containing just
rows 1 to 15, but am stuck in my thinking at the moment.

Any help gratefully received

Roger






  




Re: Is there any workbench or development studio available for Linux?

2008-02-07 Thread Bill Newton

From the download page:

Please note that at this point only the Windows Beta version is 
available. Linux and OS X releases will be available in 2008.




It looks nice, I was looking for a similar tool 5 -6 years ago. It looks 
like what I would have wanted at the time.


legolas wrote:

Is there any plan to release the second link (workbench) for linux?
thanks



John Comerford-2 wrote:
  

http://dev.mysql.com/downloads/gui-tools/5.0.html
http://dev.mysql.com/workbench/

legolas wrote:


Hi
thank you for reading my post
Is there a development workbench or development/ administration studio
available for linux?
Whether from MySQL AB itself or other 3rd party companies?

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-table-checksum with mixed storage enginges

2007-08-28 Thread Bill Newton
Will mysql-table-checksum from mysql toolkit work with setups that have 
different Master/ Slave storage engines? Are there any things to 
consider when using it between two different engines ( say Innodb master 
and MyIsam slave)?


Thanks in advance,

Bill Newton




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



Re: it doesn't return from the mysql_query processing

2007-07-18 Thread Bill Newton

Hi Koki,

You have to re- establish the database connection in each child process. 
Otherwise the packets get mangled and you get the errors you're seeing.


Koki Takeda wrote:

I hope that my contacting you is not an imposition in any way.

My name is Koki Takeda.

This time, I made the php program using MySQL. 

The child process is generated in the program, and MySQL query 
are transmitted two or more times in the child process. That's 
my problem.


There is difficultly both executions in a present environment 
though I thought about the following two solutions by 
investigating.


I will inform the following of details. Please teach some 
solutions.


And, please contact me when there are lack information etc.

I would be very happy to hear from you.

--
■ Facts

  OS:SunOS xxx 5.8 Generic_108528-23 sun4u sparc 
 SUNW,UltraAX-i2 (Solaris 8)

  php:   4.3.9
  Mysql: Ver 4.0.12-standard for sun-solaris2.8 on sparc


■ Content of processing

  In the made php program (A temporary name: test.php), it 
  transmits repeating MySQL query (select,insert) according to 
  MySQL function mysql_query.


  And, test.php forking does the process, and operates at the 
  same time five child processes. 
  MySQL query is transmitted about 2500 times in all child 
  process total. 

  I will explain the outline of the program and the outline of 
  the program flow as follows. 


  <Outline of test.php program>

It is processing that forwards an arbitrary file to 
another server.


  <Outline of test.php program flow>

Start

Query execution to acquire file list to be transmitted 
(real environment: About 60 records)

  mysql_query (select)

Ceri execution to acquire server list(real environment: 
Five records)

  mysql_query (select)

Beginning of loop1(loop for a few minutes of server) {

  It is a fork as for the process. 


if Fork failure {

Error processing

} elseif parent process {

Process ID backup

} else { child process

Beginning of loop2(loop for a few minutes of file 
for forwarding) {


Ceri execution that judges forwarding
  mysql_query (select)

if It is not an object of forwarding
   (Forwarded it. ) {

Ceri execution of log writing
  mysql_query (insert)

Continuance of loop2
}

Forwarding execution

End of loop2
}

End of loop1

Processing that waits for end of all child processes

End


■ symptom

  Processing ends normally in case of almost.
  However, in rare cases, it doesn't return from the 
  mysql_query processing after mysql_query is called about 
  200-250 times in total by all child process processing, and 
  processing stops. 

  SQL sentence that doesn't return from the mysql_query 
  processing is as follows. 


  ・select updated from table_name_1 where code = 98

  ・insert into table_name_2 ( field_name_1,field_name_2,  
field_name_3,field_name_4,field_name_5 ) values ( '1', '', 
'', 1,'XX#1(doc01)(192.168.1.100):The copy processing was 
skipped.(aaa.xxx) ' )


  And Mysqld is done while having started while this symptom 
  is occurring. 
  And, other Ceri can be executed. 

  Nonw, when this symptom occurs, kill does me parent process 
  and 5 child processes now.



■ Idea of solution

  It was able to be confirmed that the following errors might
  occur when test.php was being executed.  Therefore, I 
  judged that the buffer might been filled. 


  <Error message>
  Malformed packet

  Then, I considered the idea of the following two solutions. 
  However, both influences that it has on other programs are 
  large, and time is required for the verification.

  Therefore, I am looking for other solutions.

  <Idea of solution>
  (1)After mysql_query is executed, the processing of the 
 flush of query cash is added.

  (2)Upgrade of mysql


■ Content of question

  Based on above, I want to make the following question. 


  ・Is there a case similar to this symptom?

  ・How was this symptom canceled when there was a similar 
case?


  ・Additionally, does another have the thought solution?



  




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



Re: MySQL 5 et les charset sur debian etch

2007-06-15 Thread Bill Newton

Hello,

Je peux lire des Français, mais l'écriture qu'il n'est pas comme facile. 
Ainsi j'emploie des poissons de Babel pour traduire ceci 
d'anglais-français. Ainsi, mes excuses s'il la grammaire est totalement 
erroné.



Très intéressant. Je devinerais que le problème s'est produit dans le 
transfert des données à partir d'une base de données à l'autre. Comment 
avez-vous copié les données ? Vous pourriez examiner insérer de 
nouvelles données dans chaque base de données et voir si elle semble 
correcte.



Bill


Gilles MISSONNIER wrote:

Hello,

j'ai 2 machines Linux debian etch, avec MySQL 5.0.32

J'ai un problème d'affichage sur l'une des machines :
j'ai créé la même table et chargé le même fichier data
dans une base sur chaque machine, et l'affichage est différent.

Je ne vois pas oú est la différence...
my.cnf idem
locale idem


mysql select 
@@character_set_server,@@collation_server,@@character_set_connection;
+---+++ 

| @@character_set_server | @@collation_server | 
@@character_set_connection
+++---+ 

| utf8   | utf8_general_ci| utf8 
+++---+ 



mysql select nom,id from t;
+--++
| nom  | id |
+--++
| aàb  |  1 |
| été  |  2 |
| cçoôeêeèeëi  |  3 |
| EÉEÈEË   |  4 |
| c'est tout   |  5 |
+--++

sur l'autre machine, l'affichage n'est pas bon.

mysql select 
@@character_set_server,@@collation_server,@@character_set_connection;
++++ 

| @@character_set_server | @@collation_server | 
@@character_set_connection 
++++ 

| utf8   | utf8_general_ci| utf8 
++++ 



mysql select nom,id from t;
+++
| nom| id |
+++
| aà b   |  1 |
| été  |  2 |
| cçoôeêeèeëi   |  3 |
| EÉEÈEË  |  4 |
| c'est tout |  5 |
+++


mais si je fais :
mysql charset latin1;
les accents sont là oú il faut, mais pas l'alignement des colones...

mysql select nom,id from t;
+--+--+
| nom  | id   |
+--+--+
| aàb |1 |
| été|2 |
| cçoôeêeèeëi |3 |
| EÉEÈEË|4 |
| c'est tout   |5 |
+--+--+

si quelqu'un peut reproduire la chose et m'expliquer le problème...



voici la commande de création de la table :

mysql
CREATE TABLE `t` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `nom` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ;


ensuite on rentre les données :
mysql load data infile '/le_repertoire/t' into table t fields 
terminated by ':';


et le fichier t contient :

1:aàb
2:été
3:cçoôeêeèeëi
4:EÉEÈEË
5:c'est tout


_-¯-_-¯-_-¯-_-¯-_
Gilles Missonnier
IAP - [EMAIL PROTECTED]
01 44 32 81 36



  




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