| 
	
 | 
 Posted by Gordon Burditt on 02/11/06 23:48 
>How can I send it to SQL Server at once? 
 
I don't think you're going to get anywhere using mysql_query to 
send to Microsoft SQL Server. 
 
>I see mysql_query() fails on first semicolon (;) who delimits the SQL  
>Commands. 
 
Prior to some version of MySQL (maybe 5.0), you can't send more than 
one statement at a time, and it must not have a terminating semicolon. 
 
Even with the latest version, you need to use a client interface 
that knows how to deal with multiple result sets coming back. 
I am not sure whether PHP does this, but at the least, you need 
the mysqli interface, not mysql. 
 
>I send to a MySQL server via fast Internet connection, about 500 INSERT  
>commands one by one via mysql_query(). 
>It takes much time. Why? 
>I suspect that, mysql_query() after send the query to server, waits for  
>a "OK" response.  
 
This is the way it's defined to work. 
 
>If it's true, how can I send and send and send SQL  
>commands and MySQL server reply "OK" after send all these things? 
>(or no wait at all?) 
 
You can insert many, many records with one insert statement,  
(even, I believe, on MySQL 3.23.*) e.g.: 
 
insert into table values 
(.....), 
(.....), 
(.....), 
(.....); 
 
mysqldump using this form has been known to pack 5,000 records into 
one insert statement.  You are limited to some buffer size which 
might be a quarter of a megabyte or some such limit for the query. 
 
					Gordon L. Burditt
 
  
Navigation:
[Reply to this message] 
 |