Jump to content

Search the Community

Showing results for tags 'database'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

There are no results to display.

Forums

  • Welcome to Smart Mobile Studio
    • News and Information
    • Pre-Sales Questions
    • Smart In the Media
    • Smart Contests
    • Meta
  • Smart Mobile Studio Discussion
    • General
    • IDE
    • RTL
    • Code
    • Client Server
    • Platform
    • Graphics
    • Deployment
    • Suggestion box
  • Smart Mobile Studio support
    • Support
    • Bug report
  • General Discussion
    • Pascal
    • Delphi
    • Javascript
    • HTML/HTML5
    • CSS
  • Resources
    • Website
    • Download Smart Mobile Studio

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Company name


Position

Found 5 results

  1. lynkfs

    databases and applications

    Two bobs worth of thoughts on the interface between applications and databases. Every business today has its data stored in a number of databases. Whether SQL-based, proprietory, ms Office (Excel anyone ?), Hadoop on Google Cloud or whatever. On the application side apps need access to this data, and more often than not the data they need will reside in more than 1 datastore. The days that every application had its own private database are long gone. Which means we need something inbetween This middleware has the task of translating application requests into database calls, retrieving the data and making it available in some format the application understands. (Not ususally done, it could potentially also work the other way around : external changes to data could result in autonomously firing up of applications to process these changes, or at least put them in a queue for later processing). There are some products available which occupy this space. Conceivably 'ORM's, which talk 'object' on one side and SQL on the other, or products based on GraphQL (a specification opensourced by Facebook which covers some of the above), and possibly other products unknown to me. How would that work in SMS terms Middleware The middleware has to have a 'data'-model at its heart. This can be a traditional data-model, a UML model of sorts, a graph, or some other scheme - as long as it is able to represent data structure and dependencies. Since graphs are my new friends, I'm sticking with that for now. An ubiquitous example is 'the library'. a library ==> has books ==> have author(s) and books ==> have publisher And some variables associated with these nodes : title, ISBN number, publisher etc for books; name, contact info, autobiography details etc. for authors and co-authors. Databases Suppose the current situation of this imaginary library is something like this "Some former regional libraries have been amalgamated into the new current library. However staff at present still has to work with the old separate databases, waiting for a reconciliation effort by the IT-department later this year/cycle/decade". Applications. App-01 is meant to solve this problem. It is also meant to decouple application processing and database management as much as possible. As an example : one of its functions is to display book and author info based on selecting (partial) titles. Such a query call could look something like this { book(title: "*smart*") { ISBN author } } the middleware would reconcile this with its internal graph model, find out where and how to extract the data fields for this query and spawn calls to one or more book databases. These SQL calls would be something like select * from books a, authors b where a.author = b.author and a.title like '%smart%' and the middleware would amalgamate the select cursors into a single result set and return that to App-01, possibly in a format like { book: { 'A Smart Book' { ISBN : '' author: 'Primo┼ż Gabrijelcic' }, 'The Smart Company' { ISBN : 'coming' author: 'Jon Aasenden' } } } I think this would be feasible. The advantages of such an approach / product would be a certain amount of decoupling of dependencies between application and database.
  2. lynkfs

    Database connectivity - 1

    Delphi has a number of database components, which make it pretty easy to connect to external datastores. TDataBase, TTable, TQuery and TDataSource encapsulate database connections, provide access to tables directly or through queries, and provide the links to visual elements. I think it is feasible to construct something similar (and maybe even better) in Smart This post is an exploration on how this could look, proof of concept basically Please feel free to comment It should be possible to connect to a variety of external databases, like MySQL, Oracle etc, as long as they understand ansi-SQL, and to internal datastores based on SQLLite or TDataSet Server connections should at least cover php/ajax and node/sockets There probably should be a set of DB-aware visual components, like TDBEditBox, TDBMemo, TDBCheckBox etc. which make it possible to display and alter data, and maybe also a set of read-only components like TDBLabel for read-only purposes. At this stage these terms only loosely refer to the Delphi component names, and they certainly will not be a straight copy in any way or form. How would this work a) from server to client - data will be accessed through sql-queries (TQuery) or implied queries (TTable) - current data will be stored in TFields, which also store links to visual components on the form b)from client to server - data can be changed by the user using the specialised DB-aware components, but also programmatically (business logic) - all changes to TField-data will auto-propagate back to the database - if possible c) possible further future explorations - it should eventually be possible to auto-generate forms based on query results. F.i. a query like 'select firstname, lastname, gender, age from empl' contains enough information to be able to generate a form with the relevant editboxes, labels etc. - by adding some kind of templating, it should be possible to auto-generate more intricate forms, like forms which can handle master-detail relationships (supplier -> supplier invoices) - looking at formal mapping of relational and object data (orm), to see if it would be worthwhile to delve into that TField Lets start with this non-visual object. TFields are in a way the interface between database and form elements, and as such store current values and the links to visual elements. The key behaviour is that whenever its data changes, an attempt is made to update the underlying database. Data can be changed by the user, or programmatically, and both have the same effect. In the new version of Smart there is a TVariant.watch function built in, which could be used to trigger actions on changes. However this version is in alpha only. Alternatively an eventlistener can be added which fires when the data changes. The following code implements this behaviour type TField = class (TObject) private FHandle: THandle; public Constructor Create; virtual; Procedure Bind(Element : Variant); Procedure ChangeValue(Data: Variant); end; procedure updateDB(value: string); implementation Constructor TField.Create; begin inherited Create; asm function MyField() {}; MyField.prototype.bind = function (element) { this.element = document.getElementById(element); this.data = this.element.value; this.element.addEventListener('change', this, false); }; MyField.prototype.handleEvent = function (event) { switch (event.type) { case "change": this.change(this.element.value); } }; MyField.prototype.change = function (value) { if (this.data !== value) { this.data = value; this.element.value = value; @updateDB(value); }; }; @FHandle = new MyField(); end; end; Procedure TField.Bind(Element : Variant); begin FHandle.bind(Element); end; Procedure TField.ChangeValue(Data: Variant); begin FHandle.change(Data); end; procedure updateDB(value: String); begin ShowMessage('updating field in DB with value : ' + value); end; and can be used like MyField.Bind(W3EditBox1.TagId); //bind the TField to some visual element (W3EditBox1) //when a user types something in this EditBox, and leaves it, the change event fires //which triggers the change function //this works for <input>, <select>, and <textarea> based elements //so EditBox, Memo, CheckBox, RadioBox, ComboBox, ToggleSwitch, datepickers, filepickers etc MyField.ChangeValue('aaaaa'); //or change its value programmatically, which also executes the change procedure Demo project code here The first button binds a TField to an editbox Changing the value and leaving this field (click somewhere else) triggers an update action The second button programmatically changes the TField value which also triggers the update action next post
  3. IElite

    Smart Mobile Studio Grid

    Jon is still plugging away on the RTL Smart Mobile Grid part 3 Smart Mobile Studio Grid 2 Smart Mobile Studio Grid
  4. lynkfs

    Database connectivity

    The usual way to access an external database from a html/js client is through ajax. However this requires server-side scripting (php) to connect to the db-server and echo query results back. The downside among others is the requirement for a separate php server. The other way is to use node.js server side, install a node.js mysql / oracle connector and set up the connection from the client. Downside is that it involves setting up a separate node server Devart (www.devart.com) supplies database connectivity components for delphi, lazarus, free pascal on windows, mac-os, android, ios in 32 and 64 bit versions for all major databases. I've used them from Delphi and they work great. The interesting thing is that some of their products (mydac, dbexpress) are able to connect NATIVELY to external databases, not using additional server side processing or any specific client libraries at all. https://www.devart.com/mydac/ "MyDAC-based DB applications are easy to deploy, do not require installation of other data provider layers (such as BDE or ODBC), and that's why they can work faster than the ones based on standard data connectivity solutions. Moreover, MyDAC provides an additional opportunity to work NATIVELY without involving any client library." This native connectivity is built on tcp/ip Question : would it be possible to do something similar and end up with a native SMS client-dbserver connection not involving any other server side processing or os specific drivers ?
  5. A couple of links for whoever is interested in some simple SMS components : 1) www.lynkfs.com/components/MySQLDB/MySQLDB.pas A cross domain component which takes a SQL query on any existing MySQL database and returns the cursor in both a local Variant and an on the fly generated TDataSet. Superfluous to have both ways implemented, but just for fun Example of use of this component in ..../MySQLDB/TestMySQLDB.sproj How to make a standard memo data-aware : just drag this component and a Memo on a form and connect them as in .../MemoDB/TestMemoDB.sproj Preview in .../MemoDB/www/index.html 2) www.lynkfs.com/components/Accordeon/Accordion.pas A collapsible panel component. Example of use in .../Accordeon/TestAccordeon.sproj Preview in .../Accordeon/www/index.html How to make this component data aware : put this component and the previous one on a form as in .../AccordeonDB/TestAccordeonDB.sproj Preview in .../AccordeonDB/www/index.html Components have been built with the latest beta. The MySQL test database used has just 1 table with some data of just 5 customers. 3) For a next post : TTreeView, TCarousel, TPageControl and TPopUpMenu
×