On Aug 23, 2006, at 9:11 AM, Vassilis Aggelakos wrote:
Typing in the command window:
lcPhoto = Filetostr("c:\myphoto.jpg")
? SQLEXEC(1, "insert into t (rec_id, PhotoField) values (1, " +
lcPhoto + ")" )
I get an error saying that my syntax is not correct.
Does anyone know how this can be accomplished?
First, MySQL requires single quotes around strings. Second, strings
need to be escaped, since they may contain quotes, backslashes, and
other meta characters; use the MySQL Quote() function for this. So
your statement should look like:
? SQLEXEC(1, "insert into t (rec_id, PhotoField) values (1, QUOTE('"
+ lcPhoto + "'))" )
You may also have a problem is the photo is large. There is a
setting called 'max_allowed_packet' that limits the largest command
that MySQL will accept. Check the docs for details on this, but the
basic command is:
set @@max_allowed_packet = NNN
where 'NNN' is the size you want. It should be at least as big as the
largest blob you will be working with.
<http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html>
( -or- http://tinyurl.com/exaop )
2. I create another field in my table and then I add a varhcar(50)
field. I mark BINARY flag and then click on "Save Changes" button.
When I reopen the properties of the field BINARY mark has gone!
Since this is a crazy behaviour I may have missed something very
essential. Does anybody know something about it?
I don't know what tool you're using, but there are two data types:
varchar and varbinary. The only time 'binary' is used with varchar is
when doing case-sensitive comparisons.
3. I create a field with column charset ="greek" and column colate
= "greek_general_ci". When I try ta save greek characters there and
i get error messages. Finally I managed to save greek characters
with column charset = utf8.
What's going here???
Sorry, I wish I could help you there. I have very little experience
in anything beyond utf-8.
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.