Recent

Author Topic: [SOLVED] Can database auto-connected in fcl-web applications?  (Read 1467 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1520
[SOLVED] Can database auto-connected in fcl-web applications?
« on: November 02, 2020, 10:00:12 am »
I put an TIBConnection, TSQLTransaction, and TSQLQuery and wrote a simple CGI application just returning the content of a table. This runs well, even though I myself do not set TIBConnection.Connected := True. This this possible?

In HTTPServer it does not.
« Last Edit: November 02, 2020, 03:11:21 pm by egsuh »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Can database auto-connected in fcl-web applications?
« Reply #1 on: November 02, 2020, 02:30:55 pm »
It should be possible if you set IBDatabase.Connected and SQLTransaction.Active to True at design-time, though that is not generally recommended: if the database doesn't exist at run-time, having those set will make the up barf up a couple of exceptions when launched, which is not really a nice thing, specially for a CGI ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Sieben

  • Sr. Member
  • ****
  • Posts: 372
Re: Can database auto-connected in fcl-web applications?
« Reply #2 on: November 02, 2020, 02:54:36 pm »
If you Open a TSQLQuery it's TXYZConnection will be implicitly set Connected, and a TSQLTransaction wired to it will be set Active as well.
Lazarus 2.2.0, FPC 3.2.2, .deb install on Ubuntu Xenial 32 / Gtk2 / Unity7

egsuh

  • Hero Member
  • *****
  • Posts: 1520
Re: Can database auto-connected in fcl-web applications?
« Reply #3 on: November 02, 2020, 03:10:56 pm »
Quote
if you set IBDatabase.Connected and SQLTransaction.Active to True at design-time,
No. If I did set connected and active true, then it's natural. But both were false.

Quote
If you Open a TSQLQuery it's TXYZConnection will be implicitly set Connected, and a TSQLTransaction wired to it will be set Active as well.
I see. That's why it acted in that way. Interesting thing is setting transaction wired to an unconnected database raises exception.

 

TinyPortal © 2005-2018