| @@ -30,6 +30,7 @@ Class CommentsRepository_Class | |||||
| Public Function Find(where_kvarray, order_string_or_array) | Public Function Find(where_kvarray, order_string_or_array) | ||||
| Dim sql : sql = "Select [AuthorEmail], [AuthorName], [Body], [CommentID], [CreatedDate], [IsApproved], [PostID] FROM [Comments]" | Dim sql : sql = "Select [AuthorEmail], [AuthorName], [Body], [CommentID], [CreatedDate], [IsApproved], [PostID] FROM [Comments]" | ||||
| Dim where_keys, where_values, i | Dim where_keys, where_values, i | ||||
| where_values = Empty | |||||
| If Not IsEmpty(where_kvarray) Then | If Not IsEmpty(where_kvarray) Then | ||||
| KVUnzip where_kvarray, where_keys, where_values | KVUnzip where_kvarray, where_keys, where_values | ||||
| If Not IsEmpty(where_keys) Then | If Not IsEmpty(where_keys) Then | ||||
| @@ -51,14 +52,15 @@ Class CommentsRepository_Class | |||||
| Destroy rs | Destroy rs | ||||
| End Function | End Function | ||||
| Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) | |||||
| Dim sql : sql = "Select [AuthorEmail], [AuthorName], [Body], [CommentID], [CreatedDate], [IsApproved], [PostID] FROM [Comments]" | |||||
| Dim where_keys, where_values, i | |||||
| If Not IsEmpty(where_kvarray) Then | |||||
| KVUnzip where_kvarray, where_keys, where_values | |||||
| If Not IsEmpty(where_keys) Then | |||||
| sql = sql & " WHERE " | |||||
| For i = 0 To UBound(where_keys) | |||||
| Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) | |||||
| Dim sql : sql = "Select [AuthorEmail], [AuthorName], [Body], [CommentID], [CreatedDate], [IsApproved], [PostID] FROM [Comments]" | |||||
| Dim where_keys, where_values, i | |||||
| where_values = Empty | |||||
| If Not IsEmpty(where_kvarray) Then | |||||
| KVUnzip where_kvarray, where_keys, where_values | |||||
| If Not IsEmpty(where_keys) Then | |||||
| sql = sql & " WHERE " | |||||
| For i = 0 To UBound(where_keys) | |||||
| If i > 0 Then sql = sql & " AND " | If i > 0 Then sql = sql & " AND " | ||||
| sql = sql & " " & QI(where_keys(i)) & " = ?" | sql = sql & " " & QI(where_keys(i)) & " = ?" | ||||
| Next | Next | ||||
| @@ -76,13 +78,14 @@ Class CommentsRepository_Class | |||||
| Destroy rs | Destroy rs | ||||
| End Function | End Function | ||||
| Public Function SearchTablePaged(columns_array, search_value, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) | |||||
| Dim sql : sql = "Select [AuthorEmail], [AuthorName], [Body], [CommentID], [CreatedDate], [IsApproved], [PostID] FROM [Comments]" | |||||
| Dim i, params() | |||||
| If IsArray(columns_array) And UBound(columns_array) >= 0 Then | |||||
| sql = sql & " WHERE " | |||||
| ReDim params(UBound(columns_array)) | |||||
| For i = 0 To UBound(columns_array) | |||||
| Public Function SearchTablePaged(columns_array, search_value, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) | |||||
| Dim sql : sql = "Select [AuthorEmail], [AuthorName], [Body], [CommentID], [CreatedDate], [IsApproved], [PostID] FROM [Comments]" | |||||
| Dim i, params() | |||||
| params = Empty | |||||
| If IsArray(columns_array) And UBound(columns_array) >= 0 Then | |||||
| sql = sql & " WHERE " | |||||
| ReDim params(UBound(columns_array)) | |||||
| For i = 0 To UBound(columns_array) | |||||
| If i > 0 Then sql = sql & " OR " | If i > 0 Then sql = sql & " OR " | ||||
| sql = sql & " " & QI(columns_array(i)) & " LIKE ?" | sql = sql & " " & QI(columns_array(i)) & " LIKE ?" | ||||
| params(i) = "%" & search_value & "%" | params(i) = "%" & search_value & "%" | ||||
Powered by TurnKey Linux.