@@ -35,10 +35,10 @@ implementation *and* API of prepared statements is in `PreparedImpl`.
35
35
ddox-generated documentation, AND no longer accomplishes anything * anyway*
36
36
now that ` PreparedImpl ` no longer has any dtor (for various complicated
37
37
reasons relating to struct dtors, the auto-purge feature from v1.1.4 and
38
- recognizing that manual release of statements from the server isn't stictly
38
+ recognizing that manual release of statements from the server isn't strictly
39
39
necessary, being per-connection after all).
40
40
41
- 6 . Mysql-native is not currently tempated on connection type, it uses a literal
41
+ 6 . Mysql-native is not currently templated on connection type, it uses a literal
42
42
` Connection ` throughout. Unfortunately, this means the ` LockedConnection!Connection `
43
43
returned by Vibe.d's connection pools (which ` MySQLPool ` is based on) gets
44
44
downgraded to a mere ` Connection ` . Ordinarily this would be fine if it was only
@@ -51,36 +51,36 @@ to correct this just to still compile anyway.
51
51
Why these problems?
52
52
-------------------
53
53
54
- I believe , for the most part, these issues are ultimately symptomatic of the
54
+ I think , for the most part, these issues are ultimately symptomatic of the
55
55
Prepared abstraction not accurately matching the reality. Thus, it needs
56
56
high-level rethinking:
57
57
58
58
Currently, ` Prepared ` (just like the original functionality in the old
59
59
pre-v1.0.0 ` Command ` struct) is designed around the low-level reality that
60
60
MySQL ties prepared statements to individual connections. But then, instead
61
61
of treating prepared statements as something owned by a connection (as they
62
- realistically are), ` Prepared ` flips this around and * has a* connection,
63
- instead of the reality that a connection * has a * prepared statement .
62
+ realistically are), ` Prepared ` flips this around and * has a* connection
63
+ instead.
64
64
65
65
It's also wrong on a higher level: Conceptually, to a database's human user,
66
66
a prepared statement is...an SQL statement...that just has special "slots"
67
67
for parameters and provides certain benefits. To a user, that's it, nothing
68
68
more. That these particular statements happen to be tied to individual
69
69
connections is merely an implementation detail of the communications protocol.
70
70
71
- I believe these disconnects are the main cause of the above problems with ` Prepared ` .
71
+ I believe these disconnects are the major cause of the above problems with ` Prepared ` .
72
72
73
73
Solution for v2.0.0:
74
74
--------------------
75
75
76
76
Originally, I was thinking about (if anything * at all* ) * maybe* offering an
77
77
additional abstraction over top ` Prepared ` which manages prepared statements
78
78
across multiple connections. But that would only address the first problem
79
- above, not all of them, and I now believe would liklely create additional
79
+ above, not all of them, and I now believe would likely create additional
80
80
mess and problems due to the original disconnect only being covered up,
81
- not resoloved .
81
+ not resolved .
82
82
83
- So I think a re-design is warranted:
83
+ So I think a redesign is warranted:
84
84
85
85
- Get rid of ` PreparedImpl ` . Just have a ` Prepared ` struct and be done with it.
86
86
In the unlikely case anyone really does need deterministic server-side release
@@ -103,7 +103,7 @@ automatically creates it.
103
103
104
104
- ` struct Prepared ` itself shouldn't have any "release" or "register"
105
105
functionality of its own, at all. That should be fully considered a
106
- charactaristic of the communications channel, not a charactaristic of
106
+ charactaristic of the communications channel, not a characteristic of
107
107
statements.
108
108
109
109
- ` Connection ` should have a ` .release(Prepared) ` to manually release a
@@ -112,8 +112,8 @@ the statement hasn't been registered on the connection, or has already been
112
112
released (as defined by the statement's SQL string).
113
113
114
114
- Any functionality to manually release a Prepared from ALL connections
115
- should be in ` MySQLPool ` . I'm undecided whether this would be essential
116
- for v2.0.0 or could be deferred until v2.1.0 or so.
115
+ should be in ` MySQLPool ` . This will not be in v2.0.0 though,
116
+ it is delayed until v2.1.0 or so.
117
117
118
118
- Connection and MySQLPool should also have ` .register(Prepared) `
119
119
(or is there a better name?) to manually create a prepared statement on a
@@ -123,9 +123,10 @@ will be still be automatically registered when its actually used.
123
123
124
124
- When a statement is manually registered on a MySQLPool (as opposed to
125
125
a Connection), The MySQLPool will manually register it on all
126
- currenty -open connections. After this point, the statement will automatically
126
+ currently -open connections. After this point, the statement will automatically
127
127
be registered on all new connections, immediately upon each new connection's
128
- creation, until ` MySQLPool.release ` is called on the statement.
128
+ creation, until ` MySQLPool.release ` is called on the statement. This will also
129
+ not be in v2.0.0 though, it is delayed until v2.1.0 or so.
129
130
130
131
- In the future, other functionality could be added:
131
132
` Connection/MySQLPool.releaseAllPrepared ` , ` Connection/MySQLPool.releaseStalePrepared ` ,
@@ -164,22 +165,22 @@ value in that.
164
165
165
166
It could be argued that mysql-native is, in some ways, higher level than
166
167
that original charter, and the same could be said for some of these changes.
167
- However, I don't beleive these changes make it too high-level for the vast
168
+ However, I don't think these changes make it too high-level for the vast
168
169
majority of use-cases, and I do believe these higher-level interfaces are
169
170
more than worthwhile and moving in a very good direction for the average D
170
171
database user.
171
172
172
173
So what of the need for a stripped-down low-level API?
173
174
------------------------------------------------------
174
175
175
- First off all, there's nothing stopping other high-level DB libs from basing
176
+ First of all, there's nothing stopping other high-level DB libs from basing
176
177
their MySQL/MariaDB support on top of mysql-native's higher-level interfaces.
177
178
That's entirely viable, and may even make things easier for the lib developers.
178
179
And mysql-native * does* intend to reduce any overhead it does have and keep
179
180
that to a minimum, even for high-level functionality (IMO, that's part of D's
180
181
own charter, after all).
181
182
182
- But aside from that: For the sake of sensible code hygeine and maintainability,
183
+ But aside from that: For the sake of sensible code hygiene and maintainability,
183
184
my intention for the near-term future of this library is to clean up the
184
185
internal design and separate all the low-level communications code out of the
185
186
higher-level interfaces. This will have the additional benefit of opening the
0 commit comments