Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Newbie question on MySQL RDD

334 views
Skip to first unread message

petert

unread,
Apr 7, 2011, 10:24:48 PM4/7/11
to multisoft FlagShip
Using the MYSQL RDD, I open the database
Then I create a temporary DBF file, using MYQTODBF
How do I get the temporary file name into the USE statement, so I can
then browse it using BROWSE() or DBEDIT?

Thanks for you help.

Cheers,

Peter

-------------------------------------------------------------------------------------
MYDBOPEN("test", "localhost", "root", "melbrooks")
? "Connection opened"
BEGIN SEQUENCE
? MYFILENAME:=MYQTODBF("select * from person")

?"command executed"

USE MYFILENAME SHARED
DbEdit() // browse database
RECOVER
? "recover 4 could not execute select to dbf "
END
---------------------------------------------------------------------------------------

petert

unread,
Apr 10, 2011, 6:16:30 PM4/10/11
to multisoft FlagShip
Great example. Thanks. It works fine.

Question, with this RDD, using the DBedit, or Browse, what is the
recommended way of allowing a user to edit/change a record?

Do you look for a change event on the dbedit object?
Or do you look for a key press for editing and then give the user a
edit screen?

Again, thank you for the help.

Peter

On Apr 8, 4:56 am, Paul <supp...@flagship.de> wrote:
> Would strongly suggest to check success. There is also semantic error
> in the USE command. See fixed example below.
>         local ok, myFileName
>         ok := MYDBOPEN("test", "localhost", "root", "melbrooks")
>         if !ok
>            alert("Could not open mySQL database 'test'")
>            quit
>         endif
>         BEGIN SEQUENCE
>           MYFILENAME:=MYQTODBF("select * from person")
>           if empty(myFileName)
>              BREAK
>           endif
>           ?"command executed"
>           USE (MYFILENAME) SHARED   // note parentheses
>           if !used()
>              alert("Could not open resulting database " + myFileName)
>              quit
>           endif
>           if reccount() == 0
>              alert("Note: The resulting database " + myFileName + " is
> empty")
>           endif
>           DbEdit()         // browse database
>         RECOVER
>           ? "recover (line#" + ltrim(procline()) + ") could not
> execute select to dbf"
>           wait
>         END
>
> You also may compile the mySQL RDD source and your application with
> debugger (-d compiler switch) and then step thru.
>
> Hope this helps you.
> Paul
Message has been deleted

Paul

unread,
Apr 9, 2018, 10:19:52 AM4/9/18
to multisoft...@googlegroups.com
Would strongly suggest to check success. There is also semantic error
in the USE command. See fixed example below.

On Apr 8, 4:24 am, petert <pe...@jumpgatetech.com> wrote:
        local ok, myFileName
        ok := MYDBOPEN("test", "localhost", "root", "melbrooks")
        if !ok
           alert("Could not open mySQL database 'test'")
           quit
        endif
        BEGIN SEQUENCE
          MYFILENAME:=MYQTODBF("select * from person")
          if empty(myFileName)
             BREAK
          endif
          ?"command executed"
          USE (MYFILENAME) SHARED   // note parentheses
          if !used()
             alert("Could not open resulting database " + myFileName)
             quit
          endif
          if reccount() == 0
             alert("Note: The resulting database " + myFileName + " is empty")
          endif
          DbEdit()         // browse database
        RECOVER
          ? "recover (line#" + ltrim(procline()) + ") could not execute select to dbf"
          wait
        END

Paul

unread,
Feb 11, 2017, 11:41:08 AM2/11/17
to multisoft...@googlegroups.com


On Monday, April 11, 2011 12:16:30 AM UTC+2, petert wrote:
Great example. Thanks. It works fine.

Question, with this RDD, using the DBedit,  or Browse, what is the
recommended way of allowing a user to edit/change a record?

Do you look for a change event on the dbedit object?
Or do you look for a key press for editing and then give the user a
edit screen?

In the FlagShip manual, both your questions are described in FUN.DbEdit(). On needs, you also may study or modify the behavior by yourself, since DbEdit() is available in source code in FlagShip's ...\system folder. This default behavior however handles the underlaying .dbf and hence will change only the temporary copy of your extract/select'ed mySQL records. To modify the mySQL database, add your own UDF to  DbEdit() to handle mySQL via FmySQL, see details and study examples in the documentation of the FmySQL RDD.
 
Paul
Reply all
Reply to author
Forward
0 new messages