Re: [fpc-pascal] Connecting to a database from a commandline pascal program
On 16/02/18 16:00, Terry A. Haimann wrote: Hello, I am trying to write a command Line Pascal program to connect to a MySQLdatabase using the ZeosDBO Library. I am sure I have done somethingstupid. I have it now so that it will compile, but it crashes as soon as I tryto modify my TZConnection variable. I have it defined as: MyConnection: TZconnection; And code is defined as: WriteLn('2'); MyConnection.Create(Nil); // MyQuery.Create(Nil); WriteLn('2.0); MyConnection := '127.0.0.1';WriteLn('2.1'); MyConnection.Protocol := 'mysql'; WriteLn('2.2'); MyConnection.Database := 'MyDatabase';WriteLn('2.3'); MyConnection.User := 'MyUser'; WriteLn('2.4'); MyConnection.Password := 'MyPass';WriteLn('2.5'); MyConnection.Connected := True; WriteLn('2.6'); It never hits 2.0, so I believe it is dying on the create. Am I doingthe create wrong? I can't find any examples as too doing this, I havetried googling it. Most of the examples I see are doing this fromLazarus. Not from a command line Free Pascal program. Shouldn't that be MyConnection := TZconnection.Create(nil); -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Connecting to a database from a commandline pascal program
Wouldn't this... MyConnection.Create(Nil); // MyQuery.Create(Nil); ... be more like... MyConnection := TZConnection.Create(); MyQuery := TQuery.Create(); Then at the end you'd need... MyQuery.Free(); MyConnection.Free(); Jeff On Fri, Feb 16, 2018 at 10:25 AM, Terry A. Haimann wrote: > Hello, > > I am trying to write a command Line Pascal program to connect to a MySQL > database using the ZeosDBO Library. I am sure I have done something > stupid. > > I have it now so that it will compile, but it crashes as soon as I try > to modify my TZConnection variable. > > > I have it defined as: > > MyConnection: TZconnection; > > And code is defined as: > > WriteLn('2'); > MyConnection.Create(Nil); > // MyQuery.Create(Nil); > WriteLn('2.0); > MyConnection := '127.0.0.1'; > WriteLn('2.1'); > MyConnection.Protocol := 'mysql'; > WriteLn('2.2'); > MyConnection.Database := 'MyDatabase'; > WriteLn('2.3'); > MyConnection.User := 'MyUser'; > WriteLn('2.4'); > MyConnection.Password := 'MyPass'; > WriteLn('2.5'); > MyConnection.Connected := True; > WriteLn('2.6'); > > It never hits 2.0, so I believe it is dying on the create. Am I doing > the create wrong? I can't find any examples as too doing this, I have > tried googling it. Most of the examples I see are doing this from > Lazarus. Not from a command line Free Pascal program. > > Thanks in advance, Terry H. > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Connecting to a database from a commandline pascal program
Hello, I am trying to write a command Line Pascal program to connect to a MySQL database using the ZeosDBO Library. I am sure I have done something stupid. I have it now so that it will compile, but it crashes as soon as I try to modify my TZConnection variable. I have it defined as: MyConnection: TZconnection; And code is defined as: WriteLn('2'); MyConnection.Create(Nil); // MyQuery.Create(Nil); WriteLn('2.0); MyConnection := '127.0.0.1'; WriteLn('2.1'); MyConnection.Protocol := 'mysql'; WriteLn('2.2'); MyConnection.Database := 'MyDatabase'; WriteLn('2.3'); MyConnection.User := 'MyUser'; WriteLn('2.4'); MyConnection.Password := 'MyPass'; WriteLn('2.5'); MyConnection.Connected := True; WriteLn('2.6'); It never hits 2.0, so I believe it is dying on the create. Am I doing the create wrong? I can't find any examples as too doing this, I have tried googling it. Most of the examples I see are doing this from Lazarus. Not from a command line Free Pascal program. Thanks in advance, Terry H. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMS Web core released - based on pas2js.
On Fri, 16 Feb 2018, code dz wrote: nice , but its slow i wich we can achive some thing fast like this : https://flyover.github.io/imgui-js/example/ Sure. All you need to do is create an import class, and you can use this. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMS Web core released - based on pas2js.
nice , but its slow i wich we can achive some thing fast like this : https://flyover.github.io/imgui-js/example/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Python interaction... how?
On Fri, 16 Feb 2018, leledumbo via fpc-pascal wrote: Does anyone know of a minimal example or pseudo code or just an explanation? Python actually provides a Python.h that you can convert to a Pascal unit. But inside, it includes a bunch of other header files and conversion might be a tedious task. If you made it, though, simply call: Py_Initialize(); Py_WhateverThereAreMultipleChoicesHere(ProbablyAPythonScriptAsCString); Py_Finalize(); and you're done. This task has been done for you. See: http://wiki.freepascal.org/Python4Delphi Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Python interaction... how?
> Does anyone know of a minimal example or pseudo code or just an explanation? Python actually provides a Python.h that you can convert to a Pascal unit. But inside, it includes a bunch of other header files and conversion might be a tedious task. If you made it, though, simply call: Py_Initialize(); Py_WhateverThereAreMultipleChoicesHere(ProbablyAPythonScriptAsCString); Py_Finalize(); and you're done. But if I have to, I would take the external program approach instead using its interpreter's -c option through TProcess. Communication will then be done through pipes. It's probably slower, but quicker to work. If you take the header conversion approach, however, that might benefit everyone else needing to do the same, just like how the Lua bindings are done (but they're a lot cleaner that makes conversion simpler). -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal