[ic] Getting a db match in GDBM

Jeff Fearn interchange-users@icdevgroup.org
Fri Aug 16 13:19:01 2002


I don't seem to have any trouble creating or updating the records, but 
getting a matched is proving elusive. Below are some things I have tried, 
please take into account that I have been working on these for a while and 
they seem to get worse as my frustration level increases :}

oops, What I am aiming for is to know if there is a match where session_id = 
the current session and result = "A", I don't really care how many are in 
there of other results. It should only ever be 1, and they all get deleted 
after the check.

This one chokes on the and, it does not interpolate, tried several 
modifications:

[seti result]0[/seti]
[loop search="
ra=yes
st=db
sq=select * from comsec
ml=1000
"]
[if interpolate=1 [loop-data comsec session_id] eq [data session id]]
[and [loop-data comsec result] eq "A"]
[seti result]1[/seti]
[/if]
[/loop]
[scratch result]


This one never returns a positive value, suspect GDBM is choking on the 
where clause:

[perl tables="comsec"]
	my $db = $Db{comsec};
	my $count = $db->query(
	{
	sql => "SELECT * FROM comsec WHERE session_id='[data session id]' and 
result='A'",
	row_count => 1,
	}
	);
	$Scratch->{count} = $count;
[/perl]
[scratch count]<BR>


Basically same as above, same result as well :{

[tmp dbResult]
        [query st=db
                table=comsec
                type=row_count
                sql="SELECT * FROM comsec WHERE session_id='[data session 
id]' and result='A'"]
        [/query]
[/tmp]
[scratch dbResult]

Thanks, Jeff.


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com