Wednesday, October 11, 2017

LINQ using two tables on Managed Dbf

A demonstration of querying two Managed Dbf tables using LINQ to find all sales record of a particular customer and display it's Sales Invoice No. and  Amount.

Managed Dbf can do it in the good old fashion but effective way, an xBase style of gathering information without using a querying language.

Managed Dbf Methods and Properties are almost identical to Visual FoxPro Commands.

Thursday, October 5, 2017

LINQ saved my day!

LINQ saved my day by writing my own OLEDB and OBDC driver for Managed Dbf, I'm in the process of learning, researching and studying how to build my own OLEDB like VFPOLEDB to support querying language until I read  Why LINQ beats SQL .

Now, I don't have to go through the lengthy process of creating my own Data Provider or to load any OBDC Driver or using any ADO/NET data connector for Managed Dbf  just to have a querying language to gather information, LINQ now can be use to query data in Managed Dbf  but it's still in early stage. I Quoted from LINQPad creator "LINQ is in most cases a significantly more productive querying language than SQL."

I wanted Managed Dbf to be free of any third party library or driver with only minimum set of .Net Assemblies, by using LINQ which is a major part .NET Framework since .NET 3.5 uses an SQL-like syntax to make a query expressions.

Managed Dbf using LINQ in action  :

XBase / Clipper / Visual FoxPro Equivalent Commands  :

Friday, June 16, 2017

Lambda Expression for Deletion

Lambda expression, it's an anonymous function it can use to create delegates or expression tree, by using lambda conditions, we can write local functions that can be passed as parameters. Let's see it in action for deleting a records using Lambda expression for Where and While condition in Managed Dbf and it's equivalent xBase/Clipper/Vfp code.

Delete all customers from USA country and state of New York or California.


Solution 1 :  ( Slowest )

This is the slowest solution, iterating to all records and check if we meet the condition criteria before
marking the record for deletion.

Equivalent xBase/Clipper/VFP commands :


Solution 2 :  ( Slow )

This is slow but not the slowest solution, any method using *All in Managed Dbf are using disk caching for reading all records and this solution is only using single line of code and lambda expression condition for deleting a record.

Equivalent xBase/Clipper/Vfp commands :


Solution 3 :  ( Fast )

This is a fast solution because it uses index file to searching country and continue reading WHILE the country still match the search and test for state conditions before marking the record for deletion.

Equivalent xBase/Clipper/Vfp commands :


Solution 4 :  ( Fastest )

This is a fastest solution because it uses index file for searching country+state and continue reading WHILE the search condition is true before marking the record for deletion.

Equivalent xBase/Clipper/Vfp commands :

Saturday, April 29, 2017

What's wrong extending the life of Dbf file format : - D

I already know what's your thinking... You may say maybe I'm just reinventing the wheel. Why not design my own programming languages and write my own compilers for them? Or even better create my own operating system from scratch? 😄 because there are fricking hundreds if not thousands of available database projects out there in the wild which are ready to use and battle tested.

Whenever you can’t find some information you are looking for a certain applications, or a good software library but lacking some option and features you need, why not create your own? If you have the luxury of time and you believe you can do it, why bother using a third-party software or the work of others.

Alright, aside from the pleasure I get writing codes, fulfilling my enthusiasm for extending the life of DBF file format and staying close to the xBase commands in terms of data manipulation; has given me a great deal of enjoyment particularly in the learning process, these already are greenlight indications that I should keep continuing what I’m doing.

Imagine without any heavy weight database engine or anything to be installed on ones computer but yet you can create a fast, multiuser and easy record manipulation even in billions of records.

C# Using Managed Dbf :

// Create table free instance
var _CUSTOMER = new MDb.Table();

// Open Dbf file in shared mode and read-only
_CUSTOMER.File.Open( @"\\MyServer\Fileman\Customer.Dbf",
                                       TableShare.Shared, TableAccess.ReadOnly, TableMaxSize.MaxOf16G );

// Set sort order by country + state


Visual FoxPro/xBase Equivalent commands :




What's has been extended so far  :

* Managed Dbf can open different types of DBF file format.
     - Can open Dbf file format even with unsupported field type.

* Extended the 2GIG limitation on table size.
     - The Dbf table is still compatible if the size less than 2GIG

* Extended the field name length to 32 default value is 10
     - The Dbf table is still compatible, Managed Dbf will only created
       an extension file to store some extended information.

* Not relying on CDX Index file, Managed Dbf uses ZDX for Index file
    - Since Managed is not using and abandoning VFP Runtime, VFPOLEBD, ADO/NET, ODBC
      I created my own custom index file and called it ZDX file : - D