]> rtime.felk.cvut.cz Git - edu/osp-wiki.git/blob - student/dendimar/index.mdwn
(no commit message)
[edu/osp-wiki.git] / student / dendimar / index.mdwn
1 [[!meta title="Dendis Martin"]]
2
3 **Project name and homepage:** [Nette](http://nette.org)
4
5 Assignment
6 ======
7
8 I'd like to help fix some bugs in database layout I've discovered
9
10 (a) If I have in database column with type time/timeint, database layout will return it's values as instance of class DateInterval. But when I want to insert or update this column, database layout can't process DateInterval & crashes.
11 See the example:
12
13 >     // This works just fine
14 >     $actRow = $this->connection->table('test')->insert(array('time' => '1:30:00'));
15
16 >     // But this will crash, because database layout can't deal with class DateInterval on insert or update
17 >     $actRow = $this->connection->table('test')->insert(array('time' => new \DateInterval('PT1H30M')));
18
19 >     // On the other hand
20 >     $actRow = $this->connection->table('test')->insert(array('time' => '1:30:00'));
21 >     echo $actRow['time'] instanceof \DateInterval ? 'Yes' : 'No'; // Will print Yes
22
23 (b) If I'm working with ActivRow and I want to update column which is defined as primary key the app crashes. It's because after each update of ActiveRow database layout fetches (refreshes) row from database, but with old values of primary keys. Seethe example:
24
25 >     // In database I have in table test defined column id as primary key
26 >     $actRow = $this->connection->table('test')->insert(array('username' => 'marek'));
27 >
28 >     // This operation will fail, the data in the database has been modified
29 >     // But after update, database layout will try to refresh ActiveRow from database 
30 >     // and use old primary key 'marek' instead of new one 'ondra' so no record is found and exception is thrown
31 >     $actRow->update(array('username' => 'ondra'));
32
33 and maybe some others...
34  
35
36 Links documenting the results of my work
37 ======
38
39 Here, I'll add links similar to the examples below and describe what
40 is being linked.
41
42
43 Presentation
44 ==========
45
46
47 Ohloh
48 =====
49
50 Here, I'll fill in the HTML code of the [Ohloh widgetu][w] showing my KudoRank.
51
52 For example:
53
54 [w]:https://www.ohloh.net/accounts/dendimar/widgets
55
56
57   [1]: https://sourceforge.net/p/phpmyadmin/feature-requests/1491/
58
59