Re: [AOLSERVER] using openacs db api

2008-04-03 Thread Juan José del Río (Simple Option)
I think I do... It's called OpenACS :)


On Wed, 2008-04-02 at 20:49 +0100, Xavier Bourguignon wrote:
 Hi All,
 
 Does anybody know what is required to use OpenAcs DB API for
 accessing Postgres DB within aolserver?
 
 Thank you
 


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] using openacs db api

2008-04-03 Thread Xavier Bourguignon
thank you all for the info.

Jeff, I have been using your code and adapted it to my needs, thanks for that.

On 02/04/2008, Juan José del Río (Simple Option)
[EMAIL PROTECTED] wrote:
 I think I do... It's called OpenACS :)



  On Wed, 2008-04-02 at 20:49 +0100, Xavier Bourguignon wrote:
   Hi All,
  
   Does anybody know what is required to use OpenAcs DB API for
   accessing Postgres DB within aolserver?
  
   Thank you
  


  --

 AOLserver - http://www.aolserver.com/

  To Remove yourself from this list, simply send an email to [EMAIL 
 PROTECTED] with the
  body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
 field of your email blank.



-- 
Xavier Bourguignon


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


[AOLSERVER] using openacs db api

2008-04-02 Thread Xavier Bourguignon
Hi All,

Does anybody know what is required to use OpenAcs DB API for
accessing Postgres DB within aolserver?

Thank you

-- 
Xavier Bourguignon


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] using openacs db api

2008-04-02 Thread Dave Bauer
You'd have to 1) Install OpenACS http://openacs.org/
or 2) try to extract the database api procedures in
http://cvs.openacs.org/cvs/openacs-4/packages/acs-tcl/tcl/
00-database-procs.tcl
00-database-procs-postgresql.tcl
00-database-procs-oracle.tcl
and take the queries out of the XML files
00-database-procs-postgresql-postgresql.xql into the tcl library file
(due to datbase abstraction technique specific to OpenACS.)

The code relies on a configuration param in your AOLserver config file also see
return [nsv_get ad_database_type .] where there is an nsv variable
set on startup to decide oracle or postgresql.

This was just a quick review there might be other stuff you will need
to make it work.
OpenACS also has automatic database handle handling (sorry couldn't
think of a better word for that.)

This contains the postgresql bind variable emulation implementation as
well that replaces tcl variables in the query string.

Here is an overview of how the database api works.
http://openacs.org/doc/current/db-api.html

Dave

On Wed, Apr 2, 2008 at 3:49 PM, Xavier Bourguignon [EMAIL PROTECTED] wrote:
 Hi All,

  Does anybody know what is required to use OpenAcs DB API for
  accessing Postgres DB within aolserver?

  Thank you

  --
  Xavier Bourguignon


  --
  AOLserver - http://www.aolserver.com/

  To Remove yourself from this list, simply send an email to [EMAIL 
 PROTECTED] with the
  body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
 field of your email blank.




-- 
Dave Bauer
[EMAIL PROTECTED]
http://www.solutiongrove.com


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] using openacs db api

2008-04-02 Thread Jeff Rogers

Xavier Bourguignon wrote:

Hi All,

Does anybody know what is required to use OpenAcs DB API for
accessing Postgres DB within aolserver?


OpenACS is a complete integrated platform for creating web communities; 
 I suspect that the DB api builds on the ACS core api and as such it is 
not a trivial matter to use the former without the latter.  If you're 
building a new community system, OpenACS is worth a look, but it's a 
large system to just jump into (especially as an intro to aolserver, 
tcl, or both).


http://openacs.org/ - OpenACS home
http://openacs.org/doc/current/db-api.html - docs on the ACS db api

That said, it's not difficult to emulate some of the useful things like 
bind variables.  This proc expands ? in sql statements.  It could easily 
be made to call ns_dbquotevalue before replacing the variables.  It does 
not do anything with the db drivers, so it is of no help for something 
like bypassing oracle's 4000 character limit as native bind variables do.


proc bindsql {sql args} {
set varcount [llength $args]
set indices [regexp -all -indices -inline {\?} $sql]
if {[llength $indices] != $varcount} {
error [llength $indices] variables expected, $varcount passed
}
set ofs 0
foreach replacement $args idx $indices {
set ix [expr {[lindex $idx 0]+$ofs}]
set sql [string replace $sql $ix $ix $replacement]
incr ofs [string length $replacement]
incr ofs -1
}
return $sql
}

set adminop_sql {select * from tadminop where status = ?}
ns_db select $db [bindsql $adminop_sql 'a']

-J


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.