|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
define('DEBUG_INIT_SKIP_SECONDARY', true); |
|
4
|
|
|
|
|
5
|
|
|
require_once "../includes/init.php"; |
|
6
|
|
|
|
|
7
|
|
|
//$player = new Player(); |
|
8
|
|
|
//$player->db_load_by_id(2); |
|
9
|
|
|
//$player->unitList->_dump(); |
|
10
|
|
|
//pvar_dump($player->player_bonus); |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
class TestDBRow extends DBRow { |
|
14
|
|
|
|
|
15
|
|
|
public static $_table = ''; |
|
16
|
|
|
public static $_dbIdFieldName = 'id'; |
|
17
|
|
|
public static $_properties = array( |
|
18
|
|
|
'dbId' => array( |
|
19
|
|
|
P_DB_FIELD => 'id', |
|
20
|
|
|
), |
|
21
|
|
|
); |
|
22
|
|
|
|
|
23
|
|
|
public $_dbId; |
|
24
|
|
|
|
|
25
|
|
|
public function __construct() { |
|
26
|
|
|
parent::__construct(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function __get($name) { |
|
30
|
|
|
return parent::__get($name); // TODO: Change the autogenerated stub |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function __set($name, $value) { |
|
34
|
|
|
parent::__set($name, $value); // TODO: Change the autogenerated stub |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function dbLoad($dbId, $lockSkip = false) { |
|
38
|
|
|
return parent::dbLoad($dbId, $lockSkip); // TODO: Change the autogenerated stub |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function dbSave() { |
|
42
|
|
|
parent::dbSave(); // TODO: Change the autogenerated stub |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function dbInsert() { |
|
46
|
|
|
return parent::dbInsert(); // TODO: Change the autogenerated stub |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function dbUpdate() { |
|
50
|
|
|
parent::dbUpdate(); // TODO: Change the autogenerated stub |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function dbDelete() { |
|
54
|
|
|
parent::dbDelete(); // TODO: Change the autogenerated stub |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
public function isNew() { |
|
59
|
|
|
return parent::isNew(); // TODO: Change the autogenerated stub |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Является ли запись пустой - т.е. при исполнении _dbSave должен быть удалён |
|
64
|
|
|
* |
|
65
|
|
|
* @return bool |
|
66
|
|
|
*/ |
|
67
|
|
|
public function isEmpty() { |
|
68
|
|
|
// TODO: Implement isEmpty() method. |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function dbRowParse(array $db_row) { |
|
72
|
|
|
parent::dbRowParse($db_row); // TODO: Change the autogenerated stub |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function dbMakeFieldSet($isUpdate = false) { |
|
76
|
|
|
return parent::dbMakeFieldSet($isUpdate); // TODO: Change the autogenerated stub |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function db_field_set_create(array $field_set) { |
|
80
|
|
|
return parent::db_field_set_create($field_set); // TODO: Change the autogenerated stub |
|
81
|
|
|
} |
|
82
|
|
|
public function db_field_update(array $field_set) { |
|
83
|
|
|
return parent::db_field_update($field_set); // TODO: Change the autogenerated stub |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function isFieldChanged($fieldName) { |
|
87
|
|
|
return parent::isFieldChanged($fieldName); // TODO: Change the autogenerated stub |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Lock all fields that belongs to operation |
|
92
|
|
|
* |
|
93
|
|
|
* @param int $dbId |
|
94
|
|
|
* |
|
95
|
|
|
* @return |
|
96
|
|
|
* param DBLock $dbRow - Object that accumulates locks |
|
97
|
|
|
* |
|
98
|
|
|
*/ |
|
99
|
|
|
public function dbGetLockById($dbId) { |
|
100
|
|
|
// TODO: Implement dbGetLockById() method. |
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/* |
|
105
|
|
|
lh__test |
|
106
|
|
|
|
|
107
|
|
|
id |
|
108
|
|
|
abigint |
|
109
|
|
|
adatetime |
|
110
|
|
|
astring |
|
111
|
|
|
afloat |
|
112
|
|
|
adecimal |
|
113
|
|
|
res_metal |
|
114
|
|
|
res_crystal |
|
115
|
|
|
|
|
116
|
|
|
-- ---------------------------- |
|
117
|
|
|
-- Table structure for lh__test |
|
118
|
|
|
-- ---------------------------- |
|
119
|
|
|
DROP TABLE IF EXISTS `lh__test`; |
|
120
|
|
|
CREATE TABLE `lh__test` ( |
|
121
|
|
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
122
|
|
|
`abigint` bigint(20) DEFAULT NULL, |
|
123
|
|
|
`adatetime` datetime DEFAULT NULL, |
|
124
|
|
|
`astring` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, |
|
125
|
|
|
`afloat` float DEFAULT NULL, |
|
126
|
|
|
`adecimal` decimal(64,8) DEFAULT NULL, |
|
127
|
|
|
`res_metal` decimal(64,4) DEFAULT NULL, |
|
128
|
|
|
`res_crystal` decimal(64,0) DEFAULT NULL, |
|
129
|
|
|
PRIMARY KEY (`id`) |
|
130
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
|
131
|
|
|
|
|
132
|
|
|
*/ |
|
133
|
|
|
|
|
134
|
|
|
sn_db_transaction_start(); |
|
135
|
|
|
//$fleet = new Fleet(); |
|
136
|
|
|
// |
|
137
|
|
|
//$raisedError = false; |
|
138
|
|
|
//try { |
|
139
|
|
|
// $fleet->dbSave(); |
|
140
|
|
|
//} catch (Exception $e) { |
|
141
|
|
|
// $raisedError = true; |
|
142
|
|
|
//} |
|
143
|
|
|
|
|
144
|
|
|
//$fleet->dbLoad(103); |
|
145
|
|
|
// |
|
146
|
|
|
////$fleet_row = doquery("SELECT * FROM {{fleets}} WHERE fleet_id = 80;", true); |
|
147
|
|
|
////$fleet_row = doquery("SELECT * FROM {{fleets}} WHERE fleet_id = 8;", true); |
|
148
|
|
|
////pdump($fleet_row); |
|
149
|
|
|
////$fleet->dbRowParse($fleet_row); |
|
150
|
|
|
////pdie('disabled for debug purposes'); |
|
151
|
|
|
// |
|
152
|
|
|
////$fleet->setDbId(0); |
|
153
|
|
|
////$fleet->unitList->unitZeroDbId(); |
|
154
|
|
|
////pvar_dump($fleet->unitList[1131268]); |
|
155
|
|
|
////pdie('disabled for debug purposes'); |
|
156
|
|
|
// |
|
157
|
|
|
// |
|
158
|
|
|
// |
|
159
|
|
|
//pdump(property_exists($fleet->unitList[1131268], 'count'), 'count exists'); |
|
160
|
|
|
//pdump($fleet->unitList[1131268]->count); |
|
161
|
|
|
//$fleet->unitList[1131268]->adjustCount(-1); |
|
162
|
|
|
//pdump($fleet->unitList[1131268]->count); |
|
163
|
|
|
// |
|
164
|
|
|
//$fleet->dbSave(); |
|
165
|
|
|
// |
|
166
|
|
|
//pvar_dump($fleet->unitList); |
|
167
|
|
|
// |
|
168
|
|
|
////$fleet->unitList->unitZeroCount(); |
|
169
|
|
|
////$fleet->dbSave(); |
|
170
|
|
|
|
|
171
|
|
|
//pdie('disabled for debug purposes'); |
|
172
|
|
|
|
|
173
|
|
|
|
|
174
|
|
|
//sn_db_transaction_commit(); |
|
175
|
|
|
|
|
176
|
|
|
pdie('tests completed'); |