db_types.anubis
2.03 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
* Created by PyramIDE.
* User: Totoro
* Date: 14/11/2011
* Time: 22:41
*
*/
transmit tools/basis.anubis
transmit tools/ISO-8601.anubis
/* DB_id will is deprecated. Please use next version below all upper case */
public type DB_id:
none,
db_id(Int value).
public type DB_ID:
none,
pk(Int value).
public type DB_datetime:
db_datetime(String datetime). //Date and time in ISO8601 format "YYYY-MM-DD hh:mm:ss"
public type DB_date:
db_date(String date). //Date in ISO8601 format "YYYY-MM-DD"
public type DB_time:
db_time(String time). //Time in ISO8601 format "hh:mm:ss"
public type DB_integer:
db_integer(Int value).
public define String
to_String
(
DB_id idx
)=
if idx is
{
none then "none",
db_id(_idx) then abs_to_decimal(_idx)
}.
public define Int
to_Int
(
DB_id idx
)=
if idx is
{
none then (Int)-1,
db_id(_idx) then _idx
}.
public define String
to_String
(
DB_ID idx
)=
if idx is
{
none then "none",
pk(_idx) then abs_to_decimal(_idx)
}.
public define Int
to_Int
(
DB_ID idx
)=
if idx is
{
none then (Int)-1,
pk(_idx) then _idx
}.
public define String
to_String
(
DB_date d
)=
date(d).
public define String
to_String
(
DB_datetime dt
)=
datetime(dt).
public define String
to_String
(
DB_time t
)=
time(t).
public define String
to_DBString
(
Bool value
)=
if value then "1" else "0".
public define Int
to_DBInt
(
Bool value
)=
if value then 1 else 0.
public type SQLite3_update_field:
field(String column, SQLite3Bind bind).
* Some Bind helper *
/********** Some default type values ********************/
public define DB_datetime
get_dummy_DB_datetime
=
db_datetime("").
public define DB_datetime
now
=
db_datetime(_Int_to_ISO_8601_datetime(now)).
public define DB_time
get_dummy_DB_time
=
db_time("").
public define DB_date
get_dummy_DB_date
=
db_date("").