|
This is not a good article.
The starting line: " This is a simple ..."
is complete BS. Three pages of bugs and
the question I have is included and still not answered.
No sample code either.
Very very poor...
|
|
|
|
|
I would use mySQL again, but i have a lot of problems with wchars, because i'm using allready wchars everywhere (wchar_t). My MySql API has just interfaces which are using chars. Have you experience with the same problem?
Best regards, Caesten
Caesten
Sunfire
|
|
|
|
|
It's in mysqlplus.h
could you tell me how can i fix this error please?
I really appreciate it
Error: "ISO C++ forbids declaration of `operator=' with no type"
Thanks a lot
|
|
|
|
|
The overloading of the '=' operator needs to have a return type:
The example in the downloaded code has:
operator = ( int i );
operator = ( double d );
operator = ( char *s );
operator = ( const char *s );
They don't have return types, and I don't think that is correct.
I could be wrong, as I have not tested this yet (see below) but I think this might be what we want:
char* operator = ( int i );
char* operator = ( double d );
char* operator = ( char *s );
sql_var_c& operator = ( const char *s );
.... and the implementation:
char* sql_var_c::operator = ( int i )
{
release();
value = new char [ 11 + 1 ];
itoa( i, value, 10 );
return value;
}
char* sql_var_c::operator = ( double d )
{
release();
value = new char [ 32 ];
sprintf( value, "%15.5f", d );
return value;
}
char* sql_var_c::operator = ( char *s )
{
release();
value = new char [ strlen( s ) + 1 ];
strcpy( value, s );
return value;
}
sql_var_c& sql_var_c::operator = ( const char *s )
{
*this = (char *)s;
return *this;
}
modified on Sunday, April 19, 2009 3:53 PM
|
|
|
|
|
can anyone give a clear example to use the wrapper ? iam not able to go through the flow.... please help..
|
|
|
|
|
My installation directory is;
C:\Program Files\MySQL\MySQL Server 5.0
this does not contain a 'lib' or 'include' directory, only 'bin', 'data', 'docs' and 'share'
Am I supposed to download a different package from MySQL?
David
|
|
|
|
|
Yup, you have installed the Windows Essentials package.
|
|
|
|
|
I can not locate mysql.h in the win32 distribution. Is it available in mysql 5? Is there a special package that contains the lib?
*very sad*
|
|
|
|
|
After you have installed mysql5, then include [path to mysyl5]/include in the project.
// Signature
if it ain't broke, don't fix it
|
|
|
|
|
Using MFC / C++ with ADO accessing a MySQL database. I have in one table a column type TEXT. It seems however that the ActiveX or the MySQL driver (not sure which) is identifying that column as “adVarChar” instead of what I expected it to be “adLongVarChar” and subsequently, the process ends up with wrong data buffer.
Should I use maybe another data type for long text colimns?
Cheers
Alex
|
|
|
|
|
sorry my english.
hi guys.
i use mysql and visual c++. today i try remote connect mysql server. but i can't mysql server support localhost, it's not enough .
my client application must be remote!!!
how can i connect to mysql server.
PLZ HELP ME!!!
sorry my english.
naya l baina
|
|
|
|
|
Think we found a bug. Each query creates a new connection to the Server in
*sql_connection_c::grabdb()
Your code:
OPENDB *sql_connection_c::grabdb()
{
OPENDB *odb;
for ( odb = opendbbase; odb; odb = odb->next )
{
if ( !odb->busy )
{
break;
}
}
...
...
else
{
odb->busy++; // <- That could also be a Problem because you have to count this down at
} // the end of the query to prevent an overflow of "busy"
return odb;
}
*****************************************************************
Fixed code:
OPENDB *sql_connection_c::grabdb()
{
OPENDB *odb;
for ( odb = opendbbase; odb; odb = odb->next )
{
//if ( !odb->busy )
if(odb)
{
break;
}
}
...
...
}
Fixed "busy":
It should be better to manage "busy" here:
int sql_query_c::execute( char *sql )
{
if ( sql_connection && odb && !res )
{
odb->busy++;
if ( try_execute( sql ) )
{
res = mysql_store_result( &odb->mysql );
odb->busy--;
}
}
return (int)res;
}
|
|
|
|
|
#include <winsock2.h>
That's for wincrap if I'm not mistaken...
But that's a project about databases.. who the %/$% runs databases on personal computers?!?
Anyone knows of a solution for linux???
MJ
|
|
|
|
|
Can anyone tell me how to get the row value from a table by using function in mysqlplus.h?
|
|
|
|
|
No kidding, I don't get this. Does this really work.
Has anyone got it working at all. Please show some simple code.
|
|
|
|
|
OK, here is a sample I got working after hours of hell.
Hope this helps someone
Basically prints out the column/field names
Then prints out each row at each column
========================================
<br />
#include "mysqlplus.h"<br />
#include <STDIO.H><br />
<br />
#include <iostream><br />
<br />
<br />
void main()<br />
{<br />
sql_connection_c connection( "myDatabase", <br />
"localhost", "user", "password" );<br />
sql_query_c query( &connection );<br />
sql_result_c *sql_result = 0;<br />
if ( !query.execute( "select * from data" ) )<br />
{<br />
printf( "oops... didn't execute!!\n" );<br />
return;<br />
}<br />
int idx = 0;<br />
sql_result = query.store();<br />
int n_fields = sql_result->n_fields();<br />
<br />
__int64 nRows = sql_result->n_rows() ;
std::cout << "Rows: " << nRows << std::endl;
<br />
for ( idx=0 ; idx < n_fields; ++idx)<br />
{<br />
sql_field_c sql_field = sql_result->fetch_field( idx );<br />
printf( "[%s]\t", sql_field.get_name() );<br />
}<br />
printf("\n");<br />
<br />
for(__int64 i = 0; i<nRows ;++i)<br />
{<br />
sql_row_c row = sql_result->fetch_row();<br />
for(idx=0; idx < n_fields; ++idx)<br />
{<br />
printf( "%s\t", row[idx]);<br />
}<br />
printf("\n");<br />
}<br />
}<br />
|
|
|
|
|
I tried to use this class with mysql 5.0 but it don't work
Can anybody help me !!
Thanks!!!!
|
|
|
|
|
Actually, I been using it for a while with 5.0 and it works great.
Make sure you change the path in the project settings for the lib and include files. Also, make sure you update all the Lib files if you copy them to you local project dir.
|
|
|
|
|
Rolando
|
|
|
|
|
If you got compile errors like:
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_close@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_select_db@8
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_connect@16
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_init@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_free_result@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_query@8
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_store_result@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_insert_id@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_fetch_field@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_ping@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_num_rows@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_fetch_row@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_num_fields@4
mysqlplus.obj : error LNK2001: unresolved external symbol _mysql_fetch_field_direct@8
Then here is the solution: press alt+f7, goto the link tab and add this: "libmysql.lib " (without the "") in the Object/Library Modules
Where to put the files !!!!....
Cant you write a REALLY newbie toturial....
In your VC98/ folder
I am getting the following error using VC++6. I am just learning VC++/MySQL so it may be a "pilot error"
Compiling...
mysqlplus.cpp
C:\MySQL C++ Wrapper\mysqlplus.cpp(117) : error C2065: 'mysql_connect' : undeclared identifier
Error executing cl.exe.
mysqlplus.exe - 1 error(s), 0 warning(s)
Thank You in Advance
Just add the libraries to you c++ folder, dont use the new ones use these:
http://tangentsoft.net/mysql++/releases/mysql++-1.7.1-win32-vc++.zip
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
Return a value in the sql_vac_c::operator: like on the end:
return 0; //(if you dont want it to loop, but im not really 100% sure about this)
~NightGhost
|
|
|
|
|
I'm new to VC++ environment. I have installed Mysql server version 4.1 in my machine. I tried to compile and run your example program. When I compile the VC++ compiler shows the following linker error , even though I have included the "Mysql include folder" in include section and "Mysql lib (mysqlclient.lib)" in library section.
Linking...
ex01.obj : error LNK2001: unresolved external symbol "public: char * __thiscall sql_field_c::get_name(void)" (?get_name@sql_field_c@@QAEPADXZ)
ex01.obj : error LNK2001: unresolved external symbol "public: class sql_field_c __thiscall sql_result_c::fetch_field(unsigned int)" (?fetch_field@sql_result_c@@QAE?AVsql_field_c@@I@Z)
ex01.obj : error LNK2001: unresolved external symbol "public: unsigned int __thiscall sql_result_c::n_fields(void)" (?n_fields@sql_result_c@@QAEIXZ)
ex01.obj : error LNK2001: unresolved external symbol "public: class sql_result_c * __thiscall sql_query_c::store(void)" (?store@sql_query_c@@QAEPAVsql_result_c@@XZ)
ex01.obj : error LNK2001: unresolved external symbol "public: __thiscall sql_connection_c::~sql_connection_c(void)" (??1sql_connection_c@@QAE@XZ)
ex01.obj : error LNK2001: unresolved external symbol "public: __thiscall sql_query_c::~sql_query_c(void)" (??1sql_query_c@@QAE@XZ)
ex01.obj : error LNK2001: unresolved external symbol "public: int __thiscall sql_query_c::execute(char *)" (?execute@sql_query_c@@QAEHPAD@Z)
ex01.obj : error LNK2001: unresolved external symbol "public: __thiscall sql_query_c::sql_query_c(class sql_connection_c *)" (??0sql_query_c@@QAE@PAVsql_connection_c@@@Z)
ex01.obj : error LNK2001: unresolved external symbol "public: __thiscall sql_connection_c::sql_connection_c(char *,char *,char *,char *)" (??0sql_connection_c@@QAE@PAD000@Z)
LIBCMTD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/MysqlTest.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.
Can you please give me the solution for this problem.
AT Karthikeyan
|
|
|
|
|
you need to link libmysql.lib
|
|
|
|
|
Hi all,
I'm looking for a way to execute simple queries (BCB6.0 <-> MySQL 4.1.18) and this wrapper looks great. I'm having problems getting things to work properly, though.
(Unresolved external 'mysql_close' / 'mysql_init' / 'mysql_real_connect' ...)
Is anyone here using Borland and the C++ Wrapper?
PLEASE contact me at magnus.winsth@bredband.net, ICQ 12715455 or at this forum of course.
All I want is to get a very very simple example to work...
A bunch of thanx in advance!!
/ Magnus Winsth
-----------------------------------------------
Fly safe and keep the dirty side down!
|
|
|
|
|
Where to put the files !!!!....
Cant you write a REALLY newbie toturial....
|
|
|
|
|
I am getting the following error using VC++6. I am just learning VC++/MySQL so it may be a "pilot error"
Compiling...
mysqlplus.cpp
C:\MySQL C++ Wrapper\mysqlplus.cpp(117) : error C2065: 'mysql_connect' : undeclared identifier
Error executing cl.exe.
mysqlplus.exe - 1 error(s), 0 warning(s)
Thank You in Advance
alan
|
|
|
|