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 » SqlArray crash
SqlArray crash [message #52441] Mon, 30 September 2019 16:01
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I can connect from my U++ app to a remote MySQL db and perform queries. The problem began when I decided to map a table with a SqlArray:

EventDlg::EventDlg()
{
        CtrlLayout(*this, "");
	
        arrEvents.SetTable(makeevent);
	arrEvents.AddKey(id);
	arrEvents.AddColumn(id, "Id", 2); //.Edit(es1); 
	arrEvents.AddColumn(name, "Event name", 8); //.Edit(es1); 
	arrEvents.AddColumn(city, "City", 8); //.Edit(es1); 
	arrEvents.AddColumn(country_id, "Fed", 3); //.Edit(es2);
	arrEvents.AddColumn(startdate, "Begin", 4); //.Edit(ei1); 
	arrEvents.AddColumn(enddate, "End", 4); //.Edit(es3); 
	arrEvents.AddColumn(interest, "Interest", 3); //.Edit(es4); 
	arrEvents.AddColumn(show, "Visible", 3); //.Edit(es5); 
	arrEvents.AddColumn(url, "URL", 6); //.Edit(dlt); 
	arrEvents.AddColumn(user_id, "user_id", 3); //.Edit(dlt); 
	arrEvents.AddColumn(infofile, "Rule", 6); //.Edit(dlt); 
	arrEvents.AddColumn(latlon, "Lat,Lon", 6); //.Edit(dlt); 
	arrEvents.AddColumn(registration, "Regis.", 4); //.Edit(dlt); 
	arrEvents.EvenRowColor();
	arrEvents.Query()
}


The session is opened, but the program crashes. Perhaps I am missing the exact correspondence between my schema:

TABLE_(makeevent)
	INT_    (id) PRIMARY_KEY 
	STRING_ (name, 30)
	STRING_ (city, 30)
	INT_    (country_id)
	DATE_   (startdate)
	DATE_   (enddate)
	STRING_ (interest, 3)
	INT_    (show)
	STRING_ (url, 50)
	INT_    (user_id)
	STRING_ (infofile, 250)
	STRING_ (latlon, 30)
	TIME_   (registration)
END_TABLE


and the remote table:

CREATE TABLE `makeevent` (
  `id` int(11) NOT NULL,
  `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `city` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `country_id` int(11) NOT NULL,
  `startdate` date NOT NULL,
  `enddate` date NOT NULL,
  `interest` enum('Int','Nat','Loc') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Loc',
  `show` tinyint(1) NOT NULL DEFAULT '1',
  `url` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `infofile` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
  `latlon` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `registration` datetime DEFAULT NULL
)


Could be this the problem?
I have strong doubts about the correspondence between:

show tinyint(1) => INT_ (show)
interest enum('Int','Nat','Loc') => STRING_ (interest, 3)
registration datetime => TIME_ (registration)

DATETIME_ produces complain from the compiler.

Thanks,
Luigi

[Updated on: Mon, 30 September 2019 16:01]

Report message to a moderator

Previous Topic: gridctrl won't map to schema
Next Topic: PostgreSQL: JSONB Supporting by Upp
Goto Forum:
  


Current Time: Fri Apr 19 07:11:46 CEST 2024

Total time taken to generate the page: 0.03560 seconds