pepinho
Forum Replies Created
-
I have modified in translations.php the function on_duplicate_key() as below:
function on_duplicate_key($query){
$query = str_replace(‘`’, ”, $query);
if ( stripos($query, ‘ON DUPLICATE KEY UPDATE’) > 0 ) {
$table = substr($query, 12, (strpos($query, ‘ ‘, 12) – 12));
// currently just deal with wp_options table
if (stristr($table, ‘options’) !== FALSE) {
$start_pos = stripos($query, ‘ON DUPLICATE KEY UPDATE’);
$query = substr_replace($query, ”, $start_pos);
$values_pos = stripos($query, ‘VALUES’);
$first_paren = stripos($query, ‘(‘, $values_pos);
$last_paren = $this->get_matching_paren($query, $first_paren + 1);
$values = explode(‘,’, substr($query, ($first_paren + 1),($last_paren-($first_paren + 1))));
if (!isset($values[1])) {
$values[1] = ”;
}
if (!isset($values[2])) {
$values[2] = ‘no’;
}
// change this to use mapped fields
$update = ‘UPDATE ‘ . $table . ‘ SET option_value = ‘ . $values[1] . ‘, autoload = ‘ . $values[2] .
‘ WHERE option_name = ‘ . $values[0];
$update_new=’IF NOT EXISTS (SELECT * FROM ‘.$table.’ WHERE option_name=’.$values[0].’)
INSERT INTO ‘.$table.’ (option_name, option_value, autoload) VALUES (‘.$values[0].’,’.$values[1].’,’.$values[2].’)
ELSE
UPDATE ‘.$table.’ SET option_value=’.$values[1].’, autoload=’.$values[2].’ WHERE option_name=’.$values[0];
$this->following_query = $update_new;
return $update_new;
}
}return $query;
}…and now the installation procedure worked fine! The table “wp_options” has populated correctly (compared with previous table on MySql installation)…but the same error appears at the login with administrator profile:
“You do not have sufficient permission to access on this page.”…can you help me please ?
Edit: the installation procedure worked fine only with my code previously modified…without this modify the installation return some errors (see screen link) -> https://www.imagehost.it/di/PU4E/screen.jpg
Evidently my edit does not work … but the plugin still does not work!
Forum: Plugins
In reply to: [Plugin wp-db-abstraction] database errorI have resolved this problems:
For fix this issues you must edit the file “translations.php” in “sqlsrv” folder:For the error “[Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.]” the solution is edit the code
$query = substr_replace($query, 'NVARCHAR(<strong>MAX</strong>)', $start_pos, strlen($ac_type));
in
$query = substr_replace($query, 'NVARCHAR(<strong>900</strong>)', $start_pos, strlen($ac_type));
For the error “[The statement has been terminated.]” add line code
return $update;
after
$this->following_query = $update;
and before of the ‘}’in the ‘on_duplicate_key’ function.
Forum: Plugins
In reply to: [Plugin wp-db-abstraction] database errorI have the same problem…please, can somebady answer ?