Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 0518ecd

Browse files
committed
fix of a bug #12
1 parent c23cfb6 commit 0518ecd

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

fyCursor/core/core.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,10 @@
44
from sqlite3 import Cursor, Connection, ProgrammingError
55

66
from .fields import Field
7-
from typing import Union, Any, Optional, Self, Protocol, TypeVar, Mapping
7+
from typing import Union, Any, Optional, Self
88

99

1010
NULL = None
11-
_T_co = TypeVar("_T_co", covariant=True)
12-
13-
14-
class SupportsLenAndGetItem(Protocol[_T_co]):
15-
def __len__(self) -> int: ...
16-
def __getitem__(self, __k: int) -> _T_co: ...
17-
18-
19-
_Parameters = type[
20-
SupportsLenAndGetItem[str | int | float | Any | None]] | type[
21-
Mapping[str, str | int | float | Any | None]
22-
]
2311

2412

2513
class TableError(BaseException):
@@ -252,13 +240,13 @@ def where(self, **kwargs: Any) -> Self:
252240
def execute( # type: ignore
253241
self,
254242
__sql: str,
255-
*__parameters: _Parameters
243+
*__parameters: Any
256244
) -> Self:
257-
self._execution = __sql
258245
if __parameters:
259246
for param in __parameters: # type: ignore
260-
self._query.replace("?", param, 1) # type: ignore
261-
return super().execute(__sql, __parameters) # type: ignore
247+
__sql = __sql.replace("?", str(param), 1) # type: ignore
248+
self._execution = __sql
249+
return super().execute(__sql) # type: ignore
262250

263251
def fetch(
264252
self,
@@ -272,6 +260,7 @@ def fetch(
272260
"""
273261
if not self._query and not self._execution:
274262
raise ProgrammingError("Nothing to fetch")
263+
print(self._query, self._execution)
275264
super().execute(self._query or self._execution) # type: ignore
276265
super().connection.commit()
277266
self._execution = self._query = None

0 commit comments

Comments
 (0)