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 » error in example/SQLApp [FIXED]
BugFixedDead.gif  error in example/SQLApp [FIXED] [message #5706] Tue, 10 October 2006 17:29 Go to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

today is not my day. All SQL stuff does not work. Even the SQLApp has problem. Am I missing something?
Luigi

==================================
query.cpp
C:\upp\uppsrc\CtrlLib/EditCtrl.h(130) : error C2248: 'Ctrl::operator =' : cannot access private member declared in
class 'Ctrl'
C:\upp\uppsrc\CtrlCore/CtrlCore.h(260) : see declaration of 'Ctrl::operator ='
C:\upp\uppsrc\CtrlCore/CtrlCore.h(190) : see declaration of 'Ctrl'
This diagnostic occurred in the compiler generated function 'EditField &EditField::operator =(EditField &)
'
SQLApp: 1 file(s) built in (0:02.43), 2438 msecs / file, duration = 2453 msecs

[Updated on: Mon, 30 October 2006 09:45]

Report message to a moderator

Re: error in example/SQLApp [message #5707 is a reply to message #5706] Tue, 10 October 2006 17:37 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
forlano wrote on Tue, 10 October 2006 17:29

Hello,

today is not my day. All SQL stuff does not work. Even the SQLApp has problem. Am I missing something?
Luigi

==================================
query.cpp
C:\upp\uppsrc\CtrlLib/EditCtrl.h(130) : error C2248: 'Ctrl::operator =' : cannot access private member declared in
class 'Ctrl'
C:\upp\uppsrc\CtrlCore/CtrlCore.h(260) : see declaration of 'Ctrl::operator ='
C:\upp\uppsrc\CtrlCore/CtrlCore.h(190) : see declaration of 'Ctrl'
This diagnostic occurred in the compiler generated function 'EditField &EditField::operator =(EditField &)
'
SQLApp: 1 file(s) built in (0:02.43), 2438 msecs / file, duration = 2453 msecs


Perhaps I need to upgrade the plugin as explained in http://www.arilect.com/upp/forum/index.php?t=msg&th=1203 &start=0& Confused
Re: error in example/SQLApp [message #6048 is a reply to message #5707] Sun, 29 October 2006 09:16 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
had the same Problem, solved it by changing the line
query.borrowed_from = query.borrowed_to = Null;

to
query.borrowed_from = Null;
query.borrowed_to = Null;

in File "examples/SQLApp/query.cpp" function "void SQLApp::ClearQuery()"

Bas
Re: error in example/SQLApp [message #6053 is a reply to message #6048] Sun, 29 October 2006 10:52 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
fallingdutch wrote on Sun, 29 October 2006 09:16

had the same Problem, solved it by changing the line
query.borrowed_from = query.borrowed_to = Null;

to
query.borrowed_from = Null;
query.borrowed_to = Null;

in File "examples/SQLApp/query.cpp" function "void SQLApp::ClearQuery()"

Bas


Thanks Bas,

Now it works and I can start to learn sqlite.
Luigi
Re: error in example/SQLApp [message #6054 is a reply to message #6053] Sun, 29 October 2006 11:19 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
your welcome, Luigi
forlano wrote on Sun, 29 October 2006 10:52


Now it works and I can start to learn sqlite.


so can I Wink

Bas

Re: error in example/SQLApp [message #6063 is a reply to message #6054] Sun, 29 October 2006 19:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks. Should have been

query.borrowed_from <<= query.borrowed_to <<= Null;


Mirek
Re: error in example/SQLApp [message #13730 is a reply to message #6063] Fri, 25 January 2008 07:42 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I found One small error in SQLApp.

In file book.cpp, line 35, I change

SQL * dlg.ctrls.Update(BOOK);


with code

SQL * dlg.ctrls.Update(BOOK).Where(ID == q);


Without this, I can't be able to change BOOK table.


And Now question. I found error, or I don't understand Ultimate SQL teñhnique ???

Thanks.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13731 is a reply to message #13730] Fri, 25 January 2008 08:17 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Fri, 25 January 2008 01:42

I found One small error in SQLApp.

In file book.cpp, line 35, I change

SQL * dlg.ctrls.Update(BOOK);


with code

SQL * dlg.ctrls.Update(BOOK).Where(ID == q);


Without this, I can't be able to change BOOK table.


And Now question. I found error, or I don't understand Ultimate SQL teñhnique ???

Thanks.


You have found a bug. Thanks.

Mirek
Re: error in example/SQLApp [message #13733 is a reply to message #13731] Fri, 25 January 2008 11:00 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Thanks. And Sorry for my English.

Now (this time) I try to understand technique (or technology) of life with UPP and I have additional time to analize expamples.

I found this TOOL is interest and powerful.

And I found one more strange thing in this example.

File borrow.cpp, lines from 14 to 27 - Function
Value DateIntConvertCls::Scan(const Value& text) const
{
	String txt = text;
	if(IsNull(txt))
		return Null;
	Date d;
	if(StrToDate(d, txt)) {
		const char *s = txt;
		while(*s == ' ') s++;
		if(*s == '\0')
			return d - Date(1970, 1, 1);
	}
	return ErrorValue("Invalid date!");
}


I add there one string return d - Date(1970, 1, 1);.

Value DateIntConvertCls::Scan(const Value& text) const
{
	String txt = text;
	if(IsNull(txt))
		return Null;
	Date d;
	if(StrToDate(d, txt)) {
		const char *s = txt;
		while(*s == ' ') s++;
		if(*s == '\0')
			return d - Date(1970, 1, 1);
	}
	return d - Date(1970, 1, 1);
	// ^^^^^^^^^^^^^^^^^^^^^^^^^        
	return ErrorValue("Invalid date!");
}


Without this string, I can't to edit Date fields, when I add borrow records. I can add only empty dates.
This may be my mistake or mistake of program.

SQLApp - is a complex example, because many of newbies see to this application and this application is face of system.
And this app must be a exapmle of stability ( Smile ).







SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Fri, 25 January 2008 18:46]

Report message to a moderator

Re: error in example/SQLApp [message #13755 is a reply to message #13733] Fri, 25 January 2008 23:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Fri, 25 January 2008 05:00

Thanks. And Sorry for my English.

Now (this time) I try to understand technique (or technology) of life with UPP and I have additional time to analize expamples.

I found this TOOL is interest and powerful.

And I found one more strange thing in this example.

File borrow.cpp, lines from 14 to 27 - Function
Value DateIntConvertCls::Scan(const Value& text) const
{
	String txt = text;
	if(IsNull(txt))
		return Null;
	Date d;
	if(StrToDate(d, txt)) {
		const char *s = txt;
		while(*s == ' ') s++;
		if(*s == '\0')
			return d - Date(1970, 1, 1);
	}
	return ErrorValue("Invalid date!");
}


I add there one string return d - Date(1970, 1, 1);.

Value DateIntConvertCls::Scan(const Value& text) const
{
	String txt = text;
	if(IsNull(txt))
		return Null;
	Date d;
	if(StrToDate(d, txt)) {
		const char *s = txt;
		while(*s == ' ') s++;
		if(*s == '\0')
			return d - Date(1970, 1, 1);
	}
	return d - Date(1970, 1, 1);
	// ^^^^^^^^^^^^^^^^^^^^^^^^^        
	return ErrorValue("Invalid date!");
}


Without this string, I can't to edit Date fields, when I add borrow records. I can add only empty dates.
This may be my mistake or mistake of program.

SQLApp - is a complex example, because many of newbies see to this application and this application is face of system.
And this app must be a exapmle of stability ( Smile ).



Stupid me. That is the price to pay when you are overengineering the code, and not test it enough in the same time...

Value DateIntConvertCls::Scan(const Value& text) const
{
	String txt = text;
	if(IsNull(txt))
		return Null;
	Date d;
	if(StrToDate(d, txt))
		return d - Date(1970, 1, 1);
	return ErrorValue("Invalid date!");
}


Thanks!

Mirek
Re: error in example/SQLApp [message #13758 is a reply to message #13755] Sat, 26 January 2008 01:26 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

OK.

.....

.... went to test.

BTW, thanks.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13759 is a reply to message #13758] Sat, 26 January 2008 01:30 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Great.
It's Work!!!
Nearly Nirvana!!! Smile


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13760 is a reply to message #13759] Sat, 26 January 2008 01:39 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

One more small question.

Of course, I can find the answer himself.

In russian standarts Date fields must start from day, followed by month, and at end must be year. And .(period) must be as divider.
(for example 29.12.2008)

May be exist ready solution to make Date Entry field under our standards.

Thanks.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13766 is a reply to message #13760] Sat, 26 January 2008 08:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Fri, 25 January 2008 19:39

One more small question.

Of course, I can find the answer himself.

In russian standarts Date fields must start from day, followed by month, and at end must be year. And .(period) must be as divider.
(for example 29.12.2008)

May be exist ready solution to make Date Entry field under our standards.

Thanks.



Yes. You have to switch to

SetLanguage(LNG_('R','U','R','U')

at the start of program.

Mirek
Re: error in example/SQLApp [message #13771 is a reply to message #13766] Sat, 26 January 2008 10:11 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

So simple???

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13829 is a reply to message #13771] Tue, 29 January 2008 14:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Sat, 26 January 2008 04:11

So simple???


I hope so Smile Should work, as long as RURU translator did the job right Smile

(BTW, if you have a bit of time, you should provide the update of translation, see annoucements).

Mirek
Re: error in example/SQLApp [message #13853 is a reply to message #13829] Wed, 30 January 2008 00:39 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

All the works. Regarding translatings, I am still in the process of learning. I have a lot of plans for the programming in environment TheIDE. As a result, there is a lot of translations, which I will publish.

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13963 is a reply to message #13853] Mon, 04 February 2008 00:06 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Hi Mirek.
One more error in SQLApp.
In file query.cpp.

When we enter dates, then deferent dates format is used in SQL and in screen vars borrowed_from and borrowed_to.

in SQL - number of day from 1/1/1970 and in vars - in other format.

Therefore, if you really try, you will not succeed.

Sorry that I twisted for this example.

(I am trying to understand the code and do not understand. Nested see in the screen. Finally I understood it - there is a mistake!!! Very Happy )


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13964 is a reply to message #13963] Mon, 04 February 2008 00:22 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

.... continued previous message

I think.
A code should look something like this.
void SQLApp::Query()

{
	SqlBool where;
	SqlSet borrowed = Select(BOOK_ID).From(BORROW_RECORD).Where(IsNull(RETURNED));
	int q_date_from = ~query.date_from - Date(1970, 1, 1); 	// <== NEW
	int q_date_to = ~query.date_to - Date(1970, 1, 1); 	// <== NEW
	if(query.status == 1)
		where = ID != borrowed;
	if(query.status == 2)
		where = ID == borrowed;
	SqlBool bdate;
	if(!IsNull(query.borrowed_from))
//		bdate = BORROWED >= ~query.borrowed_from;
		bdate = BORROWED >= q_borrowed_from;   		// <== NEW
	if(!IsNull(query.borrowed_to))
//		bdate = BORROWED <= ~query.borrowed_to;
		bdate = BORROWED <= q_borrowed_to;		// <== NEW

	if(!bdate.IsEmpty())
		where = where && ID == Select(BOOK_ID).From(BORROW_RECORD).Where(bdate);
	book.Query(where);
}


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: error in example/SQLApp [message #13967 is a reply to message #13964] Mon, 04 February 2008 00:34 Go to previous messageGo to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Mirek, I almost finished the transfer .Tr file. In what format and where to throw it?



SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Previous Topic: Error Any SQL packets on SVN 98
Next Topic: Overflow error in bool Sql::Fetch()
Goto Forum:
  


Current Time: Mon Apr 29 09:03:59 CEST 2024

Total time taken to generate the page: 0.02225 seconds