LocateEx with lxNearest problem with dates

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

LocateEx with lxNearest problem with dates

Post by NoComprende » Thu 20 Aug 2009 13:20

Doesn't work properly with dates e.g. if I search for the nearest to the 30/12/2001 it lands on 31/01/1995 when it should land on 01/01/2002 (there's no 30th or 31st of Dec 2001 in the table). It seems to be working in alphabetical order according to the date format.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Thu 20 Aug 2009 14:25

Also if AnsiString S="31/12/2001" then
MyQuery->FindNearest(OPENARRAY(TVarRec, (S)));

does nothing. In fact I can't even get it to work on a string field.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Wed 26 Aug 2009 07:37

Is this question too hard?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 28 Aug 2009 10:21

I could not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.
Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Fri 28 Aug 2009 12:17

CREATE TABLE `Dates` (
`ADate` DATE NOT NULL,
PRIMARY KEY (`ADate`)
);

insert into Dates values (20070707), (20080101), (20090101);

Put a TMyQuery (SQL->Text = "select * from Dates") or TMyTable (Table="Dates") on to a C++ Builder form or DataModule, set IndexFieldNames = "ADate", set Active = true then link the following code to a TButton, put a breakpoint on line 1 and a Watch on Dates->RecNo.

Dates->LocateEx("ADate","31/12/2008",TLocateExOptions()LocateEx("ADate","20081231",TLocateExOptions()<<lxNearest);

After execution of line 1 the RecNo is still 1 and nothing changes when executing Line 2.

I'm using rad studio 2009 and MyDAC 5.70.0.43. I'd pay to update to the latest version of MyDAC if there was an easy way of doing so and of finding the newest version. You did say you were going to rectify the mess that is called the 'registered users area' which has so many different addresses and passwords (which don't even show the latest version or when the subscription is up) but I've heard no word on that.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Fri 28 Aug 2009 12:42

Note

Dates->LocateEx("ADate","01/01/2009",TLocateExOptions()LocateEx("ADate","01/01/2009",TLocateExOptions());

does move the cursor to record 3.

Also note

Dates->LocateEx("ADate","20091231",TLocateExOptions()LocateEx("ADate","20091231",TLocateExOptions());

raises a 'not a valid date' exception.

My windows date settings are in the dd/mm/yyyy format.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 31 Aug 2009 08:40

The point is that when you use the lxNearest location option, the compared values have the same type as the KeyValues parametes does. In your case values are compared in text format. Therefore the search is done unpredictably.
To solve this problem you should specify the parameter type equal to the date type, like this:

Code: Select all

Dates->LocateEx("ADate", StrToDate("31/12/2008"),TLocateExOptions()<<lxNearest);

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Mon 31 Aug 2009 10:27

Thanks Dimon. it now works.

Has there been any movement towards having a Registered Members Area instead of a Registered Members Areas?

Devart
Site Admin
Posts: 3974
Joined: Tue 26 Oct 2004 13:51

Post by Devart » Mon 31 Aug 2009 12:58

Sorry for the inconvenience, but we have not modified our Registered Users' Area yet.

To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Mon 31 Aug 2009 13:34

Devart wrote:Sorry for the inconvenience, but we have not modified our Registered Users' Area yet.

To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)
This is what my previous diatribe on the 'Registered Users Area(s)' was all about Dimon. I only know my subscription has expired and what edition I subscribed to because I kept the email you sent 18 months ago. When I tried to upgrade my MYDAC version last year and was unable to do so I was told my subscription must have ran out even though it had 3 months to run. You have some great products at Devart but having parallel users areas spread all over the web (that contain no details on when subscriptions run out) with different passwords and versions attached does devart or us no favours.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Mon 31 Aug 2009 13:57

I've went to the ordering page and when I clicked on 'Professional Edition Subscription' I'm asked if I want to also order dbForge Studio with a 30% discount for an additional £94.23 which I was tempted to do but I then noticed I get a copy of dbForge Studio if I take the Professional to Developer upgrade at £33.63. Am I missing something or was I nearly ripped off for £60?

Devart
Site Admin
Posts: 3974
Joined: Tue 26 Oct 2004 13:51

dbForge Fusion vs dbForge Studio

Post by Devart » Tue 01 Sep 2009 15:20

With MyDAC Developer Edition you get dbForge Fusion for MySQL. dbForge Fusion for MySQL is an add-in designed to simplify MySQL database development and enhance data management capabilities. You can integrate dbForge Fusion for MySQL into Microsoft Visual Studio or CodeGear RAD Studio. It serves for exploring and maintaining existing databases, designing compound SQL statements and queries, and manipulating data in different ways.

dbForge Studio for MySQL is an administration tool and development environment for working with MySQL databases. It serves for exploring databases, managing schema objects, setting user accounts and privileges, developing stored routines, and synchronizing data between databases.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Tue 01 Sep 2009 16:08

My apologies. I have renewed and upgraded my subscription.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Thu 03 Sep 2009 10:37

Dimon, do I have to uninstall the old version of MYDAC before installing the new one? If so, do I uninstall the components through the rad studio 2009 IDE or through control panel? My OS is Vista.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 03 Sep 2009 12:10

I should uninstall the MyDAC components through Control Panel.

Post Reply