+ return false;
+ }
+
+ $src=$params['src'];
+ $dst=$params['dst'];
+ $weight=$params['weight'];
+
+ // weight could be only positive
+ if ( $weight < 0) {
+ return false;
+ }
+
+ // if already exists
+ $q="select count(src) from neurons where dst ='$dst' and src = '$src'";
+ $set=$db->query($q);
+ $set->next();
+ $isrc=$set->getString('count(src)');
+
+ if ( $isrc > 0 ) {
+ $q="update neurons set synapse_weight='$weight'
+ where dst = '$dst' and src = '$src'";
+ } else {
+ // FIXME no vector set
+ $q="insert into neurons values('$weight','$dst','$src',0,'synapse',
+ CURRENT_TIMESTAMP(),now(),NULL,$src)";
+ }
+ $set=$db->query($q);