|
Hi ,
please help me, how can i fix this ?!
c:\documents and settings\ka$h\desktop\study\mysqlwrap_src\mysqlplus.cpp(397) : error C4716: 'sql_var_c::operator=' : must return a value
c:\documents and settings\ka$h\desktop\study\mysqlwrap_src\mysqlplus.cpp(406) : error C4716: 'sql_var_c::operator=' : must return a value
c:\documents and settings\ka$h\desktop\study\mysqlwrap_src\mysqlplus.cpp(415) : error C4716: 'sql_var_c::operator=' : must return a value
c:\documents and settings\ka$h\desktop\study\mysqlwrap_src\mysqlplus.cpp(421) : error C4716: 'sql_var_c::operator=' : must return a value
Someone already faced this problem
|
|
|
|
|
Ok now i fixed that , now its giving all wierd linking errors
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_query@8 referenced in function "public: int __thiscall sql_query_c::try_execute(char *)" (?try_execute@sql_query_c@@QAEHPAD@Z)
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_store_result@4 referenced in function "public: int __thiscall sql_query_c::execute(char *)" (?execute@sql_query_c@@QAEHPAD@Z)
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_insert_id@4 referenced in function "public: __int64 __thiscall sql_query_c::insert_id(void)" (?insert_id@sql_query_c@@QAE_JXZ)
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_fetch_field@4 referenced in function "public: struct st_mysql_field * __thiscall sql_query_c::fetch_field(void)" (?fetch_field@sql_query_c@@QAEPAUst_mysql_field@@XZ)
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_ping@4 referenced in function "public: int __thiscall sql_query_c::ping(void)" (?ping@sql_query_c@@QAEHXZ)
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_num_rows@4 referenced in function "public: __int64 __thiscall sql_result_c::n_rows(void)" (?n_rows@sql_result_c@@QAE_JXZ)
mysqlplus.obj : error LNK2019: unresolved external symbol _mysql_fetch_row@4 referenced in function "public: class sql_row_c __thiscall sql_result_c::fetch_row(void)" (?fetch_row@sql_result_c@@QAE?AVsql_row_c@@XZ)
|
|
|
|
|
ft
u must link to libmysql.lib
then
see compiling on newer MySQL 4.1.x
it's all!
|
|
|
|
|
Hi,
I had a problem compiling this on MySQL 4.1.7.
Defining USE_OLD_FUNCTIONS will overcome the compile issues, but it still has linking problems [mysql_connect]
FYI, for anybody having this problem, changing the old mysql_connect to the new mysql_real_connect will solve this problem.
Change line in OPENDB *sql_connection_c::grabdb()
[line 117] if ( !mysql_connect( &odb->mysql, host, user, password ) )
To
if ( !mysql_real_connect( &odb->mysql, host, user, password, database, 0, NULL, 0 ) )
This should work fine [works for me!]
HTH
Mark
Windows, Linux and Internet Development Consultant
http://www.scriptsmiths.co.za
|
|
|
|
|
hello...now i am having problems with inserting data...can anybody tell me the correct syntax dor doing this ?
sql_connection_c connection( "database", <br />
"localhost", "username", "password" );<br />
<br />
sql_query_c query( &connection );<br />
<br />
sql_result_c *sql_result = 0;<br />
<br />
<br />
<br />
if ( !query.execute("insert into debx_admins (id,username,password,email) values (1,'kaney07','whatever','me@myself.com')"))<br />
{<br />
printf( "oops... didn't execute1!!\n" );<br />
return;<br />
}
returns " oops didn't execute..."
Thanks for ur replies in advance ...
Best Regards,
kane
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
hi
this class works fine when i connect to the localhost but fails when i give an IP as a hostname....Any suggestions ? I am sure that the username/pass etc is correct but it gives " ooops didn't execute" but it does work without a problem..
kane
http://www.coderkane.com
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
sorry the problem was not with the program but with the acess control settinhgs on the server...it worked after i allowed mysql access to anybody with correct id/password
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
Compiling...
mysqlplus.cpp
g:\realmsmud\mysqlplus.cpp(396) : error C4716: 'sql_var_c::operator=' : must return a value
g:\realmsmud\mysqlplus.cpp(404) : error C4716: 'sql_var_c::operator=' : must return a value
g:\realmsmud\mysqlplus.cpp(412) : error C4716: 'sql_var_c::operator=' : must return a value
g:\realmsmud\mysqlplus.cpp(417) : error C4716: 'sql_var_c::operator=' : must return a value
Guess it wasn't written initially using Visual Studio 7.1.
|
|
|
|
|
I can't figure out how to do it with your code. Can you or someone else please enlighten me? Thanks!
|
|
|
|
|
is there a way i can get all the names, of the database that are in MySql DataBase . for example a function that return all the DataBase Name found in MySql DataBase.
Thank You,
jen0s
|
|
|
|
|
MySQL has a "SHOW DATABASES" syntax, the result set is the name of every visible to the current user on the current server.
e.g.
mysql> show databases;
+------------------------+
| Database |
+------------------------+
| db1 |
| phpbb |
| xcart |
...
Windows, Linux and Internet Development Consultant
http://www.scriptsmiths.co.za
|
|
|
|
|
mysqltest error LNK2019: unresolved external symbol _mysql_connect@16 referenced in function "public: struct opendbstruct * __thiscall sql_connection_c::grabdb(void)" (?grabdb@sql_connection_c@@QAEPAUopendbstruct@@XZ)
I got this message when i was trying to compile the code copied from the sample. Can somebody please tell me how to fix it?
|
|
|
|
|
look at mysql manual , " c api part--> mysql_real_connect() " , u can find below message :
"This function is deprecated. It is preferable to use mysql_real_connect() instead. "
, so , u can use mysql_real_connect() ,and
edit some code in mysqlplus.cpp , after u do
this , rebuid , and everthing is ok now !!
|
|
|
|
|
when I retrieve a date variable from my database, I get a 0000-00-00 value from a record where there is a date? any hints
If it's broken, I probably did it
bdiamond
|
|
|
|
|
The other error I submitted was solved by placing the includes where they belonged properly. Now I get the following
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
trymysql.cpp:
Error E2303 c:\Borland\Bcc55\include\mysqlplus.h 81: Type name expected
Error E2139 c:\Borland\Bcc55\include\mysqlplus.h 81: Declaration missing ;
*** 2 errors in Compile ***
The second line below is line 81 of mysqlplus, in class sql_query_c
private:
vector_c <sql_result_c *=""> results;
};
I have no idea as I'm fairly new to C++, so any help is appreciated
Patrick
|
|
|
|
|
Any ideas why I would get the following error:
Error E2209 mysqlplus.h 9: Unable to open include file 'mysql.h'
I have the following in my directory that I’m doing the compile in: my_alloc.h, mysql.h, mysql_com.h, mysql_version.h, mysqlplus.h, and vector.h; along with the sample file shown above with the inputs adjusted to my db.
Patrick
|
|
|
|
|
I'm also new to VC++ environment. I'm not sure about my answer. I think you should add MYSQL server header files(F:\tools\MYSQL 4.1\include) in include path(Tools->Options->Directories->include files) will solve the problem.
Thanks,
Karthikeyan
|
|
|
|
|
I gave you a high mark, because your wrapper class was easy and fast to implement into my own project. Thanks!
There was however one problem, which I solved by setting warnings off and adding following line, to mysqlplus.cpp :
#pragma warning( disable : 4716 ) // Disable warning messages 4716.
Johnny
ps! I know you refer to MySQL homepage for download of interface, but you only need a few files, this you could have in your project, that would make your example even more professional.
|
|
|
|
|
I gave you a high mark, because your wrapper class was easy and fast to implement into my own project. Thanks!
Johnny
|
|
|
|
|
When I compiled your code, I found an error "error C2065: 'mysql_connect' : undeclared identifier". I have already included "mysql.h". How can I get through this. Thank you for your answer.
|
|
|
|
|
Did you remember the .dll file ??? I think this function resides in the .dll file, try and download interface from mysql homepage.
|
|
|
|
|
If using MS VisualC++:
There are more headers than "mysql.h" needed.
You should include the mysql include path to your workspace, i.e. "C:\MYSQL\INCLUDE".
For linking do the same with mysql lib path, i.e. "C:\MYSQL\LIB"
With MS VC6.0 no problems to compile ...
For execution copy the correct libMySql.dll file to your project's DEBUG or RELEASE directory.
|
|
|
|
|
Hi,
I found this on newer MySQL 4.1.x [4.1.7 to be exact]
A number of calls have been depreciated in 4.x
Defining USE_OLD_FUNCTIONS will let the compiler see the old mysql_connect, but I found it still wouldn't link.
So, if you are including the <mysql.h> and thats all good, try applying the fix in my earlier post [Compiling on new MySQL..], this worked for me.
It upgrades the script to use the new mysql_real_connect instead of the old mysql_connect
HTH
Mark
Windows, Linux And Internet Development Consultant
http://www.scriptsmiths.co.za
|
|
|
|
|
change line 118 of "mysqlplus.cpp" :
if ( !mysql_connect( &odb->mysql, host, user, password ) )
{
//fprintf( stderr, "mysql_connect(%s,%s,***) failed\n", host, user );
errc = 2;
}
by :
if ( !mysql_real_connect( &odb->mysql, host, user, password, database, 0, NULL, 0 ) )
{
//fprintf( stderr, "mysql_connect(%s,%s,***) failed\n", host, user );
errc = 2;
}
|
|
|
|
|
I am testing mySQL C++ Wrapper. But get the following compilation errors:
mysqlplus.h (lines 102 - 105)
-----------------------------
ISO C++ forbids declaration of 'oprators=' with no type
mysqlplus.cpp(lines 391, 399, 407 ..)
------------------------------
ISO C++ forbids declaration of 'oprators=' with no type
I am using the Bloodshed Dev C++ compiler (ref: www.bloodshed.net).
Do you have any suggestions?
Thanks,
Pete
|
|
|
|