Skip to content

Commit a841d98

Browse files
committed
TODO
1 parent a463f40 commit a841d98

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

TODO.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
## SHORT TERM
3+
4+
Misc remidners while in the heat of adapting the adpater.
5+
6+
* Try removing `sp_executesql_sql_type` all together. Do we have to add more types?
7+
* Did we get the schema cache right?
8+
9+
10+
11+
## LONG TERM
12+
13+
After we get some tests passing
14+
15+
* Is `primary_keys(table_name)` performant? Contribute to rails for abstract adapter.
16+
* Check `sql_for_insert` can do without the table regular expresion.
17+
* Do we need the `query_requires_identity_insert` check in `execute`?
18+
* Will we have to add more Data types to our dates and use them in `quoted_date` or `quoted_string` or `_type_cast`?
19+
20+
21+
#### Use #without_prepared_statement?
22+
23+
I think we always send everything thru `sp_executesql`. Consider re-evaulating if there are no `binds` that we get any benefit from this. By doing so we also give the users the ability to turn this off completly. Would be neat to see how our prepared statments actually perform again.
24+
25+
```ruby
26+
def without_prepared_statement?(binds)
27+
!prepared_statements || binds.empty?
28+
end
29+
```
30+
31+
Maybe just quick bail to `do_execute`. Maybe related:
32+
33+
* [Do not cache prepared statements that are unlikely to have cache hits](https://github.com/rails/rails/commit/cbcdecd2)
34+
35+
36+
37+
38+
#### Does Find By SQL Work?
39+
40+
With binds and prepareable?
41+
42+
```ruby
43+
# Post.find_by_sql ["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date]
44+
# Post.find_by_sql ["SELECT body FROM comments WHERE author = :user_id OR approved_by = :user_id", { :user_id => user_id }]
45+
#
46+
def find_by_sql(sql, binds = [], preparable: nil)
47+
result_set = connection.select_all(sanitize_sql(sql), "#{name} Load", binds, preparable: preparable)
48+
```

0 commit comments

Comments
 (0)