[AOLSERVER] ns_db problem

2008-04-01 Thread Xavier Bourguignon
Hi all,

I have this in my config file:
ns_section ns/server/games-admin/modules
ns_param nssock $bindir/nssock.so
ns_param nslog $bindir/nslog.so
ns_param nscp $bindir/nscp.so
ns_param nsdb $bindir/nsdb.so
ns_param shared_tcl tcl

ns_section ns/db/drivers
ns_param postgres nspostgres.so

ns_section ns/db/pools
ns_param gameskillspool Postgres

ns_section ns/db/pool/gamespool
ns_param Driver postgres
ns_param Connections 5
ns_param DataSource localhost::games
ns_param User postgres
ns_param Password secret
ns_param Verbose On
ns_param LogSQLErrors On
ns_param ExtendedTableInfo On
ns_param Connection 5

ns_section ns/server/games-admin/db
ns_param Pools *

I have the following in my db.tcl file:
set db   [ns_db gethandle  gamespool]
set datasource [ns_db datasource $db]
set dbtype[ns_db dbtype $db]
set driver  [ns_db driver $db]
set poolname   [ns_db poolname   $db]
set user[ns_db user   $db]
set password[ns_db password   $db]

In file admin_op.tcl I do this:
set row [ns_db select $db select * from tadminoptype;]
while { [ns_db getrow $db $row] } {
ns_log Notice [ns_set get $row type] - [ns_set get $row desc]
}

The problem is that the code in admin_op does not work, I get this error:
can't read db: no such variable
while executing
ns_db select $db select * from tadminoptype;

But if I put this code in the db.tcl file, then it works fine.

Can someone tell me if some settings are wrong, or if I am using ns_db
incorrectly?

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] ns_db problem

2008-04-01 Thread Xavier Bourguignon
So you know, the line:
ns_param gameskillspool Postgres

should read:
ns_param gamespool Postgres

On 01/04/2008, Xavier Bourguignon [EMAIL PROTECTED] wrote:
 Hi all,

  I have this in my config file:
  ns_section ns/server/games-admin/modules
 ns_param nssock $bindir/nssock.so
 ns_param nslog $bindir/nslog.so
 ns_param nscp $bindir/nscp.so
 ns_param nsdb $bindir/nsdb.so
 ns_param shared_tcl tcl

  ns_section ns/db/drivers
 ns_param postgres nspostgres.so

  ns_section ns/db/pools
 ns_param gameskillspool Postgres

  ns_section ns/db/pool/gamespool
 ns_param Driver postgres
 ns_param Connections 5
 ns_param DataSource localhost::games
 ns_param User postgres
 ns_param Password secret
 ns_param Verbose On
 ns_param LogSQLErrors On
 ns_param ExtendedTableInfo On
 ns_param Connection 5

  ns_section ns/server/games-admin/db
 ns_param Pools *

  I have the following in my db.tcl file:
  set db   [ns_db gethandle  gamespool]
  set datasource [ns_db datasource $db]
  set dbtype[ns_db dbtype $db]
  set driver  [ns_db driver $db]
  set poolname   [ns_db poolname   $db]
  set user[ns_db user   $db]
  set password[ns_db password   $db]

  In file admin_op.tcl I do this:
  set row [ns_db select $db select * from tadminoptype;]
  while { [ns_db getrow $db $row] } {
 ns_log Notice [ns_set get $row type] - [ns_set get $row desc]
  }

  The problem is that the code in admin_op does not work, I get this error:
  can't read db: no such variable
 while executing
  ns_db select $db select * from tadminoptype;

  But if I put this code in the db.tcl file, then it works fine.

  Can someone tell me if some settings are wrong, or if I am using ns_db
  incorrectly?

  Thank you

  --

 Xavier Bourguignon



-- 
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] ns_db problem

2008-04-01 Thread Juan José del Río (Simple Option)
That's a problem about variables scope, Xavier.

the line: set row [ns_db select $db select * from tadminoptype;]

requires the variable $db to be set.

That's done by the line: set db [ns_db gethandle  gamespool]

So to make the query work, you only need to add the line set db ..
before the set row  one.

$db is the database handler you're using to do the queries.


Regards,

  Juan José


-- 
Juan José del Río|  Comercio online / e-commerce
(+34) 616 512 340|  [EMAIL PROTECTED]


Simple Option S.L.
  Tel: (+34) 951 930 122
  Fax: (+34) 951 930 122
  http://www.simpleoption.com





 set datasource [ns_db datasource $db]
 set dbtype[ns_db dbtype $db]
 set driver  [ns_db driver $db]
 set poolname   [ns_db poolname   $db]
 set user[ns_db user   $db]
 set password[ns_db password   $db]
 
 In file admin_op.tcl I do this:
 




On Tue, 2008-04-01 at 22:21 +0100, Xavier Bourguignon wrote:
 Hi all,
 
 I have this in my config file:
 ns_section ns/server/games-admin/modules
 ns_param nssock $bindir/nssock.so
 ns_param nslog $bindir/nslog.so
 ns_param nscp $bindir/nscp.so
 ns_param nsdb $bindir/nsdb.so
 ns_param shared_tcl tcl
 
 ns_section ns/db/drivers
 ns_param postgres nspostgres.so
 
 ns_section ns/db/pools
 ns_param gameskillspool Postgres
 
 ns_section ns/db/pool/gamespool
 ns_param Driver postgres
 ns_param Connections 5
 ns_param DataSource localhost::games
 ns_param User postgres
 ns_param Password secret
 ns_param Verbose On
 ns_param LogSQLErrors On
 ns_param ExtendedTableInfo On
 ns_param Connection 5
 
 ns_section ns/server/games-admin/db
 ns_param Pools *
 
 I have the following in my db.tcl file:
 set db   [ns_db gethandle  gamespool]
 set datasource [ns_db datasource $db]
 set dbtype[ns_db dbtype $db]
 set driver  [ns_db driver $db]
 set poolname   [ns_db poolname   $db]
 set user[ns_db user   $db]
 set password[ns_db password   $db]
 
 In file admin_op.tcl I do this:
 set row [ns_db select $db select * from tadminoptype;]
 while { [ns_db getrow $db $row] } {
   ns_log Notice [ns_set get $row type] - [ns_set get $row desc]
 }
 
 The problem is that the code in admin_op does not work, I get this error:
 can't read db: no such variable
 while executing
 ns_db select $db select * from tadminoptype;
 
 But if I put this code in the db.tcl file, then it works fine.
 
 Can someone tell me if some settings are wrong, or if I am using ns_db
 incorrectly?
 
 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] ns_db problem

2008-04-01 Thread Bas Scheffers

How are db.tcl and admin.tcl called?

The normal way of using ns_db is simply to get a handle in the page  
(ADP, Tcl or registered proc) that you need it on. Not in some other  
file like your db.tcl.


Bas.

On 02/04/2008, at 7:51 AM, Xavier Bourguignon wrote:


Hi all,

I have this in my config file:
ns_section ns/server/games-admin/modules
   ns_param nssock $bindir/nssock.so
   ns_param nslog $bindir/nslog.so
   ns_param nscp $bindir/nscp.so
   ns_param nsdb $bindir/nsdb.so
   ns_param shared_tcl tcl

ns_section ns/db/drivers
   ns_param postgres nspostgres.so

ns_section ns/db/pools
   ns_param gameskillspool Postgres

ns_section ns/db/pool/gamespool
   ns_param Driver postgres
   ns_param Connections 5
   ns_param DataSource localhost::games
   ns_param User postgres
   ns_param Password secret
   ns_param Verbose On
   ns_param LogSQLErrors On
   ns_param ExtendedTableInfo On
   ns_param Connection 5

ns_section ns/server/games-admin/db
   ns_param Pools *

I have the following in my db.tcl file:
set db   [ns_db gethandle  gamespool]
set datasource [ns_db datasource $db]
set dbtype[ns_db dbtype $db]
set driver  [ns_db driver $db]
set poolname   [ns_db poolname   $db]
set user[ns_db user   $db]
set password[ns_db password   $db]

In file admin_op.tcl I do this:
set row [ns_db select $db select * from tadminoptype;]
while { [ns_db getrow $db $row] } {
ns_log Notice [ns_set get $row type] - [ns_set get $row desc]
}

The problem is that the code in admin_op does not work, I get this  
error:

can't read db: no such variable
   while executing
ns_db select $db select * from tadminoptype;

But if I put this code in the db.tcl file, then it works fine.

Can someone tell me if some settings are wrong, or if I am using ns_db
incorrectly?

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.



--
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] ns_db problem

2008-04-01 Thread Brett Schwarz
 I have this in my config file:
 ns_section ns/server/games-admin/modules
 ns_param nssock $bindir/nssock.so
 ns_param nslog $bindir/nslog.so
 ns_param nscp $bindir/nscp.so
 ns_param nsdb $bindir/nsdb.so
 ns_param shared_tcl tcl
 
 ns_section ns/db/drivers
 ns_param postgres nspostgres.so
 
 ns_section ns/db/pools
 ns_param gameskillspool Postgres
 
 ns_section ns/db/pool/gamespool
 ns_param Driver postgres
 ns_param Connections 5
 ns_param DataSource localhost::games
 ns_param User postgres
 ns_param Password secret
 ns_param Verbose On
 ns_param LogSQLErrors On
 ns_param ExtendedTableInfo On
 ns_param Connection 5
 
 ns_section ns/server/games-admin/db
 ns_param Pools *
 
 I have the following in my db.tcl file:
 set db  [ns_db gethandle  gamespool]

Are you sourcing in db.tcl from admin_op.tcl? Otherwise, how will admin_op.tcl 
know about $db that was set from db.tcl by [ns_db gethandle  gamespool] ?


 set datasource [ns_db datasource $db]
 set dbtype[ns_db dbtype$db]
 set driver  [ns_db driver$db]
 set poolname  [ns_db poolname  $db]
 set user[ns_db user  $db]
 set password[ns_db password  $db]
 
 In file admin_op.tcl I do this:
 set row [ns_db select $db select * from tadminoptype;]
 while { [ns_db getrow $db $row] } {
 ns_log Notice [ns_set get $row type] - [ns_set get $row desc]
 }
 
 The problem is that the code in admin_op does not work, I get this error:
 can't read db: no such variable
 while executing
 ns_db select $db select * from tadminoptype;
 
 But if I put this code in the db.tcl file, then it works fine.
 



  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.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] ns_db problem

2008-04-01 Thread Darren Ferguson
Your pool is called gameskillspool and your in /db/pool you just have 
gamespool.

Respectfully,
Darren Ferguson

Xavier Bourguignon wrote:

Hi all,

I have this in my config file:
ns_section ns/server/games-admin/modules
ns_param nssock $bindir/nssock.so
ns_param nslog $bindir/nslog.so
ns_param nscp $bindir/nscp.so
ns_param nsdb $bindir/nsdb.so
ns_param shared_tcl tcl

ns_section ns/db/drivers
ns_param postgres nspostgres.so

ns_section ns/db/pools
ns_param gameskillspool Postgres

ns_section ns/db/pool/gamespool
ns_param Driver postgres
ns_param Connections 5
ns_param DataSource localhost::games
ns_param User postgres
ns_param Password secret
ns_param Verbose On
ns_param LogSQLErrors On
ns_param ExtendedTableInfo On
ns_param Connection 5

ns_section ns/server/games-admin/db
ns_param Pools *

I have the following in my db.tcl file:
set db   [ns_db gethandle  gamespool]
set datasource [ns_db datasource $db]
set dbtype[ns_db dbtype $db]
set driver  [ns_db driver $db]
set poolname   [ns_db poolname   $db]
set user[ns_db user   $db]
set password[ns_db password   $db]

In file admin_op.tcl I do this:
set row [ns_db select $db select * from tadminoptype;]
while { [ns_db getrow $db $row] } {
ns_log Notice [ns_set get $row type] - [ns_set get $row desc]
}

The problem is that the code in admin_op does not work, I get this error:
can't read db: no such variable
while executing
ns_db select $db select * from tadminoptype;

But if I put this code in the db.tcl file, then it works fine.

Can someone tell me if some settings are wrong, or if I am using ns_db
incorrectly?

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.