digitalmethodsinitiative / dmi-tcat

Digital Methods Initiative - Twitter Capture and Analysis Toolset
Apache License 2.0
367 stars 114 forks source link

Problem with new column on capture #94

Closed psegovias closed 9 years ago

psegovias commented 9 years ago

I add a new column to _tweets its called "starred" i use a MYSQL UPDATE to change this to 'yes' or 'no'.

Add them to capture/common/functions.php

starred varchar(64) NOT NULL DEFAULT '',

Sometimes when i track via search.php i got this error and no tweets are inserted:

insert into table XXX_tweets failed with '23000: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'starred' cannot be null'

Any ideas?

ErikBorra commented 9 years ago

Hi @psegovias,

such a question is related to MySQL and not to TCAT.

You could consider relieving the NULL constraint from the column.

Best,

Erik

psegovias commented 9 years ago

HI @ErikBorra sorry again, but can u guide me on this?

You say delete the "NOT NULL" when its created the bin?

Regards!

ErikBorra commented 9 years ago

ALTER TABLE XXX_tweets ALTER COLUMN starred varchar(64) NULL DEFAULT '';

This will remove the NOT NULL constraint.

psegovias commented 9 years ago

Ok already done that yesterday, the problem with that its when i have this mysql sentence: ( I must only see mentions "starred" )

$sql = "SELECT * FROM " . $esc['mysql']['dataset'] . "_tweets t "; $where = "starred NOT IN ('No') AND"; $sql .= sqlSubset($where); $sql .= " ORDER BY created_at DESC";

I cant see new mentions, cuz (i think) starred is NULL, any idea?

ErikBorra commented 9 years ago
$sql = "SELECT * FROM " . $esc['mysql']['dataset'] . "_tweets t ";
$where = "starred NOT IN ('No') AND starred IS NOT NULL AND STARRED != '' AND ";
$sql .= sqlSubset($where);
$sql .= " ORDER BY created_at DESC";
psegovias commented 9 years ago

Thanks @ErikBorra :)