Differences From Artifact [a09ffbf71b]:
- File
src/PGConnection.h
— part of check-in
[30633656b0]
at
2024-08-11 17:22:05
on branch trunk
— Remove -[PGConnection insertRow:]
It can be used in a way that leads to security issues, so it's better
not to have it at all. (user: js, size: 1467) [annotate] [blame] [check-ins using]
To Artifact [4e80eb06d8]:
- File src/PGConnection.h — part of check-in [e4c8de38e0] at 2024-08-11 17:45:27 on branch trunk — Add documentation (user: js, size: 2428) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #import <ObjFW/ObjFW.h> #import "PGResult.h" OF_ASSUME_NONNULL_BEGIN typedef OFDictionary OF_GENERIC(OFString *, id) *PGRow; @interface PGConnection: OFObject { PGconn *_connection; OFDictionary OF_GENERIC(OFString *, OFString *) *_parameters; } @property (nonatomic, copy) OFDictionary OF_GENERIC(OFString *, OFString *) *parameters; - (void)connect; - (void)reset; - (void)close; - (nullable PGResult *)executeCommand: (OFConstantString *)command; - (nullable PGResult *)executeCommand: (OFConstantString *)command parameters: (id)firstParameter, ... OF_SENTINEL; @end OF_ASSUME_NONNULL_END | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #import <ObjFW/ObjFW.h> #import "PGResult.h" OF_ASSUME_NONNULL_BEGIN /** @file */ /** * @brief A result row. */ typedef OFDictionary OF_GENERIC(OFString *, id) *PGRow; /** * @class PGConnection PGConnection.h ObjPgSQL/ObjPgSQL.h * * @brief A connection to a database. */ @interface PGConnection: OFObject { PGconn *_connection; OFDictionary OF_GENERIC(OFString *, OFString *) *_parameters; } /** * @brief The parameters for the database connection. See `PQconnectdb` in the * PostgreSQL documentation. */ @property (nonatomic, copy) OFDictionary OF_GENERIC(OFString *, OFString *) *parameters; /** * @brief Connects to the database. * * @throw PGConnectionFailedException The connection failed */ - (void)connect; /** * @brief Resets the connection to the database. */ - (void)reset; /** * @brief Closes the connection to the database. */ - (void)close; /** * @brief Executes the specified command. * * @param command The command to execute * @return The result of the command, if any * @throw PGCommandFailedException Executing the command failed. */ - (nullable PGResult *)executeCommand: (OFConstantString *)command; /** * @brief Executes the specified command. * * @param command The command to execute * @param firstParameter First parameter for the command * @return The result of the command, if any * @throw PGCommandFailedException Executing the command failed. */ - (nullable PGResult *)executeCommand: (OFConstantString *)command parameters: (id)firstParameter, ... OF_SENTINEL; @end OF_ASSUME_NONNULL_END |