Why do the old avatars remain in my old entries after being removed?
MySQL database development
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > MySQL database developmentGo to page: « previous | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | next »

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:
Thursday, 11 January 2007
RAID Marco Ratto 19:53:04
 How can I use RAID's option in MySql?

Thanks.
Bye, Marco


comment 25 answers | Add comment
loading files onto MySQL Scott Yamahata 18:42:46
 Newbie question here. Using Mac OSX Server 10.4.4. Do most MySQL tasks in
terminal window.
Recently purchased software that tells me to go to Control Panel (which I
don't think I have--though I have MySQL tools) and load their file onto the
MySQL database.

I'm not sure what this means. If I create a database called "test" is there
a way to load their file onto that database in the terminal window?

Thanks. I'm probably asking a very stupid question.

___________________­____________________­____________________­______
Type your favorite song. Get a customized station. Try MSN Radio powered
by Pandora. http://radio.msn.co­m/?icid=T002MSN03A07­001


--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 1 answer | Add comment
Re: mysql data into CSV file. / (Errcode: 13) Shain Lee 18:19:00
 MySql - server version: 4.1.7
OS - RedHat Linux AS 4

mysql> use Music;

mysql> SELECT * INTO OUTFILE '/home/shaine/Music­.csv' FROM Music_Details;

ERROR 1 (HY000): Can't create/write to file '/home/shaine/Music­_Details.csv' (Errcode: 13)

I faced a problem as mentioned above. really got stucked. how can i solve that problem ? is it a bug ?

please help .

Thank you,
Shaine.


Jake Peavy <djstunks@gmail.com­> wrote: On 1/4/07, Shain Lee <gsm_linux@yahoo.co­.uk> wrote:
I wanted to get that info which has stored in relavent fields into a CSV fle .

Can somebody help me to do that please ?
Can i do it mysql commands it self ?


You could do with with SELECT .... INTO OUTFILE as outlined at

http://dev.mysql.co­m/doc/refman/5.0/en/­select.html#id304179­5


Or you could make use of the new CSV storage engine

http://dev.mysql.co­m/doc/refman/5.0/en/­csv-storage-engine.h­tml


--
-jp


Switzerland isn't really neutral. They just haven't figured out what side Chuck Norris is on yet.


-------------------­--------------
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. Do it now...
comment 3 answer | Add comment
Re: new feature submission for mysql-connector-jav­a-5.0.4 Don Cohen 17:45:07
 
This is a note about the feature submission I sent on 26 Oct 2006.
When I try to compile it for java version 1.4 I find that it uses
a feature introduced in 1.5. The best way I see so far to make it
compile (and work) in 1.4 is to make the two changes below.
If anyone would like to offer a better solution I'd be happy to see
it.
BTW, I've not heard anything back about either this feature submission
or the bug fix I submitted in December. I begin to wonder whether
anyone is listening.

/src/com/mysql/jdbc­/ExportControlled.ja­va
My previous diff listed line 68 as
TrustingSSLSocketFa­ctory.getDefault();
which I now change to
TrustingSSLSocketFa­ctory.getDefault2();­

and /src/com/mysql/jdbc­/TrustingSSLSocketFa­ctory.java line 39
which was previously listed as
public static javax.net.ssl.SSLSo­cketFactory getDefault() {
I now change to
public static javax.net.ssl.SSLSo­cketFactory getDefault2() {


--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org


comment 1 answer | Add comment
Multiple table updates (Was: Does Update allow for aliases) Chris White 17:39:19
 Reading the noted previous thread, I was curious as to updating multiple
tables. I read the MySQL docs, which mentions that you can do it:

Multiple-table syntax:

UPDATE [LOW_PRIORITY] [IGNORE] /|table_references|­/
SET /|col_name1|/=/|exp­r1|/ [, /|col_name2|/=/|expr2|/ ...]
[WHERE /|where_condition|/]


However, I didn't see any sort of example for achieving this (that
wasn't somewhat complicated). Does anyone have a base example
(preferably with table structure) that can show how this works?

comment 2 answer | Add comment
Select where the column names are not fully known Andy Lawton 17:20:18
 We have a logging package that logs data into a table. Part of the data
that is logged are elements of a vector. A logging application
automatically takes out the elemets of the vector and automatically
creates column names based on it's name and the element. This data will
be mixed in with lots of other scalar data, but the elements will be
created next to each other. For example, I may have a table with column
names like this:

datetime
scalar1
scalar2
scalar3
vector_1
vector_2
vector_3
vector_4
scalar4
scalar5

etc etc. I reality there is a lot more data than this. I neet to be able
to select only the items of the vector - like this:

select vector_1,vector_2,v­ector_4,vector_4 from mytable where
datetime=somedateti­me.

So far so good. However the problem is that the vector size can vary
from contract to contract. I don't want to have to change the select
command for each contract we do. The format of the column name is always
itemname_x where x starts at 0.

So I'd like to do something like

select vector_* from mytable where datetime=somedateti­me.

but of course this doesn't work.

Anyone any ideas how I can do this?


Andy

comment 2 answer | Add comment
New Free BitKeeper Client Stefan Hinz 16:37:14
 New Free BitKeeper Client
-------------------­------
If you're installing MySQL from our development source trees you need
BitKeeper to access those source trees. You can find out which source
trees are publicly available by looking at http://mysql.bkbits­.net/.

BitKeeper isn't free software, but there's a free client you can use
to get read access to MySQL source trees (and that's all you need to
install MySQL from a development tree). This year, that free BitKeeper
client has been upgraded to version 2.0. The new version is needed to
access the source trees; version 1.1 will not work any more for that
purpose.

The new free BitKeeper client provides a number of enhancements over the
old client. Among other things, it has an integrated help, and the
commands you can use are very similar to the commands of the commercial
version (for example, "bkf clone" or "bkf pull"). The MySQL Reference
Manual has been updated with information about the new client; see:
http://dev.mysql.co­m/doc/refman/5.0/en/­installing-source-tr­ee.html
(replace "5.0" in the URL with "4.1" or "5.1" for other versions).

Regards,

Stefan
--
Stefan Hinz <stefan@mysql.com>
MySQL AB Documentation Team Lead. Berlin, Germany (UTC +2:00)
Skype:stefanhinz Cell:+491777841069 Desk:+493082702940 Fax:+493082702941


--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


Add comment
Persian , IRAN Translation Sajad Hajforoosh 11:30:08
 hello
before everything , special thanks for your best database .
i was translated MySQL administrator language into persian , iran language
, that exactly like on how_to_translate.tx­t , but it's doen't work , it make
default,mo and i can select persian langiage in tools -> general option but
, after it , that show all word in english language .
please help me .
mysql administrator version : 1.2.4. rc
best regards
sajad

___________________­____________________­____________________­______
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.ms­n.click-url.com/go/o­nm00200471ave/direct­/01/


--
MySQL GUI Tools Mailing List
For list archives: http://lists.mysql.­com/gui-tools
To unsubscribe: http://lists.mysql.­com/gui-tools?unsub=­gcdmm-mycc@m.gmane.o­rg


comment 1 answer | Add comment
Help me to understand multiple locking the same tables (lock; lock; unlock) Denis Solovyov 00:58:31
 Dear friends,

Please help me to understand several LOCKing the same tables without
unlocking them between "LOCKs". Imagine the following code:

LOCK TABLES t1 READ, t2 READ;
-- some hard select queries which need that other threads do not update tables
LOCK TABLES t1 WRITE, t2 WRITE;
-- some easy update queries
UNLOCK TABLES;

Is this code equal to the following:

LOCK TABLES t1 READ, t2 READ;
-- some hard select queries which need that other threads do not update tables
UNLOCK TABLES;
-- here other threads have a moment to update these tables!
LOCK TABLES t1 WRITE, t2 WRITE;
-- some easy update queries
UNLOCK TABLES;

or t1 and t2 will not be unlocked even for a moment before the second
lock?

Really, I don't want to have a single WRITE LOCK here and freeze
everything for some time, but I can't understand if here is a chance for
other threads to update tables between two lockings or not...

MySQL 4.1, myisam tables (if it is important).

Best regards,
Denis Solovyov


--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 1 answer | Add comment
Wednesday, 10 January 2007
Date v. DateTime index performance Thomas Bolioli 20:04:07
 If one has a large number of records per month and normally searches for
things by month, yet needs to keep things time coded, does anyone know
if it make sense to use datetime or separate date and a time columns?
Thanks,
Tom

--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 6 answers | Add comment
database access Trevor Luo 18:57:03
 Hi,

I encounter an error in jsp:

java.sql.SQLExcepti­on: Invalid authorization specification: Access
denied for user: 'javauser@127.0.0.1­' (Using password: YES)

Could i specify the user javauser@localhost to access the database
instead of javauser@12.0.0.1 in tomcat server.xml file ?

Besides, if i am using driver manager, how can i specify the user ?

con =
DriverManager.getCo­nnection("jdbc:mysql­://localhost.localdo­main/NewIntra
?user=javauser&pass­word=abc");

Here is the snippet of server.xml config file in tomcat for your ref:

<!-- Class name for mm.mysql JDBC driver -->
<parameter>
<name>driverClassNa­me</name>
<value>org.gjt.mm.m­ysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql:/­/localhost/javatest<­/value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</nam­e>
<value>javauser</va­lue>
</parameter>

Thanks in advance!
Trevor Luo



--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org
comment 2 answer | Add comment
Enum issue Olaf Stein 16:19:17
 Hi All

If I have a column
`consent` enum('Y','N','P') default NULL,

And I try to insert 'NULL' I get this error:

Warning: Data truncated for column 'consent' at row 1

What is the problem there?

What I am doing is moving data from one table to another with a python
script so I have to assign 'NULL' to the variable in the insert string (at
least to my knowledge) because python retrieves "None" (type <type
'NoneType'>) when querying a NULL value.

Help is appreciated.

Olaf



--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 2 answer | Add comment
Connection Problem Tripp Bishop 15:04:39
 Hello all,

Suddenly in the last hour or so the connection speed
between our webserver and database server has
skyrocketed to the point that our site is no longer
usable! Just trying to connection via the mysql client
takes a long time. Once the connection is established,
however, queries seem to execute in a timely fashion.
As far as we can tell the network connection between
the two boxes is fine (at least testing by ping OK)
and again, once connected everything seems fine.

We've seen some errors in our logs that state: Can't
connect to local MySQL server through socket
'/var/lib/mysql/mys­ql.sock'. Why would php
mysql_connect be trying to connect to the local MySQL
Server? Our connection string should point it to the
db server.

We're using php 4.3.9 and MySQL 4.0.20.

Thanks for any help,

Tripp



___________________­_______________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.ya­hoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 4 answer | Add comment
Add foreign key Mungbeans 07:31:55
 
Still on the top of foreign keys :)­

I have this statement:

ALTER TABLE `mytable`
ADD FOREIGN KEY ( `id` )
REFERENCES `othertable` ( `id` );

Is there a way I can give this key a specific name (eg 'FK_mytable_id') and
specific the type of reference (eg 'ON UPDATE CASCADE')?


--
View this message in context: http://www.nabble.c­om/Add-foreign-key-t­f2950373.html#a82513­94
Sent from the MySQL - General mailing list archive at Nabble.com.


--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 2 answer | Add comment
Create funtion UDF on MYSQL Nguyen Thi Ngoc Thoi 07:12:19
 Hi!
can you hep?
when create funtion UDF on linux
then it have error
ERROR 1126 Can't opened shared library (error: 0 feature disabled)
i do'nt want use it ,if you knowm this problem,please help me.
i hope to receive your mail
thank for read it.

___________________­____________________­___________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.c­om
Add comment
Cannot connect with MyODBC Version 5.0.10 Jim Bullington 05:09:30
 I am unable to connect to a MySQL Version 5.0 database using the MySQL Connector/ODBC v5 driver. I am using the following connection string (with VB6/ADO - no DSN):

Driver={MySQL Connector/ODBC v5};Server=server;D­atabase=mydb;Uid=dbu­ser;Pwd=dbpass;Optio­n=3;

Returns the following error:

[MySQL][MyODBC 5.00.10][MySQL] 1045 Access denied for user 'dbuser@localhost' (using password: YES) Database: server, mydb

This is a remote server, should the @localhost be there?

The following connection string (MyODBC 3.51) to the same database works fine:

Driver={MySQL ODBC 3.51 Driver};Server=serv­er;Database=mydb;Use­r=dbuser;Password=db­pass;Option=3;

Any help would be greatly appreciated!

JIMB


--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.­com/myodbc
To unsubscribe: http://lists.mysql.­com/myodbc?unsub=gcd­mo-myodbc@m.gmane.or­g


comment 4 answer | Add comment
mysql - connections question Bruce 05:07:18
 hi shawn...

mysql permits you to set/modify the number of simultaneous connections via
the my.cnf file

my assumption is that this is for all the databases for a mysql instance. is
this correct? also, what issues might one run into if you have multiple
copies of mysql running on a single server?

i'm looking at possibly needing multiple mysql instances running so that i
can handle the databases, and the connections that i'm going to be dealing
with.

thanks



--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


Add comment
Choose a random record from a list of duplicates Trev Green 01:18:11
 Hello all,

I'm having real problems trying to work this one out. Basically I have
a big table full of names, addresses and other such information. What
I want to do is select all the records from the table but where there
are duplicate entries (based on say, the surname and postcode fields)
pick a random record and then ignore the rest. Lets say i have 2000
records in the table but 5 of them are dupes based on the surname and
postcode, how can I pick one of those 5 at random and return it with
the rest of the table.

Any help would be greatly appreciated.

--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


comment 2 answer | Add comment
Extracting transactional data from InnoDB log files Jason J. W. Williams 01:18:11
 Hello,

Is it possible to extract transactional data from InnoDB log files?
InnoDB kept crashing and trying to insert the same record (replayed
from the log after the crash I assume). I'd like to try and extract
the record from log to reconstruct the query and try to break it again
in case it caused the corruption in the ibdata file. Any help is
greatly appreciated.

Best Regards,
Jason

--
MySQL General Mailing List
For list archives: http://lists.mysql.­com/mysql
To unsubscribe: http://lists.mysql.­com/mysql?unsub=gcdm­g-mysql@m.gmane.org


Add comment
JOIN condition v.s. WHERE condition Ran 01:18:11
 Hi all,
If my post is irrelevant to the list, please let me know.
I have conditions (REGEXP 'STRING' or ='STRING') as JOIN condition or as
WHERE clause condition, i wonder for a 10 table LEFT/INNER JOIN query, which
approach is better and why.

Thanks,
ran

i.e.
" SELECT "+
" m.id_company, "+
" m.name, "+
" m.division, "+
" m.is_deleted, "+
" GROUP_CONCAT( DISTINCT
pt.name,':\t',p.val­ueSEPARATOR '\n') AS phone_concat "+
" FROM "+
" crm_company m "+
" INNER JOIN "+
" crm_company m1 "+
" ON "+
" m1.id_company = m.id_company "+
" AND "+
" (m.name REGEXP '^"+q+"| "+q+"'
"+
" OR m.division REGEXP '^"+q+"| "+q+"')
"+
" LEFT JOIN "+
" crm_communication_c­ompany_link pmk "+
" ON pmk.id_company = m.id_company "+
" LEFT JOIN "+
" crm_communication p ON pmk.id_communicatio­n =
p.id_communication "+
" LEFT JOIN "+
" crm_communication_t­ype pt ON
p.id_communication_­type = pt.id_communication­_type "+
" LEFT JOIN "+
" crm_customer_compan­y_link cmk "+
" ON cmk.id_company = m.id_company "+
" LEFT JOIN "+
" crm_has_contact hc "+
" ON hc.cid = cmk.id_customer "+
_GROUP_CTRL +
" WHERE "+
" m.is_deleted = 0 "+
" GROUP BY "+
" m.id_company "+
" ORDER BY "+
" m.name REGEXP '^"+q+"' DESC, "+
" m.name ASC ";

Compare to that moved to WHERE clause:

" SELECT "+
" m.id_company, "+
" m.name, "+
" m.division, "+
" m.is_deleted, "+
" GROUP_CONCAT( DISTINCT
pt.name,':\t',p.val­ueSEPARATOR '\n') AS phone_concat "+
" FROM "+
" crm_company m "+
# self inner join removed
" LEFT JOIN "+
" crm_communication_c­ompany_link pmk "+
" ON pmk.id_company = m.id_company "+
" LEFT JOIN "+
" crm_communication p ON pmk.id_communicatio­n =
p.id_communication "+
" LEFT JOIN "+
" crm_communication_t­ype pt ON
p.id_communication_­type = pt.id_communication­_type "+
" LEFT JOIN "+
" crm_customer_compan­y_link cmk "+
" ON cmk.id_company = m.id_company "+
" LEFT JOIN "+
" crm_has_contact hc "+
" ON hc.cid = cmk.id_customer "+
_GROUP_CTRL +
" WHERE "+
" m.is_deleted = 0 AND ("+
" AND "+
" (m.name REGEXP '^"+q+"| "+q+"'
"+
" OR m.division REGEXP '^"+q+"| "+q+"') )
"+
" GROUP BY "+
" m.id_company "+
" ORDER BY "+
" m.name REGEXP '^"+q+"' DESC, "+
" m.name ASC ";
Add comment
Tuesday, 9 January 2007
Porting MySQL 5.0.x and 5.1.x on Linux IA64: Compiling options and errors Mariella Petrini 21:30:14
 Dear All,

I am trying to compile MySQL 5.0.27 and 5.1.14 on a shared memory processors system with 128 processors IA-64 Itanium-2.

I have downloaded the binary version of MySQL-max 5.0.27 Linux IA64 and I have installed and configured it with no problems.

I need to install also the MySQL-max 5.1.x Linux IA64 version. I could not find a compiled binary version for MySQL 5.1.x for Linux IA64, so I have downloaded the source code for
MySQL 5.1.14.

The shared memory processors system is running Linux 2.6.16.21-0.8 and it has Intel compiler ecc/icc version 9.0
I have tried to compile MySQL 5.0.27 and 5.1.x with the settings below, but unfortunately it fails.

These are the options used:
-------------------­--------------------­--------------------­--------------------­--------------------­---------------
CC=icc CFLAGS="-O2 -tpp2 -ip -nolib_inline" CXX=icc CXXFLAGS="-O2
-tpp2 -ip -nolib_inline" ./configure --prefix=/home/app/­mysql
--with-extra-charse­ts=complex --enable-thread-saf­e-client
--enable-local-infi­le
-------------------­--------------------­--------------------­--------------------­--------------------­---------------

These are the error messages:
-------------------­--------------------­--------------------­--------------------­--------------------­---------------

............
icc -O2 -tpp2 -ip -nolib_inline -rdynamic -o conf_to_src conf_to_src.o -lcrypt -lnsl -lm -lz
make[2]: Leaving directory `/home/mysql-5.1.14­-beta/libmysql'
Making all in client
make[2]: Entering directory `/home/mysql-5.1.14­-beta/client'
if icc -DUNDEF_THREADS_HAC­K -DDEFAULT_MYSQL_HOM­E="\"/home/...../mys­ql-5.1.14\"" -DDATADIR="\"/home/­..../mysql-5.1.14/va­r\"" -I. -I. -I.. -I../include -I../include -I../regex -O2 -tpp2 -ip -nolib_inline -fno-implicit-templ­ates -fno-exceptions -fno-rtti -MT mysql.o -MD -MP -MF ".deps/mysql.Tpo" -c -o mysql.o mysql.cc; \
then mv -f ".deps/mysql.Tpo" ".deps/mysql.Po"; else rm -f ".deps/mysql.Tpo"; exit 1; fi
/usr/include/sys/uc­ontext.h(52): error: identifier "__builtin_offsetof­" is undefined
unsigned long _pad[_SC_GR0_OFFSET/8];
^
/usr/include/sys/uc­ontext.h(52): error: function call is not allowed in a constant expression
unsigned long _pad[_SC_GR0_OFFSET/8];
^
/usr/include/sys/uc­ontext.h(52): error: type name is not allowed
unsigned long _pad[_SC_GR0_OFFSET/8];
^
/usr/include/sys/uc­ontext.h(52): error: expected a ")"
unsigned long _pad[_SC_GR0_OFFSET/8];
^
/usr/include/sys/uc­ontext.h(52): error: expected a "]"
unsigned long _pad[_SC_GR0_OFFSET/8];
^
/usr/include/sys/uc­ontext.h(52): error: expected a ";"
unsigned long _pad[_SC_GR0_OFFSET/8];
^
compilation aborted for mysql.cc (code 2)
make[2]: *** [mysql.o] Error 1
make[2]: Leaving directory `/home/mysql-5.1.14­-beta/client'
make[1]: *** [all-recursive] Error 1
-------------------­--------------------­--------------------­--------------------­--------------------­---------------

I have tried to compile the MySQL 5.0.27 source code with the same settings used
to compile 5.1.14, but it fails as well.

I have also tried to use the BUILD/compile-ia64-­debug-max but I get the same set of errors.

Could you please help ?
Which are the compilation, linking options used to produce the binary version
of MySQL 5.0.27 for Linux IA64 (using Intel icc and gcc), available at http://dev.mysql.co­m/downloads/mysql/5.­0.html ?
Which version of the Intel icc has been used ?

Does anybody know whether the issues could be related to the version of the icc ? ( e.g. http://dev.mysql.co­m/doc/refman/5.1/en/­porting.html, even though I am trying to compile 5.0.27 I get the same set of errors that I get when trying to compile 5.1.14).


Thanks in advance for your help,

Mariella


___________________­____________________­___________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.c­om
Add comment
inserting a vector into a MySQL blob field Daniel Thorpe 15:47:31
 Hi, I've searched all over the internet for information about
inserting data into blob fields, and I've looked at the mysql++
examples. However I still can't seem to solve my problem, so I'm
posting here...

I'm trying to store a vector of doubles into a blob field in a mysql
database, along with the size of the vector in another field. I'm
using C++ with MySQL++ 2.1.1 and MySQL 5.0.27.

My code looks something like this....

char dataBuff[500];
int dataLength = 0;
int bufferLength = 0;
int vectorLength = this->data.size();/­/ this->data is an STL
vector of doubles

memset(dataBuff, 0, 500);// zero out the buffer
dataLength = sizeof(double);// the length of a double

for(int i=0; i<vectorLength; i++) {// Loop through the vector
// Copy each element of the vector to the memory space
memcpy(dataBuff + bufferLength, &data[i], dataLength);
// Increment the length of the buffer.
bufferLength += dataLength;
}

string blob(dataBuff, bufferLength);// Copy the length of the
data buffer to a string
cout << "bufferLength is: " << bufferLength << endl;
cout << "blob: " << blob << endl;


// Establish the connection to the database server.
mysqlpp::Connection­ con(mysqlpp::use_ex­ceptions);
try {
// Make a connection
con.connect(MYSQL_S­HAPE_DB, MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD);
// Create a query object
mysqlpp::Query query = con.query();

// We need a string stream
ostringstream strbuf;
strbuf << "INSERT INTO centralisedMoment (order, data, com_x,
com_y) VALUES (" << this->order << ", \"" << mysqlpp::escape << blob
<< mysqlpp::escape << "\", " << this->com->x << ", " << this->com->y
<< ")";

cout << strbuf.str() << endl;
query.exec(strbuf.s­tr());

} // End of try


The various outputs look like this....


bufferLength is: 128
blob: ?p?)??R>???m???(D?3­? ???tB^????M7Z[?jR<f?­?Wc:?­?>???c.X@>vQ?;O­
\???r??!?>С?R?&1>J5­.??Y>C?y?)?
INSERT INTO centralisedMoment (order, data, com_x, com_y) VALUES (4,
"\0\0\0\0\0\0\0\0\0­\0\0\0\0\0\0\0?p?)??­R>???m??\0\0\0\0\0\0­\0\0?
(D? ???tB^????M7\ZZ[?jR<­f??Wc:?­?>???c.X@>vQ?­;O\\???r??!?>С?R?&1>­J5.?? Y>C?y?)?", 259, 257)
Query error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'order, data, com_x, com_y) VALUES (4, "\0\0\0\0\0\0\0\0\0­\0
\0\0\0\0\0\0?p?)??R­>' at line 1



So, my question is, what am I doing wrong? I figure it's something to
do with escaping the blob - I don't really get what the
mysqlpp::escape does...

Any help on how to solve this problem is much appreciated.

Cheers
Dan





--
MySQL++ Mailing List
For list archives: http://lists.mysql.­com/plusplus
To unsubscribe: http://lists.mysql.­com/plusplus?unsub=g­cdmc-plusplus@m.gman­e.org


comment 3 answer | Add comment
Query::str returns std::string containing null Robert Mecklenburg 15:37:50
 The mysqlpp::Query class member function str() returns a std::string
containing a null byte. I realize this is the actual documented
behavior of the function, but this runs contrary to the normal use of
std::string. Here is an example program:

#include <mysql++.h>
int
main()
{
mysqlpp::Connection­ c("s5db", "...", "root", "...");
mysqlpp::Query q = c.query();
std::cout << "preview length = " << q.preview().length(­) << std::endl;
std::cout << "preview[0] = " << q.preview().at(0) << std::endl;
return 0;
}

This code produces the following output:

$ foo
preview length = 1
preview[0] =
comment 2 answer | Add comment
VARBINARY and VARCHAR Frantisek Kaduch 15:34:21
 Hello,

I've a question regarding the VARBINARY field type. I'm using MySQL 5.0.27 and
mysql++-2.1.1.
Can I insert binary data, it means a string of unsigned chars, with values in
the range 0 - 255 in the VARCHAR field ? I tried first to define the field as
VARBINARY, but could not find a corresponding mysql++type in the
sql_types.h, something like "sql_varbinary", there's only sql_varchar
available.
The data to insert I acquire from the stream of digital TV and they form an SI
table binary descriptor.

thanks

--
Frantisek Kaduch

--
MySQL++ Mailing List
For list archives: http://lists.mysql.­com/plusplus
To unsubscribe: http://lists.mysql.­com/plusplus?unsub=g­cdmc-plusplus@m.gman­e.org


comment 1 answer | Add comment

Add new topic:

How:  Register )
 
Login:   Password:   
Comments by: Premoderation:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > MySQL database developmentGo to page: « previous | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | next »

see also:
Q-build released
Antw: Re: Q: programmatic creation of…
problem with 13-Sep build
pass tests:
Do you know women?
Trix
see also:

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .