All pastes #553309 Raw Edit

Something

public text v1 · immutable
·published 2007-06-09 17:37 UTC
rendered paste body
\ \ * ForthUNE * mySQL module *

REQUIRE "		~ac/lib/str5.f
REQUIRE {		~ac/lib/locals.f
REQUIRE MyQuery		~day/lib/mysql.f 
: SKIPn ( asc # u --> asc # )
	OVER MIN TUCK - >R + R>
;


: selectValueJivevcard_String#1
	S' SELECT value FROM jivevcard WHERE username="'
;
: updateValueJivevcard_String#1
	S' UPDATE jivevcard SET value=<vCard xmlns="vcard-temp"><MUC0>'
;
: updateValueJivevcard_String#2
	S' " WHERE username="'
;
: endS
	S' "'
;

\ \ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
: edit_updateValueJivevcard { \ val2 id2 } ( Login Value -- Str )
	(") -> val2
	(") -> id2
	" {updateValueJivevcard_String#1}{$val2}{updateValueJivevcard_String#2}{$id2}{endS}" STR@
;

\ \ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


: querer { \ muc id myH myRes val }
-> id
-> muc
		S" localhost" S" root" S" 44444" MyConnect 0=
	IF
		TO myH
		S" wildfire" myH MySelectDB
						0= ABORT" can't select db"
		" {selectValueJivevcard_String#1}{$id}{endS}" STR@
		myH MyQuery
						0=  ABORT" Can't make query"
		myH MyStoreRes TO myRes
		0 myRes MyFetchRow
		myRes ColData 37 SKIPn (")
\ -> val
\		" {updateValueJivevcard_String#1}{$muc}{$val}{updateValueJivevcard_String#2}{$id}{endS}" STR@
 STYPE SPACE
		myRes MyFreeRes
		myH MyClose
	ELSE
	THEN
;
: updater { \ muc id myH myRes val }
-> id
-> muc
		S" localhost" S" root" S" 44444" MyConnect 0=
	IF
		TO myH
		S" wildfire" myH MySelectDB
						0= ABORT" can't select db"
		" {selectValueJivevcard_String#1}{$id}{endS}" STR@
		myH MyQuery
						0=  ABORT" Can't make query"
		myH MyStoreRes TO myRes
		0 myRes MyFetchRow
		myRes ColData 37 SKIPn (")
\ -> val
\		" {updateValueJivevcard_String#1}{$muc}{$val}{updateValueJivevcard_String#2}{$id}{endS}" STR@
 STYPE SPACE
 id

		myH MyQuery
		myRes MyFreeRes
		myH MyClose
	ELSE
	THEN
;


\ STARTLOG

: test
S" 11233" (")
S" 11111111" (")
 querer
 S" 11233" (")
 S" 11111111" (")
\ querer
\ updater
;

test
\EOF
( Login -- Value )