Search Posts

Month: November 2017

Remove all whitespaces between non words?

How can I remove all spaces between non words from a column? I have a column with values like that: “This Is My – Value” “This Is My- Value” “This Is My/ Value” “This Is My- Value (Other -Value)” How can I remove all whitespaces between non words, like so: “This Is My-Value” “This Is My-Value” “This Is My/Value” “This Is My-Value(Other-Value)” Tried this, but is not working: SELECT REGEXP_REPLACE(I,”s*([^a-zA-Zds:])s*”,”1″) FROM registros; Source: Stackoverflow MariaDB

Error trying to create a WordPress database table

I am creating a plugin for WordPress. I’m trying to create a new table to insert inside the WordPress database, but i keep getting this error and I can’t understand well the reason. “have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘wp_gdax_account_info’ at line 1” Is there a mistake in my code? Does someone know how to solve it? […]

Run mysql commands on wordpress

I have a script file (.sql) which has almost 20k insert statements in it. The sql file converted from a csv file. There’s an option “load data infile” but it’s disabled by the hosting company so i choose to upload a .sql file. As far as i learned, load data infile is not working with sql files. so i need to work like that command below on wordpress. mysql < yourfile.sql but there’s another problem. […]

Does flexviews need manual refresh while flexcdc is running?

I’m developing a database schema for our company. And I studied these materials. youtube video : Web page : Using Flexviews – part two I created a Flexviews view(‘self_mv’) and tested as follows – via 6 steps, (my questions appear after the ‘last’ 6th step). Created a table “test.t1”, a log for the table, inserted a row into t1, and ran a Select statement for the view to create. (see figure below) Created a […]

Force MariaDB clients to use utf8mb4

I’m running into an issue where I’m getting differently ordered results when querying with PHP Versus the command line. From my research, it appears that in some cases that bad encoding can cause problems with the order of the results. That said, all my DB tables are encoded as utf8mb4, with the collation utf8mb4_general_ci. However, it doesnt seem that the mysql variables are set correctly. I’m on Mysql 5.5.5-10.1.26-MariaDb. Here are my CNF settings, but […]

Visual Studio Community 2017 linker problems – MariaDB

Its my first foray into messing with DB’s in programming (specifically MariaDB) in Visual Studio and am not having much luck. It looks like I have configured external linking incorrectly however I am staring at my settings and just not seeing the error. Its probably going to be obvious to more experienced coders out there but I can’t see the forest because of the trees. I have tried compiling in both x86 and 64bit with […]

How can I create a sequence number (like in ORACLE) using MariaDB and Galera Cluster

I need to have a sequence number (not for primary key nor auto_increment) in MariaDB using Galera Cluster. I was thinking of having a table with sequence name, current value and using stored procedures to return the next value. I am not sure a Galera Cluster will support this ( CREATE FUNCTION NextVal (vname VARCHAR(30)) RETURNS INT BEGIN UPDATE _sequences SET next = (@next := next) + 1 WHERE name = vname; RETURN @next; END […]

MariaDB – online move/archive tables

We have a script that “rotates”/archive the Syslog tables in MySQL. This script: at Linux level, renames the “MyISAM” tables files then compress them then inside MySQL, rename these tables The 2 steps are “online”. No MySQLd restart is required. Now I built a new Syslog database in MariaDB (Debian Stretch). The tables are using InnoDB and not MyISAM. This script fails at the 2nd execution to rename the table inside MySQL after moving the […]

Mariadb Json-column Insert data into empty Json_object

I work with mariadb and i want to use json-column. When i create a row, the json-column “default” value is {}. It’s empty. Exemple : 1- I create a Json_object empty. create json_object 2- I add a value in this json_object add data to json_object But the response is null. I want to have {“a”: “b”}. First “bad” solution would be to recreate the object : recreate json object I don’t want to recreat a […]

Next Page »