Archive for July 4, 2014

Smart Pascal dataset

July 4, 2014 Leave a comment

As I have mentioned earlier in my posts, Smart Pascal have no default database framework. Smart Mobile Studio (which is the #1 compiler for Smart Pascal) have wrappers for all the various browser database engines, so using them is greatly simplified for Smart programmers — but there are no such things as datasets, field objects and any of the standard stuff we are used to under Delphi or Freepascal.

Well, today I had enough and started writing the basics!

The cool part is that dealing with data is, believe it or not, much easier in Smart Pascal than under native Delphi. For instance, a row of data (a data packet) is stored in JSON format, and JavaScript’s live prototype nature makes it extremely elegant to read, write and update a large collection of packets. Being able to read, write and update data from your server or the cloud is, to my surprise.. easy as apple pie!

Screendump of my vmware for smart pascal

Screendump of my vmware for smart pascal

For instance, what is a record? Answer: It is a collection of persistent, named field objects. Under JavaScript that can be easily represented as a JSON object – or “array of named variants” in Object Pascal terms. So you get the naming of data free of charge, because that’s how JavaScript works. And you also get the serialization of data free of charge, because that’s how JSON works. So roughly 25% of the work required by “native” languages in order to represent a dataset – is already done. Pretty cool huh? 🙂

And yes, this code will work under any Smart Pascal compliant system. DWScript, Smart Mobile Studio and Quartex Pascal. But it will ship first and foremost with Smart Mobile Studio.

And now for something completely different

Bored? Check out the TV series “Silicon Valley” from HBO, I laughed so hard I nearly broke a rib. The series if a complete rip-off from the british “IT crowd” (even the music), but it reminded me so much of Borland vs. Microsoft that I nearly fell out of my couch 😀

Silicon Valley

Phillipe Kahn on drugs 🙂