Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Not needed |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | BOGUS |
Files: | files | file ages | folders |
SHA3-256: | e0025ebfb414c2d74c8257eea28a3d4f |
User & Date: | tangent 2018-09-26 02:33:11 |
Context
2018-09-26
| ||
02:33 | Not needed Closed-Leaf check-in: e0025ebfb4 user: tangent tags: BOGUS | |
02:28 | Better explanation of the "bootstrap bat" option in HACKERS.md. BAD CHECKIN. check-in: cf53e4ee34 user: tangent tags: BOGUS | |
Changes
Deleted pretty.pl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 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 91 92 93 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
#ifndef __result1_hh__ #define __result1_hh__ #ifdef __WIN32__ #include <Windows32/Base.h> #include <Windows32/Defines.h> #include <Windows32/Structures.h> #include <winsock.h> #define errno WSAGetLastError() #endif #include <map.h> #include <set.h> #include <mysql.h> #include <string> #include "define_short" #include "field_names1.hh" #include "row1.hh" #include "resiter1.hh" #include "tracker.h" #include "field_types1.hh" #include "fields1.hh" #include "connection0.hh" //: class ResUse : public MysqlChild { friend Connection; protected: Connection *mysql; mutable MYSQL_RES *mysql_res; bool throw_exceptions; mutable FieldNames *_names; mutable FieldTypes *_types; Fields _fields; string _table; static pointer_tracker<MYSQL_RES, ResUse> others; void copy(const ResUse& other); public: ResUse () : mysql(0), mysql_res(0), throw_exceptions(false), _names(NULL), _types(NULL), _fields(this) {} ResUse (MYSQL_RES *result, Connection *m = NULL, bool te = false); ResUse (const ResUse &other) {copy(other);} inline ResUse& operator = (const ResUse &other); MYSQL_RES *mysql_result (void) {return mysql_res;} /* raw mysql c api functions */ Row fetch_row() {return Row(mysql_fetch_row(mysql_res), this, throw_exceptions);} //: raw c api function bool eof () const {return mysql_eof(mysql_res);} //: raw c api function unsigned int fetch_lengths () const {return *mysql_fetch_lengths(mysql_res);} //: raw c api function void free_result() {mysql_free_result(mysql_res);} //: raw c api function /* raw mysql c api fields functions */ Field& fetch_field () const {return *mysql_fetch_field(mysql_res);} //: raw c api field function void field_seek (int field) {mysql_field_seek (mysql_res, field);} //: raw c api field function int num_fields() const {return mysql_num_fields(mysql_res);} //: raw c api field function ~ResUse (); void parent_leaving() {mysql = NULL;} void purge(MYSQL_RES *r) { free_result(); delete _names; delete _types; _names=0; _types=0; } operator bool() const {if (mysql_res) return true; return false;} //: unsigned int columns() const {return num_fields();} //: string& table() {return _table;} //: table name const string& table() const {return _table;} //: table name /* methods for working with field names */ inline int field_num(const string&) const; //: Returns the offset of the filed which equals str. inline string& field_name(int); //: Returns the field with an offset of i. inline const string& field_name(int) const; //: Returns the field with an offset of i. inline FieldNames& field_names(); //: Returns a reference to the underlying FieldNames class. inline const FieldNames& field_names() const; //: Returns a const reference to the underlaying FieldNames class. inline void reset_field_names(); //: Resets the field names to there original values. /* methods for working with field types */ inline mysql_type_info& field_type(int i); //: Returns a reference to the mysql field type for the field with an offset of i. inline const mysql_type_info& field_type(int) const; //: Returns a const reference to the mysql field type for the field with an offset of i. inline FieldTypes& field_types(); //: Returns a reference to the underlying FieldTypes inline const FieldTypes& field_types() const; //: Returns a const reference to the underlying FieldTypes inline void reset_field_types(); //: Resets the field_types to their original values. /* short names for the above methods */ inline int names(const string& s) const; //: Returns the offset of the filed which equals str. inline string& names(int i); //: Returns the field with an offset of i. inline const string& names(int i) const; //: Returns the field with an offset of i. inline FieldNames& names(); //: Returns a reference to the underlying FieldNames class. inline const FieldNames& names() const; //: Returns a const reference to the underlying FieldNames class. inline void reset_names(); //: Resets the field names to their original values. inline mysql_type_info& types(int i); //: Returns a reference to the mysql field type for the field with an offset of i. inline const mysql_type_info& types(int i) const; //: Returns a const reference to the mysql field type for the field with an offset of i. inline FieldTypes& types(); //: Returns a reference to the underlying FieldTypes inline const FieldTypes& types() const; //: Returns a const reference to the underlying FieldTypes inline void reset_types(); //: Resets the field_types to their original values. /* methods for working with field info */ const Fields& fields() const {return _fields;} //: returns a reference to the underling Fields structure. const Field& fields(unsigned int i) const {return _fields[i];} //: returns a reference to the the mysql field info for a field with an offset of i. bool operator == (const ResUse &other) const {return mysql_res == other.mysql_res;} //: bool operator != (const ResUse &other) const {return mysql_res != other.mysql_res;} //: }; //: This class handles the result set. // It is also a Random Access Container that is not LessThanComparable // and not Assignable. Being a Random Access Container it can // return a Random Access Iterator or a reverse Random Access Iterator // yet. // // See MutableRes for a result set that can be modified. class Result : public ResUse, public const_subscript_container<Result,Row,const Row> { friend Connection; public: Result () {} //: Result (MYSQL_RES *result, bool te = false) : ResUse(result, NULL, te) {mysql = NULL;} //: Result (const Result &other) : ResUse(other) {mysql = NULL;} //: // raw mysql c api functions const Row fetch_row() const {return Row(mysql_fetch_row(mysql_res), this, throw_exceptions);} //: Raw c api function int num_rows() const {return mysql_num_rows(mysql_res);} //: Raw c api function void data_seek (uint offset) const {mysql_data_seek(mysql_res, offset);} //: Raw c api function size_type size() const {return num_rows();} //: Returns the number of columns. size_type rows() const {return num_rows();} //: Returns the number of rows. const Row operator [] (size_type i) const {data_seek(i); return fetch_row();} //: Returns the row with an offset of i. }; class MutabelRes; //: This class handles the result set. // It is also a Random Access Container that is not LessThanComparable // but is Assignable. Being a Random Access Container it can // return a Random Access Iterator or a reverse Random Access Iterator // yet. // class MutableRes : public vector<MutableRow<MutableRes> > { private: size_type _columns; FieldNames _names; void populate(ResUse res); typedef vector<MutableRow<MutableRes> > parent; public: MutableRes() {} //: MutableRes(ResUse res) : _names(&res) {populate(res);} //: MutableRes(size_type i) : _columns(i), _names (i) {} //: Creates a new mutable result set with i columns. MutableRes& operator = (ResUse res) { _names=&res; populate(res); return *this; } //: MutableRes& operator = (size_type i) { _columns = i; _names = i; return *this; } //: size_type rows() const {return size();} //: Returns the number of rows. size_type columns() const {return _columns;} //: Returns the number of columns. /* methodes for inserting elements as the standart insert functions won't work that well as MutableRow needs to be constructed in a special way */ iterator insert(iterator pos) {return parent::insert(pos, value_type(this));} void insert(iterator pos, size_type n) {parent::insert(pos, n, value_type(this));} void push_back() {parent::push_back(value_type(this));} /* methods for working with field names */ inline int field_num(const string& str) const; //: Returns the offset of the filed which equals str. inline string& field_name(int i); //: Returns the field with an offset of i. inline const string& field_name(int i) const; //: Returns the field with an offset of i. inline FieldNames& field_names(); //: Returns a reference to the underlying FieldNames class. inline const FieldNames& field_names() const; //: Returns a const reference to the underlying FieldNames class. // short names for the above methods inline int names(const string& s) const; //: Returns the offset of the filed which equals str. inline string& names(int i); //: Returns the field with an offset of i. inline const string& names(int i) const; //: Returns the field with an offset of i. inline FieldNames& names(); //: Returns a reference to the underlying FieldNames class. inline const FieldNames& names() const; //: Returns a const reference to the underlying FieldNames class. }; //! with_class = ResUSe //: inline void swap (ResUse &x, ResUse &y) { ResUse tmp = x; x = y; y = tmp; } //! with_class = Result //: inline void swap (Result &x, Result &y) { Result tmp = x; x = y; y = tmp; } //: This structure holds the information on the success of queries that //: don't return any results. struct ResNSel { bool success; int insert_id; //: int rows; //: Number of rows affected string info; //: Additional info ResNSel() : success(false) {}; ResNSel (Connection *q); operator bool() {return success;} //: If the query was successful }; #endif |
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |