Large insert question

2009-05-20 Thread Gary Smith
Hello, 

I'm working on a project that will be inserting very large text streams into a 
database.  They range from 100K to 100M.  I suspect that the average will be 
about 2M per insert.  This is a low volume (under 20 inserts per day).  I don't 
really need to optimize much on this but I had a question regarding max data 
per insert.  I know some time ago on another project I had to increase sometime 
to handle inserts over a certain size because of a default setting that limited 
the size of the data per connection.  Anyone know what setting I need to tweak 
to ensure that it can accept large inserts of this size?

Thanks, 

Gary
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



RE: Large insert question

2009-05-20 Thread Gary Smith
Michael, 

Thanks.  Thats what I was looking for, I just couldn't remember what it was.

Gary


From: Michael Dykman [mdyk...@gmail.com]
Sent: Wednesday, May 20, 2009 9:17 AM
To: Gary Smith
Cc: mysql@lists.mysql.com
Subject: Re: Large insert question

On Wed, May 20, 2009 at 12:02 PM, Gary Smith g...@primeexalia.com wrote:
 Hello,

 I'm working on a project that will be inserting very large text streams into 
 a database.  They range from 100K to 100M.  I suspect that the average will 
 be about 2M per insert.  This is a low volume (under 20 inserts per day).  I 
 don't really need to optimize much on this but I had a question regarding max 
 data per insert.  I know some time ago on another project I had to increase 
 sometime to handle inserts over a certain size because of a default setting 
 that limited the size of the data per connection.  Anyone know what setting I 
 need to tweak to ensure that it can accept large inserts of this size?

 Thanks,

 Gary

As I recall, max_allowed_packet is what controls that limit.


--
 - michael dykman
 - mdyk...@gmail.com

 - All models are wrong.  Some models are useful.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=g...@primeexalia.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: Large insert question

2009-05-20 Thread Michael Dykman
On Wed, May 20, 2009 at 12:02 PM, Gary Smith g...@primeexalia.com wrote:
 Hello,

 I'm working on a project that will be inserting very large text streams into 
 a database.  They range from 100K to 100M.  I suspect that the average will 
 be about 2M per insert.  This is a low volume (under 20 inserts per day).  I 
 don't really need to optimize much on this but I had a question regarding max 
 data per insert.  I know some time ago on another project I had to increase 
 sometime to handle inserts over a certain size because of a default setting 
 that limited the size of the data per connection.  Anyone know what setting I 
 need to tweak to ensure that it can accept large inserts of this size?

 Thanks,

 Gary

As I recall, max_allowed_packet is what controls that limit.


-- 
 - michael dykman
 - mdyk...@gmail.com

 - All models are wrong.  Some models are useful.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



insert question

2009-02-24 Thread PJ
Is there a way to insert several rows into a table with one statement?
I have this:
$sql2 = INSERT INTO authors
(first_name, last_name, ordinal) VALUES
('$first_nameIN', '$last_nameIN', '1');
$result2 = mysql_query($sql2, $db);

I want to avoid doing another insert like:
$sql3 = INSERT INTO authors
(first_name, last_name, ordinal) VALUES
('$first_name2IN', '$last_name2IN', '2');
$result2 = mysql_query($sql2, $db);



-- 

Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: insert question

2009-02-24 Thread Michael Dykman
On Tue, Feb 24, 2009 at 8:53 PM, PJ af.gour...@videotron.ca wrote:
 Is there a way to insert several rows into a table with one statement?
 I have this:
 $sql2 = INSERT INTO authors
(first_name, last_name, ordinal) VALUES
 ('$first_nameIN', '$last_nameIN', '1');
$result2 = mysql_query($sql2, $db);

 I want to avoid doing another insert like:
 $sql3 = INSERT INTO authors
(first_name, last_name, ordinal) VALUES
 ('$first_name2IN', '$last_name2IN', '2');
$result2 = mysql_query($sql2, $db);


$sql2 = INSERT INTO authors
   (first_name, last_name, ordinal) VALUES
   ('$first_nameIN', '$last_nameIN', '1'),
   ('$first_name2IN', '$last_name2IN', '2');


-- 
 - michael dykman
 - mdyk...@gmail.com

 - All models are wrong.  Some models are useful.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Delayed Insert Question

2003-12-09 Thread David Bordas
Hi list,

I've got a small MyISAM table which is used for some statistics.
I'm only doing insert into this table.
I need that clients doing INSERT queries can exit as soon as possible.

So, i'm using INSERT DELAYED with some good succes.

But I've got a question.
If i decrease delayed_insert_limit to ten secondes for example, is that mean
that delayed_queue will be flushed every ten secondes ?
Is there an other variable that specify the flush time ?

For the moment, MySQL can handle an average of 92.12 query/sec.

Thanks.
David


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



Re: Delayed Insert Question

2003-12-09 Thread Chris Elsworth
On Tue, Dec 09, 2003 at 12:17:41PM +0100, David Bordas wrote:

 So, i'm using INSERT DELAYED with some good succes.
 
 But I've got a question.
 If i decrease delayed_insert_limit to ten secondes for example, is that mean
 that delayed_queue will be flushed every ten secondes ?
 Is there an other variable that specify the flush time ?

No - delayed_insert_limit refers to how many rows a DELAYED thread
will insert at once before checking if any other SELECTs are waiting
for the table. The process (and all related variables you can tweak)
are documented here:

http://www.mysql.com/doc/en/INSERT_DELAYED.html

-- 
Chris

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



Re: Delayed Insert Question

2003-12-09 Thread David Bordas
  So, i'm using INSERT DELAYED with some good succes.
 
  But I've got a question.
  If i decrease delayed_insert_limit to ten secondes for example, is that
mean
  that delayed_queue will be flushed every ten secondes ?
  Is there an other variable that specify the flush time ?

 No - delayed_insert_limit refers to how many rows a DELAYED thread
 will insert at once before checking if any other SELECTs are waiting
 for the table. The process (and all related variables you can tweak)
 are documented here:

 http://www.mysql.com/doc/en/INSERT_DELAYED.html

Thanks Chris,

I've read mysql doc sereval times, but i can't find any varaible that
specify when the delayed queue was flushed.

If I understand, I can increase delayed_insert_limit for better performance,
but I should also increase the delayed_queue as well ?

David



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



Re: Delayed Insert Question

2003-12-09 Thread Chris Elsworth
On Tue, Dec 09, 2003 at 02:18:58PM +0100, David Bordas wrote:
 
 I've read mysql doc sereval times, but i can't find any varaible that
 specify when the delayed queue was flushed.

Well, I suppose that's because there isn't one. The DELAYED thread
handles that by itself. You don't want it too large because if mysql
crashes while you have rows sat waiting to be written, they're lost.

 If I understand, I can increase delayed_insert_limit for better performance,
 but I should also increase the delayed_queue as well ?

If you increase delayed_insert_limit then you're effectively giving
the DELAYED thread more preferencee to the table; it will write more
rows (once it can, ie there's a phase of time where there's no locks
on the table) in a batch, which potentially makes other selects wait
longer.

Inserting delayed_queue_size means the clients can pile more and more
rows into the DELAYED thread while it gets chance to write. This may
give your clients a bit of a boost, but only if the DELAYED thread
fills up; at a default of 1000, you must be doing a lot of inserts to
reach that. Remember if you have a lot of rows waiting and mysql
crashes, they're lost.

-- 
Chris

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



Re: Delayed Insert Question

2003-12-09 Thread David Bordas
Tuesday, December 09, 2003 2:51 PM
Chris Elsworth wrote:

 If you increase delayed_insert_limit then you're effectively giving
 the DELAYED thread more preferencee to the table; it will write more
 rows (once it can, ie there's a phase of time where there's no locks
 on the table) in a batch, which potentially makes other selects wait
 longer.

 Inserting delayed_queue_size means the clients can pile more and more
 rows into the DELAYED thread while it gets chance to write. This may
 give your clients a bit of a boost, but only if the DELAYED thread
 fills up; at a default of 1000, you must be doing a lot of inserts to
 reach that.

Thank you Chris, I think I understand now.

Remember if you have a lot of rows waiting and mysql
 crashes, they're lost.

Well, I know that, but loosing 2000 inserts when i made more than 3 000 000
a day isn't a big problem.
This table is for statistics only, data isn't very important and MySQL
doesn't crash as often happyily :)
Now i just need to choose, I can boost the insert ratio but i'll take some
risks, or i can leave all as default ...

Bye
David


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



complex, to me, insert question

2003-09-27 Thread dan orlic
I have an insert that I have to get to work from the following tables
here is my query:
 
Select distinct t1.id, t3.id, t2.id, g.description, g.price, g.qty,
g.comments from cp.Category t1, Gifts g, cp.Manufacturer t2, cp.Pattern
t3 where t1.name = g.Category and t2.name = g.Manfacturer and t3.name =
g.pattern;
 
This yields the correct 7 values, now what I want to do is an insert
into Items (above select);
The problem is that table has an addition 4 extraneous fields so as a
result I get a Column count doesn't match value count at row one.
Also, there is an autoincrement Id in that table, but I doun't think
that's an issue.
 
I just want to put some default  or now()'s for timestamps for those
remaining values, but I am unsure how to.  Please help.
 
 


Re: complex, to me, insert question

2003-09-27 Thread Kelley Lingerfelt
You need to substitute t1_id, t3_id ... etc, for the appropriate field
names in the
other_table you are wanting to insert the values into.
The missing fields will be filled in with their default values:


INSERT INTO other_table (t1_id, t3_id, t2_id, g_description, g_price,
g_qty, g_comments)
SELECT distinct t1.id, t3.id, t2.id, g.description, g.price, g.qty,
g.comments FROM cp.Category t1, Gifts g, cp.Manufacturer t2, cp.Pattern
t3 WHERE t1.name = g.Category and t2.name = g.Manfacturer and t3.name =
g.pattern;

Kelley



dan orlic wrote:

 I have an insert that I have to get to work from the following tables
 here is my query:

 Select distinct t1.id, t3.id, t2.id, g.description, g.price, g.qty,
 g.comments from cp.Category t1, Gifts g, cp.Manufacturer t2, cp.Pattern
 t3 where t1.name = g.Category and t2.name = g.Manfacturer and t3.name =
 g.pattern;

 This yields the correct 7 values, now what I want to do is an insert
 into Items (above select);
 The problem is that table has an addition 4 extraneous fields so as a
 result I get a Column count doesn't match value count at row one.
 Also, there is an autoincrement Id in that table, but I doun't think
 that's an issue.

 I just want to put some default  or now()'s for timestamps for those
 remaining values, but I am unsure how to.  Please help.




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



INSERT Question

2002-08-01 Thread Steven Kreuzer

Hello All,

First, Let me start by saying this question has most likely been asked 
before, but I did a search in the archive and was unable to come up with 
any results. I think this  is because I am not quite sure what this is 
called. So, I do apologize, but hopefully this can be answered quickly 
and will really help me out.

This is more of a General SQL question, regarding sytanx.

I have 3 table I am going to be working on. contact, address and state.
state contains 51 states (Washington D.C is listed as a state) each with 
their unique ID. Contact contains a persons first and last name, as well 
as their own ID. Address contains their street name, the city, state and 
a column called contactid for the id of the person who lives there.

State is a foreign key for the state table and contactid is a foreign 
key for the contact's id.

Now here is what I want to do:

I want to insert a person into the contact database and then insert 
their address into the address table, but I want to somehow put the ID 
of the state, and the id of the contact into the fields without actually 
  having to know the values.

Like rather then having to look up New York and then insert 033, can I 
just somehow put New York?

Is this possible to do?

Many thanks
-Steven

mysql, sql, query





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: very newbie insert question

2001-10-04 Thread Jonathan Hilgeman

I always use 

INSERT INTO table SET field1='value', field2='value', etc...

If I don't specify fields like an auto-incrementing number, it is filled in
automatically.

- Jonathan

-Original Message-
From: sjs [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 03, 2001 5:51 PM
To: [EMAIL PROTECTED]
Subject: very newbie insert question


This is my first script, so I am sorry it is so newbie-ish.
I think I have the correct script to open the connection, open the database
and the table. However, I cannot get the insert into to work. I have read
several online sources and books, all of which are slightly different. It is
not a parse error.  Can you help?

Thanks
SJS
 Script as follows:

html
headtitleAdding Your Record to the Database/title/head
body
center
?php
if((!$lastName) || (!firstName) ||(!emailAddress))
{
echo You have not entered all required informaton.br Please try again;
exit;
}
$lastName=addslashes($lastName);
$firstName=addslashes($firstName);
$email_address=addslashes($email_address);
@ $db=mysql_pconnect(, ,);
if (!$db)
{
echo Couldn't connect to the database.brIf problem persists, please
contact webmaster;
exit;
}
$db= mysql_select_db(emailDB);
if (!$db)
{
echo Sorry. Could not retrieve correct database.br If problem persists,
please contact webmaster;
}
$sql = INSERT INTO email_addresses VALUES ('$lastName', '$firstName',
'$email_address');
$result = mysql_query($sql);
if (!$result)
{
echo pSorry.brYour address was not successfully added.brIf problem
persists, please contact webmaster.;
}
else
{
echo pDONE DEAL!;
}
?
/body
/html



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: very newbie insert question

2001-10-04 Thread William R. Mussatto

Slight error here if you want the auto icrement field to work properly

On Wed, 3 Oct 2001, Chris Johnson wrote:

 Date: Wed, 3 Oct 2001 20:07:49 -0500
 From: Chris Johnson [EMAIL PROTECTED]
 To: Russell Miller [EMAIL PROTECTED], sjs [EMAIL PROTECTED],
 [EMAIL PROTECTED]
 Subject: Re: very newbie insert question
 
 One only needs to specify the column names if and only if there are not
 values, in the correct order, for all of the columns in the table.
 
 That is:
 Create Table foo (
 aid  intnot null  auto_increment  primary key,
^^
 last varchar(30),
 firstvarchar(30),
 emailvarchar(60)
 );
 
 Right:
 Insert Into foo Values (0, '$lastname', '$firstname', '$email');
  ^ 
 Insert Into foo (last, first, email) Values ('$lastname', '$firstname',
 '$email');
 
 Wrong:
 Insert Into foo Values ('$lastname', '$firstname', '$email');
 
 ..chris
 
 - Original Message -
 From: Russell Miller [EMAIL PROTECTED]
 To: sjs [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Wednesday, October 03, 2001 7:53 PM
 Subject: Re: very newbie insert question
 
 
 I did not see the full schema so I can't give you a definite answer.
 However, your syntax is wrong:
 
 INSERT INTO email_addresses (last_name, first_name, email_address) VALUES
 ($lastname, $firstname, $email_address);
 
 For each value you specify, you also have to specify a column name.
 
 Did you set it up so the email_address field is the primary key?
 
 HTH.
 
 --Russell
 
 - Original Message -
 From: sjs [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, October 03, 2001 7:51 PM
 Subject: very newbie insert question
 
 
  This is my first script, so I am sorry it is so newbie-ish.
  I think I have the correct script to open the connection, open the
 database
  and the table. However, I cannot get the insert into to work. I have
 read
  several online sources and books, all of which are slightly different. It
 is
  not a parse error.  Can you help?
 
  Thanks
  SJS
   Script as follows:
 
  html
  headtitleAdding Your Record to the Database/title/head
  body
  center
  ?php
  if((!$lastName) || (!firstName) ||(!emailAddress))
  {
  echo You have not entered all required informaton.br Please try again;
  exit;
  }
  $lastName=addslashes($lastName);
  $firstName=addslashes($firstName);
  $email_address=addslashes($email_address);
  @ $db=mysql_pconnect(, ,);
  if (!$db)
  {
  echo Couldn't connect to the database.brIf problem persists, please
  contact webmaster;
  exit;
  }
  $db= mysql_select_db(emailDB);
  if (!$db)
  {
  echo Sorry. Could not retrieve correct database.br If problem persists,
  please contact webmaster;
  }
  $sql = INSERT INTO email_addresses VALUES ('$lastName', '$firstName',
  '$email_address');
  $result = mysql_query($sql);
  if (!$result)
  {
  echo pSorry.brYour address was not successfully added.brIf problem
  persists, please contact webmaster.;
  }
  else
  {
  echo pDONE DEAL!;
  }
  ?
  /body
  /html
 
 
 
  -
  Before posting, please check:
 http://www.mysql.com/manual.php   (the manual)
 http://lists.mysql.com/   (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
 [EMAIL PROTECTED]
  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 

Sincerely,

William Mussatto, Senior Systems Engineer
CyberStrategies, Inc
ph. 909-920-9154 ext. 27


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




very newbie insert question

2001-10-03 Thread sjs

This is my first script, so I am sorry it is so newbie-ish.
I think I have the correct script to open the connection, open the database
and the table. However, I cannot get the insert into to work. I have read
several online sources and books, all of which are slightly different. It is
not a parse error.  Can you help?

Thanks
SJS
 Script as follows:

html
headtitleAdding Your Record to the Database/title/head
body
center
?php
if((!$lastName) || (!firstName) ||(!emailAddress))
{
echo You have not entered all required informaton.br Please try again;
exit;
}
$lastName=addslashes($lastName);
$firstName=addslashes($firstName);
$email_address=addslashes($email_address);
@ $db=mysql_pconnect(, ,);
if (!$db)
{
echo Couldn't connect to the database.brIf problem persists, please
contact webmaster;
exit;
}
$db= mysql_select_db(emailDB);
if (!$db)
{
echo Sorry. Could not retrieve correct database.br If problem persists,
please contact webmaster;
}
$sql = INSERT INTO email_addresses VALUES ('$lastName', '$firstName',
'$email_address');
$result = mysql_query($sql);
if (!$result)
{
echo pSorry.brYour address was not successfully added.brIf problem
persists, please contact webmaster.;
}
else
{
echo pDONE DEAL!;
}
?
/body
/html



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: very newbie insert question

2001-10-03 Thread Russell Miller

I did not see the full schema so I can't give you a definite answer.
However, your syntax is wrong:

INSERT INTO email_addresses (last_name, first_name, email_address) VALUES
($lastname, $firstname, $email_address);

For each value you specify, you also have to specify a column name.

Did you set it up so the email_address field is the primary key?

HTH.

--Russell

- Original Message -
From: sjs [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 7:51 PM
Subject: very newbie insert question


 This is my first script, so I am sorry it is so newbie-ish.
 I think I have the correct script to open the connection, open the
database
 and the table. However, I cannot get the insert into to work. I have
read
 several online sources and books, all of which are slightly different. It
is
 not a parse error.  Can you help?

 Thanks
 SJS
  Script as follows:

 html
 headtitleAdding Your Record to the Database/title/head
 body
 center
 ?php
 if((!$lastName) || (!firstName) ||(!emailAddress))
 {
 echo You have not entered all required informaton.br Please try again;
 exit;
 }
 $lastName=addslashes($lastName);
 $firstName=addslashes($firstName);
 $email_address=addslashes($email_address);
 @ $db=mysql_pconnect(, ,);
 if (!$db)
 {
 echo Couldn't connect to the database.brIf problem persists, please
 contact webmaster;
 exit;
 }
 $db= mysql_select_db(emailDB);
 if (!$db)
 {
 echo Sorry. Could not retrieve correct database.br If problem persists,
 please contact webmaster;
 }
 $sql = INSERT INTO email_addresses VALUES ('$lastName', '$firstName',
 '$email_address');
 $result = mysql_query($sql);
 if (!$result)
 {
 echo pSorry.brYour address was not successfully added.brIf problem
 persists, please contact webmaster.;
 }
 else
 {
 echo pDONE DEAL!;
 }
 ?
 /body
 /html



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: very newbie insert question

2001-10-03 Thread Chris Johnson

One only needs to specify the column names if and only if there are not
values, in the correct order, for all of the columns in the table.

That is:
Create Table foo (
aid  intnot nullprimary key,
last varchar(30),
firstvarchar(30),
emailvarchar(60)
);

Right:
Insert Into foo Values (1, '$lastname', '$firstname', '$email');
Insert Into foo (last, first, email) Values ('$lastname', '$firstname',
'$email');

Wrong:
Insert Into foo Values ('$lastname', '$firstname', '$email');

..chris

- Original Message -
From: Russell Miller [EMAIL PROTECTED]
To: sjs [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 7:53 PM
Subject: Re: very newbie insert question


I did not see the full schema so I can't give you a definite answer.
However, your syntax is wrong:

INSERT INTO email_addresses (last_name, first_name, email_address) VALUES
($lastname, $firstname, $email_address);

For each value you specify, you also have to specify a column name.

Did you set it up so the email_address field is the primary key?

HTH.

--Russell

- Original Message -
From: sjs [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 03, 2001 7:51 PM
Subject: very newbie insert question


 This is my first script, so I am sorry it is so newbie-ish.
 I think I have the correct script to open the connection, open the
database
 and the table. However, I cannot get the insert into to work. I have
read
 several online sources and books, all of which are slightly different. It
is
 not a parse error.  Can you help?

 Thanks
 SJS
  Script as follows:

 html
 headtitleAdding Your Record to the Database/title/head
 body
 center
 ?php
 if((!$lastName) || (!firstName) ||(!emailAddress))
 {
 echo You have not entered all required informaton.br Please try again;
 exit;
 }
 $lastName=addslashes($lastName);
 $firstName=addslashes($firstName);
 $email_address=addslashes($email_address);
 @ $db=mysql_pconnect(, ,);
 if (!$db)
 {
 echo Couldn't connect to the database.brIf problem persists, please
 contact webmaster;
 exit;
 }
 $db= mysql_select_db(emailDB);
 if (!$db)
 {
 echo Sorry. Could not retrieve correct database.br If problem persists,
 please contact webmaster;
 }
 $sql = INSERT INTO email_addresses VALUES ('$lastName', '$firstName',
 '$email_address');
 $result = mysql_query($sql);
 if (!$result)
 {
 echo pSorry.brYour address was not successfully added.brIf problem
 persists, please contact webmaster.;
 }
 else
 {
 echo pDONE DEAL!;
 }
 ?
 /body
 /html



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERT question

2001-06-04 Thread karel pitra


Hello,

  i'm writing an application in java and i have the following problem :

when i insert a record into a mysql table through the executeUpdate() method 
of either Statement or PreparedStatement, does the method return immediately
or does it wait until MySql has the data written into the database?

i'm hesitating whether to use a new thread to do inserts with lower priority 
which would be necessary if executeUpdate() waits or whether to do them
in the main thread.

  thank you
   karel pitra

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




INSERT question...

2001-03-07 Thread Josh Burroughs

Hi-o! I was wondering if it's possible when inserting a value into a table
that has an auto_increment field to have MySQL return the value of the
auto_increment field right after doing the insert, w/out having to run a
seperate query? 
For example if I had a table with two collums, ID and name. Where ID is an
int field with auto_increment set, and is the primary key. and name is
just a varchar. and did this:

INSERT INTO some_table (name) VALUES("bob");

I'd like for the query to return the value for ID that was just assigned.
Is there a way to do this all in one SQL statement? 

Thanks in advance!

"Listen: We are here on Earth to fart around. Don't let anybody tell you
any different!" - Kurt Vonnegut

Josh Burroughs
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: INSERT question...

2001-03-07 Thread Johnny Withers

After doing an INSERT, you may do

SELECT last_insert_id();

and it will return the last id the last INSERT command used. it doesn't matter if your 
MySQL server is very busy doing inserts, if
you call 'SELECT last_insert_id()' right after the INSERT, you will get the correct 
value. last_insert_id() returns the last insert
ID of that connection ID, so you will get the correct values.


-
Johnny Withers
[EMAIL PROTECTED]
p. 601.853.0211
c. 601.954.9133



-Original Message-
From: Josh Burroughs [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 06, 2001 6:18 PM
To: [EMAIL PROTECTED]
Subject: INSERT question...


Hi-o! I was wondering if it's possible when inserting a value into a table
that has an auto_increment field to have MySQL return the value of the
auto_increment field right after doing the insert, w/out having to run a
seperate query?
For example if I had a table with two collums, ID and name. Where ID is an
int field with auto_increment set, and is the primary key. and name is
just a varchar. and did this:

INSERT INTO some_table (name) VALUES("bob");

I'd like for the query to return the value for ID that was just assigned.
Is there a way to do this all in one SQL statement?

Thanks in advance!

"Listen: We are here on Earth to fart around. Don't let anybody tell you
any different!" - Kurt Vonnegut

Josh Burroughs
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php