mmsql_pm.bas: mmsql 1.2 with the few lines changed that the PicoMite needs
==========================================================================

Made only to test the PicoMite's SQL command with mmsql and its test suite;
everything else is mmsql 1.2 as Matthias released it. On a PicoComputer 3
with this firmware the test suite gives: part 1 24 of 24, part 2 27 of 27,
fail 0, mt_dump.sql 61 statement(s) OK, mt_2.sql 32 OK.

The differences between the CMM2 and the PicoMite that it meets:

1. OPTION CRLF CR (line 26): the PicoMite allows OPTION CRLF only at the
   command prompt ("Invalid in a program"). Left out.
2. MM.INFO(HARDWARE) (line 119): the PicoMite has none ("Invalid syntax").
   MS_g2% = 1: a PicoComputer 3 has PSRAM, as a G2 has more memory.
3. MM.INFO(MODE) (line 767, .set screen): the PicoMite has none. The MODE
   at the start is taken as 1.
4. MM.INFO(FILESIZE f$) gives 0 on the PicoMite for a file that is not
   there (and for a folder), where the CMM2 gives -1 (and -2). Every
   MM.INFO(FILESIZE ...) is FSize%(...), a function at the end that gives
   -1 for a missing file (a folder is -1 too).

Two more that the README's instructions meet:
- CHDIR cannot change the drive on the PicoMite: DRIVE "B:" : CHDIR "sql".
- A database must be on B: (SD card) or C: (USB drive), not on A: (the
  flash), so the test suite goes in B:/sql.

The unified diff follows.

--- mmsql.bas (1.2)
+++ mmsql_pm.bas
@@ -1 +1,4 @@
+' mmsql_pm.bas: homa's mmsql 1.2 with the changes the PicoMite needs, to test its SQL command (not for release):
+' OPTION CRLF CR left out, MS_g2% = 1, no MM.INFO(MODE), and FSize%() for MM.INFO(FILESIZE): -1 for a missing file
+' (the PicoMite gives 0 for a missing file or a folder; the CMM2 -1 and -2)
 ' ============================================================
@@ -25,3 +28,3 @@
 ENDIF
-OPTION CRLF CR                 ' Enter gives CR only (ends with the program)
+' OPTION CRLF CR               ' PicoMite copy: OPTION CRLF is only allowed at the prompt
 
@@ -118,3 +121,3 @@
 DIM MS_db$ = ""                ' open database ("" = none)
-DIM MS_g2% = (MM.INFO(HARDWARE) = 0)
+DIM MS_g2% = 1                 ' PicoMite copy: no MM.INFO(HARDWARE); a PC3 has PSRAM, as a G2
 DIM MS_Gen$ = "G1"             ' G1, G2, G3 (G2/G3 under OPTION PICOMITE)
@@ -766,3 +769,3 @@
   LOCAL e%
-  IF CLI_ScrChg% = 0 THEN CLI_Scr0! = MM.INFO(MODE) : CLI_Font0% = MM.INFO(FONT)
+  IF CLI_ScrChg% = 0 THEN CLI_Scr0! = 1 : CLI_Font0% = MM.INFO(FONT)  ' PicoMite copy: no MM.INFO(MODE)
   ON ERROR CLEAR
@@ -2505,3 +2508,3 @@
   FOR i% = 0 TO n% - 1
-    sz% = MM.INFO(FILESIZE d$ + MS_L$(i%))
+    sz% = FSize%(d$ + MS_L$(i%))
     PRINT CLI_Fit$(CLI_Show$(MS_L$(i%)), w%); "  "; CLI_Fit$(CLI_Size$(sz%), 9); " "; LEFT$(MM.INFO$(MODIFIED d$ + MS_L$(i%)), 16)
@@ -2527,4 +2530,4 @@
   IF INSTR(f$, "*") OR INSTR(f$, "?") THEN PRINT "No wildcards - one file at a time." : EXIT SUB
-  IF MM.INFO(FILESIZE f$) = -2 THEN PRINT "That is a folder." : EXIT SUB
-  IF MM.INFO(FILESIZE f$) < 0 THEN PRINT "File not found: "; f$ : EXIT SUB
+  IF FSize%(f$) = -2 THEN PRINT "That is a folder." : EXIT SUB
+  IF FSize%(f$) < 0 THEN PRINT "File not found: "; f$ : EXIT SUB
   IF MS_db$ <> "" AND UCASE$(CLI_File$(f$)) = UCASE$(CLI_File$(MS_db$)) THEN
@@ -2532,3 +2535,3 @@
   ENDIF
-  IF CLI_YN%("Delete " + f$ + " (" + CLI_Size$(MM.INFO(FILESIZE f$)) + ")?") = 0 THEN PRINT "Not deleted." : EXIT SUB
+  IF CLI_YN%("Delete " + f$ + " (" + CLI_Size$(FSize%(f$)) + ")?") = 0 THEN PRINT "Not deleted." : EXIT SUB
   ON ERROR CLEAR
@@ -2540,3 +2543,3 @@
   j$ = f$ + "-journal"
-  IF MM.INFO(FILESIZE j$) >= 0 THEN
+  IF FSize%(j$) >= 0 THEN
     IF CLI_YN%("Also delete " + j$ + " (left from an unfinished transaction)?") THEN
@@ -2698,3 +2701,3 @@
   IF h$ <> "SQLite format 3" + CHR$(0) THEN PRINT "Not an SQLite database: "; f$ : EXIT SUB
-  PRINT "Replace "; d$; " ("; CLI_Size$(MM.INFO(FILESIZE d$)); ") with "; f$; " ("; CLI_Size$(MM.INFO(FILESIZE f$)); ")?"
+  PRINT "Replace "; d$; " ("; CLI_Size$(FSize%(d$)); ") with "; f$; " ("; CLI_Size$(FSize%(f$)); ")?"
   IF CLI_YN%("The present content of " + CLI_File$(d$) + " is lost.") = 0 THEN PRINT "Not restored." : EXIT SUB
@@ -2707,3 +2710,3 @@
   IF ok% THEN
-    IF MM.INFO(FILESIZE t$) <> MM.INFO(FILESIZE f$) THEN ok% = 0
+    IF FSize%(t$) <> FSize%(f$) THEN ok% = 0
   ENDIF
@@ -2716,3 +2719,3 @@
     ON ERROR SKIP
-    IF MM.INFO(FILESIZE d$ + "-journal") >= 0 THEN KILL d$ + "-journal"
+    IF FSize%(d$ + "-journal") >= 0 THEN KILL d$ + "-journal"
     KILL d$
@@ -5119 +5122,6 @@
 END FUNCTION
+
+' PicoMite copy: MM.INFO(FILESIZE f$) as the CMM2 gives it for a missing file (-1); a folder is -1 too here
+FUNCTION FSize%(f$)
+  IF MM.INFO(EXISTS FILE f$) THEN FSize% = MM.INFO(FILESIZE f$) ELSE FSize% = -1
+END FUNCTION
