-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_key_uniqueness_err.txt
67 lines (57 loc) · 1.89 KB
/
get_key_uniqueness_err.txt
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
$dataTypeMap:=New collection
$dataTypeMap[1]:="boolean"
//
$dataTypeMap[3]:="16-bit integer"
$dataTypeMap[4]:="32-bit integer"
$dataTypeMap[5]:="64-bit integer"
$dataTypeMap[6]:="real"
$dataTypeMap[7]:="float"
$dataTypeMap[8]:="date"
$dataTypeMap[9]:="time"
$dataTypeMap[10]:="text inside record"
//11
$dataTypeMap[12]:="picture"
$dataTypeMap[13]:="UUID"
$dataTypeMap[14]:="text outside record"
//15
//16
//17
$dataTypeMap[18]:="BLOB"
$dataTypeMap[19]:="text inside record" //utf8
$dataTypeMap[20]:="text outside record" //utf8
$dataTypeMap[21]:="object"
ARRAY LONGINT($types;0)
//1-field
Begin SQL
SELECT DISTINCT(_USER_COLUMNS.DATA_TYPE)
FROM _USER_CONS_COLUMNS,_USER_COLUMNS,_USER_CONSTRAINTS
WHERE _USER_CONSTRAINTS.CONSTRAINT_TYPE= '4DR'
AND _USER_CONSTRAINTS.CONSTRAINT_ID = _USER_CONS_COLUMNS.CONSTRAINT_ID
AND _USER_COLUMNS.TABLE_ID = _USER_CONSTRAINTS.RELATED_TABLE_ID
AND _USER_COLUMNS.COLUMN_ID = _USER_CONS_COLUMNS.RELATED_COLUMN_ID
INTO :$types;
End SQL
$types1:=New collection
ARRAY TO COLLECTION($types1;$types)
C_LONGINT($type)
$results:=New collection
ARRAY TEXT($fields;0)
For each ($type;$types1)
Begin SQL
SELECT DISTINCT(CONCAT(CONCAT(CONCAT('[:',_USER_COLUMNS.TABLE_ID),']:'),_USER_COLUMNS.COLUMN_ID))
FROM _USER_CONS_COLUMNS,_USER_COLUMNS,_USER_CONSTRAINTS
WHERE _USER_CONSTRAINTS.CONSTRAINT_TYPE= '4DR'
AND _USER_CONSTRAINTS.CONSTRAINT_ID = _USER_CONS_COLUMNS.CONSTRAINT_ID
AND _USER_COLUMNS.TABLE_ID = _USER_CONSTRAINTS.RELATED_TABLE_ID
AND _USER_COLUMNS.COLUMN_ID = _USER_CONS_COLUMNS.RELATED_COLUMN_ID
AND _USER_COLUMNS.UNIQUENESS = FALSE
AND _USER_COLUMNS.DATA_TYPE = :$type
INTO :$fields;
End SQL
If (Size of array($fields)#0)
For ($i;1;Size of array($fields))
$results.push(New collection($dataTypeMap[$type];Parse formula($fields{$i};Formula out with tokens)).join("\t"))
End for
End if
End for each
SET TEXT TO PASTEBOARD($results.join("\r"))