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 » Developing U++ » U++ Developers corner » Date emulation for Sqlite
icon3.gif  Re: Date emulation for Sqlite [message #6762 is a reply to message #5295] Sun, 26 November 2006 18:07 Go to previous messageGo to previous message
fabio is currently offline  fabio
Messages: 9
Registered: November 2006
Promising Member
EditDate not work with SqlCtrl and Sqlite, but you can make new ctrl like SqlEditDate which work with date like "yyyy-mm-dd" in sqlite table. The only requirement is SQL.GetDialect().

You can change method for support more formats like yyyymmdd (string like number) and others.


//----------------------------------------------------------
//Add this class definition in SqlCtrl.h

class SqlEditDate : public EditDate
{
public:
virtual void SetData(const Value& data);
};

//--------------------------------------------------
// Add this method in SqlCtrl.cpp

void SqlEditDate::SetData(const Value& data)
{
Value valdata = data;
if (SQL.GetDialect()==SQLITE3){
switch(data.GetType()){
case STRING_V:
case WSTRING_V:
valdata = Date(atoi(data.ToString().Mid(0,4)),atoi(data.ToString().Mid (5,2)),atoi(data.ToString().Mid(8,2)));
break;
}
}
SetText((WString)convert->Format(valdata));
}
//-------------------------------------------------




Fabio
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon3.gif
Read Message
Read Message
Previous Topic: A new way how to create "plugin"
Next Topic: uvs2 as "public application"
Goto Forum:
  


Current Time: Sat Jul 05 16:09:08 CEST 2025

Total time taken to generate the page: 0.04375 seconds