Checking in Terminal, the file command reports the content like this: The plugin builds now and we got a new plugin file for both CPU architectures. But I had an idea and made myself a dummy amework, which exports the right functions and is built for both Intel and Apple Silicon. The work went nice until we came to linking the project and amework was Intel only. MBS FileMaker Plugin for Apple Silicon Last weekend I had a funny idea to continue the preparation on supporting Apple Silicon for the MBS FileMaker Plugin. But since this is working, converting a Xojo example from SQLiteDatabase to SQLDatabaseMBS is only a handful of lines to change. For example we may need to tune the auto generated SQL for some database types. This new feature may need some testing and tuning. InsertRecord(TableName as String, Record as Dictionary) UpdateRecord(TableName as String, Record as Dictionary, Keys as Dictionary) Otherwise you can collect record data via dictionary and use our InsertRecord/ UpdateRecord methods with those dictionaries:
#XOJO LOOP THROUGH CONTAINERCONTROLS UPDATE#
If you like to get a more detailed update statement or control how it is build, you may just use prepared statement with the UPDATE statement you like to use. The call may also fail if we can't identify a key field. For examples if you used AS in the SQL to rename a field or an expression, the update statement will fail with unrecognized field name. If something goes wrong now, we return an error. Data type is either given by Xojo as parameter to the plugin or we pick it from the matching field. We fill in the key values from the old values in the RecordSet and fill the new values as passed by Xojo. But if your primary key is not part of the record set and no other unique key was selected, we find multiple records and return an error. This should always find exactly one record. To be sure we only edit one record, we make a SELECT query to count the records matching the given keys. You may notice that we don't need to query the schema this way, which is great when you have 15 different target databases. This usually may include ID fields and UUID fields.
What is left will be a few string and integer fields, which are the invariants to identify the record. Also we count all numeric, double, interval, BLob, CLob and date/time fields in this category. We separate the fields into two categories: Fields you changed are data fields. Please only assign data fields and never the primary key fields as that helps us distinguish the fields.įinally you call the Update method. Next you may assign values to some fields in the RecordSet. We currently don't do any record locking there, but could maybe in future.
If you call Edit on the RecordSet, we just check the pre-conditions. As we use it later with a record set, the SQL has already be parsed and accepted by the database server, so it is always valid SQL. Let us know if you can find some SQL, where it doesn't work as expected. The function is available for you to try as FindTableName in SQLGlobalsMBS. That means we won't allow you to edit the record set from such a statement. If the SQL is complex, has some JOIN operator or references multiple tables, we stop and return an empty string. Let me explain how it works now: First we got a little SQL parser to find the table name in a SQL statement. Recently we got some ideas, so we started to implement them.
#XOJO LOOP THROUGH CONTAINERCONTROLS HOW TO#
Well, till now we didn't have an idea how to do this well for all database types. Edit and Update for SQLDatabaseMBS class For years we had requests to add support for Edit and Update functions in the RecordSet to our own classes, SQLDatabaseMBS and SQLConnectionMBS.