| 
 | 
 | 
 
Home » U++ Library support » U++ SQL » Error when compiling native MySql with MSC9 
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: Error when compiling native MySql with MSC9 [message #34302 is a reply to message #34301] | 
			Wed, 09 November 2011 21:42    | 
		 
		
			
				
				
				  | 
					
						  
						BioBytes
						 Messages: 312 Registered: October 2008  Location: France
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Mirek, 
 
Sorry and confused     for the following points: 
 
First: double post (I did not see you reply so fast). 
 
Second: I forgot to indicate in the package configuration that the project needs GUI MT and not MT alone. 
 
Now no more linkage error but the application crashes. Please find herafter the header, cpp and schema files; 
 
Header: 
 
#ifndef _DirectDB_DirectDB_h 
#define _DirectDB_DirectDB_h 
 
#include <CtrlLib/CtrlLib.h> 
#include <MySql/MySql.h> 
 
using namespace Upp; 
 
#define LAYOUTFILE <DirectDB/DirectDB.lay> 
#include <CtrlCore/lay.h> 
 
#define IMAGEFILE <DirectDB/DirectDB.iml> 
#include <Draw/iml_header.h> 
 
#define SCHEMADIALECT <MySql/MySqlSchema.h> 
#define MODEL <DirectDB/DirectDB.sch> 
#include <Sql/sch_header.h> 
 
SqlId TBLPROCS("PROCESSUS"),NAME("NAMEPROC"),CODE("CODEPROC"); 
 
class DirectDBWin : public WithDirectDBWinLayout<TopWindow> { 
public: 
	typedef DirectDBWin CLASSNAME; 
	MySqlSession session; 
	 
	DirectDBWin(); 
}; 
 
#endif 
 
Scheme file: 
 
TABLE (OWNERS) 
	INT(IDOWNER)PRIMARY_KEY AUTO_INCREMENT 
	INT(IDPROCOWNER) 
	STRING_(OWNERNAME,200)  
	STRING_(OWNERFIRSTNAME,200) 
	STRING_(OWNERLOGON,20) 
	STRING_(OWNERSTATUS,1) 
	INT(IDPROC1) 
	INT(IDPROC2) 
END_TABLE 
 
TABLE (PROCESSUS) 
	INT(IDPROC)PRIMARY_KEY AUTO_INCREMENT 
	STRING_(CODEPROC,30) 
	STRING_(NAMEPROC,100) 
END_TABLE 
 
TABLE (SKILLS) 
	INT(IDSKILL)PRIMARY_KEY AUTO_INCREMENT 
	INT(IDPROCSKILL) 
	STRING(SKILL,400) 
	INT(IDRANGE) 
END_TABLE 
 
TABLE (SKILLSLEVEL) 
	INT(IDLEVEL)PRIMARY_KEY AUTO_INCREMENT 
	INT(IDSKILLLEVEL) 
	INT(SKILLLEVEL) 
	STRING_(OPENAME,200) 
	STRING_(OPEFIRSTNAME,200) 
	STRING_(OPESHORTID,20) 
END_TABLE 
 
cpp file: 
 
#include "DirectDB.h" 
 
#define IMAGECLASS DirectDBImg 
#define IMAGEFILE <DirectDB/DirectDB.iml> 
#include <Draw/iml.h> 
 
#define SCHEMADIALECT <MySql/MySqlSchema.h> 
#include <Sql/sch_source.h> 
 
DirectDBWin::DirectDBWin() 
{ 
	CtrlLayout(*this, "Window title"); 
	if(session.Connect("patrice","patrice","skillsdb","127.0.0.1 ",3306,NULL)) 
     { 
     	PromptOK("Connexion réussie"); 
     	 
     	SQL *Select(CODE,NAME).From(TBLPROCS); 
     	 
     	while(SQL.Fetch())PromptOK(AsString(SQL[0])+" : "+AsString(SQL[1])); 
     } 
      
	   else PanicMessageBox("Erreur","Pas de connexion possible"); 
} 
 
GUI_APP_MAIN 
{ 
	SetLanguage(GetSystemLNG()); 
	SetLNGCharset(GetSystemLNG(),CHARSET_UTF8); 
	 
	DirectDBWin().Run(); 
} 
 
Do you have any comments ? I have no idea of what is not working now. 
 
Thank you again for your help 
 
Biobytes
		
		
		[Updated on: Wed, 09 November 2011 22:10] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: Error when compiling native MySql with MSC9 [message #34307 is a reply to message #34302] | 
			Thu, 10 November 2011 22:02   | 
		 
		
			
				
				
				  | 
					
						  
						BioBytes
						 Messages: 312 Registered: October 2008  Location: France
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi Mirek, 
 
With your help and suggestions, I succeeded to compile my demo project. I forgot to add "SQL = session" just after getting the connection. 
 
#include "DirectDB.h" 
 
#define IMAGECLASS DirectDBImg 
#define IMAGEFILE <DirectDB/DirectDB.iml> 
#include <Draw/iml.h> 
 
#define SCHEMADIALECT <MySql/MySqlSchema.h> 
#include <Sql/sch_source.h> 
 
DirectDBWin::DirectDBWin() 
{ 
	CtrlLayout(*this, "Window title"); 
	if(session.Connect("alexandre","deming","skillsdb","127.0.0.1 ",3306,NULL)) 
     { 
     	PromptOK("Connexion réussie"); 
     	SQL = session; (new line) 
     	 
     	try 
     	{ 
     		SQL &Select(CODE,NAME).From(TBLPROCS); 
     	 
     		while(SQL.Fetch())PromptOK(AsString(SQL[0])+" : "+AsString(SQL[1])); 
     	} 
     	catch(SqlExc &ex) 
     	{ 
     		PanicMessageBox(t_("Erreur MySql"),t_("L'erreur suivante s'est produite : ")+ex.ToString()); 
     		Close(); 
     	} 
     } 
      
	   else PanicMessageBox("Erreur","Pas de connexion possible"); 
} 
 
GUI_APP_MAIN 
{ 
	SetLanguage(GetSystemLNG()); 
	SetLNGCharset(GetSystemLNG(),CHARSET_UTF8); 
	 
	DirectDBWin().Run(); 
} 
 
Really U++ is an amazing tool for C++ development. 
 
I got some difficulties to link with MySql library so I went through ODBC to by-pass use of native MySql. Now all is working perfectly. So I would like to post some help for newbie probably facing the same problems. 
 
Please consider this topic closed. 
 
Thanks again for your help 
 
Regards 
Biobytes
		
		
		
 |  
	| 
		
	 | 
 
 
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 01:50:51 CET 2025 
 Total time taken to generate the page: 0.06673 seconds 
 |   
 |  
  |