r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

Graham
2-Jun-2007
[822x2]
Ok. Thanks
Does Cheyenne honor the shebang on rebol cgi scripts ?
Dockimbel
2-Jun-2007
[824]
It just skip it.
Graham
2-Jun-2007
[825x2]
Or, does it just spawn a separate rebol process for it?
Ok, I presumed it wasn't necessary
Dockimbel
2-Jun-2007
[827x2]
Cheyenne uses one of the bg process to execute the CGI.
That way Cheyenne achieve FastCGI speed on normal CGI scripts.
Graham
2-Jun-2007
[829]
Before I think I checked on each page to see if the user was authenticated 
by checking the session.  But it looks like this is now automatic, 
and the user is sent to login page if they access a page and the 
user is not authenticated?
Dockimbel
2-Jun-2007
[830x5]
Right, but only if you're inside a web-app container (defined in 
the config file). Otherwise, it's up to you to do the checking.
You can use RSP at 3 different levels :
1- raw RSP pages : no session data
2- RSP with session context : start a session using SESSION/START 
and keep some data persistant in the session context.
3 - Web-app : RSP application container, automatic session management, 
login state built-in support, etc...
Graham
2-Jun-2007
[835x4]
well, that makes it easier :)
## Error in [conf-parser] : Error in conf file at:
remr odbc://remr !
Hmm.  Doesn't like my database block.
databases [
		remr odbc://remr
]
Dockimbel
2-Jun-2007
[839]
the databases block have to be in : globals [...] specification block
Graham
2-Jun-2007
[840x3]
Ok, now working there.
Should this work?


	in-user: select request/content 'login
	in-pass: select request/content 'pass
	
	if all [ in-user in-pass ][

  result: do-sql 'remr rejoin [ {select staffname from staff where 
  staffname = '} in-user {' and pwd = '} in-pass {'} ]

		print <pre>
		probe result
		print </pre>	
	]
Error Code :  	305
Description : 	script error !

Invalid argument: select staffname from staff where staffname = 'test' 
and pwd = 'letmein'
Near : 	[any [
insert pos/2 data 
copy pos/2
]]
Where : 	do-sql
Dockimbel
2-Jun-2007
[843x3]
if you're using the odbc:// driver, like all RT's DB drivers, it 
requires a : first db-port to open the connection port, so you have 
to change the do-sql source a little bit (in %handler/RSP.r file), 
in do-sql source :
if any [block? pos/2 url? pos/2][
	poke pos 2 open pos/2
]

replace it by :

if any [block? pos/2 url? pos/2][
	poke pos 2 first open pos/2
]
I'll fix that for next release. It wasn't a priority for me until 
now, because I only use my own DB drivers which API differs a little 
from RT's ones.
Graham
2-Jun-2007
[846x3]
Ok.
Error Code :
			
301

		Description :
			
 script  error ! 
 sql needs a value

		Near :
			
[sql: do-sql 'remr qry 
probe
]

		Where :
			
protected-exec
I'm passing a correct sql string .. tested in console, but I get 
this error.
Dockimbel
2-Jun-2007
[849]
need to go, will be back in half a hour.
Graham
2-Jun-2007
[850x3]
Ok.
Just noticed all the Rebol icons in the system try - for Cheyenne
tray
Dockimbel
2-Jun-2007
[853]
If you close Cheyenne by using the [x] console gadget, a ghost image 
remains in the systray (disappears if you pass you mouse over), f 
you stop your Cheyenne session by using the systray menu, it will 
clean it properly.
Graham
2-Jun-2007
[854]
doing sql the usual way works ...
Dockimbel
2-Jun-2007
[855]
I can't see what's causing your error, it may be related to another 
difference between odbc:// and my DB API.
Graham
2-Jun-2007
[856]
I  guess it should be okay if I just open my odbc connection in cheyenne.r 
?
Dockimbel
2-Jun-2007
[857x3]
no, it won't work, RSP are executed in bg processes, not in the main 
cheyenne process.
give me a few minutes, I've reproduce the error here using RT's mysql 
driver, tracking the cause...
reproduced
Graham
2-Jun-2007
[860]
thax
Dockimbel
2-Jun-2007
[861x3]
Here's a patched version of do-sql working with /Command DB drivers 
(paste it in %handlers/RSP.r) :
set 'do-sql func [[catch] db [word!] data [string! block! word!] 
/flat /local port][
		if not block? databases [
			throw make error! "no databases defined!"
		]
		if not pos: find databases :db [
			throw make error! rejoin ["database" :db "not defined!"]
		]
		port: pos/2
		if any [block? port url? port][
			poke pos 2 port: first open port
		]
		either word? data [
			db-cache/query db data flat
		][
			poke response/stats 1 response/stats/1 + 1
			either all [flat value? 'send-sql][
				send-sql/flat port data
			][
				either port/handler [
					any [
						insert port data
						copy port
					]
				][
					insert port data
					copy port
				]
			]
		]
	]
Note that the /FLAT won't work with /Command drivers (I'll add such 
support in next releases).
Graham
2-Jun-2007
[864x3]
Works ..
I don't know what /Flat does .. so I guess I can do without it :)
bed for me ... thanks.
Pekr
2-Jun-2007
[867x4]
I don't want to post off-topic here, but as you are here guys - do 
you think that it would be vital/possible, for R3, to create some 
DB abstraction schema?Kind of ODBC, JDBC --> RDBC? So that we could 
use the same syntax and just choose the driver underneath?
/flat?
should provide you with just one block, so youcan use foreach [name 
last-name whatever][record][do something ....
flat - simply - each record is not separate subblock ....
Dockimbel
2-Jun-2007
[871]
/Command DB API is a de-facto standard. I didn't complied with that 
standard, just because I found it not handy the db-port / command-port 
approach ...so my fault ;-)