Re: images with mysql
I am now having a database storing images of chinese characters for research purpose. I wrote a program to store and retrieve them. My images are of type ppm. This is how I designed my table: mysql describe poor; +++--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +++--+-+-+---+ | cc | char(2) binary | | | | | | width | int(1) | YES | | NULL| | | height | int(1) | YES | | NULL| | | data | blob | YES | | NULL| | +++--+-+-+---+ Just have to be really careful in storing binary data. Hope this help. On Thu, 20 Mar 2003 10:34:19 +0100 [EMAIL PROTECTED] wrote: Hi! I have a problem with my MySQL I need to have some a images related with an item for example -- ! author ! date of birth an death ! image! -- How can I define the field for the images? I have read that LONGBLOB could be useful for large objct like images, but I can't understand how to set it in my database... Thank you in advance stefano -- S t e f a n o C a r d o Debian GNU-Linux user - 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: images with mysql
Well, this may be off topic. In my case, I store tens of thousands of images, gradually growing. All of them are quite small, most around 30*30 gray scale. Would it still be faster to store them on disk? On Thu, 20 Mar 2003 13:57:06 +0100 B. van Ouwerkerk [EMAIL PROTECTED] wrote: IMHO it's better to store a link. I have seen databases (not MySQL) getting corrupted because the file inserted was to big. For the visitor it doesn't really matter whether you put it into the database or not. A link is less difficult and you don't have to retrieve pictures from the database so it might be quicker.. B. At 18:34 20-03-2003 +, Lai Liu-yuan wrote: I am now having a database storing images of chinese characters for research purpose. I wrote a program to store and retrieve them. My images are of type ppm. This is how I designed my table: mysql describe poor; +++--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +++--+-+-+---+ | cc | char(2) binary | | | | | | width | int(1) | YES | | NULL| | | height | int(1) | YES | | NULL| | | data | blob | YES | | NULL| | +++--+-+-+---+ Just have to be really careful in storing binary data. Hope this help. On Thu, 20 Mar 2003 10:34:19 +0100 [EMAIL PROTECTED] wrote: Hi! I have a problem with my MySQL I need to have some a images related with an item for example -- ! author ! date of birth an death ! image! -- How can I define the field for the images? I have read that LONGBLOB could be useful for large objct like images, but I can't understand how to set it in my database... Thank you in advance stefano -- S t e f a n o C a r d o Debian GNU-Linux user - 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: This query shouldn't be wrong, but mysql says it is???
I reread the mysql manual again, and found the little piece I've missed : version 4!! That's the problem. Thanks for your reply. - 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
Is mysql_real_escape_string for blob storage?
Hi, everyone. I use blob to store image data in mysql. I use mysql_real_query to store it, but did not use mysql_real_escape_string to process it before hand. Then I saw in the document that this is needed. But I am testing the data stored by reading them out to do some processing, there seems no segmentation fault happened. By the way, when I stored the image, I stored the width and height also into the database. I read the image out for processing alsa based on these two variables. So if the image data is truncated due to special characters, there should be segmentation fault, shouldn't it? So, back to the question, is mysql_real_escape_string needed when storing blob data? Thanks. - 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: Is mysql_real_escape_string for blob storage?
Thanks for your reply. But, what then is the role of mysql_real_query? In document, it says You must use mqsql_real_query for queries that contain binary data? - 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
what's wrong with this query?
Please help me with the following c code: sprintf(update, update chrc set center='); len = 24; memcpy(update+len, center, 128); len += 128; sprintf(update+len, ', var='); len += 8; memcpy(update+len, var, 128); len += 128; sprintf(update+len, ' where cc='%s', row[0]); len += 15; if (ret = mysql_real_query(conn, update, len)) printf(fail update %d\n, ret); int center[4][8], var[4][8] row[0] is a chinese character (2 bytes) update is a buffer of char [500] mysql describe chrc; ++--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | ++--+--+-+-+---+ | cc | char(2) binary | YES | | NULL| | | count | int(11) | YES | | NULL| | | center | char(128) binary | YES | | NULL| | | var| char(128) binary | YES | | NULL| | ++--+--+-+-+---+ The query I want to do is update chrc set center='--', var'++' where cc='xx' (1) where -- is center[4][8] (all of them), ++ is var[4][8], and xx is the chinese character. The result I get is that all rows in the table chrc are updated. And it can be seen from /var/log/mysql/mysql.log, the query executed is update chrc set center=' (2) But I dumped the variable update to a file, and it is exactly as what I want in (1). Please point me out what is the problem. Thank you very much. - 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