Re: Help connect in aubit4gl

Mike Aubury <[email protected]>
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAGAq4WEGpohrXEGRf3YZX+gz32j3ovmJrcCsRuOiqR_r_nQchg@mail.gmail.com>
Ok, i've just added code to CVS which should allow this..

You can now run things like :
MAIN
DEFINE lv_c1, lv_c2 INTEGER
DEFINE lv_a INTEGER

CONNECT TO test AS con1 USER "aubit4gl" USING "somepassword"
DELETE FROM testtab
INSERT INTO testtab VALUES("1234")


CONNECT TO test1 AS con2 USER "aubit4gl" USING "somepassword"

DELETE FROM testtab

USE SESSION con1 FOR SELECT COUNT(*) INTO lv_c1 FROM testtab;
USE SESSION con2 FOR SELECT COUNT(*) INTO lv_c2 FROM testtab;

DISPLAY lv_c1
DISPLAY lv_c2



SET SESSION TO con1
DECLARE c1 CURSOR FOR SELECT * INTO lv_a FROM testtab
FOREACH c1
        DISPLAY "INSERTING : ", lv_a
        Use SESSION con2 FOR INSERT INTO testtab VALUES (lv_a)
END FOREACH

USE SESSION con1 FOR SELECT COUNT(*) INTO lv_c1 FROM testtab;
USE SESSION con2 FOR SELECT COUNT(*) INTO lv_c2 FROM testtab;
DISPLAY lv_c1
DISPLAY lv_c2

END MAIN


[ Here - i have 2 databases: test & test1 - and I'm inserting into one,
then reading that to insert into the other ]

Its obviously just a first draft - so treat with caution and report any
bugs...
If you need a binary or source tarball - let me know and I'll get one
together over the weekend.


I *think* the databases will still need to be on the same machine just for
now if you want to do it "neatly" - but, the connection just
uses "MYSQL_SERVER" from the environment - so you should be able to set
that using

CALL aclfgl_setenv("MYSQL_SERVER","newserver")

in between CONNECTs


On 8 January 2015 at 03:46, Herman Carrion L. <[email protected]>
wrote:

> Hi everyone...and happy  new year.
>
> Mi code:
>
> -----------------------------------------------------------------------------------------
>   1 DATABASE prueba
>   2 MAIN
>   3
>   4 DEFINE base1    CHAR(60)
>   5 DEFINE base2    CHAR(60)
>   6 DEFINE user1    CHAR(60)
>   7 DEFINE user2    CHAR(60)
>   8 DEFINE pass1    CHAR(60)
>   9 DEFINE pass2    CHAR(60)
>  10
>  11 LET base1="prueba" CLIPPED
>  12 LET base2="prueba_policentro" CLIPPED
>  13 LET user1="root" CLIPPED
>  14 LET user2="root" CLIPPED
>  15 LET pass1="fender" CLIPPED
>  16 LET pass2="fender" CLIPPED
>  17
>  18 CONNECT TO base1 AS con1 USER user1 USING pass1
>  19
>  20 SELECT * FROM usuarios
>  21         WHERE codigo="bodegaop"
>  22
>  23 END MAIN
>  24
>
> ------------------------------------------------------------------------------------------
>
> Compilation=Ok.
>
> Execution: ERROR.
>
> Err:Program ./k stopped at 'k.4gl', line number 20.
> Error status number -30156.
> Sessions not implemented.
>
> 4gl function call stack :
>     MAIN
>
> my database is mysql with native connection.
>
>  Thanks for the advice.
>
> Herman Carrion L.
> Guayaquil - Ecuador
> South America
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming! The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net
> _______________________________________________
> Aubit4gl-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
>
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net

_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.