Error from wifiscan table

Development questions: create new plugins, add new features...
Post Reply
wep_hkpu
Posts: 25
Joined: Thu Mar 10, 2016 2:24 pm

Error from wifiscan table

Post by wep_hkpu » Thu Jan 05, 2017 10:33 am

Dear libelium-dev,

I have updated the system manager from version 3.2.1 to 3.2.2 and 3.2.3.
The problem is the warning below.

Warning: fopen(/mnt/user/logs/wifiscan.log) [function.fopen]: failed to open stream: Permission denied in /mnt/lib/var/www/ManagerSystem/core/API/Logger.class.php on line 69

However, I found a solution the forum topic 'Wifi table corupted'
viewtopic.php?f=4&t=21379&p=60893&hilit ... ror#p60893

I followed the steps. The warning disappeared but an error occurred when I clicked 'show data' button.

ERROR: Unable to get the results: [PDO Exception] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Type' in 'field list'

I checked the table wifiScan and found that it does not have 3 columns: Type, Ap, and sync.
This may be the reason.

Could you please suggest the suitable solution for this issue?
Thank you.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Error from wifiscan table

Post by libelium-dev » Mon Jan 09, 2017 9:36 am

Hi wep_hkpu,

Please, check your wifiScan Table DB integrity:

Code: Select all

mysql> describe MeshliumDB.wifiScan;

It should look like this:

Code: Select all

+-----------+--------------+------+-----+-------------------+----------------+
| Field     | Type         | Null | Key | Default           | Extra          |
+-----------+--------------+------+-----+-------------------+----------------+
| ID_frame  | int(11)      | NO   | MUL | NULL              | auto_increment | 
| TimeStamp | timestamp    | NO   |     | CURRENT_TIMESTAMP |                | 
| MAC       | varchar(17)  | NO   |     | NULL              |                | 
| SSID      | varchar(32)  | NO   |     | NULL              |                | 
| RSSI      | varchar(3)   | NO   |     | NULL              |                | 
| Vendor    | varchar(150) | NO   |     | NULL              |                | 
| Type      | varchar(10)  | NO   |     | NULL              |                | 
| AP        | varchar(17)  | NO   |     | NULL              |                | 
| sync      | int(1)       | NO   |     | 0                 |                | 
+-----------+--------------+------+-----+-------------------+----------------+
Please, send us the restult.

Best regards,

wep_hkpu
Posts: 25
Joined: Thu Mar 10, 2016 2:24 pm

Re: Error from wifiscan table

Post by wep_hkpu » Wed Jan 11, 2017 8:57 am

Dear libelium_dev,

This is the result.

Code: Select all

+-----------+--------------+------+-----+-------------------+----------------+
| Field     | Type         | Null | Key | Default           | Extra          |
+-----------+--------------+------+-----+-------------------+----------------+
| ID_frame  | int(11)      | NO   | MUL | NULL              | auto_increment | 
| TimeStamp | timestamp    | NO   |     | CURRENT_TIMESTAMP |                | 
| MAC       | varchar(17)  | NO   |     | NULL              |                | 
| SSID      | varchar(32)  | NO   |     | NULL              |                | 
| RSSI      | varchar(3)   | NO   |     | NULL              |                | 
| Vendor    | varchar(150) | NO   |     | NULL              |                | 
+-----------+--------------+------+-----+-------------------+----------------+
6 rows in set (0.00 sec)
It seems like the wifiScan table haven't been upgraded to include the missing fields.
Consequently, the data fields derived from Wifi scan service do not match the data fields in wifiScan table.
Please suggest the solution. Thank you.

Regards.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Error from wifiscan table

Post by libelium-dev » Thu Jan 12, 2017 8:42 am

Hi wep_hkpu,


Please, continue installing all updates available (last update is 3.2.7).

When you finished to install all updates, please check again your wifiScan database structure:

Code: Select all

mysql> describe MeshliumDB.wifiScan;
And tell us the result.

Best regards!

wep_hkpu
Posts: 25
Joined: Thu Mar 10, 2016 2:24 pm

Re: Error from wifiscan table

Post by wep_hkpu » Wed Jan 18, 2017 8:01 am

Dear libelium-dev,

I have updated the Manager System to the current version (3.2.7).
The structure of wifiScan table in the database is the same as the older version.
I still have the same error.

ERROR: Unable to get the results: [PDO Exception] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Type' in 'field list'

I think we have to use a script to recreate the wifiScan table in the local database.
What is your suggestion?

Regards.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Error from wifiscan table

Post by libelium-dev » Wed Jan 18, 2017 9:18 am

Hi wep_hkpu,

Please perform th following command on your MySQL engine:

Code: Select all

describe MeshliumDB.wifiScan;
Then you can add Type column with the following command:

Code: Select all

USE  MeshliumDB;

Code: Select all

ALTER TABLE `wifiScan` ADD `Type` VARCHAR(10) AFTER `Vendor`;
Regards

wep_hkpu
Posts: 25
Joined: Thu Mar 10, 2016 2:24 pm

Re: Error from wifiscan table

Post by wep_hkpu » Thu Jan 19, 2017 7:38 am

Dear libelium-dev,

The problem is solved after the insertion of 3 missing columns: Type, AP, and sync.
This is what wifiScan table's structure looks like.

Code: Select all

+-----------+--------------+------+-----+-------------------+----------------+
| Field     | Type         | Null | Key | Default           | Extra          |
+-----------+--------------+------+-----+-------------------+----------------+
| ID_frame  | int(11)      | NO   | MUL | NULL              | auto_increment | 
| TimeStamp | timestamp    | NO   |     | CURRENT_TIMESTAMP |                | 
| MAC       | varchar(17)  | NO   |     | NULL              |                | 
| SSID      | varchar(32)  | NO   |     | NULL              |                | 
| RSSI      | varchar(3)   | NO   |     | NULL              |                | 
| Vendor    | varchar(150) | NO   |     | NULL              |                | 
| Type      | varchar(10)  | YES  |     | NULL              |                | 
| AP        | varchar(17)  | YES  |     | NULL              |                | 
| sync      | int(1)       | YES  |     | 0                 |                | 
+-----------+--------------+------+-----+-------------------+----------------+
However, I have to set the initial value 0 for 'sync' column in order to transfer the data to an external database.

Code: Select all

ALTER TABLE `wifiScan` ALTER COLUMN `sync` SET DEFAULT 0;
Thanks for your help.

Regards.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Error from wifiscan table

Post by libelium-dev » Thu Jan 19, 2017 8:00 am

Hi wep_hkpu,

Glad to hear that! If you have more questions, please do not hesitate and drop us a line.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest