') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Bad mojo. EOF found reading column header. · Issue #242 · ChuckBell/MySQL_Connector_Arduino · GitHub
Skip to content

Bad mojo. EOF found reading column header. #242

Description

@ml01

I use the library on some sensors with inserts, call procedures (even with return values) without any problems.
But I can't get a "simple" select to work. :(

Hard-/Software:
ESP8266 (wemos d1 mini) with some sensors and a relay card.
Arduino IDE 2.3.4
MySQL Connector Arduino 1.2.0
MySQL 5.1.73 - Source distribution

void setup() {
...
// connecting to MySQL
MySQL_Connection conn((Client *)&client);
Serial.println("Connecting to MySQL...");
if (conn.connect(server_addr, 3306, user, password, db)) {
delay(1000);
} else {
Serial.println("Connection failed.");
delay(2000);
ESP.restart();
}
// Create an instance of the cursor passing in the connection
char query1[200];
char query2[] = "CALL DataCalc();";
char query3[] = "SELECT int_heizkreis, str_mac FROM Wohnung_Messdaten.pipe_sensor_config";
Serial.println("query 1");
MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
sprintf(query1, "UPDATE sensor_config SET ts_letzte_meldung = NOW(), str_typ = '%s' WHERE str_mac = '%s'", IP, str_mac);
Serial.println(query1);
cur_mem->execute(query1);
delete cur_mem;
Serial.println("query 2");
MySQL_Cursor *cur_mem2 = new MySQL_Cursor(&conn);
row_values *row2 = NULL;
cur_mem2->execute(query2);
column_names *columns2 = cur_mem2->get_columns();
row2 = cur_mem2->get_next_row();
Relay = atol(row2->values[0]);
Serial.println(Relay,BIN);
IOexpanderWrite(DEVICE_1, Relay);
delete cur_mem2;
Serial.println("query 3");
MySQL_Cursor *cur_mem3 = new MySQL_Cursor(&conn);
row_values *row3 = NULL;
cur_mem3->execute(query3);
Serial.println("Columns start");
column_names *columns3 = cur_mem3->get_columns();
Serial.println("Columns done");
do {
row3 = cur_mem3->get_next_row();
if (row3 != NULL) {
int heizkreis = atoi(row3->values[0]);
byte mac_address[8];
char* mac_str = row3->values[1]; ...
}
} while (row3 != NULL);
delete cur_mem3;
conn.close();
}

and the serial output (query 3 is the problematic one)

..[WIFI] STATION Mode, SSID: WiFi1, IP address: 10.10.10.123
Connected to network
MAC-Adresse: 98:f4:ab:db:28:3a
IP-Adresse: 10.10.10.123
serverSetupRelay: 11
Server started
Connecting to MySQL...
...trying...
Connected to server version 5.1.73
query 1
UPDATE sensor_config SET ts_letzte_meldung = NOW(), str_typ = '10.10.10.123' WHERE str_mac = '98:f4:ab:db:28:3a'
query 2
1000000
query 3
Columns start
Bad mojo. EOF found reading column header.
Columns done
ERROR: You must read the columns first!
Disconnected.

Is there any option to skip the columns or fix the error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions