summaryrefslogtreecommitdiffstats
path: root/kexi/tests/altertable/defaultvalues.altertable
blob: d5abe1342ee460d6ba4e7f17acb4dfd698751b60 (plain)
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
openDatabase 1.kexi

/* 
 This test checks:
 - creating table fields of all possible types with specific default values
 - adding new fields to the table with preserving the original content

 All the existing columns are removed

 Used tables: cars
*/

designTable cars #initially there are 3rows
 removeField 2
 removeField 2
 i=2
 insertField i textField
 changeFieldProperty i type string text
 changeFieldProperty i defaultValue string abc
 i++
 insertField i longTextField
 changeFieldProperty i type string longText
 changeFieldProperty i defaultValue string def
 i++
 insertField i byteField
 changeFieldProperty i type string byte
 changeFieldProperty i defaultValue int 11
 i++
 insertField i shortIntField
 changeFieldProperty i type string shortInteger
 changeFieldProperty i defaultValue int 22
 i++
 insertField i intField
 changeFieldProperty i type string integer
 changeFieldProperty i defaultValue int 333
 i++
 insertField i bigIntField
 changeFieldProperty i type string bigInteger
 changeFieldProperty i defaultValue longlong 1234567891011
 i++
 insertField i booleanField
 changeFieldProperty i type string boolean
 changeFieldProperty i defaultValue bool true
 i++
 insertField i dateField
 changeFieldProperty i type string date
 changeFieldProperty i defaultValue date 2006-08-09
 i++
 insertField i dateTimeField
 changeFieldProperty i type string dateTime
 changeFieldProperty i defaultValue dateTime 2006-08-09T10:36:01
 i++
 insertField i timeField
 changeFieldProperty i type string time
 changeFieldProperty i defaultValue time 10:36:02
 i++
 insertField i floatField
 changeFieldProperty i type string float
 changeFieldProperty i defaultValue float 1.98
 i++
 insertField i doubleField
 changeFieldProperty i type string double
 changeFieldProperty i defaultValue double 3.1415926
 i++
 insertField i blobField
 changeFieldProperty i type string blob
 changeFieldProperty i defaultValue byteArray fdfeff
endDesign

 showSchema

 checkSchema
  id  UNSIGNED Integer AUTOINC UNIQUE PKEY NOTNULL NOTEMPTY
  textfield Text(200) DEFAULT=[TQString]abc,
  longtextfield LongText DEFAULT=[TQString]def,
  bytefield Byte DEFAULT=[int]11,
  shortintfield ShortInteger DEFAULT=[int]22,
  intfield Integer DEFAULT=[int]333,
  bigintfield BigInteger DEFAULT=[TQ_LLONG]1234567891011,
  booleanfield Boolean NOTNULL DEFAULT=[bool]true,
  datefield Date DEFAULT=[QDate]2006-08-09,
  datetimefield DateTime DEFAULT=[QDateTime]2006-08-09T10:36:01,
  timefield Time DEFAULT=[QTime]10:36:02,
  floatfield Float DEFAULT=[double]1.98,
  doublefield Double DEFAULT=[double]3.1415926,
  blobfield BLOB DEFAULT=[QByteArray]FDFEFF
 endSchema

# showActions clipboard

 checkActions
Remove table field "owner"
Remove table field "model"
Insert table field "textfield" at position 1 (textfield Text(200) DEFAULT=[TQString]abc)
Insert table field "longtextfield" at position 2 (longtextfield LongText DEFAULT=[TQString]def)
Insert table field "bytefield" at position 3 (bytefield Byte DEFAULT=[int]11)
Insert table field "shortintfield" at position 4 (shortintfield ShortInteger DEFAULT=[int]22)
Insert table field "intfield" at position 5 (intfield Integer DEFAULT=[int]333)
Insert table field "bigintfield" at position 6 (bigintfield BigInteger DEFAULT=[TQ_LLONG]1234567891011)
Insert table field "booleanfield" at position 7 (booleanfield Boolean NOTNULL DEFAULT=[bool]true)
Insert table field "datefield" at position 8 (datefield Date DEFAULT=[QDate]2006-08-09)
Insert table field "datetimefield" at position 9 (datetimefield DateTime DEFAULT=[QDateTime]2006-08-09T10:36:01)
Insert table field "timefield" at position 10 (timefield Time DEFAULT=[QTime]10:36:02)
Insert table field "floatfield" at position 11 (floatfield Float DEFAULT=[double]1.98)
Insert table field "doublefield" at position 12 (doublefield Double DEFAULT=[double]3.1415926)
Insert table field "blobfield" at position 13 (blobfield BLOB DEFAULT=[QByteArray]FDFEFF)
 endActions

saveTableDesign #executes Alter Table

#closeWindow

#stop
#quit

# copyTableDataToClipboard
 showTableData clipboard
# stop

 checkTableData
"ID"	"textField"	"longTextField"	"byteField"	"shortIntField"	"intField"	"bigIntField"	"booleanField"	"dateField"	"dateTimeField"	"timeField"	"floatField"	"doubleField"	"blobField"
1	"abc"	"def"	11	22	333	1234567891011	true	2006-08-09	2006-08-09 10:36:01	10:36:02	1.98	3.1415926	"FDFEFF"
2	"abc"	"def"	11	22	333	1234567891011	true	2006-08-09	2006-08-09 10:36:01	10:36:02	1.98	3.1415926	"FDFEFF"
3	"abc"	"def"	11	22	333	1234567891011	true	2006-08-09	2006-08-09 10:36:01	10:36:02	1.98	3.1415926	"FDFEFF"
5	"abc"	"def"	11	22	333	1234567891011	true	2006-08-09	2006-08-09 10:36:01	10:36:02	1.98	3.1415926	"FDFEFF"
6	"abc"	"def"	11	22	333	1234567891011	true	2006-08-09	2006-08-09 10:36:01	10:36:02	1.98	3.1415926	"FDFEFF"
 endTableData