We have just released a set of slides introducing ORM, SOA, REST, JSON, MVC, MVVM, SOLID, Mocks/Stubs, Domain-Driven Design concepts with Delphi, and showing some sample code using our Open Source mORMot framework. You can follow the public link on Google Drive! This is a great opportunity to […]
2014-04-18
Introducing mORMot's architecture and design principles
2014-04-18. Open Source › mORMot Framework
2014-04-07
JavaScript support in mORMot via SpiderMonkey
2014-04-07. Open Source › mORMot Framework
As we already
stated, we finished the first step of integration of the
SpiderMonkey engine to our mORMot framework.
Version 1.8.5 of the library is already integrated, and latest official
revision will be soon merged,
thanks to mpv's great contribution.
It can be seen as stable, since it is already used on production site to serve more than
1,000,000 requests per day.

You can now easily uses JavaScript on both client and server side.
On server side, mORMot's implementation offers an unique concept, i.e.
true multi-threading,
which is IMHO a huge enhancement when compared to the regular node.js mono-threaded implementation,
and its callback hell.
In fact, node.js official marketing states its non-blocking scheme is
a plus. It allows to define a HTTP server in a few lines, but huge server
applications need JavaScript experts not to sink into a state a
disgrace.
2014-03-29
Enhanced and fixed late-binding of variants for Delphi XE2 and up
2014-03-29. Open Source › mORMot Framework
For several units of our framework, we allow late-binding of data
values, using a variant and direct named access to
properties:
- In SynCommons, we defined our TDocVariant custom
variant type, able to store any JSON/BSON document-based content;
- In SynBigTable, we use the TSynTableVariantType custom
variant type, as defined in SynCommons;
- In SynDB, we defined a TSQLDBRowVariantType, ready to
access any column of a RDBMS data result set row;
- In mORMot, we allow access to TSQLTableRowVariantType
column values.
It's a very convenient way of accessing result rows values. Code is still very readable, and safe at the same time.
For instance, we can write:
var V: variant;
...
TDocVariant.New(V); // or slightly slower V := TDocVariant.New;
V.name := 'John';
V.year := 1972;
// now V contains {"name":"john","year":1982}
This is just another implementation of KISS design in our framework.

Since Delphi XE2, some modifications were introduced to the official
DispInvoke() RTL implementation:
- A new
varUStrArgkind of parameter has been defined, which will allow to transmitUnicodeStringproperty values; - All text property values would be transmitted as BSTR
/ WideString / varOleStrvariants to the invoked variant type; - All textual property names were normalized to be in UPPERCASE.
Those modifications are worth considering...
And we may have discovered two regressions: one about speed, and the other
about an unexpected logic bug...
2014-03-13
ORM mapping class fields to external table columns
2014-03-13. Open Source › mORMot Framework
When working with an ORM, you have mainly two possibilites:
- Start from scratch, i.e. write your classes and let the ORM creates all the database structure - it is also named "code-first";
- From an existing database, you define in your model how your classes map the existing database structure - this is "database-first".
We have just finalized ORM external table field mapping in mORMot,
using e.g.
aModel.Props[aExternalClass].ExternalDB.MapField(..)
See
this last commit.

So you can write e.g.
fProperties := TSQLDBSQLite3ConnectionProperties.Create(
SQLITE_MEMORY_DATABASE_NAME,'','','');
VirtualTableExternalRegister(fExternalModel,
TSQLRecordPeopleExt,fProperties,'PeopleExternal');
fExternalModel.Props[TSQLRecordPeopleExt].ExternalDB.
MapField('ID','Key').
MapField('YearOfDeath','YOD');
Then you use your TSQLRecordPeopleExt table as usual from
Delphi code, with ID and YearOfDeath fields:
- The "internal"
TSQLRecordclass will be stored within the PeopleExternal external table; - The "internal"
TSQLRecord.IDfield will be an external "Key: INTEGER" column; - The "internal"
TSQLRecord.YearOfDeathfield will be an external "YOD: BIGINT" column; - Other internal published properties will be mapped by default with the same name to external column.
2014-03-07
Support of MySQL, DB2 and PostgreSQL
2014-03-07. Open Source › mORMot Framework
We just tested, benchmarked and validated Oracle MySQL, IBM DB2 and PostgreSQL support for our SynDB
database classes and the mORMot's ORM core.
This article will also show all updated results, including our newly introduced multi-value
INSERT statement generations, which speed up a lot BATCH insertion.
Stay tuned!

Purpose here is not to say that one library or database is better or faster than another, but publish a snapshot of mORMot persistence layer abilities, depending on each access library.
In this timing, we do not benchmark only the "pure" SQL/DB layer access
(SynDB units), but the whole Client-Server ORM of our
framework.
Process below includes all aspects of our ORM:
- Access via high level CRUD methods (Add/Update/Delete/Retrieve, either per-object or in BATCH mode);
- Read and write access of
TSQLRecordinstances, via optimized RTTI; - JSON marshaling of all values (ready to be transmitted over a network);
- REST routing, with security, logging and statistic;
- Virtual cross-database layer using its SQLite3 kernel;
- SQL on-the-fly generation and translation (in virtual mode);
- Access to the database engines via several libraries or providers.
In those tests, we just bypassed the communication layer, since
TSQLRestClient and TSQLRestServer are run in-process,
in the same thread - as a TSQLRestServerDB instance. So you have
here some raw performance testimony of our framework's ORM and RESTful core,
and may expect good scaling abilities when running on high-end hardware, over a
network.
On a recent notebook computer (Core i7 and SSD drive), depending on the back-end database interfaced, mORMot excels in speed, as will show the following benchmark:
- You can persist up to 570,000 objects per second, or retrieve 870,000 objects per second (for our pure Delphi in-memory engine);
- When data is retrieved from server or client 38, you can read more than 900,000 objects per second, whatever the database back-end is;
- With a high-performance database like Oracle, and our direct access classes, you can write 70,000 (via array binding) and read 160,000 objects per second, over a 100 MB network;
- When using alternate database access libraries (e.g. Zeos, or
DB.pasbased classes), speed is lower (even if comparable for DB2, MS SQL, PostgreSQL, MySQL) but still enough for most work, due to some optimizations in the mORMot code (e.g. caching of prepared statements, SQL multi-values insertion, direct export to/from JSON, SQlite3 virtual mode design, avoid most temporary memory allocation...).
Difficult to find a faster ORM, I suspect.
2014-03-03
ORM enhanced for BATCH insert
2014-03-03. Open Source › mORMot Framework
We just committed some nice features to the ORM kernel, and SynDB* classes of our mORMot framework.
During BATCH
insertion, the ORM is able to generate some optimized SQL statements,
depending on the target database, to send several rows of data at once.
It induces a noticeable speed increase when saving several objects into an
external database.

This feature is available for SQlite3 (3.7.11 and later),
MySQL, PostgreSQL, MS SQL Server (2008
and up), Oracle, Firebird and NexusDB.
Since it is working at SQL level, it is available for all supported access
libraries, e.g. ODBC, OleDB, Zeos/ZDBC, UniDAC,
FireDAC.
It means that even properties not implementing array binding (like OleDB,
Zeos or UniDAC) are able to have a huge boost at data insertion,
ready to compete with the
(until now) more optimized libraries.
2014-02-28
Are NoSQL databases ACID?
2014-02-28. Open Source › mORMot Framework
One of the main features you may miss when discovering NoSQL ("Not-Only SQL"?) databases, coming from a RDBMS background, is ACID.
ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties that guarantee that database transactions are processed reliably. In the context of databases, a single logical operation on the data is called a transaction. For example, a transfer of funds from one bank account to another, even involving multiple changes such as debiting one account and crediting another, is a single transaction. (Wikipedia)
But are there any ACID NoSQL database?
Please ensure you read the Martin Fowler
introduction about NoSQL databases.
And the corresponding
video.

First of all, we can distinguish two types of NoSQL databases:
- Aggregate-oriented databases;
- Graph-oriented databases (e.g. Neo4J).
By design, most Graph-oriented databases are ACID!
This is a first good point.
Then, what about the other type?
In Aggregate-oriented databases, we can identify three sub-types:
- Document-based NoSQL databases (e.g. MongoDB, CouchDB);
- Key/Value NoSQL databases (e.g. Redis);
- Column family NoSQL databases (e.g. Cassandra).
It may be schema-less, blob-stored, column-driven, but it is always some set of values bound together to be persisted.
This set of values define a particular state of one entity, in a given model.
Which we may call Aggregate.
Think free as in free speech, not free beer
2014-02-28. Open Source
After more than 5 years of opening some huge part of Delphi code base, just my two cents.
Free software means free as a bird.
In practice, most Open Source "consumers" focus on free as a free
beer...
This is a reality, especially for "niche" projects like developing libraries
for Delphi.

Here are some thoughts from my little experiment with mORMot.
If you ask what Open Source for libraries mean, it may help you!
« previous entries - page 22 of 52 - next entries »
