Delete items which aren't present in another table?

2003-12-23 Thread Adam Clauss
I have a table which maintains a list of categories and has a field called
catID.  This field is a one-to-many relationship with another table.
What I want to do is remove any empty categories - aka: remove any
categories which aren't used in the second table.
 
I thought MySQL at least partially supported nested SELECT queries, but
either it does not support them in DELETE's or I got the syntax wrong.
Here's what I was trying to use:
DELETE FROM Categories WHERE NOT(catID IN (SELECT DISTINCT catID FROM
items));
 
Any easy alternatives here?
Adam Clauss
cabadam@ mailto:[EMAIL PROTECTED] houston.rr.com
 


Is my logic wrong here?

2003-12-21 Thread Adam Clauss
I am using the following C++ (Visual Studio .Net 2002) code to determine
whether or not a given object exists in a table.If it DOES exist, it adds
it.
 
snip
query.Format(SELECT catID FROM Categories WHERE category=\%s\ AND
subcategory=\%s\,
   currentObject-category, currentObject-subcategory);
if (!sqlCon.ExecuteQuery(query))
{
 sqlCon.QueryError(query);
 delete currentObject;
 currentObject = NULL;
 return;
}
 
if (sqlCon.res.size() == 0) //then doesn't exist, need to add it
{
 query.Format(INSERT INTO Categories (category, subcategory) VALUES(\%s\,
\%s\),
   currentObject-category, currentObject-subcategory);
 if (!sqlCon.ExecuteQuery(query))
 {
  sqlCon.QueryError(query);
  delete currentObject;
  currentObject = NULL;
  return;
 }
 
 
/snip
 
What I just began getting is the case where the selected results have a size
of 0 (indicating that the specified object does not exist), but then when I
try to insert that very same item, it gives me a key violation.  I just
upgraded this program to be using a 4.0.17 server - was previously using
4.0.12 and did not have this problem.  Any ideas on what might be wrong?
 
Adam Clauss
[EMAIL PROTECTED]
 


How to optimize this query?

2003-12-19 Thread Adam Clauss
I have a table which contains many items.  Each item consists of an
scriptID, several attributes, and an optional field - a parent (called
dupeitem in the database) item.  Most all of these fields are strings -
even the IDs which consist of a combination of letters and numbers.  Items
which have a parent item listed do not have attributes themselves, but
instead inherit these properties from their parent. These child items are
initially added with NULL attributes.  The parent item is listed in the
dupeitem field - which specifies the scriptID of its parent.
I populate the database by reading in the items from various files.  Upon
completion, I then attempt to fill in the missing attributes.  To accomplish
this I am currently usign the following query:
 
UPDATE items, items AS items2
SET items.catID = items2.catID, items.name = items2.name, items.id =
items2.id, items.description = items2.description
WHERE items.added = 1 AND items.dupeitem = items2.scriptID
 
This query on the items table (which contains over 50,000 items) takes an
INCREDIBLY long time to execute.
Actually... now that I think about it - I haven't actually seen it finish
yet - I've always run out of time (10-15min) to wait for it and have
aborted.
 
Any ideas/suggestions on what I could do to cut this time down?  Or another
alternative for filling in this information?
 
Adam Clauss
[EMAIL PROTECTED]
 


Got error 22 from table handler

2003-10-29 Thread Adam Clauss
I have an app that (rapidly) adds items (via individual insert statements as
items are parsed in from a file) into the database.  I seem to be randomly
getting got error 22 from table handler on what appears to be perfectly
valid INSERT queries.

perror 22 gave:
Error code  22:  Invalid argument

I'm using multithreading in my app, but I make sure to LOCK/UNLOCK my tables
before and after use.
What would cause this?

Adam Clauss
[EMAIL PROTECTED]


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



MyISAM table corrupting in 4.0.16???

2003-10-29 Thread Adam Clauss
I just upgraded an embedded server application to use 4.0.16 (from 4.0.12)
and now I am quite consistently getting a corrupt table.  I am now getting
Got error 127 from table handler returned as the error.  Copying the data
directory into a true SQL server and executing a CHECK on the involved
tables gives:
1 clients is using or hasn't closed the table properly

This sounds like I locked it, but didn't unlock it?  But I am positive I
did.
I use the following procedure:

AddItem()
LockTable
InsertItem
UnlockTable


Just to double check, I have the a function for LockTable and a function for
UnlockTable.  These functions keep a counter and increment it/decrement it
each time it is called.  I verified that prior to running this query (an
UPDATE query) that the counter is 0 - which indicates that everytime I
locked the table, I unlocked it.

Note that this same code did not cause this problem with 4.0.12 (had
problems in other places, which are the reasons I just upgraded this).

Any ideas?
Adam Clauss
[EMAIL PROTECTED]


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



RE: MyISAM table corrupting in 4.0.16???

2003-10-29 Thread Adam Clauss
Narrowed it down - it doesn't seem to have anything to do with the table
locking.  I removed ALL locking/unlocking and it made no difference.  Still
getting there error.

What would cause the 127 error? (perror says: 127 = Record-file is crashed)

Adam Clauss
[EMAIL PROTECTED]


 -Original Message-
 From: Adam Clauss [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, October 29, 2003 9:21 PM
 To: [EMAIL PROTECTED]
 Subject: MyISAM table corrupting in 4.0.16???
 
 
 I just upgraded an embedded server application to use 4.0.16 
 (from 4.0.12)
 and now I am quite consistently getting a corrupt table.  I 
 am now getting
 Got error 127 from table handler returned as the error.  
 Copying the data
 directory into a true SQL server and executing a CHECK on 
 the involved
 tables gives:
 1 clients is using or hasn't closed the table properly
 
 This sounds like I locked it, but didn't unlock it?  But I am 
 positive I
 did.
 I use the following procedure:
 
 AddItem()
   LockTable
   InsertItem
   UnlockTable
 
 
 Just to double check, I have the a function for LockTable and 
 a function for
 UnlockTable.  These functions keep a counter and increment 
 it/decrement it
 each time it is called.  I verified that prior to running 
 this query (an
 UPDATE query) that the counter is 0 - which indicates that everytime I
 locked the table, I unlocked it.
 
 Note that this same code did not cause this problem with 4.0.12 (had
 problems in other places, which are the reasons I just upgraded this).
 
 Any ideas?
 Adam Clauss
 [EMAIL PROTECTED]
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/mysql? [EMAIL PROTECTED]
 


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



Filling in data from already existing rows in table

2003-10-28 Thread Adam Clauss
I am parsing a file reading in information and adding it in, one row at a
time, to a table (also storing filename and line number).
Some of the entries in the file will simply consist of nothing more than a
base item value.  For these items, I want to look up this 'base item'
(which should already be in the table) and fill in the missing values from
it.

For example, on my pass through the file, I would have (there are other
values being copied besides name and id, I didn't include them here to
shorten it):
Itemnameid  filename
linenumber  baseitem
A   itema   someid  somefile.txt1
 (blank string - not NULL)
B   somefile.txt5
A

I was thinking of doing some form of UPDATE with a nested select, but this
is on 4.0xx MySQL, which doesn't yet support nested queries.
Any suggestions?
Adam Clauss
[EMAIL PROTECTED]


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



How to best accomplish selecting string (unless it is null)

2003-10-25 Thread Adam Clauss
I have a select statement that selects two string (text) fields.  In some
cases, the first of them may be NULL.  In this case, I would like the second
field to be selected instead.  It is also possible that in rare cases that
the second string may be NULL, in which case it should just return NULL.

Ex:
I have a table similar to:
Key   |   str1   |   str2
0 |  str1  |  anotherstr
1 |   NULL   |  string
2 |   NULL   |   NULL


I would like the select statement to return:
Key   |   Str
0 |   str1
1 |   string
2 |   NULL

How possible is this?

Adam Clauss
[EMAIL PROTECTED]


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



SHOW CREATE TABLE on one line?

2003-10-13 Thread Adam Clauss
I'm currently writing a program that will make use of the SHOW CREATE TABLE
statement to verify that existing tables are correct (if not, it drops them
and recreates).  Why is it though that the SHOW CREATE TABLE statement
returns the answer on multiple lines?  Why not just one line?  And is it
possible to make it return the result on just one line?

Thanks,
Adam Clauss
[EMAIL PROTECTED]


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



RE: SHOW CREATE TABLE on one line?

2003-10-13 Thread Adam Clauss
Well the issue wasn't so much with my program at runtime, but at design time
(now).  What I am doing is hardcoding the string that creates the table into
the program.  Program then calls SHOW CREATE TABLE and compares the two
strings to see if they are the same.  If not, it drops and recreates.

What I have to do everytime I add a table and want to hardcode it in, is run
SHOW CREATE TABLE myself when I know the table is correct and then copy that
string into my program.  That copying part is where I am having difficulty.
It is taking a while for me to figure out where linebreaks, spaces, etc. are
in it.  I spend way too much time trying to make everything line up
character per character.
On the other hand if it was all on one line it would be a simple matter of
copy/paste in.  This, to me, seems like it would be much better to see as
well.
If you can suggest another method to accomplish this, I'm definitely willin
to listen.  I previously was using DESCRIBE to figure out if the table was
correct... But the code to compare each field of each table was getting
rather messy -- MUCH messier than simply saying:

String create = some create string
String str = run SHOW CREATE TABLE
If (create != str)
recreate table


Adam Clauss
[EMAIL PROTECTED]


 -Original Message-
 From: Paul DuBois [mailto:[EMAIL PROTECTED] 
 Sent: Monday, October 13, 2003 3:15 PM
 To: Adam Clauss; [EMAIL PROTECTED]
 Subject: Re: SHOW CREATE TABLE on one line?
 
 
 At 14:48 -0500 10/13/03, Adam Clauss wrote:
 I'm currently writing a program that will make use of the 
 SHOW CREATE TABLE
 statement to verify that existing tables are correct (if 
 not, it drops them
 and recreates).  Why is it though that the SHOW CREATE TABLE 
 statement
 returns the answer on multiple lines?  Why not just one 
 line?  And is it
 possible to make it return the result on just one line?
 
 The statement looks better if you print it.
 
 Why does it matter to your program what it looks like, especially if
 you're just executing the statement?  It's a single string, 
 so it should
 be a legal statement in any API.
 
 
 Thanks,
 Adam Clauss
 [EMAIL PROTECTED]
 
 
 -- 
 Paul DuBois, Senior Technical Writer
 Madison, Wisconsin, USA
 MySQL AB, www.mysql.com
 
 Are you MySQL certified?  http://www.mysql.com/certification/
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/mysql? [EMAIL PROTECTED]
 


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



RE: what means shell ?

2003-10-12 Thread Adam Clauss
For Windows, it’s the DOS prompt.  Go to start/run and type cmd.

Adam Clauss
[EMAIL PROTECTED]


 -Original Message-
 From: Stephan Wölfel [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, October 12, 2003 12:27 PM
 To: [EMAIL PROTECTED]
 Subject: what means shell ?
 
 
 In the third chapter of the MySQL manual I don't understand 
 the mentioned shell. Where must I type in this and the 
 following instructions or what does it mean ?
 Until now I have found and started the winmysqladmin.exe 
 file. But how to continue ?
 
 Stephan
 __
 _
 Schreibsüchtige gesucht! http://my-mail.ch/?redirect=9902
 Heute schon Danke gesagt? Mit swissflowers.ch Blumen 
 schenken! http://my-mail.ch/?redirect=9910
 


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



Moving database from Windows - *nix?

2003-10-06 Thread Adam Clauss
I am going to possibly have to transfer a MySQL database that is currently
running on Windows to a Linux/Unix box (not sure exactly what version it is
running yet).  Any pitfalls to avoid here?
Thanks

Adam Clauss
[EMAIL PROTECTED]


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



RE: php and mysql

2003-09-27 Thread Adam Clauss
There shouldn't be anything else required (besides PHP).  PHP has built in
functions to access MySQL.
See:
http://www.php.net/manual/en/ref.mysql.php

Adam Clauss
[EMAIL PROTECTED]

 -Original Message-
 From: gamalt tant [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, September 27, 2003 8:48 PM
 To: [EMAIL PROTECTED]
 Subject: php and mysql
 
 
 hi
 i want to use php with mysql. However, i do not know
 if i should install another package from mysql that
 incluse shared library between php and mysql?. i
 already installed mysql client and server package. if
 there more package i should install,can you please
 tell the name and where can i find it?
 
redhat8.0
mysql 4.0.15
  thanks
 
 __
 Do you Yahoo!?
 The New Yahoo! Shopping - with improved product search
 http://shopping.yahoo.com
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/mysql? [EMAIL PROTECTED]
 


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



RE: No valid command found

2003-09-25 Thread Adam Clauss
I know I have been.

Adam Clauss
[EMAIL PROTECTED]


 -Original Message-
 From: Director General: NEFACOMP [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 25, 2003 12:52 PM
 To: [EMAIL PROTECTED]
 Subject: Fw: No valid command found
 
 
 Is everyone on the list receiving the message below?
 
 It is coming to me every time I send a message to the mysql list
 
 
 Thanks
 Emery
 - Original Message - 
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, September 25, 2003 20:04
 Subject: No valid command found
 
 
  Your message does not contain a valid command for this mail server
  to process.  No action has been taken.
  
  Message-Id: [EMAIL PROTECTED]
  From: [EMAIL PROTECTED]
  Time-Stamp: Thu, 25 Sep 2003 19:40:58 +0200
  
  : Message contains [1] file attachments
  
 
 


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



Design Suggestion

2003-09-21 Thread Adam Clauss
I have several fields in which I will be strong text.  Various categories,
and for each category, its related subcategories.  Each subcategory then
contains various items.

My question is, for performance, would it be better to assign each
category/subcategory pair a unique ID number and then anytime I need to
lookup something in a subcategory, look up the ID number and search off of
that?

Or, would it be about the same to just search the entire list of items on
the text of the category subcategory?

Ex:

First way:
Two tables:

Categories - Category (text), Subcategory (text), CatID (unique integer)
Items - CatID (integer relating to id in categories table),  Other item
info

I would do something like:
SELECT CatID FROM Categories WHERE Category=desired category AND
Subcategory=desired subcategory
Then for example to retrieve all items in that subcategory:
SELECT * FROM Items WHERE CatID=(the id found in previous select)


OR:
One table:
Items - Category (text), Subcategory (text), ... Other item info

And to find all items in a subcategory, do:
SELECT * FROM Items WHERE Category=desired category AND
Subcategory=desired subcategory



It seems to me the second way would be slower, because it has to do many
more string tests.  But does it make a difference?  Is testing integer
equality actually faster than string equality?

Adam Clauss
[EMAIL PROTECTED]


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



Design Suggestion

2003-09-18 Thread Adam Clauss
I have several fields in which I will be strong text.  Various categories,
and for each category, its related subcategories.  Each subcategory then
contains various items.

My question is, for performance, would it be better to assign each
category/subcategory pair a unique ID number and then anytime I need to
lookup something in a subcategory, look up the ID number and search off of
that?

Or, would it be about the same to just search the entire list of items on
the text of the category subcategory?

Ex:

First way:
Two tables:

Categories - Category (text), Subcategory (text), CatID (unique integer)
Items - CatID (integer relating to id in categories table),  Other item
info

I would do something like:
SELECT CatID FROM Categories WHERE Category=desired category AND
Subcategory=desired subcategory
Then for example to retrieve all items in that subcategory:
SELECT * FROM Items WHERE CatID=(the id found in previous select)


OR:
One table:
Items - Category (text), Subcategory (text), ... Other item info

And to find all items in a subcategory, do:
SELECT * FROM Items WHERE Category=desired category AND
Subcategory=desired subcategory



It seems to me the second way would be slower, because it has to do many
more string tests.  But does it make a difference?  Is testing integer
equality actually faster than string equality?

Adam Clauss
[EMAIL PROTECTED]


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



RE: MySQL running out of date

2003-08-21 Thread Adam Clauss
Same here.

Got 0's for the invalid dates, correct date for the other.  What is wrong?

Adam Clauss
[EMAIL PROTECTED]


 -Original Message-
 From: Rajesh Kumar [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 21, 2003 1:35 PM
 To: Hans van Harten
 Cc: [EMAIL PROTECTED]
 Subject: Re: MySQL running out of date
 
 
 Hans van Harten unknowingly asked us:
  Some make the laughing stock of MySQL with this code:
  create database data_test ;
  use data_test;
  create table test3 (a date);
  insert into test3 values (-1);
  insert into test3 values ('1996-02-31');
  insert into test3 values ('1996-67-31');
  select * from test3;
  
  I ran it on MYSQL-4.10-max and was not amused.
  Anyone to comment??
 
 Yeah, what's wrong with this? Absolutely expected results.
 
 -- 
 [ Rajesh Kumar ]
 __
 Meet the guy at http://www.meetRajesh.com/
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/mysql? [EMAIL PROTECTED]
 


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



RE: How to fill an Blob with binary data

2003-05-27 Thread Adam Clauss
I am in need of help with the same question (sent late last night, but
apparently got passed over).

Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: Thomas Hoelsken [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


Hi,

isn't there any other solution instead of using PHP just for filling an
Blob!?

I don't need php and would prefer any other way!

Thanks,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 27, 2003 6:56 PM
 To: [EMAIL PROTECTED]
 Subject: Re: How to fill an Blob with binary data
 
 
 
 Search the mailing list archives for this... There is a link to this
 article:
 
http://www.php4.com/forums/viewtopic.php?t=6


I wonder if the mailinglist search was powered by google more people would
use it?

On Tue, 27 May 2003, Thomas Hoelsken wrote:

 Hi,

 I would like to fill an Blob with binary data thru SQL-statements or 
 any other MySQL tools and don't know how!?

 Are there suggestions?

 Thanks,
 Thomas Hoelsken



 --
 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 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: How to fill an Blob with binary data

2003-05-27 Thread Adam Clauss
In my case, its neither.  Some random binary data.  Could be ANY kind of
file... (I'm doing mine programmatically).

Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: Mike Hillyer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:23 PM
To: Adam Clauss; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


Like I said, for Image and text blobs, use MyCC and it should work.

Mike Hillyer
www.vbmysql.com


-Original Message-
From: Adam Clauss [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 11:18 AM
To: [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


I am in need of help with the same question (sent late last night, but
apparently got passed over).

Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: Thomas Hoelsken [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


Hi,

isn't there any other solution instead of using PHP just for filling an
Blob!?

I don't need php and would prefer any other way!

Thanks,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 27, 2003 6:56 PM
 To: [EMAIL PROTECTED]
 Subject: Re: How to fill an Blob with binary data
 
 
 
 Search the mailing list archives for this... There is a link to this
 article:
 
http://www.php4.com/forums/viewtopic.php?t=6


I wonder if the mailinglist search was powered by google more people
would
use it?

On Tue, 27 May 2003, Thomas Hoelsken wrote:

 Hi,

 I would like to fill an Blob with binary data thru SQL-statements or 
 any other MySQL tools and don't know how!?

 Are there suggestions?

 Thanks,
 Thomas Hoelsken



 --
 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 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 General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: How to fill an Blob with binary data

2003-05-27 Thread Adam Clauss
Copied from my original message:
I am writing a database that will contain a blob field for some binary data.
My question is, what is the most efficient way to load this binary data in?
I could turn it into a string and pass it into an INSERT/UPDATE statement,
but I am afraid that problems will arise when it is converted into a string
(with newlines, nulls, etc).  I considered saving it to a file, and then
using LOAD_FILE, but:
a) that ALSO invovles turning it into a string, but since MySQL is doing it,
it might end up OK.
b) I'm not sure how the performance will be when I have to save it to a
file, then have MySQL read it back in.

The app is using the C++ API and I was wondering if there was any other way
to directly 'stream' the data in?

Thanks,
Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: Mike Hillyer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:31 PM
To: Adam Clauss; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


In what language?

Mike Hillyer
www.vbmysql.com


-Original Message-
From: Adam Clauss [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 11:30 AM
To: Mike Hillyer; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


In my case, its neither.  Some random binary data.  Could be ANY kind
of
file... (I'm doing mine programmatically).

Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: Mike Hillyer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:23 PM
To: Adam Clauss; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


Like I said, for Image and text blobs, use MyCC and it should work.

Mike Hillyer
www.vbmysql.com


-Original Message-
From: Adam Clauss [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 11:18 AM
To: [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


I am in need of help with the same question (sent late last night, but
apparently got passed over).

Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: Thomas Hoelsken [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: How to fill an Blob with binary data


Hi,

isn't there any other solution instead of using PHP just for filling an
Blob!?

I don't need php and would prefer any other way!

Thanks,
Thomas

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 27, 2003 6:56 PM
 To: [EMAIL PROTECTED]
 Subject: Re: How to fill an Blob with binary data
 
 
 
 Search the mailing list archives for this... There is a link to this
 article:
 
http://www.php4.com/forums/viewtopic.php?t=6


I wonder if the mailinglist search was powered by google more people
would
use it?

On Tue, 27 May 2003, Thomas Hoelsken wrote:

 Hi,

 I would like to fill an Blob with binary data thru SQL-statements or 
 any other MySQL tools and don't know how!?

 Are there suggestions?

 Thanks,
 Thomas Hoelsken



 --
 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 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 General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: How to fill an Blob with binary data

2003-05-27 Thread Adam Clauss
OK question then - when I use LOAD_FILE, does it automatically put escape
characters in front of anything that needs it?

I am in development on an SMTP server with an SQL backend rather than simply
a filesystem.  My concern is regarding file attachments which could be
pretty much anything imaginable.

Adam Clauss
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 12:53 PM
To: [EMAIL PROTECTED]
Cc: Adam Clauss
Subject: RE: How to fill an Blob with binary data


Depending on size of data there are a few different methods...   Just like
what most people do.. use plain insert statements with the data properly
escaped and shouldn't have any problem going in.

Pulling data out is pretty quick .. I can stream binary data out of my
mysql storage servers via our ftp gateway at speeds about 40MB/sec (~
4000k/sec) which is pretty quick for the crappy development server I've
got..

You mention streaming in.. I've got a ftpgateway to mysql storage that I
use.. it's written in java.. but you could also implement one in C++




On Tue, 27 May 2003, Adam Clauss wrote:

 Copied from my original message:
 I am writing a database that will contain a blob field for some binary
data.
 My question is, what is the most efficient way to load this binary data
in?
 I could turn it into a string and pass it into an INSERT/UPDATE statement,
 but I am afraid that problems will arise when it is converted into a
string
 (with newlines, nulls, etc).  I considered saving it to a file, and then
 using LOAD_FILE, but:
 a) that ALSO invovles turning it into a string, but since MySQL is doing
it,
 it might end up OK.
 b) I'm not sure how the performance will be when I have to save it to a
 file, then have MySQL read it back in.

 The app is using the C++ API and I was wondering if there was any other
way
 to directly 'stream' the data in?

 Thanks,
 Adam Clauss
 [EMAIL PROTECTED]


 -Original Message-
 From: Mike Hillyer [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 12:31 PM
 To: Adam Clauss; [EMAIL PROTECTED]
 Subject: RE: How to fill an Blob with binary data


 In what language?

 Mike Hillyer
 www.vbmysql.com


 -Original Message-
 From: Adam Clauss [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 11:30 AM
 To: Mike Hillyer; [EMAIL PROTECTED]
 Subject: RE: How to fill an Blob with binary data


 In my case, its neither.  Some random binary data.  Could be ANY kind
 of
 file... (I'm doing mine programmatically).

 Adam Clauss
 [EMAIL PROTECTED]


 -Original Message-
 From: Mike Hillyer [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 12:23 PM
 To: Adam Clauss; [EMAIL PROTECTED]
 Subject: RE: How to fill an Blob with binary data


 Like I said, for Image and text blobs, use MyCC and it should work.

 Mike Hillyer
 www.vbmysql.com


 -Original Message-
 From: Adam Clauss [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 11:18 AM
 To: [EMAIL PROTECTED]
 Subject: RE: How to fill an Blob with binary data


 I am in need of help with the same question (sent late last night, but
 apparently got passed over).

 Adam Clauss
 [EMAIL PROTECTED]


 -Original Message-
 From: Thomas Hoelsken [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, May 27, 2003 12:11 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: How to fill an Blob with binary data


 Hi,

 isn't there any other solution instead of using PHP just for filling an
 Blob!?

 I don't need php and would prefer any other way!

 Thanks,
 Thomas

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, May 27, 2003 6:56 PM
  To: [EMAIL PROTECTED]
  Subject: Re: How to fill an Blob with binary data
 
 
 
  Search the mailing list archives for this... There is a link to this
  article:
 
 http://www.php4.com/forums/viewtopic.php?t=6


 I wonder if the mailinglist search was powered by google more people
 would
 use it?

 On Tue, 27 May 2003, Thomas Hoelsken wrote:

  Hi,
 
  I would like to fill an Blob with binary data thru SQL-statements or
  any other MySQL tools and don't know how!?
 
  Are there suggestions?
 
  Thanks,
  Thomas Hoelsken
 
 
 
  --
  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 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 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

RE: Catching Exceptions

2003-05-27 Thread Adam Clauss
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 27, 2003 3:16 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: Catching Exceptions
 
 I noticed that the exceptions were being caught by pointer. I 
 recommend that
 you catch them by const reference, as you always should. It 
 might make a
 difference with the MSVC++ compiler.
 

*Looks for cliff to go jump off of*
Why? LOL... I KNEW that.  Yet it totally had me lost.
Thanks...

Although... Why const reference?  I've typically just done it by value.


Adam Clauss
[EMAIL PROTECTED]


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



RE: Select name, email where birthday = ??

2003-05-27 Thread Adam Clauss
Where MONTH(birthday)=MONTH(now()) AND
DAYOFMONTH(birthday)=DAYOFMONTH(now())

Adam Clauss
[EMAIL PROTECTED]


 -Original Message-
 From: Scott Haneda [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 27, 2003 9:21 PM
 To: MySql
 Subject: Select name, email where birthday = ??
 
 
 Hello, I have a date field in my database
 Format is -MM-DD
 
 Once a day at 12:01AM a script is going to run that will
 Select name, email from users where birthday = ??
 
 And the ?? Is where I am stuck, I don¹t care about the year 
 at all, I just
 need to match on the month and day, how would I do this?
 
 -
 Scott HanedaTel: 415.898.2602
 http://www.newgeo.com   Fax: 313.557.5052
 [EMAIL PROTECTED]Novato, CA U.S.A.
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/mysql? [EMAIL PROTECTED]
 


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



Question About Compiling

2001-06-08 Thread Adam Clauss

I am using VC++ 6 on Win2K.
What is the exact process I need to go through to set this up to use it?
I compiled the original project in the root directory.  I then setup one of my 
programs to include the mysql.h as the example had.  I also have the lib file 
included to link in the project settings.  But when I compile I get several errors... 

c:\my documents\my c++\mysqlapi\mysql\include\mysql_com.h(114) : error C2146: syntax 
error : missing ';' before identifier 'fd'
c:\my documents\my c++\mysqlapi\mysql\include\mysql_com.h(114) : error C2501: 'SOCKET' 
: missing storage-class or type specifiers
c:\my documents\my c++\mysqlapi\mysql\include\mysql_com.h(114) : error C2501: 'fd' : 
missing storage-class or type specifiers

What do I need to do?
Adam
[EMAIL PROTECTED]