Differences From Artifact [2f9bde1ae6]:
- File
src/PGConnection.m
— 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: 4303) [annotate] [blame] [check-ins using]
To Artifact [5e7a8f6854]:
- File src/PGConnection.m — part of check-in [e4c8de38e0] at 2024-08-11 17:45:27 on branch trunk — Add documentation (user: js, size: 4500) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "PGConnection.h" #import "PGConnection+Private.h" #import "PGResult.h" #import "PGResult+Private.h" #import "PGConnectionFailedException.h" | | > > > > > > > > > > > > > > | 18 19 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 | #import "PGConnection.h" #import "PGConnection+Private.h" #import "PGResult.h" #import "PGResult+Private.h" #import "PGConnectionFailedException.h" #import "PGExecuteCommandFailedException.h" @implementation PGConnection @synthesize pg_connection = _connection, parameters = _parameters; - (instancetype)init { self = [super init]; @try { _parameters = [[OFDictionary alloc] init]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_parameters release]; [self close]; |
︙ | ︙ | |||
80 81 82 83 84 85 86 | - (PGResult *)executeCommand: (OFConstantString *)command { PGresult *result = PQexec(_connection, command.UTF8String); if (PQresultStatus(result) == PGRES_FATAL_ERROR) { PQclear(result); | | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | - (PGResult *)executeCommand: (OFConstantString *)command { PGresult *result = PQexec(_connection, command.UTF8String); if (PQresultStatus(result) == PGRES_FATAL_ERROR) { PQclear(result); @throw [PGExecuteCommandFailedException exceptionWithConnection: self command: command]; } switch (PQresultStatus(result)) { case PGRES_TUPLES_OK: return [PGResult pg_resultWithResult: result]; case PGRES_COMMAND_OK: PQclear(result); return nil; default: PQclear(result); @throw [PGExecuteCommandFailedException exceptionWithConnection: self command: command]; } } - (PGResult *)executeCommand: (OFConstantString *)command parameters: (id)parameter, ... |
︙ | ︙ | |||
155 156 157 158 159 160 161 | case PGRES_TUPLES_OK: return [PGResult pg_resultWithResult: result]; case PGRES_COMMAND_OK: PQclear(result); return nil; default: PQclear(result); | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 | case PGRES_TUPLES_OK: return [PGResult pg_resultWithResult: result]; case PGRES_COMMAND_OK: PQclear(result); return nil; default: PQclear(result); @throw [PGExecuteCommandFailedException exceptionWithConnection: self command: command]; } } @end |