Re: [lazarus] FPC question

2006-04-22 Thread Micha Nelissen
On Fri, 21 Apr 2006 23:50:08 +0200
Graeme Geldenhuys [EMAIL PROTECTED] wrote:

 Thanks for the help!
 
 Any idea how to rename the title of a page? See the newly added tiOPF
 page. Currently the title is TiOPF and it should read tiOPF.

I think MediaWiki automatically uppercases the first letter, I have no clue
why though. This will probably need some PHP hacking to get right :-/.

Micha

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-22 Thread Vincent Snijders

Micha Nelissen wrote:

On Fri, 21 Apr 2006 23:50:08 +0200
Graeme Geldenhuys [EMAIL PROTECTED] wrote:



Thanks for the help!

Any idea how to rename the title of a page? See the newly added tiOPF
page. Currently the title is TiOPF and it should read tiOPF.



I think MediaWiki automatically uppercases the first letter, I have no clue
why though. This will probably need some PHP hacking to get right :-/.



It is possible, look for example here:
http://forums.macrumors.com/showthread.php?t=167613
It also lists the drawbacks.

I don't know in what version of mediawiki this was added and how to set 
this flag, so if anybody can dig up that information, please send it to me.


Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-22 Thread Felipe Monteiro de Carvalho
On 4/21/06, Graeme Geldenhuys [EMAIL PROTECTED] wrote:
 Any idea how to rename the title of a page? See the newly added tiOPF
 page. Currently the title is TiOPF and it should read tiOPF.

Wikimedia automatically makes the first letter capitalized.

If you read wikipedia often you will see many articles have notices
saying that the first letter should not be capitalized but is, due to
technical restrictions.

This leads to the conclusion that only throught a hack on the software
you may be able to create a non-capitalized title. It is probably
easier to just use the title as it is and put a notice if you want to
make it clear of the correct name.

--
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-22 Thread Vincent Snijders

Vincent Snijders wrote:

Micha Nelissen wrote:


On Fri, 21 Apr 2006 23:50:08 +0200
Graeme Geldenhuys [EMAIL PROTECTED] wrote:



Thanks for the help!

Any idea how to rename the title of a page? See the newly added tiOPF
page. Currently the title is TiOPF and it should read tiOPF.




I think MediaWiki automatically uppercases the first letter, I have no 
clue

why though. This will probably need some PHP hacking to get right :-/.



It is possible, look for example here:
http://forums.macrumors.com/showthread.php?t=167613
It also lists the drawbacks.

I don't know in what version of mediawiki this was added and how to set 
this flag, so if anybody can dig up that information, please send it to me.


Both Sven Heinig and Micha Nelissen told me that I need to set 
wgCapitalLinks to false. Thanks. I just made this change.


Doing this means that some links will get broken, i.e. links that start 
with a lowercase character, for example if the History page is 
referenced like [[history]]. This will need to be replaced by 
[[History|history]]. If you find them, please fix them.


Vincent.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: tiOPF wiki page (was Re: [lazarus] FPC question)

2006-04-21 Thread Vincent Snijders

Graeme Geldenhuys schreef:

I added a link here:
http://wiki.lazarus.freepascal.org/index.php/Components_and_Code_examples#Databases

Feel free the change the name of the link. Then click on it, the wiki
sees the page does not exist and you can start edit the empty page.

Vincent.


Okay, I added the content to the page, but I have two problems.

1) The title of the page is TiOPF where it should be tiOPF.  No idea
how to change that.


I don't know that either.

Vincent.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-21 Thread L505
 Any idea how to rename the title of a page? See the newly added tiOPF
 page. Currently the title is TiOPF and it should read tiOPF.

Probably have to cut and paste, not sure if there is a rename function in 
wikis..

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Graeme Geldenhuys
Hi John,

Maybe you should look at using a OPF (Object Persistent Framework) to
solve your transaction issues, as well as lookups etc...  I have
ported the TechInsite tiOPF version 2 to Free Pascal and have been
using it with Lazarus in a commercial environment for the last 8
months with great success. Before that I have used tiOPF under Delphi
for the last 3 years.

I understand that moving over to a OPF for data and object handling is
a huge learning curve, but soon you will start reaping the rewards. 
One of the great things about using a OPF (and there are many others)
is that DB handling is all done for you as well as transactions.  All
you need to work with is you related objects and just go Object.Save
or Object.Load.  Switching database backend is also a no brainer, just
change a Compiler Define (nothing else in code changes).

To read more about the tiOPF and how it works go to the following link.
http://www.techinsite.com.au/tiOPF
The website is a bit out of date, so is the documentation, but the
internals of the OPF still apply to Ver.2.

Regards,
  - Graeme -


On 19/04/06, johnf [EMAIL PROTECTED] wrote:
 Since I believe I'm the guy that started this thread I think I'll take the
 time to explain in more detail how and why I started the thread.



--
There's no place like 127.0.0.1

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Alexander Todorov
On 4/20/06, Graeme Geldenhuys [EMAIL PROTECTED] wrote:
 I have
 ported the TechInsite tiOPF version 2 to Free Pascal and have been
 using it with Lazarus in a commercial environment for the last 8
 months with great success.

Is this one free / open source or you have a commercial license and
ported it for your needs?
If not commercial please provide link to download. It would be great
to have it in Lazarus.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Michael Van Canneyt



On Thu, 20 Apr 2006, Alexander Todorov wrote:


On 4/20/06, Graeme Geldenhuys [EMAIL PROTECTED] wrote:

I have
ported the TechInsite tiOPF version 2 to Free Pascal and have been
using it with Lazarus in a commercial environment for the last 8
months with great success.


Is this one free / open source or you have a commercial license and
ported it for your needs?
If not commercial please provide link to download. It would be great
to have it in Lazarus.


The general page is

http://www.techinsite.com.au/default.htm

But the version 2 of tiOPF is in Subversion, and I don't have the link
for that at the moment.

Michael.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Graeme Geldenhuys
The tiOPF is a open-source project for a few years now. As Michael
said, Version 2 is in SubVersion.

The SubVersion address is:
  http://tiopf.techinsite.com.au/svn/tiOPF2/Trunk

Daily builds can be downloaded from:
   http://tiopf.techinsite.com.au/DailyBuild/Index.html

tiOPF Support by news groups
  News Server:  news.techinsite.com.au
  News Server port: 119

  Web Interface:http://news.techinsite.com.au/webnews/
  User name:anything as long as it is a single alphanumeric name.

Website:
   http://www.techinsite.com.au/tiOPF/


Regards,
  - Graeme -


On 20/04/06, Alexander Todorov [EMAIL PROTECTED] wrote:
 On 4/20/06, Graeme Geldenhuys [EMAIL PROTECTED] wrote:
  I have
  ported the TechInsite tiOPF version 2 to Free Pascal and have been
  using it with Lazarus in a commercial environment for the last 8
  months with great success.

 Is this one free / open source or you have a commercial license and
 ported it for your needs?
 If not commercial please provide link to download. It would be great
 to have it in Lazarus.

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives



--
There's no place like 127.0.0.1

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Vincent Snijders

Graeme Geldenhuys wrote:

Hi John,

Maybe you should look at using a OPF (Object Persistent Framework) to
solve your transaction issues, as well as lookups etc...  I have
ported the TechInsite tiOPF version 2 to Free Pascal and have been
using it with Lazarus in a commercial environment for the last 8
months with great success. Before that I have used tiOPF under Delphi
for the last 3 years.

I understand that moving over to a OPF for data and object handling is
a huge learning curve, but soon you will start reaping the rewards. 
One of the great things about using a OPF (and there are many others)

is that DB handling is all done for you as well as transactions.  All
you need to work with is you related objects and just go Object.Save
or Object.Load.  Switching database backend is also a no brainer, just
change a Compiler Define (nothing else in code changes).

To read more about the tiOPF and how it works go to the following link.
http://www.techinsite.com.au/tiOPF
The website is a bit out of date, so is the documentation, but the
internals of the OPF still apply to Ver.2.



Can you create a source zip for upload to lazarus-ccr?
Then it can be mentioned on 
http://wiki.lazarus.freepascal.org/index.php/Components_and_Code_examples


Vincent.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Graeme Geldenhuys
On 20/04/06, Vincent Snijders [EMAIL PROTECTED] wrote:
 Can you create a source zip for upload to lazarus-ccr?
 Then it can be mentioned on
 http://wiki.lazarus.freepascal.org/index.php/Components_and_Code_examples

 Vincent.


No problem.  An official v2 release is due any time now, but in the
mean while, I will zip up the Source folder.  Do I email it to you?

Regards,
  - Graeme -


--
There's no place like 127.0.0.1

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Vincent Snijders

Graeme Geldenhuys wrote:

On 20/04/06, Vincent Snijders [EMAIL PROTECTED] wrote:


Can you create a source zip for upload to lazarus-ccr?
Then it can be mentioned on
http://wiki.lazarus.freepascal.org/index.php/Components_and_Code_examples

Vincent.




No problem.  An official v2 release is due any time now, but in the
mean while, I will zip up the Source folder.  Do I email it to you?



Yes.

Maybe we can work on wiki description page too, like 
http://wiki.lazarus.freepascal.org/index.php/TAChart


Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Alexandre Leclerc
2006/4/20, Graeme Geldenhuys [EMAIL PROTECTED]:
 On 20/04/06, Vincent Snijders [EMAIL PROTECTED] wrote:
  Can you create a source zip for upload to lazarus-ccr?
  Then it can be mentioned on
  http://wiki.lazarus.freepascal.org/index.php/Components_and_Code_examples
 
  Vincent.


 No problem.  An official v2 release is due any time now, but in the
 mean while, I will zip up the Source folder.  Do I email it to you?

Native PostgreSQL access in v2 (asside using proprietary drivers)? :)

--
Alexandre Leclerc

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Graeme Geldenhuys
On 20/04/06, Vincent Snijders [EMAIL PROTECTED] wrote:
 Maybe we can work on wiki description page too, like
 http://wiki.lazarus.freepascal.org/index.php/TAChart

 Vincent

I was just looking at those pages.  I don't know how to create/start a
new wiki page, only edit current ones.  Do you need special
permissions to create new pages, if so could you create a
blank/template page, and I will fill in the rest. (or I'll start
reading the wiki help)

What category in Components and Code examples would fit the OPF?
Databases? Packages for FPC/Lazarus?

Regards,


--
There's no place like 127.0.0.1

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-20 Thread Tony Maro
Graeme Geldenhuys wrote:
 I was just looking at those pages.  I don't know how to create/start a
 new wiki page, only edit current ones.  Do you need special
 permissions to create new pages, if so could you create a
 blank/template page, and I will fill in the rest. (or I'll start
 reading the wiki help)
Log into the wiki, then directly change the URL to have the pagename you
want to use.  For instance, if your topic is Test Blank do:

http://wiki.lazarus.freepascal.org/index.php/TestBlank

You'll get a page saying there's no text yet, then you just edit it.

-Tony

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


tiOPF wiki page (was Re: [lazarus] FPC question)

2006-04-20 Thread Vincent Snijders

Graeme Geldenhuys wrote:

On 20/04/06, Vincent Snijders [EMAIL PROTECTED] wrote:


Maybe we can work on wiki description page too, like
http://wiki.lazarus.freepascal.org/index.php/TAChart

Vincent



I was just looking at those pages.  I don't know how to create/start a
new wiki page, only edit current ones.  Do you need special
permissions to create new pages, if so could you create a
blank/template page, and I will fill in the rest. (or I'll start
reading the wiki help)

What category in Components and Code examples would fit the OPF?
Databases? Packages for FPC/Lazarus?




I added a link here:
http://wiki.lazarus.freepascal.org/index.php/Components_and_Code_examples#Databases

Feel free the change the name of the link. Then click on it, the wiki 
sees the page does not exist and you can start edit the empty page.


Vincent.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Micha Nelissen

Joost van der Sluis wrote:

Is this a problem with PostrgreSQL itself or the component in lazarus
wrapping it?


It's a problem of postgres. A transaction 'block' is started with the
sql-command 'begin', from that comand on, all queries are executed


But you can do multiple queries in a block I suppose ? Multiple update, 
and one select, or so ?


Micha

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Michael Van Canneyt



On Wed, 19 Apr 2006, Adrian Maier wrote:


On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:

Is this a problem with PostrgreSQL itself or the component in lazarus
wrapping it?


It's a problem of postgres. A transaction 'block' is started with the
sql-command 'begin', from that comand on, all queries are executed
within that transaction. Using another connection is not possible.
Unless, offcourse, you start a new connection. Or closes the transaction
(commit, rollback etc)


Please pardon me for jumping in the middle of the thread, but your
phrase made me really curious.   The behaviour you described seems
to be the normal one, once you execute begin (transaction) . What
other behaviour would someone expect postgres to have ?


To allow several concurrent transactions.

Interbase/Firebird allows to start several concurrent transactions in
1 connection. AFAIK Oracle and MS-SQL too (named transactions).

This is extremely handy.

Michael.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Michael Van Canneyt



On Wed, 19 Apr 2006, Micha Nelissen wrote:


Joost van der Sluis wrote:

Is this a problem with PostrgreSQL itself or the component in lazarus
wrapping it?


It's a problem of postgres. A transaction 'block' is started with the
sql-command 'begin', from that comand on, all queries are executed


But you can do multiple queries in a block I suppose ? Multiple update, and 
one select, or so ?


Obviously, this is the whole idea of transactions ? :)

Michael.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Micha Nelissen

Michael Van Canneyt wrote:
But you can do multiple queries in a block I suppose ? Multiple 
update, and one select, or so ?


Obviously, this is the whole idea of transactions ? :)


Then I don't see why multiple concurrent transactions are useful ? The 
user can only do one thing at a time anyway, right? :-)


Micha

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Michael Van Canneyt



On Wed, 19 Apr 2006, Micha Nelissen wrote:


Michael Van Canneyt wrote:
But you can do multiple queries in a block I suppose ? Multiple update, 
and one select, or so ?


Obviously, this is the whole idea of transactions ? :)


Then I don't see why multiple concurrent transactions are useful ? The user 
can only do one thing at a time anyway, right? :-)


Didn't you implement threads ? ;-)

Not if you make e.g. some reports in the background, using threads.

For server apps, multiple transactions in a connection are a must.

My apps at work depend on it: one connection to the database, and at least
1 transaction per user...

Michael.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Micha Nelissen

Michael Van Canneyt wrote:
Then I don't see why multiple concurrent transactions are useful ? The 
user can only do one thing at a time anyway, right? :-)


Didn't you implement threads ? ;-)

Not if you make e.g. some reports in the background, using threads.


Hmm I didn't expect multiple transactions on one connection to be thread 
safe.



For server apps, multiple transactions in a connection are a must.

My apps at work depend on it: one connection to the database, and at least
1 transaction per user...


The 'middle' tier, you mean ? Why is the single connection a must ?

Micha

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Joost van der Sluis
On Tue, 2006-04-18 at 14:27 -0700, johnf wrote:
 On Tuesday 18 April 2006 13:42, Marc Santhoff wrote:
  Am Dienstag, den 18.04.2006, 21:29 +0200 schrieb Joost van der Sluis:
   On Tue, 2006-04-18 at 14:43 -0400, Alexandre Leclerc wrote:
2006/4/18, Joost van der Sluis [EMAIL PROTECTED]:
 But you can have one connection, whith several transactions bound
  
   to it.
  
 PostgreSQL doesn't support that, but SQLdb handles that for you,
  
   it
  
 creates new connection internally automatically.
   
Do you mean TPQConnection does not support many TSQLTransaction?
  
   'But you can have one connection, whith several transactions bound to
   it.'
  
   So you can.
  
   Only PostgreSQL can't, so SQLDdb handles it.
 
  May I ask:
 
  Is this a problem with PostrgreSQL itself or the component in lazarus
  wrapping it?
 
  I'm planning to use PG in the near future, but this may influence my
  decision ...
 
  TIA,
  Marc
 
 I can't answer your question directly.  But I can provide a little 
 information 
 about what I have added to this discussion.  First let me say that I have 
 always used only one connection to a database engine and controlled all of my 
 transactions in code in the past (just to let you know where I'm coming 
 from).  But with FPC I was not able to use just one connection to the 
 database.  

There's a difference between 'FPC can't' and 'PostgreSQL can't'
Since FPC can do this, but postgresql can't. So sqldb hides the creation
of a second connection to the database.

If that doesn't work, it's a bug.

But in the case of postgres you should not think of connections. In
reality, it has no connections, it only has transactions! You open a
transaction to the database...

-- 
Met vriendelijke groeten,

  Joost van der Sluis
  CNOC Informatiesystemen en Netwerken
  http://www.cnoc.nl

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Joost van der Sluis
On Wed, 2006-04-19 at 09:22 +0200, Micha Nelissen wrote:

 But you can do multiple queries in a block I suppose ? Multiple
 update, 
 and one select, or so ?

Yes, you can even do multiple selects. But what you can't do is rollback
only a part of the block. (well.. there are safepoints, but not
important for this example)
And you can't isolate the different select statements within one block.

JoJo,
  Joost

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Joost van der Sluis
On Wed, 2006-04-19 at 10:22 +0300, Adrian Maier wrote:
 On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:
   Is this a problem with PostrgreSQL itself or the component in lazarus
   wrapping it?
 
  It's a problem of postgres. A transaction 'block' is started with the
  sql-command 'begin', from that comand on, all queries are executed
  within that transaction. Using another connection is not possible.
  Unless, offcourse, you start a new connection. Or closes the transaction
  (commit, rollback etc)
 
 Please pardon me for jumping in the middle of the thread, but your
 phrase made me really curious.   The behaviour you described seems
 to be the normal one, once you execute begin (transaction) . What
 other behaviour would someone expect postgres to have ?

Several other databases have support for more then one transaction. This
means that if you want to execute a query, you have to tell in which
transaction the query should be executed. There are no real standard
sql-commands for this, but consider something like this:

connect;
begin trans1;
begin trans2;
trans1: select * from tbl1;
trans1: insert into tbl1(str) values ('Welcome');
trans2: select * from tbl1;
commit trans1;
trans2: select * from tbl1;
commit trans2;
disconnect;

This code will never show the just inserted value 'welcome'. (Default
isolation-level)

Since the insert that is done in transaction1, isn't visible for
transaction2.

Postgres doesn't support multiple transactions in one connection. So you
have to use two connections. But further it's the same.

JoJo,
  Joost.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Adrian Maier
On 4/19/06, Michael Van Canneyt [EMAIL PROTECTED] wrote:
 On Wed, 19 Apr 2006, Adrian Maier wrote:

  On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:
  Is this a problem with PostrgreSQL itself or the component in lazarus
  wrapping it?
 
  It's a problem of postgres. A transaction 'block' is started with the
  sql-command 'begin', from that comand on, all queries are executed
  within that transaction. Using another connection is not possible.
  Unless, offcourse, you start a new connection. Or closes the transaction
  (commit, rollback etc)
 
  Please pardon me for jumping in the middle of the thread, but your
  phrase made me really curious.   The behaviour you described seems
  to be the normal one, once you execute begin (transaction) . What
  other behaviour would someone expect postgres to have ?

 To allow several concurrent transactions.

Is this implemented inside the database engine, as some special SQL
commands ?   Is it possible to start more transactions simultaneously
from firebird's interactive utility?how does one specify that a certain
SQL command has to be executed inside one transaction or another  ?

 Interbase/Firebird allows to start several concurrent transactions in
 1 connection. AFAIK Oracle and MS-SQL too (named transactions).

I'm not sure about this.
Oracle has named transactions, but those are just labels that are given
to long-running transaction - so that they can be easier identified. Also,
in Oracle it is possible that a stored procedure be executed in an
'autonomous' transaction ( i've used this once for writing a procedure
that wrote debugging information to a table ; in case of error the messages
would have been rolled back unless they were inserted by an autonomous
transaction).  But i believe that these autonomous transactions are a different
beast from the feature we are talking about.


 This is extremely handy.

I understand this.
Yet,  my feeling is that this feature is an interbase/firebird
extension , and that
it would be possible to achieve the same by using more standard features like
cursors and savepoints.


Adrian Maier

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Michael Van Canneyt



On Wed, 19 Apr 2006, Adrian Maier wrote:


On 4/19/06, Michael Van Canneyt [EMAIL PROTECTED] wrote:

On Wed, 19 Apr 2006, Adrian Maier wrote:


On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:

Is this a problem with PostrgreSQL itself or the component in lazarus
wrapping it?


It's a problem of postgres. A transaction 'block' is started with the
sql-command 'begin', from that comand on, all queries are executed
within that transaction. Using another connection is not possible.
Unless, offcourse, you start a new connection. Or closes the transaction
(commit, rollback etc)


Please pardon me for jumping in the middle of the thread, but your
phrase made me really curious.   The behaviour you described seems
to be the normal one, once you execute begin (transaction) . What
other behaviour would someone expect postgres to have ?


To allow several concurrent transactions.


Is this implemented inside the database engine, as some special SQL
commands ?


Yes.

SET TRANSACTION



Is it possible to start more transactions simultaneously
from firebird's interactive utility?


Yes.


how does one specify that a certain
SQL command has to be executed inside one transaction or another  ?


SELECT TRANSACTION NAME XYZ




Interbase/Firebird allows to start several concurrent transactions in
1 connection. AFAIK Oracle and MS-SQL too (named transactions).


I'm not sure about this.
Oracle has named transactions, but those are just labels that are given
to long-running transaction - so that they can be easier identified. Also,
in Oracle it is possible that a stored procedure be executed in an
'autonomous' transaction ( i've used this once for writing a procedure
that wrote debugging information to a table ; in case of error the messages
would have been rolled back unless they were inserted by an autonomous
transaction).  But i believe that these autonomous transactions are a different
beast from the feature we are talking about.


Probably it's a restricted form. Like I said, I'm not sure about oracle
and MS-SQL...






This is extremely handy.


I understand this.
Yet,  my feeling is that this feature is an interbase/firebird
extension , and that
it would be possible to achieve the same by using more standard features like
cursors and savepoints.


Interbase has those too, but you can't do what I need with that:
In a server app, have 1 connection and several independent transactions
within that connection.

You must take into account that most commercial engines require a per-user
license, so connections are 'expensive'. 1 connection with separate
transactions solves this problem. There is 1 connection, but each user
is in a separate transaction...

Michael.

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Joost van der Sluis
On Wed, 2006-04-19 at 13:22 +0300, Adrian Maier wrote:
 On 4/19/06, Michael Van Canneyt [EMAIL PROTECTED] wrote:
  On Wed, 19 Apr 2006, Adrian Maier wrote:
 
   On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:
   Is this a problem with PostrgreSQL itself or the component in lazarus
   wrapping it?
  
   It's a problem of postgres. A transaction 'block' is started with the
   sql-command 'begin', from that comand on, all queries are executed
   within that transaction. Using another connection is not possible.
   Unless, offcourse, you start a new connection. Or closes the transaction
   (commit, rollback etc)
  
   Please pardon me for jumping in the middle of the thread, but your
   phrase made me really curious.   The behaviour you described seems
   to be the normal one, once you execute begin (transaction) . What
   other behaviour would someone expect postgres to have ?
 
  To allow several concurrent transactions.
 
 Is this implemented inside the database engine, as some special SQL
 commands ?   Is it possible to start more transactions simultaneously
 from firebird's interactive utility?how does one specify that a 
 certain
 SQL command has to be executed inside one transaction or another  ?
  Interbase/Firebird allows to start several concurrent transactions in
  1 connection. AFAIK Oracle and MS-SQL too (named transactions).
 
 I'm not sure about this.
 Oracle has named transactions, but those are just labels that are given
 to long-running transaction - so that they can be easier identified. Also,
 in Oracle it is possible that a stored procedure be executed in an
 'autonomous' transaction ( i've used this once for writing a procedure
 that wrote debugging information to a table ; in case of error the messages
 would have been rolled back unless they were inserted by an autonomous
 transaction).  But i believe that these autonomous transactions are a 
 different
 beast from the feature we are talking about.

Oracle's transactions are the most flexible. You can do the same thing
with them as with the Firebird transactions, and far more.

If you use the C-api to execute a query, you have to/can provide the
transaction in which the query should get executed. 

I don't know if that could also be done with SQL-statements, or which
statements that should be.

JoJo,
  Joost.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Joost van der Sluis
On Wed, 2006-04-19 at 13:36 +0300, Adrian Maier wrote:
 On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:
  Several other databases have support for more then one transaction. This
  means that if you want to execute a query, you have to tell in which
  transaction the query should be executed. There are no real standard
  sql-commands for this, but consider something like this:
 
 The one thing that is unclear for me is how do you specify in which
 transaction you wish to execute a particular command.
 
  connect;
  begin trans1;
  begin trans2;
 
  trans1: select * from tbl1;
 
 Is this some kind of pseudocode, or are you saying that
 trans1: select * from tbl1;  is valid SQL syntax ?

No, pseudo-code, see Michaels mail for the real commands.

  trans1: insert into tbl1(str) values ('Welcome');
  trans2: select * from tbl1;
  commit trans1;
  trans2: select * from tbl1;
  commit trans2;
  disconnect;
 
  This code will never show the just inserted value 'welcome'. (Default
  isolation-level)
 
  Since the insert that is done in transaction1, isn't visible for
  transaction2.
 
 Indeed, it's not visible.  Therefore: the same user can see that record
 in one place, and at the same time he doesn't see the record in another
 place. Is this truly a good thing ?

No. I would use one transaction for one user.
Or you can decide to use one transaction for each form, or one for each
thread. That's all up to the developer.

-- 
Met vriendelijke groeten,

  Joost van der Sluis
  CNOC Informatiesystemen en Netwerken
  http://www.cnoc.nl

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread Adrian Maier
On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:

 No, pseudo-code, see Michaels mail for the real commands.

Yep, I've seen them.   Interesting. It's good to know about them .

  Indeed, it's not visible.  Therefore: the same user can see that record
  in one place, and at the same time he doesn't see the record in another
  place. Is this truly a good thing ?

 No. I would use one transaction for one user.
This happens in a middle-tier application, i guess.

 Or you can decide to use one transaction for each form, or one for each
 thread. That's all up to the developer.

I see.

Just a last note (maybe this is useful for someone):
When using postgresql and there are too many users, it is possible to use
connection polling  :   http://pgpool.projects.postgresql.org/


Adrian Maier

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-19 Thread johnf
On Wednesday 19 April 2006 04:57, Adrian Maier wrote:
 On 4/19/06, Joost van der Sluis [EMAIL PROTECTED] wrote:
  No, pseudo-code, see Michaels mail for the real commands.

 Yep, I've seen them.   Interesting. It's good to know about them .

   Indeed, it's not visible.  Therefore: the same user can see that record
   in one place, and at the same time he doesn't see the record in another
   place. Is this truly a good thing ?
 
  No. I would use one transaction for one user.

 This happens in a middle-tier application, i guess.

  Or you can decide to use one transaction for each form, or one for each
  thread. That's all up to the developer.

 I see.

 Just a last note (maybe this is useful for someone):
 When using postgresql and there are too many users, it is possible to use
 connection polling  :   http://pgpool.projects.postgresql.org/


 Adrian Maier

Since I believe I'm the guy that started this thread I think I'll take the 
time to explain in more detail how and why I started the thread.  

In the app I want to develop I would like the user to be able to have open 
several forms at once.  As an example I could open the customer form several 
times and each form would be independent of each other.  Each customer form 
could do lookups, change data etc.  You see examples of what I'm describing 
in accounting programs.  I started out attempting to use a data module.  The 
data module solution sort of worked (although I would crash for unknown 
reasons) but required that the transaction control be opened and closed often 
as I moved from form to form and from action to action (selects, updates, 
deletes, inserts).  Controlling a single transaction control from each form 
was a pain.  So why not have a number of transactions available – one for 
each form.  That's when I discovered that one connection would not allow 
multiple transaction.  You see I was leaving the transaction active.  When I 
opened a second form and attempted to select any data I'd get the error 
stating that I had an open transaction.  This started me thinking why does 
this limitation exist?  So I started asking questions.  Shouldn't each 
transaction have it's own session.  Why is it that when I do a read (select) 
I must have a transaction open (a begin is sent to the database engine).  In 
the end I have been told that it is a limitation of Postgres not SQLdb.  So 
in the end I choose to use a new connection for each form.  I guess the real 
reason I questioned all of this was because I did not have any such 
limitation when using Foxpro to connect to Postgres.  I could make all the 
reads I wanted without having to start a transaction.  But I was forced to 
control updates, inserts, and deletes within transactions.  

Yes I understand that I could write a Unit that contains a routine to handle 
my reads:
procedure GetSqlData(parameter myquery);
Open the transaction;
Make the select; 
Close the transaction;

And the above started more questions.  When I started experimenting with the 
call I noticed that my code size got larger.  I would have thought just the 
reverse would have occurred.  I became concerned when I realized that I was 
passing objects as parameters.  So then I asked the question about how the 
compiler handled the call.  Which is why this thread is labeled “FPC 
question”.  I was concerned that I had missed a compiler switch or was doing 
it wrong.  In the end I have no answer.  The size of the bin is not that 
large (I have about 8 forms and code = approx. 15.1 megs) and it seems to run 
fast with calling a central routine or just having a connection for each 
form.  Programming is a lot easier when I just add a connection for each 
form.  But then I open lots of connections.  Postgres can handle thousands of 
connections with little overhead.  So why worry – be happy to coin a song.

John

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread johnf
On Tuesday 18 April 2006 08:25, Alexandre Leclerc wrote:
 2006/4/17, johnf [EMAIL PROTECTED]:
  Or is it better (what a word):
 
  sqlunit

 If you have a 'sqlunit' that handles all the sql stuff of you
 application, be object oriented in your concepts. Iwould have only one
 function in the sqlunit to close the sql object(s) with proper checks.

 If you have an sqltransaction in each form (which looks like), simple
 have the procedure in the form or in a descendent of the form.
 TMySQLForm = class(TForm) // stuff your sqltransaction object in it
 and the procedure. Then inherit from the TMySQLForm

 Another simple way is to avoid such a function for a simple task like
 that. You could simply execute the code sqltransaction1.active:=False;
 in the OnDestroy of the form. With the TMySQLForm example concept it
 would be a good idea too. Avoid the procedure for such a simple task.
 It is like bloat code ;)

 Best Regards.

 --
 Alexandre Leclerc
Thanks for answering.  You are right the task was very simple.  I used the 
code as an example because in fact I'm having issues with understanding the 
OOP involved and how the FPC compiler works.  It seems that having one call 
would be the OOP thing to do.  But I noticed that making the call increased 
the size of the code and I wondered if the execution speed would suffer 
because of the call.  In general I would say that the SQLdb is not OOP in its 
use.  PQConnections,TSQLTransactions and TSQLQuery work best if they are 
placed on the form and not created at runtime.  I'm not sure if this is 
because my inexperience with FPC (the way I coded it) or because of the way 
SQLdb was designed (maybe the way Delphi was designed?).  

In the Visual FoxPro world I normally would have an object (class) that is 
placed on the form to handle all interaction with the data as required.  But 
so far I don't understand how to do this with the SQLdb controls.  I could 
create a class to create and set all the SQLdb controls in code but I don't 
understand how to add it (the class) to the forms.  Even if I did create the 
class I don't see the advantage over just placing the SQLdb controls directly 
on the forms.  OOP for OOP sake does not make much sense. Placing the 
TSQLTransaction on the form handles all the 'Begin' and 'Rollback' issues and 
infact by placing a PQConnection on each form creates a new connection to the 
database - therefore, the database is then responsable for any data locking 
issues.  What could easier - I don't have to worry about record locking 
except within the forms access.  So you can see I have questions about how 
data is accessed.   

I did notice that there is a framework that is available (started with a oT - 
something) for FPC.  But I noticed that it's main purpose is to support 
different database engines with the same code base.  Not what I was looking 
for.  Anyway, I keep learning more about FPC and Lazarus daily.  

John

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Joost van der Sluis
On Tue, 2006-04-18 at 10:21 -0700, johnf wrote:
 In the Visual FoxPro world I normally would have an object (class) that is 
 placed on the form to handle all interaction with the data as required.  But 
 so far I don't understand how to do this with the SQLdb controls.  I could 
 create a class to create and set all the SQLdb controls in code but I don't 
 understand how to add it (the class) to the forms.  Even if I did create the 
 class I don't see the advantage over just placing the SQLdb controls directly 
 on the forms.  OOP for OOP sake does not make much sense. Placing the 
 TSQLTransaction on the form handles all the 'Begin' and 'Rollback' issues and 
 infact by placing a PQConnection on each form creates a new connection to the 
 database - therefore, the database is then responsable for any data locking 
 issues.  What could easier - I don't have to worry about record locking 
 except within the forms access.  So you can see I have questions about how 
 data is accessed.   

I also read that in your wiki-article.

But you can have one connection, whith several transactions bound to it.
PostgreSQL doesn't support that, but SQLdb handles that for you, it
creates new connection internally automatically. 

So you could think of 1 connection for the whole aplication, and then
one transaction for each form.

JoJo,
  Joost.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Alexandre Leclerc
2006/4/18, johnf [EMAIL PROTECTED]:
 Thanks for answering.  You are right the task was very simple.  I used the
 code as an example because in fact I'm having issues with understanding the
 OOP involved and how the FPC compiler works.  It seems that having one call
 would be the OOP thing to do.  But I noticed that making the call increased
 the size of the code and I wondered if the execution speed would suffer
 because of the call.  In general I would say that the SQLdb is not OOP in its
 use.  PQConnections,TSQLTransactions and TSQLQuery work best if they are
 placed on the form and not created at runtime.  I'm not sure if this is
 because my inexperience with FPC (the way I coded it) or because of the way
 SQLdb was designed (maybe the way Delphi was designed?).

With the big CPU of today a procedure call will not slow down your
application that much :). But I'm from the old school on some parts of
code like that. The example function you made is in my things you
don't do list, except if it fulfills some OOP criterions and specific
reasons that would have made such a procedure a good app/code design.
:)

In the very precise case you talk, if many forms are using
PQConnections, TSQLTransactions and TSQLQuery, I would create a new
form that implement already all these controls and functions you need.
(But... see bellow.) Then I would inherit from this form. I dont' know
if lazarus is yet able to do form inheritance at design time. I saw a
thread some times ago that it was not yet able to do it in the editor.
But in the code, it will.

It requires inheritance / class creation knowledge. You could
certainly find a lot of information on the web (see Delphi) if you are
not very familiar with this. These are concepts not too hard to learn.

As for the bd controls, it should be no problems if they are created
at run time. It is probably some simple things that are missing. (I
did not try the controls, I'm talking about theory here.)

 In the Visual FoxPro world I normally would have an object (class) that is
 placed on the form to handle all interaction with the data as required.  But
 so far I don't understand how to do this with the SQLdb controls.  I could
 create a class to create and set all the SQLdb controls in code but I don't
 understand how to add it (the class) to the forms.  Even if I did create the
 class I don't see the advantage over just placing the SQLdb controls directly
 on the forms.  OOP for OOP sake does not make much sense. Placing the
 TSQLTransaction on the form handles all the 'Begin' and 'Rollback' issues and
 infact by placing a PQConnection on each form creates a new connection to the
 database - therefore, the database is then responsable for any data locking
 issues.  What could easier - I don't have to worry about record locking
 except within the forms access.  So you can see I have questions about how
 data is accessed.

The way to go in Delphi (and Lazarus) is to create a TDataModule and
put all your DB related stuff there. Then in the Form you 'uses' the
TDataModule and acces the DB aware controls from there. So you have
only one central location. This is much better than my previous
example bellow. (In fact, I would never do that personally; I use
DataModules.) This is a very clean OOP approach, and code reuse can be
potentially high and effective (and lower your app size and increase
efficiency with memory, etc.) I say 'could' because it depends how you
code your thing. :)

Best regards.

--
Alexandre Leclerc

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Alexandre Leclerc
2006/4/18, Joost van der Sluis [EMAIL PROTECTED]:
 But you can have one connection, whith several transactions bound to it.
 PostgreSQL doesn't support that, but SQLdb handles that for you, it
 creates new connection internally automatically.

Do you mean TPQConnection does not support many TSQLTransaction?

In Delphi I was using ODBC access and many TQuery plugged to my data
provider. This was working with only one connection and working great.

Was it because ODBC/BDE was handling the thing for me? Or is it reallt
a TPQConnection issue?

--
Alexandre Leclerc

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread johnf
On Tuesday 18 April 2006 11:31, Joost van der Sluis wrote:
 On Tue, 2006-04-18 at 10:21 -0700, johnf wrote:
  In the Visual FoxPro world I normally would have an object (class) that
  is placed on the form to handle all interaction with the data as
  required.  But so far I don't understand how to do this with the SQLdb
  controls.  I could create a class to create and set all the SQLdb
  controls in code but I don't understand how to add it (the class) to the
  forms.  Even if I did create the class I don't see the advantage over
  just placing the SQLdb controls directly on the forms.  OOP for OOP sake
  does not make much sense. Placing the TSQLTransaction on the form handles
  all the 'Begin' and 'Rollback' issues and infact by placing a
  PQConnection on each form creates a new connection to the database -
  therefore, the database is then responsable for any data locking issues. 
  What could easier - I don't have to worry about record locking except
  within the forms access.  So you can see I have questions about how data
  is accessed.

 I also read that in your wiki-article.

 But you can have one connection, whith several transactions bound to it.
 PostgreSQL doesn't support that, but SQLdb handles that for you, it
 creates new connection internally automatically.

 So you could think of 1 connection for the whole aplication, and then
 one transaction for each form.

 JoJo,
   Joost.
I did attempt to use only one connection.  But it appeared that each 
transaction on each form (each form has only one transaction) was not 
independent of each other.  At least with FPC 2.1.1 (a few weeks ago).  I 
kept getting an error suggesting I could not open a second transaction 
without closing the first transaction.  It could be that Postgres does not 
support the multiple transactions per connection.  
Thanks,
John

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Alexandre Leclerc
2006/4/18, Joost van der Sluis [EMAIL PROTECTED]:
 Delphi handled that for you, yes. Just like SQLdb does.  ODBC doesn't
 support more than one transaction for a connection, just like
 PostgreSQL.

Very interesting, I never payed attention to that. I have an app in
D3/BDE/ODBC/PostgreSQL8.x and will look at the behaviour this
week-end. (Look at multiple connections to the PostgreSQL server).

In fact, I'm not scandalized by that; this is ok. If a
thread/dbconnection crashes this will not affect the whole working of
the program/db. So there are advantages to that behaviour. Disaventage
is potentially too many connections per client (and to the server).
But, at that point, better software design can be achieve.

Thank you for the information Joost.

--
Alexandre Leclerc

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread johnf
On Tuesday 18 April 2006 13:42, Marc Santhoff wrote:
 Am Dienstag, den 18.04.2006, 21:29 +0200 schrieb Joost van der Sluis:
  On Tue, 2006-04-18 at 14:43 -0400, Alexandre Leclerc wrote:
   2006/4/18, Joost van der Sluis [EMAIL PROTECTED]:
But you can have one connection, whith several transactions bound
 
  to it.
 
PostgreSQL doesn't support that, but SQLdb handles that for you,
 
  it
 
creates new connection internally automatically.
  
   Do you mean TPQConnection does not support many TSQLTransaction?
 
  'But you can have one connection, whith several transactions bound to
  it.'
 
  So you can.
 
  Only PostgreSQL can't, so SQLDdb handles it.

 May I ask:

 Is this a problem with PostrgreSQL itself or the component in lazarus
 wrapping it?

 I'm planning to use PG in the near future, but this may influence my
 decision ...

 TIA,
 Marc

I can't answer your question directly.  But I can provide a little information 
about what I have added to this discussion.  First let me say that I have 
always used only one connection to a database engine and controlled all of my 
transactions in code in the past (just to let you know where I'm coming 
from).  But with FPC I was not able to use just one connection to the 
database.  At first I considered this fact to be a problem.  But then I 
reconsidered.  Yes, it is true if my user opens 10 forms I will have ten 
connections and if I have 100 users I will have 1000 connections open.  This 
of course sounded like a lot.  But then I realized that today Postgres can 
handle thousands of connections without issue.  In fact 1000 connections uses 
only 50K of extra ram.  With todays fast CPU's controlling 1000 connections 
is nothing.  But what about the time to open each connection?  On a LAN I 
doubt it amounts to much.  On my LAN we are talking about micro-seconds per 
connection (at least that is what is reported in the log).  But on a dial-up 
- Maybe!  So in the end I guess it really doesn't matter.  BTW in my app I 
doubt if my users will have ten forms open at the same time.  Also in my app 
I close the connection each time I close a form.  One nice thing as result of 
using a connection per form - I no longer attempt to control the locking in 
anyway.  I let Postgres use it's record locking schema.  I just use a try to 
catch the error if there is a locking issue.  So far I can not create any 
locking issues even in code.  Postgres is faster than I can update the data.  

Hope this helps!

John 

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Joost van der Sluis
On Tue, 2006-04-18 at 22:42 +0200, Marc Santhoff wrote:
 Am Dienstag, den 18.04.2006, 21:29 +0200 schrieb Joost van der Sluis:
  On Tue, 2006-04-18 at 14:43 -0400, Alexandre Leclerc wrote:
   2006/4/18, Joost van der Sluis [EMAIL PROTECTED]:
But you can have one connection, whith several transactions bound
  to it.
PostgreSQL doesn't support that, but SQLdb handles that for you,
  it
creates new connection internally automatically.
   
   Do you mean TPQConnection does not support many TSQLTransaction?
  
  'But you can have one connection, whith several transactions bound to
  it.'
  
  So you can.
  
  Only PostgreSQL can't, so SQLDdb handles it.
 
 May I ask:
 
 Is this a problem with PostrgreSQL itself or the component in lazarus
 wrapping it?

It's a problem of postgres. A transaction 'block' is started with the
sql-command 'begin', from that comand on, all queries are executed
within that transaction. Using another connection is not possible.
Unless, offcourse, you start a new connection. Or closes the transaction
(commit, rollback etc)

JoJo,
  Joost.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Marc Santhoff
Am Dienstag, den 18.04.2006, 23:28 +0200 schrieb Joost van der Sluis:
 On Tue, 2006-04-18 at 22:42 +0200, Marc Santhoff wrote:
  Am Dienstag, den 18.04.2006, 21:29 +0200 schrieb Joost van der Sluis:

   'But you can have one connection, whith several transactions bound to
   it.'
   
   So you can.
   
   Only PostgreSQL can't, so SQLDdb handles it.
  
  May I ask:
  
  Is this a problem with PostrgreSQL itself or the component in lazarus
  wrapping it?
 
 It's a problem of postgres. A transaction 'block' is started with the
 sql-command 'begin', from that comand on, all queries are executed
 within that transaction. Using another connection is not possible.
 Unless, offcourse, you start a new connection. Or closes the transaction
 (commit, rollback etc)

I see. Problems or at least unusual design approaching when regarding
datamodules ...

Thank you,
Marc


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] FPC question

2006-04-18 Thread Marc Santhoff
Am Dienstag, den 18.04.2006, 14:27 -0700 schrieb johnf:
 Yes, it is true if my user opens 10 forms I will have ten 
 connections and if I have 100 users I will have 1000 connections open.  This 
 of course sounded like a lot.  But then I realized that today Postgres can 
 handle thousands of connections without issue.  In fact 1000 connections uses 
 only 50K of extra ram.  With todays fast CPU's controlling 1000 connections 
 is nothing.  But what about the time to open each connection?  On a LAN I 
 doubt it amounts to much.  On my LAN we are talking about micro-seconds per 
 connection (at least that is what is reported in the log).  But on a dial-up 
 - Maybe!  So in the end I guess it really doesn't matter.

Thanks to your report I see no problems in the number of connections at
all but I fear design trouble in writing the persistance layer in a way
independant from the database without having too much code dealing with
a special kind of database - but that was only a dream, I think. ;)

   BTW in my app I 
 doubt if my users will have ten forms open at the same time.  Also in my app 
 I close the connection each time I close a form.  One nice thing as result of 
 using a connection per form - I no longer attempt to control the locking in 
 anyway.  I let Postgres use it's record locking schema.  I just use a try to 
 catch the error if there is a locking issue.  So far I can not create any 
 locking issues even in code.  Postgres is faster than I can update the data.  

I'll have to deal with multiple transactions, sort of bulk updates
together with XML-RDB-mapping, this will be important when coupling to
the client app(s) has to be done. But all of this is in it's early
planning stages, I haven't evaluated native XML databases yet.

 Hope this helps!

It does, thank you.

Regards,
Marc


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] FPC question

2006-04-17 Thread johnf
Hi,

I have code like:

procedure CloseDataAccess;
begin
 self.sqltransaction1.active:=False;
end;

in each form (might have 20 forms).  

Or is it better (what a word):

sqlunit

procedute CloseDataAccess(sender:tsqltransaction);
begin
sender.active:=False;
end;

And call the CloseDataAccess for each form.

It would seem that the compiler would have only one routine in memory if I 
used the 'sqlunit'.  But what does it save?  

John

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives