@@ -24,12 +24,12 @@ public MethodDeclaration OneDeclare(string funcName, string queryTextConstant, s
24
24
new SimpleStatement ( $ "{ Variable . Entity . AsVar ( ) } ", newObjectExpression ) ,
25
25
new SimpleExpression ( $ "return { Variable . Entity . AsVar ( ) } ")
26
26
]
27
- ) ;
27
+ ) . ToList ( ) ;
28
28
29
29
return new MethodDeclaration ( funcName , GetMethodArgs ( argInterface , parameters ) ,
30
30
new List < IComposable >
31
31
{
32
- new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody )
32
+ new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody . ToList ( ) )
33
33
} ) ;
34
34
}
35
35
@@ -52,15 +52,16 @@ public MethodDeclaration ManyDeclare(string funcName, string queryTextConstant,
52
52
dbDriver . PrepareStmt ( funcName , queryTextConstant ) ,
53
53
ExecuteAndAssign ( funcName , queryParams ) ,
54
54
new SimpleStatement ( Variable . Entities . AsVar ( ) , new SimpleExpression ( "[]" ) ) ,
55
- new ForeachLoop ( Variable . Result . AsVar ( ) , Variable . Row . AsVar ( ) , new List < IComposable > { listAppend } ) ,
55
+ new ForeachLoop ( Variable . Result . AsVar ( ) , Variable . Row . AsVar ( ) ,
56
+ new List < IComposable > { listAppend } ) ,
56
57
new SimpleExpression ( $ "return { Variable . Entities . AsVar ( ) } ")
57
58
]
58
- ) ;
59
+ ) ;
59
60
60
61
return new MethodDeclaration ( funcName , GetMethodArgs ( argInterface , parameters ) ,
61
62
new List < IComposable >
62
63
{
63
- new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody )
64
+ new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody . ToList ( ) )
64
65
} ) ;
65
66
}
66
67
@@ -72,12 +73,14 @@ public MethodDeclaration ExecDeclare(string funcName, string queryTextConstant,
72
73
withResourceBody = withResourceBody . AppendIfNotNull ( queryParams ) ;
73
74
withResourceBody = withResourceBody
74
75
. Append ( dbDriver . PrepareStmt ( funcName , queryTextConstant ) )
75
- . Append ( dbDriver . ExecuteStmt ( funcName , queryParams ) ) ;
76
+ . Append ( dbDriver . ExecuteStmt ( funcName , queryParams ) )
77
+ . ToList ( ) ;
76
78
77
79
return new MethodDeclaration ( funcName , GetMethodArgs ( argInterface , parameters ) ,
78
80
new List < IComposable >
79
81
{
80
- new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody )
82
+ new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody . ToList ( )
83
+ )
81
84
} ) ;
82
85
}
83
86
@@ -95,24 +98,29 @@ public MethodDeclaration ExecLastIdDeclare(string funcName, string queryTextCons
95
98
new SimpleExpression ( $ "return { Variable . Client . AsVar ( ) } .last_id")
96
99
]
97
100
) ;
98
- return new MethodDeclaration ( funcName , GetMethodArgs ( argInterface , parameters ) ,
101
+
102
+ return new MethodDeclaration (
103
+ funcName , GetMethodArgs ( argInterface , parameters ) ,
99
104
new List < IComposable >
100
105
{
101
- new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) , withResourceBody )
102
- } ) ;
106
+ new WithResource ( Variable . Pool . AsProperty ( ) , Variable . Client . AsVar ( ) ,
107
+ withResourceBody . ToList ( ) )
108
+ }
109
+ ) ;
103
110
}
104
111
105
112
private static SimpleStatement ? GetQueryParams ( string argInterface , IList < Parameter > parameters )
106
113
{
107
114
var queryParams = parameters . Select ( p => $ "{ argInterface } .{ p . Column . Name } ") . ToList ( ) ;
108
115
return queryParams . Count == 0
109
116
? null
110
- : new SimpleStatement ( Variable . QueryParams . AsVar ( ) , new SimpleExpression ( $ "[{ queryParams . JoinByComma ( ) } ]") ) ;
117
+ : new SimpleStatement ( Variable . QueryParams . AsVar ( ) ,
118
+ new SimpleExpression ( $ "[{ queryParams . JoinByCommaAndFormat ( ) } ]") ) ;
111
119
}
112
120
113
- private static IEnumerable < SimpleExpression > GetColumnsInitExpressions ( IEnumerable < Column > columns )
121
+ private static IList < SimpleExpression > GetColumnsInitExpressions ( IList < Column > columns )
114
122
{
115
- return columns . Select ( c => new SimpleExpression ( $ "{ Variable . Row . AsVar ( ) } ['{ c . Name } ']") ) ;
123
+ return columns . Select ( c => new SimpleExpression ( $ "{ Variable . Row . AsVar ( ) } ['{ c . Name } ']") ) . ToList ( ) ;
116
124
}
117
125
118
126
private SimpleStatement ExecuteAndAssign ( string funcName , SimpleStatement ? queryParams )
0 commit comments