In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I. Strict Mode expatiates
Based on the limitations of strict mode (STRICT_TRANS_TABLES) of mysql5.0 and above:
1)。 Inserting null values into not null fields is not supported
2)。 Inserting a''value for a self-growing field is not supported, but a null value can be inserted
3)。 Default values for text fields are not supported
Look at the following code: (the first field is a self-increment field)
Sql code
$query= "insert into demo values (','$firstname','$lastname','$sex')"
The above code is only valid in non-strict mode.
Code code
$query= "insert into demo values (NULL,'$firstname','$lastname','$sex')"
The above code is valid only in strict mode. Replace the null value''with NULL.
ii. Make the database support Strict Mode
1. Make the following changes to the database structure to support strict mode:
1) set non-null default values for all not null fields, string defaults to'', numeric defaults to 0, and date defaults to '0000-00-0000: 00'
2) remove the default value of the text field
3) normalization improvement: change the title field to varchar (255) and the null field with default value to not null field.
two。 If the database structure of the installed PHP program shuts down Strict mode
1)。 One is to remove strict mode when installing mysql5.0 (including above).
Edit my.cnf and close Strict Mode:
Sql-mode= "NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
2)。 The other is to modify the query statement. For example, in
If ($this- > dbcharset) {@ mysql_query ("SET NAMES". $this- > dbcharset);}
Later execution
Mysql_query ("SET @ @ sql_mode =''")
Make sure you are using MySQL5
The mysqli approach is similar in that it executes the
Mysqli_query ($this- > connection_id, "SET @ @ sql_mode =''")
So far, this is the end of this article on the detailed explanation of MySQL mode Strict Mode knowledge points. For more information about MySQL mode Strict Mode content, please search the previous articles or continue to browse the relevant articles below. I hope you will support me in the future!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.