Jump to content
Slick

BLOB cannot have default values.

Recommended Posts

THIS IS NOTHING TO DO WITH MY EXTDB

I have looked on forums and forums researched the error and Im just coming here to post it to see if any of you have any knowledge of this sort of thing but so far most of you don't.

SQL Error (1101): BLOB/TEXT column 'cop_licenses' can't have a default value. - I have found a way to set default values for when people join the server so I can use there licenses and assign them on a panel. But I have 1 small issue. I cannot set a default value for BLOB/TEXT columns. If any of you have a fix please reply or pm me on the forum. Anything helps.

Share this post


Link to post
Share on other sites

That error is a truth in MySQL. On linux, it'll generally just throw a warning and continue, but on Windows it's an error.

You have 4 options:

  1. Insert the default licenses when the player first joins the server and gets inserted into your database. (This would be the best way).
  2. Create a trigger to replaced the null on an insert with the default text: https://stackoverflow.com/a/25233562
  3. Use a varchar instead of Text.
  4. Create a watcher script to catch and replace nulls in your DB with the default. (A program that would watch the DB and do this at whatever interval you like.)

Edit: If you control the server, install MariaDB above version 10.2.1 and you should be able to set defaults on TEXT and BLOB as you expect to.

Edited by imthatguyhere

Share this post


Link to post
Share on other sites
6 hours ago, imthatguyhere said:

That error is a truth in MySQL. On linux, it'll generally just throw a warning and continue, but on Windows it's an error.

You have 4 options:

  1. Insert the default licenses when the player first joins the server and gets inserted into your database. (This would be the best way).
  2. Create a trigger to replaced the null on an insert with the default text: https://stackoverflow.com/a/25233562
  3. Use a varchar instead of Text.
  4. Create a watcher script to catch and replace nulls in your DB with the default. (A program that would watch the DB and do this at whatever interval you like.)

Edit: If you control the server, install MariaDB above version 10.2.1 and you should be able to set defaults on TEXT and BLOB as you expect to.

So I've solved it but the default text I put in does not show up. What would be affecting this?

Share this post


Link to post
Share on other sites
17 hours ago, Slick said:

So I've solved it but the default text I put in does not show up. What would be affecting this?

What did you do to solve it?

Share this post


Link to post
Share on other sites

If this issue has been resolved, please confirm and reply with the solution.

Edited by Kaiden

Share this post


Link to post
Share on other sites

This issue has been resolved I have found a way to do it without having to recreate my database haha.

The way to add default values without even port forwarding or setting a MariaDB up just having an Xampp (I'm using MariaDB but you can use xampp I tested it for the boys)

I am using 3.1.4.8 don't judge me but if you go into your core folder and go to configuration.sqf you can find some license variables under life_licenses. It will set a default license so you can use a PHP admin panel to change variable and it saves a lot of time because this is an automated alternative to adding licenses manually to player (This is a way of giving licenses without them buying one)

If you have any problems with this method HMU I have gone through so much with this haha.

Close this thread please thank you.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×