Database - functionality for front end application

Pierre Sahores psahores at easynet.fr
Sun Nov 16 03:57:28 CST 2003


Le dim 16/11/2003 à 07:43, Melvin Cox a écrit :

-- snip --
> 
> Problem Two: Placing the current time into a field
> ------------------
> 
> Just prior to an insert or update of any row, I wish to populate the form's 
> Last_update field with a datetime value reflecting the current date and time 
> (ie. "2003-11-14 13:17:39.250").
> 
> How can this best be implemented?
> 

Pick in the basic procs below the way in witch i'm inserting datetime
refs (french format, to be changed for you) in my inserted/updated
records (in sending the queries to PostgreSQL via a piped shell comand).


> function parsesql s
>   global PgPath
>   repeat for each char c in s
>     try
>       if chartonum(c) > 223
>       then put "&#" & chartonum(c) & ";" after t
>       else if chartonum(c) > 191
>       then put "&#" & chartonum(c) & ";" after t
>       else put c after t
>     catch errornum
>       if c is not char 1 of s
>       then if c is not char -1 of s
>       then put "_" after t
>     end try
>   end repeat
>   replace "\" with "" in t
>   replace "[" with "&" in t
>   replace "]" with "\" in t
>   return shell("echo" && quote & t & quote && "|" && PgPath)
> end parsesql
> 
> 
> 
> function presave r
>   set itemdel to "¶"
>   put item 1 of r into s
>   put item 2 of r into t
>   set itemdel to "&"
>   replace numtochar(10) with "##10;#" in s
>   replace "\'" with "##11;#" in s
>   replace numtochar(34) with "##34;#" in s
>   replace "##11;###11;#" with "" in s
>   if "NRC=insert" is in s then put item itemoffset("rneetabl=",s) of s & return into datatosave
>   repeat for each item i in s
>     if char 1 to 4 of i is t then put i & return after datatosave
>   end repeat
>   repeat for each char c in datatosave
>     try
>       if c is "_"
>       then put " " after datatosavec
>       else if chartonum(c) > 223
>       then put "&#" & chartonum(c) & ";" after datatosavec
>       else if chartonum(c) > 191
>       then put "&#" & chartonum(c) & ";" after datatosavec
>       else if chartonum(c) = 39
>       then put "&#" & chartonum(c) & ";" after datatosavec
>       else put c after datatosavec
>     catch errornum
>       if c is not char 1 of datatosave
>       then if c is not char -1 of datatosave
>       then put "_" after datatosavec
>     end try
>   end repeat
>   set itemdelimiter to "/"
>   put item 2 of the short date & "/" & item 1 of the short date & "/" & item 3 of the short date into aa
>   if length(item 1 of aa) = 1 then put "0" before item 1 of aa
>   if length(item 2 of aa) = 1 then put "0" before item 2 of aa
>   put "20" before item 3 of aa
>   if "rneetabl" is in datatosavec then
>     put " ( " into insertcolnames
>     put " values ( " into insertcoldatas
>     repeat for each line l in datatosavec
>       if l is line -1 of datatosavec then
>         put char 1 to 8 of l && ") " after insertcolnames
>         put "'" & aa & "' ) " after insertcoldatas
>       else
>         put char 1 to 8 of l && ", " after insertcolnames
>         put "'" & char 10 to -1 of l & "' , " after insertcoldatas
>       end if
>     end repeat
>     put insertcolnames && insertcoldatas into updatecols
>   else
>     repeat for each line l in datatosavec
>       if l is line -1 of datatosavec then put char 1 to 8 of l && "= '" & aa & "'" after updatecols
>       else put char 1 to 8 of l && "= '" & the char 10 to -1 of l & "' , " after updatecols
>     end repeat
>   end if
>   return updatecols
> end presave

> 
> Problem Three: Forcing All Caps
> --------------------
> 
> To insure data integrity, my application design requires entry of data into 
> the "Pid" field in UPPER CASE format.
> 
> While I have been successful in limiting the length of the data entered in 
> this field to ten (10) characters or less, my attempts to force 
> CAPITALIZATION have to date failed.  The following script is currently 
> applied to the field:

>From within Rev, just use the toUpper(x) transcript build-in function.

Hope this help,
> 
> ===================================
> 
> on keyDown theKey
>   if the length of me >= 10 then beep
>   else pass keyDown
> end keyDown
> 
> ===================================
> 
> Any assistance in these areas is most sincerely appreciated.
> 
> 
> 
> Melvin Cox
> BCM Productions
> 
> _________________________________________________________________
> Frustrated with dial-up? Get high-speed for as low as $26.95.  
> https://broadband.msn.com (Prices may vary by service area.)
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

-- 
Bien cordialement, Pierre Sahores

100, rue de Paris
F - 77140 Nemours

psahores at easynet.fr

GSM:   +33 6 03 95 77 70
Pro:   +33 1 41 60 52 68
Dom:   +33 1 64 45 05 33
Fax:   +33 1 64 45 05 33

Inspection académique de Seine-Saint-Denis
Applications et SGBD ACID SQL (WEB et PGI)
Penser et produire "delta de productivité"


More information about the use-livecode mailing list