pike.git
/
lib
/
modules
/
Sql.pmod
/
sql_util.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/sql_util.pmod:153:
}); return replace(query,k,v); } //! Result object wrapper performing utf8 decoding of all fields. class UnicodeWrapper ( // The wrapped result object. protected object master_result ) {
+
inherit Sql.Result;
+
//! Returns the number of rows in the result. int num_rows() { return master_result->num_rows(); } //! Returns the number of fields in the result. int num_fields() { return master_result->num_fields();
pike.git/lib/modules/Sql.pmod/sql_util.pmod:191:
//! The table the field is from. Not present from all databases. //! @member string "default" //! The default value for the column. Not available from all databases. //! @endmapping array(int|mapping(string:mixed)) fetch_fields() { if (!field_info) { field_info = master_result->fetch_fields(); foreach(field_info, int|mapping(string:mixed) field) { if (mappingp(field)) {
-
field->name = utf8_to_string(field->name);
+
field->name = utf8_to_string(field->name
, 2
);
if (field->table) {
-
field->table = utf8_to_string(field->table);
+
field->table = utf8_to_string(field->table
, 2
);
} if (field->default) {
-
field->default = utf8_to_string(field->default);
+
field->default = utf8_to_string(field->default
, 2
);
} } } } return field_info; } //! Skip ahead the specified number of rows. void seek(int rows) {
pike.git/lib/modules/Sql.pmod/sql_util.pmod:220:
//! Fetch the next row from the result. //! //! All strings in the result are decoded from UTF8. int|array(string) fetch_row() { int|array(string) row = master_result->fetch_row(); if (!arrayp(row)) return row; array(int|mapping(string:mixed)) field_info = fetch_fields(); foreach(row; int i; string|int val) { if (stringp(val)) {
-
row[i] = utf8_to_string(val);
+
row[i] = utf8_to_string(val
, 2
);
} } return row; } //! JSON is always utf8 default, do nothing. int|string fetch_json_result() { return master_result->fetch_json_result(); }
pike.git/lib/modules/Sql.pmod/sql_util.pmod:251:
{ inherit UnicodeWrapper; int|array(string) fetch_row() { int|array(string) row = master_result->fetch_row(); if (!arrayp(row)) return row; array(int|mapping(string:mixed)) field_info = fetch_fields(); foreach(row; int i; string|int val) { if (stringp(val) && field_info[i]->charsetnr != 63) {
-
row[i] = utf8_to_string(val);
+
row[i] = utf8_to_string(val
, 2
);
} } return row; } } class MySQLBrokenUnicodeWrapper //! This one is used to get a buggy unicode support when compiled with //! an old MySQL client lib that doesn't have the charsetnr property in //! the field info. It looks at the binary flag instead, which is set
pike.git/lib/modules/Sql.pmod/sql_util.pmod:285:
inherit UnicodeWrapper; int|array(string) fetch_row() { int|array(string) row = master_result->fetch_row(); if (!arrayp(row)) return row; array(int|mapping(string:mixed)) field_info = fetch_fields(); foreach(row; int i; string|int val) { if (stringp(val) && field_info[i]->flags && !field_info[i]->flags->binary) {
-
row[i] = utf8_to_string(val);
+
row[i] = utf8_to_string(val
, 2
);
} } return row; } }