Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Sql(SqlSession& session) problem
Sql(SqlSession& session) problem [message #37300] Mon, 17 September 2012 23:09 Go to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Hello all

I have just recompiled from last svn and I have got this linking error:

error LNK2001: unresolved external symbol "public: __thiscall Upp::Sql::Sql(class Upp::SqlSession &)"


In Sqls.h, Sql(SqlSession& session); declaration appears.

I recognize that I am not an expert in sql so it would be great if somebody could know what to do.


Best regards
Iñaki

[Updated on: Mon, 17 September 2012 23:09]

Report message to a moderator

Re: Sql(SqlSession& session) problem [message #37301 is a reply to message #37300] Tue, 18 September 2012 07:18 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Similar problem here. Starting from 5366 linking of HomeBudget fails:
Quote:

/home/h/.upp/wd_out/HomeBudget/GCCMK.Blitz.Gui.Main.Shared.S se2/HomeBudget.o: In function `GuiMainFn_()':
HomeBudget.cpp:(.text._Z10GuiMainFn_v+0xf7): undefined reference to `Upp::Sql::Sql(Upp::SqlSession&)'
/home/h/.upp/wd_out/plugin/sqlite3/GCCMK.Blitz.Gui.Shared.Ss e2/Sqlite3upp.o: In function `Upp::Sqlite3Session::EnumViews(Upp::String)':
Sqlite3upp.cpp:(.text._ZN3Upp14Sqlite3Session9EnumViewsENS_6 StringE+0x4b): undefined reference to `Upp::Sql::Sql(Upp::SqlSession&)'
/home/h/.upp/wd_out/plugin/sqlite3/GCCMK.Blitz.Gui.Shared.Ss e2/Sqlite3upp.o: In function `Upp::Sqlite3Session::EnumTables(Upp::String)':
Sqlite3upp.cpp:(.text._ZN3Upp14Sqlite3Session10EnumTablesENS _6StringE+0x4b): undefined reference to `Upp::Sql::Sql(Upp::SqlSession&)'
/home/h/.upp/wd_out/plugin/sqlite3/GCCMK.Blitz.Gui.Shared.Ss e2/Sqlite3upp.o: In function `Upp::Sqlite3Session::EnumDatabases()':
Sqlite3upp.cpp:(.text._ZN3Upp14Sqlite3Session13EnumDatabases Ev+0x24): undefined reference to `Upp::Sql::Sql(Upp::SqlSession&)'
/home/h/.upp/wd_out/plugin/sqlite3/GCCMK.Blitz.Gui.Shared.Ss e2/Sqlite3upp.o: In function `Upp::Sqlite3Session::EnumColumns(Upp::String, Upp::String)':
Sqlite3upp.cpp:(.text._ZN3Upp14Sqlite3Session11EnumColumnsEN S_6StringES1_+0x54): undefined reference to `Upp::Sql::Sql(Upp::SqlSession&)'
/home/h/.upp/wd_out/Sql/GCCMK.Blitz.Gui.Shared.Sse2/$blitz.o :$blitz.cpp:(.text._ZN3Upp10SqlSession14GetSessionSqlREv+0x2 5): more undefined references to `Upp::Sql::Sql(Upp::SqlSession&)' follow
collect2: error: ld returned 1 exit status


Best regards,
Honza
Re: Sql(SqlSession& session) problem [message #37303 is a reply to message #37301] Tue, 18 September 2012 09:25 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Hello Honza

Yes, it seems plugin/sqlite3 does not link too. I am spending the morning trying to find the problem...


Best regards
Iñaki
Re: Sql(SqlSession& session) problem [message #37304 is a reply to message #37303] Tue, 18 September 2012 10:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
The fast but ugly solution: Just remove Sql(SqlSession& session); declaration in Sqls.h.

However it says:

Sql(SqlSource& src); // internal use only


Best regards
Iñaki
Re: Sql(SqlSession& session) problem [message #37305 is a reply to message #37304] Tue, 18 September 2012 11:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14154
Registered: November 2005
Ultimate Member
Sorry, my fault, was documenting Sql and SqlSession and for a moment, that seemed like a good idea (so that we do not need to explain existence of SqlSource, which is sort of relict of the past).

Should be now fixed.
Re: Sql(SqlSession& session) problem [message #37306 is a reply to message #37305] Tue, 18 September 2012 13:00 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mirek wrote on Tue, 18 September 2012 11:47

Sorry, my fault, was documenting Sql and SqlSession and for a moment, that seemed like a good idea (so that we do not need to explain existence of SqlSource, which is sort of relict of the past).

Should be now fixed.

I can confirm that 5371 is building OK again. Thanks Mirek.

Honza
Re: Sql(SqlSession& session) problem [message #37307 is a reply to message #37306] Tue, 18 September 2012 15:06 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi,

Good news ! Razz

Is this new official release still compatible to be compiled with MSC9 and will not require MSC10 ?

--------------------------
Regards

Biobytes
Re: Sql(SqlSession& session) problem [message #37310 is a reply to message #37307] Tue, 18 September 2012 21:06 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3402
Registered: August 2008
Senior Veteran
Thank you Mirek, It is solved

Hello BioBytes

AFAIK it works perfectly with MSC9 and 10.


Best regards
Iñaki
Re: Sql(SqlSession& session) problem [message #40310 is a reply to message #37300] Wed, 17 July 2013 14:00 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
After upgrade to 5485 from 4193, I get the following error

C:\upp\uppsrc\Sql\Sqls.h: In copy constructor 'Upp::SqlSession::SqlSession(const Upp::SqlSession&':
C:\upp\uppsrc\Sql\Sqls.h:84:2 error: 'Upp::SqlSource::SqlSource(const Upp::SqlSource&)' is private
C:\upp\uppsrc\Sqls.h:299:7 error: within this context


I try to remarks the line 83 and 84 in Sqls.h
void operator=(const SqlSource&);
SqlSource(const SqlSource&);


It comply but the exe does not run.
Re: Sql(SqlSession& session) problem [message #40311 is a reply to message #40310] Wed, 17 July 2013 14:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14154
Registered: November 2005
Ultimate Member
pfsdanny wrote on Wed, 17 July 2013 08:00

After upgrade to 5485 from 4193, I get the following error

C:\upp\uppsrc\Sql\Sqls.h: In copy constructor 'Upp::SqlSession::SqlSession(const Upp::SqlSession&':
C:\upp\uppsrc\Sql\Sqls.h:84:2 error: 'Upp::SqlSource::SqlSource(const Upp::SqlSource&)' is private
C:\upp\uppsrc\Sqls.h:299:7 error: within this context


I try to remarks the line 83 and 84 in Sqls.h
void operator=(const SqlSource&);
SqlSource(const SqlSource&);


It comply but the exe does not run.


I am using Sql on daily basis, so you must have hit something special. Can you provide more details? (test package would be the best).
Re: Sql(SqlSession& session) problem [message #40312 is a reply to message #37300] Wed, 17 July 2013 14:58 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
I install MinGW and 5485 to another computer and copy my project to the new computer. Everything is ok in the old one but not running in the new computer.

What details do I need to provide, projects that not using MySql is ok.

Thanks.
Re: Sql(SqlSession& session) problem [message #40313 is a reply to message #40312] Wed, 17 July 2013 15:13 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14154
Registered: November 2005
Ultimate Member
pfsdanny wrote on Wed, 17 July 2013 08:58

I install MinGW and 5485 to another computer and copy my project to the new computer. Everything is ok in the old one but not running in the new computer.

What details do I need to provide, projects that not using MySql is ok.

Thanks.



Well, for starters mentioning MingW was a good idea... Smile

Have you tried with MSC?

Mirek
Re: Sql(SqlSession& session) problem [message #40314 is a reply to message #37300] Wed, 17 July 2013 15:17 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
I use MinGW for a year to develop the project. Does MSC 100% compatible with MinGW? This project in not yet finish, I can change any code to change to MSC. I have no idea about MSC.
Re: Sql(SqlSession& session) problem [message #40315 is a reply to message #37300] Wed, 17 July 2013 15:50 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
Just reinstall everything, and didn't fix.

Here is the code causing the problem:

db.h

class c_db : public MySqlSession{
public:
typedef c_db CLASSNAME;
String username;
String password;
String database;
String host;
String collate;
String lockId;
int port;
bool connect(bool prompt=true);
void disconnect();
void copyFm(c_db db);
bool getlock(String name);
bool releaselock();
c_db();
~c_db();
};

db.cpp
....

void c_db::copyFm(c_db db) {
host = db.host;
database = db.database;
username = db.username;
password = db.password;
port = db.port;
collate = db.collate;
}
...

The error comes from c_db::copyFm(c_db db) line. Do I need to change the code to c_db::copyFm(c_db db&)?

I don't understand the '&' stand for.

Thanks.

Re: Sql(SqlSession& session) problem [message #40316 is a reply to message #37300] Wed, 17 July 2013 16:18 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
This time I try to change the following lines in Sqls.h

FROM:
private:
void operator=(const SqlSource&);
SqlSource(const SqlSource&);

TO:
public:
void operator=(const SqlSource&);
SqlSource(const SqlSource&);

It comply without error but generate link error:
indefined reference to 'Upp::SqlSource::SqlSource(Upp::SqlSource const&);

Seems like the problems comes from the Sqls.h which is different from version 4193.
Re: Sql(SqlSession& session) problem [message #40317 is a reply to message #37300] Wed, 17 July 2013 17:01 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
Reinstall everything and try the SQL_Mysql from the reference folder. The application works! That means 5485 SQL has changed and 4193 coding is not compatible. I will try to modify the my code for this change!
Re: Sql(SqlSession& session) problem (SOLVED) [message #40320 is a reply to message #40317] Thu, 18 July 2013 15:24 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
After rewrite the code, it works. So the following code that is ok in 4193 does not work in 5485.


class c_db : public MySqlSession{
public:
typedef c_db CLASSNAME;
String username;
String password;
String database;
String host;
String collate;
String lockId;
int port;
bool connect(bool prompt=true);
void disconnect();

void copyFm(c_db db); <<--- this line cause error !
void copyFm(String xhost, String xdatabase, String xusername, String xpassword, String xcollate, int sport); <<-- change to this one and no problems !

bool getlock(String name);
bool releaselock();
c_db();
~c_db();
};
Re: Sql(SqlSession& session) problem (SOLVED) [message #40321 is a reply to message #40320] Thu, 18 July 2013 18:37 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello, Danny.
pfsdanny wrote on Thu, 18 July 2013 15:24

After rewrite the code, it works. So the following code that is ok in 4193 does not work in 5485.
Toggle source code


You are right, that after 4296 revision your previous code doesn't work, because of "Sql, SqlSession: operator= and copy constructors now private".

I think, you could rewrite your code as follows:
Toggle source code

where you will have DBData structure to avoid the need to copy each variable to c_db::copyFm method and no need to assign MySqlSession contents.

[Updated on: Thu, 18 July 2013 18:40]

Report message to a moderator

Re: Sql(SqlSession& session) problem (SOLVED) [message #40326 is a reply to message #40321] Fri, 19 July 2013 15:57 Go to previous messageGo to next message
pfsdanny is currently offline  pfsdanny
Messages: 26
Registered: December 2011
Location: Hong Kong
Promising Member
Thanks.

Should you please explain these 2 lines. I don't understand what it means. I am new to C, thanks.

DBData() : port(3306) { }
DBData(const String& username, const String& password,
 const String& database, const String& host, 
 const String& collate, const String& lockId, int port = 3306) :
 username(username), 	password(password), database(database), 
 host(host), collate(collate), lockId(lockId), port(port) { }
Re: Sql(SqlSession& session) problem (SOLVED) [message #40328 is a reply to message #40326] Fri, 19 July 2013 19:25 Go to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
pfsdanny wrote on Fri, 19 July 2013 15:57

Should you please explain these 2 lines. I don't understand what it means. I am new to C, thanks.
DBData() : port(3306) { }
DBData(const String& username, const String& password,
 const String& database, const String& host, 
 const String& collate, const String& lockId, int port = 3306) :
 username(username), 	password(password), database(database), 
 host(host), collate(collate), lockId(lockId), port(port) { }



This feature is called C++ constructor initialization lists, where possible to do implicit assignments (when variables are created), instead of explicit assignments (afterwards):
	DBData() { port = 3306; }
	DBData(const String& username, const String& password, const String& database, const String& host,
		const String& collate, const String& lockId, int port = 3306)
	{
		this->username = username; this->password = password; this->database = database;
		this->host = host; this->collate = collate; this->lockId = lockId; this->port = port;
	}

[Updated on: Fri, 19 July 2013 20:00]

Report message to a moderator

Previous Topic: [BUG] Memory leak in MySql package
Next Topic: MS SQL Server CE Assistance
Goto Forum:
  


Current Time: Mon Dec 02 23:26:51 CET 2024

Total time taken to generate the page: 0.02522 seconds