Make SQL_LastInsertId and SQL_GetAffectedRows work on query handles, allowing their use with threaded queries
3 * =============================================================================
4 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
5 * =============================================================================
7 * This file is part of the SourceMod/SourcePawn SDK.
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, version 3.0, as published by the
11 * Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
21 * As a special exception, AlliedModders LLC gives you permission to link the
22 * code of this program (as well as its derivative works) to "Half-Life 2," the
23 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
24 * by the Valve Corporation. You must obey the GNU General Public License in
25 * all respects for all other code used. Additionally, AlliedModders LLC grants
26 * this exception to all derivative works. AlliedModders LLC defines further
27 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
28 * or <http://www.sourcemod.net/license.php>.
33 #if defined _bitbuffer_included
36 #define _bitbuffer_included
39 * Writes a single bit to a writable bitbuffer (bf_write).
41 * @param bf bf_write handle to write to.
42 * @param bit Bit to write (true for 1, false for 0).
44 * @error Invalid or incorrect Handle.
46 native BfWriteBool(Handle:bf, bool:bit);
49 * Writes a byte to a writable bitbuffer (bf_write).
51 * @param bf bf_write handle to write to.
52 * @param byte Byte to write (value will be written as 8bit).
54 * @error Invalid or incorrect Handle.
56 native BfWriteByte(Handle:bf, byte);
59 * Writes a byte to a writable bitbuffer (bf_write).
61 * @param bf bf_write handle to write to.
62 * @param chr Character to write.
64 * @error Invalid or incorrect Handle.
66 native BfWriteChar(Handle:bf, chr);
69 * Writes a 16bit integer to a writable bitbuffer (bf_write).
71 * @param bf bf_write handle to write to.
72 * @param num Integer to write (value will be written as 16bit).
74 * @error Invalid or incorrect Handle.
76 native BfWriteShort(Handle:bf, num);
79 * Writes a 16bit unsigned integer to a writable bitbuffer (bf_write).
81 * @param bf bf_write handle to write to.
82 * @param num Integer to write (value will be written as 16bit).
84 * @error Invalid or incorrect Handle.
86 native BfWriteWord(Handle:bf, num);
89 * Writes a normal integer to a writable bitbuffer (bf_write).
91 * @param bf bf_write handle to write to.
92 * @param num Integer to write (value will be written as 32bit).
94 * @error Invalid or incorrect Handle.
96 native BfWriteNum(Handle:bf, num);
99 * Writes a floating point number to a writable bitbuffer (bf_write).
101 * @param bf bf_write handle to write to.
102 * @param num Number to write.
104 * @error Invalid or incorrect Handle.
106 native BfWriteFloat(Handle:bf, Float:num);
109 * Writes a string to a writable bitbuffer (bf_write).
111 * @param bf bf_write handle to write to.
112 * @param string Text string to write.
114 * @error Invalid or incorrect Handle.
116 native BfWriteString(Handle:bf, const String:string[]);
119 * Writes an entity to a writable bitbuffer (bf_write).
120 * @note This is a wrapper around BfWriteShort().
122 * @param bf bf_write handle to write to.
123 * @param ent Entity index to write.
125 * @error Invalid or incorrect Handle, or invalid entity.
127 native BfWriteEntity(Handle:bf, ent);
130 * Writes a bit angle to a writable bitbuffer (bf_write).
132 * @param bf bf_write handle to write to.
133 * @param angle Angle to write.
134 * @param numBits Optional number of bits to use.
136 * @error Invalid or incorrect Handle.
138 native BfWriteAngle(Handle:bf, Float:angle, numBits=8);
141 * Writes a coordinate to a writable bitbuffer (bf_write).
143 * @param bf bf_write handle to write to.
144 * @param coord Coordinate to write.
146 * @error Invalid or incorrect Handle.
148 native BfWriteCoord(Handle:bf, Float:coord);
151 * Writes a 3D vector of coordinates to a writable bitbuffer (bf_write).
153 * @param bf bf_write handle to write to.
154 * @param coord Coordinate array to write.
156 * @error Invalid or incorrect Handle.
158 native BfWriteVecCoord(Handle:bf, Float:coord[3]);
161 * Writes a 3D normal vector to a writable bitbuffer (bf_write).
163 * @param bf bf_write handle to write to.
164 * @param vec Vector to write.
166 * @error Invalid or incorrect Handle.
168 native BfWriteVecNormal(Handle:bf, Float:vec[3]);
171 * Writes a 3D angle vector to a writable bitbuffer (bf_write).
173 * @param bf bf_write handle to write to.
174 * @param angles Angle vector to write.
176 * @error Invalid or incorrect Handle.
178 native BfWriteAngles(Handle:bf, Float:angles[3]);
181 * Reads a single bit from a readable bitbuffer (bf_read).
183 * @param bf bf_read handle to read from.
184 * @return Bit value read.
185 * @error Invalid or incorrect Handle.
187 native bool:BfReadBool(Handle:bf);
190 * Reads a byte from a readable bitbuffer (bf_read).
192 * @param bf bf_read handle to read from.
193 * @return Byte value read (read as 8bit).
194 * @error Invalid or incorrect Handle.
196 native BfReadByte(Handle:bf);
199 * Reads a character from a readable bitbuffer (bf_read).
201 * @param bf bf_read handle to read from.
202 * @return Character value read.
203 * @error Invalid or incorrect Handle.
205 native BfReadChar(Handle:bf);
208 * Reads a 16bit integer from a readable bitbuffer (bf_read).
210 * @param bf bf_read handle to read from.
211 * @return Integer value read (read as 16bit).
212 * @error Invalid or incorrect Handle.
214 native BfReadShort(Handle:bf);
217 * Reads a 16bit unsigned integer from a readable bitbuffer (bf_read).
219 * @param bf bf_read handle to read from.
220 * @return Integer value read (read as 16bit).
221 * @error Invalid or incorrect Handle.
223 native BfReadWord(Handle:bf);
226 * Reads a normal integer to a readable bitbuffer (bf_read).
228 * @param bf bf_read handle to read from.
229 * @return Integer value read (read as 32bit).
230 * @error Invalid or incorrect Handle.
232 native BfReadNum(Handle:bf);
235 * Reads a floating point number from a readable bitbuffer (bf_read).
237 * @param bf bf_read handle to read from.
238 * @return Floating point value read.
239 * @error Invalid or incorrect Handle.
241 native Float:BfReadFloat(Handle:bf);
244 * Reads a string from a readable bitbuffer (bf_read).
246 * @param bf bf_read handle to read from.
247 * @param buffer Destination string buffer.
248 * @param maxlength Maximum length of output string buffer.
249 * @param line If true the buffer will be copied until it reaches a '\n' or a null terminator.
250 * @return Number of bytes written to the buffer. If the bitbuffer stream overflowed,
251 * that is, had no terminator before the end of the stream, then a negative
252 * number will be returned equal to the number of characters written to the
253 * buffer minus 1. The buffer will be null terminated regardless of the
255 * @error Invalid or incorrect Handle.
257 native BfReadString(Handle:bf, String:buffer[], maxlength, bool:line=false);
260 * Reads an entity from a readable bitbuffer (bf_read).
261 * @note This is a wrapper around BfReadShort().
263 * @param bf bf_read handle to read from.
264 * @return Entity index read.
265 * @error Invalid or incorrect Handle.
267 native BfReadEntity(Handle:bf);
270 * Reads a bit angle from a readable bitbuffer (bf_read).
272 * @param bf bf_read handle to read from.
273 * @param numBits Optional number of bits to use.
274 * @return Angle read.
275 * @error Invalid or incorrect Handle.
277 native Float:BfReadAngle(Handle:bf, numBits=8);
280 * Reads a coordinate from a readable bitbuffer (bf_read).
282 * @param bf bf_read handle to read from.
283 * @return Coordinate read.
284 * @error Invalid or incorrect Handle.
286 native Float:BfReadCoord(Handle:bf);
289 * Reads a 3D vector of coordinates from a readable bitbuffer (bf_read).
291 * @param bf bf_read handle to read from.
292 * @param coord Destination coordinate array.
294 * @error Invalid or incorrect Handle.
296 native BfReadVecCoord(Handle:bf, Float:coord[3]);
299 * Reads a 3D normal vector from a readable bitbuffer (bf_read).
301 * @param bf bf_read handle to read from.
302 * @param vec Destination vector array.
304 * @error Invalid or incorrect Handle.
306 native BfReadVecNormal(Handle:bf, Float:vec[3]);
309 * Reads a 3D angle vector from a readable bitbuffer (bf_read).
311 * @param bf bf_read handle to read from.
312 * @param angles Destination angle vector.
314 * @error Invalid or incorrect Handle.
316 native BfReadAngles(Handle:bf, Float:angles[3]);
319 * Returns the number of bytes left in a readable bitbuffer (bf_read).
321 * @param bf bf_read handle to read from.
322 * @return Number of bytes left unread.
323 * @error Invalid or incorrect Handle.
325 native BfGetNumBytesLeft(Handle:bf);