New topic: binary file locking/unlocking ?
<http://forums.realsoftware.com/viewtopic.php?t=15498> Page 1 of 1 [ 8 posts ] Previous topic | Next topic Author Message Rod Post subject: binary file locking/unlocking ?Posted: Tue Aug 14, 2007 8:40 pm Joined: Sun Apr 23, 2006 10:17 am Posts: 47 Location: Ontario, Canada Aaron We're converting one of our major applications from VB in order to evaluate RB. This Win XP application makes extensive use of binary files that are shared on a network by many applications written in various languages. All files operate in sharable mode, but in order to prevent data corruption they are temporarily locked by the applications during updates. We need something equivalent to VB's file Lock/Unlock statements, but can't find anything like them in the RB manuals. However, it seems we can test a FolderItems's locked status. Are we missing something. We hope to make our packages cross-platform, so would prefer not to fall back on OS API features. We want everything to be written in RB, as we do now with VB. Thanks Top Swedish Brick Post subject: Posted: Wed Aug 15, 2007 10:34 am Joined: Tue Jul 17, 2007 10:11 am Posts: 41 Location: Southern California USA As a suggestion, you may want to consider creating and using a lock table in a database so that your converted RB and other apps can refer to it and respect any locks on the binary files. Years ago, our main product also used shared binary files, but we made the decision to use a database instead. That decision was one of the best choices we ever made, though I will admit that it took some time to migrate. Is there any way you can move all of these apps to a database instead of using binary files? Top Aaron Ballman Post subject: Posted: Wed Aug 15, 2007 11:05 am Joined: Wed Sep 28, 2005 8:39 am Posts: 9340 Location: St Augusta, MN Unfortunately, you will probably have to fall back onto OS APIs to do this as REALbasic does not expose a Lock/Unlock construct for file access. What's more, when you open a file in REALbasic, you have no control over the share mode of the file (unless you open the file yourself using OS APIs). We only open files for read sharing on Windows, not write or delete sharing. _________________ Check out Ramblings on REALbasic, the hottest book on REALbasic you'll ever encounter! Top Rod Post subject: Posted: Wed Aug 15, 2007 1:04 pm Joined: Sun Apr 23, 2006 10:17 am Posts: 47 Location: Ontario, Canada Thanks guys! Our proprietary file system has been in use for over 25 years, from DOS to WinXP - on single user systems and 50-station networks. Moving to a database environment would be a formidable task for both us and our customers. However, we have a temporary fix that we put together an hour ago. We wrote a DLL in a few lines of Power Basic code that does the physical file I/O. So instead of using FolderItems and Binary Streams in our file classes, we just call the DLL using the appropriate PB file number. But I'm truly surprised and disappointed that something as fundamental as file sharing and file locking is missing from a modern OOP language like RB. After all, not all multi-user applications require databases. My aim is to move us from VB, MASM, and COBOL to a single OOP language, without getting us into major re-writes. And for now the DLL will work, but it creates problems for our long-term cross-platform plans. Top Aaron Ballman Post subject: Posted: Wed Aug 15, 2007 1:11 pm Joined: Wed Sep 28, 2005 8:39 am Posts: 9340 Location: St Augusta, MN If you want cross-platform file locking functionality, then you can file a feature request for it. However, it's a *very* specific need to be able to lock files (or sections of files), and so it seems like it's more appropriate to use plugins or declares to accomplish it. _________________ Check out Ramblings on REALbasic, the hottest book on REALbasic you'll ever encounter! Top Rod Post subject: Posted: Wed Aug 15, 2007 4:35 pm Joined: Sun Apr 23, 2006 10:17 am Posts: 47 Location: Ontario, Canada To me, file sharing/locking doesn't seem any more specific than most features in RB's feature set. I suspect there are many thousands of VB apps out there that make use of file sharing/locking, and the lack of it could be a major impediment to shops converting from VB to RB. Top Zhu Post subject: Posted: Thu Aug 16, 2007 10:07 am Joined: Sat Oct 01, 2005 5:13 am Posts: 599 Location: Shanghai, China Rod wrote:To me, file sharing/locking doesn't seem any more specific than most features in RB's feature set. I suspect there are many thousands of VB apps out there that make use of file sharing/locking, and the lack of it could be a major impediment to shops converting from VB to RB. OK, so you can go to http://www.realsoftware.com/feedback to submit a feature requested. _________________ ToringoCrypto Plugin - RSA (128 to 1024), DES/3DES/TDEA, etc. ToringoDRMInfo Plugin - Uniquely identify computers via hardware information. ãMy Company: Are you looking for someone to help you work on your projects?ã ãMy Blogã Top rebrandsoftware Post subject: Re: binary file locking/unlocking ?Posted: Tue Feb 09, 2010 2:40 pm Joined: Wed Mar 25, 2009 4:30 pm Posts: 35 Location: Alexandria, VA, USA Check out my link at the bottom of this thread which reproduces the Lock/Unlock feature using the Windows API: viewtopic.php?f=6&t=30869&start=0&st=0&sk=t&sd=a Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 8 posts ]
-- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
