Menu

[r1]: / src / functions / functions.cs  Maximize  Restore  History

Download this file

76 lines (60 with data), 1.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# function: fieldreplace
#
# create a php string with database fields from between [[]] tokens
# function: multiply
#
# create code to search fields between [[]] tokens
#set getvars=''
#set data_connection=0
#function doreplace str fid fnr
#set result=str
#match str with \([^[]*\)\[\([^[]*\)\[\([^]]*\)\]\([^]]*\)\]\(.*\) into front,before,name,after,back
#if before<>'' or after<>''
#set getvars=getvars ^ ' if ($sql->data[F' ^ fid ^ '_' ^ string_of_int fnr ^']==\'\') {$' ^ name ^ '=\'\';} else {$' ^ name ^ '=\'' ^ before ^ '\'.$sql->data[F' ^ fid ^ '_' ^ string_of_int fnr ^'].\'' ^ after ^ '\';};\n'
#else
#set getvars=getvars ^ ' $' ^ name ^ '=$sql->data[F' ^ fid ^ '_' ^ string_of_int fnr ^'];\n'
#end
#set result=front ^ '$' ^ name ^ doreplace back fid (fnr+1)
#end
#set doreplace=result
#end
#function fieldreplace str fid
#set result=''
#set getvars=''
#match str with \([^[]*\)\[\([^[]*\)\[\([^]]*\)\]\([^]]*\)\]\(.*\)
#set result=doreplace str fid 1
#end
#if result=''
#set result=str
#end
#set fieldreplace=result
#end
#function queryvars table str fnr snr
#set result=''
#match str with \([^[]*\)\[\([^[]*\)\[\([^]]*\)\]\([^]]*\)\]\(.*\) into front,before,name,after,back
#set result=table ^ '.' ^ name ^ ' as F' ^ fnr ^ '_' ^ string_of_var snr
#set next=queryvars table back fnr (snr+1)
#if next<>''
#set result=result ^ ', ' ^ next
#end
#end
#set queryvars=result
#end
#function domultiply str action
#set result=''
#match str with \([^[]*\)\[\([^[]*\)\[\([^]]*\)\]\([^]]*\)\]\(.*\) into front,before,name,after,back
#set next=domultiply back action
#set result=name ^ action ^ (if next='' then '' else 'OR ' ^ next)
#end
#set domultiply=result
#end
#function multiply str action
#set result=''
#match str with \([^[]*\)\[\([^[]*\)\[\([^]]*\)\]\([^]]*\)\]\(.*\)
#set result=domultiply str action
#end
#if result=''
#set result=str ^ action
#end
#set multiply=result
#end
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.