code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
angularjs
Improve this DocE2E Testing
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/e2e-testing.ngdoc?message=docs(guide%2FE2E%20Testing)%3A%20describe%20your%20change...)E2E Testing
===========================================================================================================================================================================================
As applications grow in size and complexity, it becomes unrealistic to rely on manual testing to verify the correctness of new features, catch bugs and notice regressions. Unit tests are the first line of defense for catching bugs, but sometimes issues come up with integration between components which can't be captured in a unit test. End-to-end tests are made to find these problems.
We have built [Protractor](https://github.com/angular/protractor), an end to end test runner which simulates user interactions that will help you verify the health of your AngularJS application.
Using Protractor
----------------
Protractor is a [Node.js](http://nodejs.org) program, and runs end-to-end tests that are also written in JavaScript and run with node. Protractor uses [WebDriver](https://code.google.com/p/selenium/wiki/GettingStarted) to control browsers and simulate user actions.
For more information on Protractor, view [getting started](http://angular.github.io/protractor/#/getting-started) or the [api docs](http://angular.github.io/protractor/#/api).
Protractor uses [Jasmine](http://jasmine.github.io/1.3/introduction.html) for its test syntax. As in unit testing, a test file is comprised of one or more `it` blocks that describe the requirements of your application. `it` blocks are made of **commands** and **expectations**. Commands tell Protractor to do something with the application such as navigate to a page or click on a button. Expectations tell Protractor to assert something about the application's state, such as the value of a field or the current URL.
If any expectation within an `it` block fails, the runner marks the `it` as "failed" and continues on to the next block.
Test files may also have `beforeEach` and `afterEach` blocks, which will be run before or after each `it` block regardless of whether the block passes or fails.
In addition to the above elements, tests may also contain helper functions to avoid duplicating code in the `it` blocks.
Here is an example of a simple test:
```
describe('TODO list', function() {
it('should filter results', function() {
// Find the element with ng-model="user" and type "jacksparrow" into it
element(by.model('user')).sendKeys('jacksparrow');
// Find the first (and only) button on the page and click it
element(by.css(':button')).click();
// Verify that there are 10 tasks
expect(element.all(by.repeater('task in tasks')).count()).toEqual(10);
// Enter 'groceries' into the element with ng-model="filterText"
element(by.model('filterText')).sendKeys('groceries');
// Verify that now there is only one item in the task list
expect(element.all(by.repeater('task in tasks')).count()).toEqual(1);
});
});
```
This test describes the requirements of a ToDo list, specifically, that it should be able to filter the list of items.
See the [angular-seed](https://github.com/angular/angular-seed) project for more examples, or look at the embedded examples in the AngularJS documentation (For example, [$http](../api/ng/service/%24http) has an end-to-end test in the example under the `protractor.js` tag).
Caveats
-------
Protractor does not work out-of-the-box with apps that bootstrap manually using `angular.bootstrap`. You must use the `ng-app` directive.
angularjs
Improve this DocWhat are Scopes?
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/scope.ngdoc?message=docs(guide%2FScopes)%3A%20describe%20your%20change...)What are Scopes?
===================================================================================================================================================================================
[Scope](../api/ng/type/%24rootscope.scope) is an object that refers to the application model. It is an execution context for [expressions](expression). Scopes are arranged in hierarchical structure which mimic the DOM structure of the application. Scopes can watch [expressions](expression) and propagate events.
Scope characteristics
---------------------
* Scopes provide APIs ([$watch](../api/ng/type/%24rootscope.scope#%24watch.html)) to observe model mutations.
* Scopes provide APIs ([$apply](../api/ng/type/%24rootscope.scope#%24apply.html)) to propagate any model changes through the system into the view from outside of the "AngularJS realm" (controllers, services, AngularJS event handlers).
* Scopes can be nested to limit access to the properties of application components while providing access to shared model properties. Nested scopes are either "child scopes" or "isolate scopes". A "child scope" (prototypically) inherits properties from its parent scope. An "isolate scope" does not. See [isolated scopes](directive#isolating-the-scope-of-a-directive.html) for more information.
* Scopes provide context against which [expressions](expression) are evaluated. For example `{{username}}` expression is meaningless, unless it is evaluated against a specific scope which defines the `username` property.
Scope as Data-Model
-------------------
Scope is the glue between application controller and the view. During the template [linking](compiler) phase the [directives](../api/ng/provider/%24compileprovider#directive.html) set up [`$watch`](../api/ng/type/%24rootscope.scope#%24watch.html) expressions on the scope. The `$watch` allows the directives to be notified of property changes, which allows the directive to render the updated value to the DOM.
Both controllers and directives have reference to the scope, but not to each other. This arrangement isolates the controller from the directive as well as from the DOM. This is an important point since it makes the controllers view agnostic, which greatly improves the testing story of the applications.
In the above example notice that the `MyController` assigns `World` to the `username` property of the scope. The scope then notifies the `input` of the assignment, which then renders the input with username pre-filled. This demonstrates how a controller can write data into the scope.
Similarly the controller can assign behavior to scope as seen by the `sayHello` method, which is invoked when the user clicks on the 'greet' button. The `sayHello` method can read the `username` property and create a `greeting` property. This demonstrates that the properties on scope update automatically when they are bound to HTML input widgets.
Logically the rendering of `{{greeting}}` involves:
* retrieval of the scope associated with DOM node where `{{greeting}}` is defined in template. In this example this is the same scope as the scope which was passed into `MyController`. (We will discuss scope hierarchies later.)
* Evaluate the `greeting` <expression> against the scope retrieved above, and assign the result to the text of the enclosing DOM element.
You can think of the scope and its properties as the data which is used to render the view. The scope is the single source-of-truth for all things view related.
From a testability point of view, the separation of the controller and the view is desirable, because it allows us to test the behavior without being distracted by the rendering details.
```
it('should say hello', function() {
var scopeMock = {};
var cntl = new MyController(scopeMock);
// Assert that username is pre-filled
expect(scopeMock.username).toEqual('World');
// Assert that we read new username and greet
scopeMock.username = 'angular';
scopeMock.sayHello();
expect(scopeMock.greeting).toEqual('Hello angular!');
});
```
Scope Hierarchies
-----------------
Each AngularJS application has exactly one [root scope](../api/ng/service/%24rootscope), but may have any number of child scopes.
The application can have multiple scopes, because [directives](directive) can create new child scopes. When new scopes are created, they are added as children of their parent scope. This creates a tree structure which parallels the DOM where they're attached.
The section [Directives that Create Scopes](scope#directives-that-create-scopes.html) has more info about which directives create scopes.
When AngularJS evaluates `{{name}}`, it first looks at the scope associated with the given element for the `name` property. If no such property is found, it searches the parent scope and so on until the root scope is reached. In JavaScript this behavior is known as prototypical inheritance, and child scopes prototypically inherit from their parents.
This example illustrates scopes in application, and prototypical inheritance of properties. The example is followed by a diagram depicting the scope boundaries.
Notice that AngularJS automatically places `ng-scope` class on elements where scopes are attached. The `<style>` definition in this example highlights in red the new scope locations. The child scopes are necessary because the repeater evaluates `{{name}}` expression, but depending on which scope the expression is evaluated it produces different result. Similarly the evaluation of `{{department}}` prototypically inherits from root scope, as it is the only place where the `department` property is defined.
Retrieving Scopes from the DOM.
-------------------------------
Scopes are attached to the DOM as `$scope` data property, and can be retrieved for debugging purposes. (It is unlikely that one would need to retrieve scopes in this way inside the application.) The location where the root scope is attached to the DOM is defined by the location of [`ng-app`](../api/ng/directive/ngapp) directive. Typically `ng-app` is placed on the `<html>` element, but it can be placed on other elements as well, if, for example, only a portion of the view needs to be controlled by AngularJS.
To examine the scope in the debugger:
1. Right click on the element of interest in your browser and select 'inspect element'. You should see the browser debugger with the element you clicked on highlighted.
2. The debugger allows you to access the currently selected element in the console as `$0` variable.
3. To retrieve the associated scope in console execute: `angular.element($0).scope()`
The `scope()` function is only available when [`$compileProvider.debugInfoEnabled()`](../api/ng/provider/%24compileprovider#debugInfoEnabled.html) is true (which is the default). Scope Events Propagation
------------------------
Scopes can propagate events in similar fashion to DOM events. The event can be [broadcasted](../api/ng/type/%24rootscope.scope#%24broadcast.html) to the scope children or [emitted](../api/ng/type/%24rootscope.scope#%24emit.html) to scope parents.
Scope Life Cycle
----------------
The normal flow of a browser receiving an event is that it executes a corresponding JavaScript callback. Once the callback completes the browser re-renders the DOM and returns to waiting for more events.
When the browser calls into JavaScript the code executes outside the AngularJS execution context, which means that AngularJS is unaware of model modifications. To properly process model modifications the execution has to enter the AngularJS execution context using the [`$apply`](../api/ng/type/%24rootscope.scope#%24apply.html) method. Only model modifications which execute inside the `$apply` method will be properly accounted for by AngularJS. For example if a directive listens on DOM events, such as [`ng-click`](../api/ng/directive/ngclick) it must evaluate the expression inside the `$apply` method.
After evaluating the expression, the `$apply` method performs a [`$digest`](../api/ng/type/%24rootscope.scope#%24digest.html). In the $digest phase the scope examines all of the `$watch` expressions and compares them with the previous value. This dirty checking is done asynchronously. This means that assignment such as `$scope.username="angular"` will not immediately cause a `$watch` to be notified, instead the `$watch` notification is delayed until the `$digest` phase. This delay is desirable, since it coalesces multiple model updates into one `$watch` notification as well as guarantees that during the `$watch` notification no other `$watch`es are running. If a `$watch` changes the value of the model, it will force additional `$digest` cycle.
1. **Creation**
The [root scope](../api/ng/service/%24rootscope) is created during the application bootstrap by the [$injector](../api/auto/service/%24injector). During template linking, some directives create new child scopes.
2. **Watcher registration**
During template linking, directives register [watches](../api/ng/type/%24rootscope.scope#%24watch.html) on the scope. These watches will be used to propagate model values to the DOM.
3. **Model mutation**
For mutations to be properly observed, you should make them only within the [scope.$apply()](../api/ng/type/%24rootscope.scope#%24apply.html). AngularJS APIs do this implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers, or asynchronous work with [$http](../api/ng/service/%24http), [$timeout](../api/ng/service/%24timeout) or [$interval](../api/ng/service/%24interval) services.
4. **Mutation observation**
At the end of `$apply`, AngularJS performs a [$digest](../api/ng/type/%24rootscope.scope#%24digest.html) cycle on the root scope, which then propagates throughout all child scopes. During the `$digest` cycle, all `$watch`ed expressions or functions are checked for model mutation and if a mutation is detected, the `$watch` listener is called.
5. **Scope destruction**
When child scopes are no longer needed, it is the responsibility of the child scope creator to destroy them via [scope.$destroy()](../api/ng/type/%24rootscope.scope#%24destroy.html) API. This will stop propagation of `$digest` calls into the child scope and allow for memory used by the child scope models to be reclaimed by the garbage collector.
### Scopes and Directives
During the compilation phase, the <compiler> matches [directives](../api/ng/provider/%24compileprovider#directive.html) against the DOM template. The directives usually fall into one of two categories:
* Observing [directives](../api/ng/provider/%24compileprovider#directive.html), such as double-curly expressions `{{expression}}`, register listeners using the [$watch()](../api/ng/type/%24rootscope.scope#%24watch.html) method. This type of directive needs to be notified whenever the expression changes so that it can update the view.
* Listener directives, such as [ng-click](../api/ng/directive/ngclick), register a listener with the DOM. When the DOM listener fires, the directive executes the associated expression and updates the view using the [$apply()](../api/ng/type/%24rootscope.scope#%24apply.html) method.
When an external event (such as a user action, timer or XHR) is received, the associated <expression> must be applied to the scope through the [$apply()](../api/ng/type/%24rootscope.scope#%24apply.html) method so that all listeners are updated correctly.
### Directives that Create Scopes
In most cases, [directives](../api/ng/provider/%24compileprovider#directive.html) and scopes interact but do not create new instances of scope. However, some directives, such as [ng-controller](../api/ng/directive/ngcontroller) and [ng-repeat](../api/ng/directive/ngrepeat), create new child scopes and attach the child scope to the corresponding DOM element.
A special type of scope is the `isolate` scope, which does not inherit prototypically from the parent scope. This type of scope is useful for component directives that should be isolated from their parent scope. See the [directives guide](directive#isolating-the-scope-of-a-directive.html) for more information about isolate scopes in custom directives.
Note also that component directives, which are created with the [.component()](../api/ng/type/angular.module#component.html) helper always create an isolate scope.
### Controllers and Scopes
Scopes and controllers interact with each other in the following situations:
* Controllers use scopes to expose controller methods to templates (see [ng-controller](../api/ng/directive/ngcontroller)).
* Controllers define methods (behavior) that can mutate the model (properties on the scope).
* Controllers may register [watches](../api/ng/type/%24rootscope.scope#%24watch.html) on the model. These watches execute immediately after the controller behavior executes.
See the [ng-controller](../api/ng/directive/ngcontroller) for more information.
### Scope $watch Performance Considerations
Dirty checking the scope for property changes is a common operation in AngularJS and for this reason the dirty checking function must be efficient. Care should be taken that the dirty checking function does not do any DOM access, as DOM access is orders of magnitude slower than property access on JavaScript object.
### Scope $watch Depths
Dirty checking can be done with three strategies: By reference, by collection contents, and by value. The strategies differ in the kinds of changes they detect, and in their performance characteristics.
* Watching *by reference* ([scope.$watch](../api/ng/type/%24rootscope.scope#%24watch.html) `(watchExpression, listener)`) detects a change when the whole value returned by the watch expression switches to a new value. If the value is an array or an object, changes inside it are not detected. This is the most efficient strategy.
* Watching *collection contents* ([scope.$watchCollection](../api/ng/type/%24rootscope.scope#%24watchCollection.html) `(watchExpression, listener)`) detects changes that occur inside an array or an object: When items are added, removed, or reordered. The detection is shallow - it does not reach into nested collections. Watching collection contents is more expensive than watching by reference, because copies of the collection contents need to be maintained. However, the strategy attempts to minimize the amount of copying required.
* Watching *by value* ([scope.$watch](../api/ng/type/%24rootscope.scope#%24watch.html) `(watchExpression, listener, true)`) detects any change in an arbitrarily nested data structure. It is the most powerful change detection strategy, but also the most expensive. A full traversal of the nested data structure is needed on each digest, and a full copy of it needs to be held in memory.
Integration with the browser event loop
---------------------------------------
The diagram and the example below describe how AngularJS interacts with the browser's event loop.
1. The browser's event-loop waits for an event to arrive. An event is a user interaction, timer event, or network event (response from a server).
2. The event's callback gets executed. This enters the JavaScript context. The callback can modify the DOM structure.
3. Once the callback executes, the browser leaves the JavaScript context and re-renders the view based on DOM changes.
AngularJS modifies the normal JavaScript flow by providing its own event processing loop. This splits the JavaScript into classical and AngularJS execution context. Only operations which are applied in the AngularJS execution context will benefit from AngularJS data-binding, exception handling, property watching, etc... You can also use $apply() to enter the AngularJS execution context from JavaScript. Keep in mind that in most places (controllers, services) $apply has already been called for you by the directive which is handling the event. An explicit call to $apply is needed only when implementing custom event callbacks, or when working with third-party library callbacks.
1. Enter the AngularJS execution context by calling <scope>`.`[$apply](../api/ng/type/%24rootscope.scope#%24apply.html)`(stimulusFn)`, where `stimulusFn` is the work you wish to do in the AngularJS execution context.
2. AngularJS executes the `stimulusFn()`, which typically modifies application state.
3. AngularJS enters the [$digest](../api/ng/type/%24rootscope.scope#%24digest.html) loop. The loop is made up of two smaller loops which process [$evalAsync](../api/ng/type/%24rootscope.scope#%24evalAsync.html) queue and the [$watch](../api/ng/type/%24rootscope.scope#%24watch.html) list. The [$digest](../api/ng/type/%24rootscope.scope#%24digest.html) loop keeps iterating until the model stabilizes, which means that the [$evalAsync](../api/ng/type/%24rootscope.scope#%24evalAsync.html) queue is empty and the [$watch](../api/ng/type/%24rootscope.scope#%24watch.html) list does not detect any changes.
4. The [$evalAsync](../api/ng/type/%24rootscope.scope#%24evalAsync.html) queue is used to schedule work which needs to occur outside of current stack frame, but before the browser's view render. This is usually done with `setTimeout(0)`, but the `setTimeout(0)` approach suffers from slowness and may cause view flickering since the browser renders the view after each event.
5. The [$watch](../api/ng/type/%24rootscope.scope#%24watch.html) list is a set of expressions which may have changed since last iteration. If a change is detected then the `$watch` function is called which typically updates the DOM with the new value.
6. Once the AngularJS [$digest](../api/ng/type/%24rootscope.scope#%24digest.html) loop finishes, the execution leaves the AngularJS and JavaScript context. This is followed by the browser re-rendering the DOM to reflect any changes.
Here is the explanation of how the `Hello world` example achieves the data-binding effect when the user enters text into the text field.
1. During the compilation phase:
1. the [ng-model](../api/ng/directive/ngmodel) and [input](../api/ng/directive/input) <directive> set up a `keydown` listener on the `<input>` control.
2. the [interpolation](../api/ng/service/%24interpolate) sets up a [$watch](../api/ng/type/%24rootscope.scope#%24watch.html) to be notified of `name` changes.
2. During the runtime phase:
1. Pressing an '`X`' key causes the browser to emit a `keydown` event on the input control.
2. The [input](../api/ng/directive/input) directive captures the change to the input's value and calls [$apply](../api/ng/type/%24rootscope.scope#%24apply.html)`("name = 'X';")` to update the application model inside the AngularJS execution context.
3. AngularJS applies the `name = 'X';` to the model.
4. The [$digest](../api/ng/type/%24rootscope.scope#%24digest.html) loop begins
5. The [$watch](../api/ng/type/%24rootscope.scope#%24watch.html) list detects a change on the `name` property and notifies the [interpolation](../api/ng/service/%24interpolate), which in turn updates the DOM.
6. AngularJS exits the execution context, which in turn exits the `keydown` event and with it the JavaScript execution context.
7. The browser re-renders the view with the updated text.
| programming_docs |
angularjs
Improve this DocRunning an AngularJS App in Production
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/production.ngdoc?message=docs(guide%2FRunning%20in%20Production)%3A%20describe%20your%20change...)Running an AngularJS App in Production
=================================================================================================================================================================================================================================
There are a few things you might consider when running your AngularJS application in production.
Disabling Debug Data
--------------------
By default AngularJS attaches information about binding and scopes to DOM nodes, and adds CSS classes to data-bound elements:
* As a result of `ngBind`, `ngBindHtml` or `{{...}}` interpolations, binding data and CSS class `ng-binding` are attached to the corresponding element.
* Where the compiler has created a new scope, the scope and either `ng-scope` or `ng-isolated-scope` CSS class are attached to the corresponding element. These scope references can then be accessed via `element.scope()` and `element.isolateScope()`.
* Placeholder comments for structural directives will contain information about what directive and binding caused the placeholder. E.g. `<!-- ngIf: shouldShow() -->`.
Tools like [Protractor](https://github.com/angular/protractor) and [Batarang](https://github.com/angular/angularjs-batarang) need this information to run, but you can disable this in production for a significant performance boost with:
```
myApp.config(['$compileProvider', function ($compileProvider) {
$compileProvider.debugInfoEnabled(false);
}]);
```
If you wish to debug an application with this information then you should open up a debug console in the browser then call this method directly in this console:
```
angular.reloadWithDebugInfo();
```
The page should reload and the debug information should now be available.
For more see the docs pages on [`$compileProvider`](../api/ng/provider/%24compileprovider#debugInfoEnabled.html) and [`angular.reloadWithDebugInfo`](../api/ng/function/angular.reloadwithdebuginfo).
Strict DI Mode
--------------
Using strict di mode in your production application will throw errors when an injectable function is not [annotated explicitly](di#dependency-annotation.html). Strict di mode is intended to help you make sure that your code will work when minified. However, it also will force you to make sure that your injectable functions are explicitly annotated which will improve angular's performance when injecting dependencies in your injectable functions because it doesn't have to dynamically discover a function's dependencies. It is recommended to automate the explicit annotation via a tool like [ng-annotate](https://github.com/olov/ng-annotate) when you deploy to production (and enable strict di mode)
To enable strict di mode, you have two options:
```
<div ng-app="myApp" ng-strict-di>
<!-- your app here -->
</div>
```
or
```
angular.bootstrap(document, ['myApp'], {
strictDi: true
});
```
For more information, see the [DI Guide](di#using-strict-dependency-injection.html).
Disable comment and css class directives
----------------------------------------
By default AngularJS compiles and executes all directives inside comments and element classes. In order to perform this task, the AngularJS compiler must look for directives by:
* Parse all your application element classes.
* Parse all your application html comments.
Nowadays most of the AngularJS projects are using only element and attribute directives, and in such projects there is no need to compile comments and classes.
If you are sure that your project only uses element and attribute directives, and you are not using any 3rd party library that uses directives inside element classes or html comments, you can disable the compilation of directives on element classes and comments for the whole application. This results in a compilation performance gain, as the compiler does not have to check comments and element classes looking for directives.
To disable comment and css class directives use the `$compileProvider`:
```
$compileProvider.commentDirectivesEnabled(false);
$compileProvider.cssClassDirectivesEnabled(false);
```
For more see the docs pages on [`$compileProvider.commentDirectivesEnabled`](../api/ng/provider/%24compileprovider#commentDirectivesEnabled.html) and [`$compileProvider.cssClassDirectivesEnabled`](../api/ng/provider/%24compileprovider#cssClassDirectivesEnabled.html).
angularjs
Improve this DocAnimations
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/animations.ngdoc?message=docs(guide%2FAnimations)%3A%20describe%20your%20change...)Animations
======================================================================================================================================================================================
AngularJS provides animation hooks for common directives such as [ngRepeat](../api/ng/directive/ngrepeat), [ngSwitch](../api/ng/directive/ngswitch), and [ngView](../api/ngroute/directive/ngview), as well as custom directives via the `$animate` service. These animation hooks are set in place to trigger animations during the life cycle of various directives and when triggered, will attempt to perform a CSS Transition, CSS Keyframe Animation or a JavaScript callback Animation (depending on whether an animation is placed on the given directive). Animations can be placed using vanilla CSS by following the naming conventions set in place by AngularJS or with JavaScript code, defined as a factory.
Note that we have used non-prefixed CSS transition properties in our examples as the major browsers now support non-prefixed properties. If you intend to support older browsers or certain mobile browsers then you will need to include prefixed versions of the transition properties. Take a look at <http://caniuse.com/#feat=css-transitions> for what browsers require prefixes, and <https://github.com/postcss/autoprefixer> for a tool that can automatically generate the prefixes for you. Animations are not available unless you include the [`ngAnimate` module](../api/nganimate) as a dependency of your application.
Below is a quick example of animations being enabled for `ngShow` and `ngHide`:
Installation
------------
See the [API docs for `ngAnimate`](../api/nganimate) for instructions on installing the module.
You may also want to setup a separate CSS file for defining CSS-based animations.
How they work
-------------
Animations in AngularJS are completely based on CSS classes. As long as you have a CSS class attached to an HTML element within your application, you can apply animations to it. Let's say for example that we have an HTML template with a repeater like so:
```
<div ng-repeat="item in items" class="repeated-item">
{{ item.id }}
</div>
```
As you can see, the `repeated-item` class is present on the element that will be repeated and this class will be used as a reference within our application's CSS and/or JavaScript animation code to tell AngularJS to perform an animation.
As `ngRepeat` does its thing, each time a new item is added into the list, `ngRepeat` will add an `ng-enter` class to the element that is being added. When removed it will apply an `ng-leave` class and when moved around it will apply an `ng-move` class.
Taking a look at the following CSS code, we can see some transition and keyframe animation code set up for each of those events that occur when `ngRepeat` triggers them:
```
/*
We are using CSS transitions for when the enter and move events
are triggered for the element that has the `repeated-item` class
*/
.repeated-item.ng-enter, .repeated-item.ng-move {
transition: all 0.5s linear;
opacity: 0;
}
/*
`.ng-enter-active` and `.ng-move-active` are where the transition destination
properties are set so that the animation knows what to animate
*/
.repeated-item.ng-enter.ng-enter-active,
.repeated-item.ng-move.ng-move-active {
opacity: 1;
}
/*
We are using CSS keyframe animations for when the `leave` event
is triggered for the element that has the `repeated-item` class
*/
.repeated-item.ng-leave {
animation: 0.5s my_animation;
}
@keyframes my_animation {
from { opacity: 1; }
to { opacity: 0; }
}
```
The same approach to animation can be used using JavaScript code (**for simplicity, we rely on jQuery to perform animations here**):
```
myModule.animation('.repeated-item', function() {
return {
enter: function(element, done) {
// Initialize the element's opacity
element.css('opacity', 0);
// Animate the element's opacity
// (`element.animate()` is provided by jQuery)
element.animate({opacity: 1}, done);
// Optional `onDone`/`onCancel` callback function
// to handle any post-animation cleanup operations
return function(isCancelled) {
if (isCancelled) {
// Abort the animation if cancelled
// (`element.stop()` is provided by jQuery)
element.stop();
}
};
},
leave: function(element, done) {
// Initialize the element's opacity
element.css('opacity', 1);
// Animate the element's opacity
// (`element.animate()` is provided by jQuery)
element.animate({opacity: 0}, done);
// Optional `onDone`/`onCancel` callback function
// to handle any post-animation cleanup operations
return function(isCancelled) {
if (isCancelled) {
// Abort the animation if cancelled
// (`element.stop()` is provided by jQuery)
element.stop();
}
};
},
// We can also capture the following animation events:
move: function(element, done) {},
addClass: function(element, className, done) {},
removeClass: function(element, className, done) {}
}
});
```
With these generated CSS class names present on the element at the time, AngularJS automatically figures out whether to perform a CSS and/or JavaScript animation. Note that you can't have both CSS and JavaScript animations based on the same CSS class. See [here](../api/nganimate#css-js-animations-together.html) for more details.
Class and ngClass animation hooks
---------------------------------
AngularJS also pays attention to CSS class changes on elements by triggering the **add** and **remove** hooks. This means that if a CSS class is added to or removed from an element then an animation can be executed in between, before the CSS class addition or removal is finalized. (Keep in mind that AngularJS will only be able to capture class changes if an **interpolated expression** or the **ng-class** directive is used on the element.)
The example below shows how to perform animations during class changes:
Although the CSS is a little different than what we saw before, the idea is the same.
Which directives support animations?
------------------------------------
A handful of common AngularJS directives support and trigger animation hooks whenever any major event occurs during their life cycle. The table below explains in detail which animation events are triggered:
| Directive | Supported Animations |
| --- | --- |
| [form / ngForm](../api/ng/directive/form#animations.html) | add and remove ([various classes](../api/ng/directive/form#css-classes.html)) |
| [ngAnimateSwap](../api/nganimate/directive/nganimateswap#animations.html) | enter and leave |
| [ngClass / {{class}}](../api/ng/directive/ngclass#animations.html) | add and remove |
| [ngClassEven](../api/ng/directive/ngclasseven#animations.html) | add and remove |
| [ngClassOdd](../api/ng/directive/ngclassodd#animations.html) | add and remove |
| [ngHide](../api/ng/directive/nghide#animations.html) | add and remove (the `ng-hide` class) |
| [ngIf](../api/ng/directive/ngif#animations.html) | enter and leave |
| [ngInclude](../api/ng/directive/nginclude#animations.html) | enter and leave |
| [ngMessage / ngMessageExp](../api/ngmessages#animations.html) | enter and leave |
| [ngMessages](../api/ngmessages#animations.html) | add and remove (the `ng-active`/`ng-inactive` classes) |
| [ngModel](../api/ng/directive/ngmodel#animations.html) | add and remove ([various classes](../api/ng/directive/ngmodel#css-classes.html)) |
| [ngRepeat](../api/ng/directive/ngrepeat#animations.html) | enter, leave, and move |
| [ngShow](../api/ng/directive/ngshow#animations.html) | add and remove (the `ng-hide` class) |
| [ngSwitch](../api/ng/directive/ngswitch#animations.html) | enter and leave |
| [ngView](../api/ngroute/directive/ngview#animations.html) | enter and leave |
(More information can be found by visiting the documentation associated with each directive.)
For a full breakdown of the steps involved during each animation event, refer to the [`$animate` API docs](../api/ng/service/%24animate).
How do I use animations in my own directives?
---------------------------------------------
Animations within custom directives can also be established by injecting `$animate` directly into your directive and making calls to it when needed.
```
myModule.directive('my-directive', ['$animate', function($animate) {
return function(scope, element) {
element.on('click', function() {
if (element.hasClass('clicked')) {
$animate.removeClass(element, 'clicked');
} else {
$animate.addClass(element, 'clicked');
}
});
};
}]);
```
Animations on app bootstrap / page load
---------------------------------------
By default, animations are disabled when the AngularJS app [bootstraps](bootstrap). If you are using the [`ngApp`](../api/ng/directive/ngapp) directive, this happens in the `DOMContentLoaded` event, so immediately after the page has been loaded. Animations are disabled, so that UI and content are instantly visible. Otherwise, with many animations on the page, the loading process may become too visually overwhelming, and the performance may suffer.
Internally, `ngAnimate` waits until all template downloads that are started right after bootstrap have finished. Then, it waits for the currently running [$digest](../api/ng/type/%24rootscope.scope#%24digest.html) and one more after that, to finish. This ensures that the whole app has been compiled fully before animations are attempted.
If you do want your animations to play when the app bootstraps, you can enable animations globally in your main module's [run](../api/ng/type/angular.module#run.html) function:
```
myModule.run(function($animate) {
$animate.enabled(true);
});
```
How to (selectively) enable, disable and skip animations
--------------------------------------------------------
There are several different ways to disable animations, both globally and for specific animations. Disabling specific animations can help to speed up the render performance, for example for large `ngRepeat` lists that don't actually have animations. Because `ngAnimate` checks at runtime if animations are present, performance will take a hit even if an element has no animation.
### During the config: [$animateProvider.customFilter()](../api/ng/provider/%24animateprovider#customFilter.html)
This function can be called during the [config](../api/ng/type/angular.module#config.html) phase of an app. It takes a filter function as the only argument, which will then be used to "filter" animations (based on the animated element, the event type, and the animation options). Only when the filter function returns `true`, will the animation be performed. This allows great flexibility - you can easily create complex rules, such as allowing specific events only or enabling animations on specific subtrees of the DOM, and dynamically modify them, for example disabling animations at certain points in time or under certain circumstances.
```
app.config(function($animateProvider) {
$animateProvider.customFilter(function(node, event, options) {
// Example: Only animate `enter` and `leave` operations.
return event === 'enter' || event === 'leave';
});
});
```
The `customFilter` approach generally gives a big speed boost compared to other strategies, because the matching is done before other animation disabling strategies are checked.
**Best Practice:** Keep the filtering function as lean as possible, because it will be called for each DOM action (e.g. insertion, removal, class change) performed by "animation-aware" directives. See [here](animations#which-directives-support-animations-.html) for a list of built-in directives that support animations. Performing computationally expensive or time-consuming operations on each call of the filtering function can make your animations sluggish. ### During the config: [$animateProvider.classNameFilter()](../api/ng/provider/%24animateprovider#classNameFilter.html)
This function too can be called during the [config](../api/ng/type/angular.module#config.html) phase of an app. It takes a regex as the only argument, which will then be matched against the classes of any element that is about to be animated. The regex allows a lot of flexibility - you can either allow animations for specific classes only (useful when you are working with 3rd party animations), or exclude specific classes from getting animated.
```
app.config(function($animateProvider) {
$animateProvider.classNameFilter(/animate-/);
});
```
```
/* prefixed with `animate-` */
.animate-fade-add.animate-fade-add-active {
transition: all 1s linear;
opacity: 0;
}
```
The `classNameFilter` approach generally gives a big speed boost compared to other strategies, because the matching is done before other animation disabling strategies are checked. However, that also means it is not possible to override class name matching with the two following strategies. It's of course still possible to enable / disable animations by changing an element's class name at runtime.
### At runtime: [$animate.enabled()](../api/ng/service/%24animate#enabled.html)
This function can be used to enable / disable animations in two different ways:
With a single `boolean` argument, it enables / disables animations globally: `$animate.enabled(false)` disables all animations in your app.
When the first argument is a native DOM or jqLite/jQuery element, the function enables / disables animations on this element *and all its children*: `$animate.enabled(myElement, false)`. You can still use it to re-enable animations for a child element, even if you have disabled them on a parent element. And compared to the `classNameFilter`, you can change the animation status at runtime instead of during the config phase.
Note however that the `$animate.enabled()` state for individual elements does not overwrite disabling rules that have been set in the [classNameFilter](../api/ng/provider/%24animateprovider#classNameFilter.html).
### Via CSS styles: overwriting styles in the ng-animate CSS class
Whenever an animation is started, `ngAnimate` applies the `ng-animate` class to the element for the whole duration of the animation. By applying CSS transition / animation styling to that class, you can skip an animation:
```
.my-class {
transition: transform 2s;
}
.my-class:hover {
transform: translateX(50px);
}
my-class.ng-animate {
transition: 0s;
}
```
By setting `transition: 0s`, `ngAnimate` will ignore the existing transition styles, and not try to animate them (Javascript animations will still execute, though). This can be used to prevent [issues with existing animations interfering with `ngAnimate`](animations#preventing-collisions-with-existing-animations-and-third-party-libraries.html).
Preventing flicker before an animation starts
---------------------------------------------
When nesting elements with structural animations, such as `ngIf`, into elements that have class-based animations such as `ngClass`, it sometimes happens that before the actual animation starts, there is a brief flicker or flash of content where the animated element is briefly visible.
To prevent this, you can apply styles to the `ng-[event]-prepare` class, which is added as soon as an animation is initialized, but removed before the actual animation starts (after waiting for a `$digest`). This class is only added for *structural* animations (`enter`, `move`, and `leave`).
Here's an example where you might see flickering:
```
<div ng-class="{red: myProp}">
<div ng-class="{blue: myProp}">
<div class="message" ng-if="myProp"></div>
</div>
</div>
```
It is possible that during the `enter` event, the `.message` div will be briefly visible before it starts animating. In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:
```
.message.ng-enter-prepare {
opacity: 0;
}
/* Other animation styles ... */
```
Preventing collisions with existing animations and third-party libraries
------------------------------------------------------------------------
By default, any `ngAnimate`-enabled directives will assume that `transition` / `animation` styles on the element are part of an `ngAnimate` animation. This can lead to problems when the styles are actually for animations that are independent of `ngAnimate`.
For example, an element acts as a loading spinner. It has an infinite css animation on it, and also an [`ngIf`](../api/ng/directive/ngif) directive, for which no animations are defined:
```
.spinner {
animation: rotating 2s linear infinite;
}
@keyframes rotating {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
```
Now, when the `ngIf` expression changes, `ngAnimate` will see the spinner animation and use it to animate the `enter`/`leave` event, which doesn't work because the animation is infinite. The element will still be added / removed after a timeout, but there will be a noticeable delay.
This might also happen because some third-party frameworks place animation duration defaults across many element or className selectors in order to make their code small and reusable.
You can prevent this unwanted behavior by adding CSS to the `.ng-animate` class, that is added for the whole duration of each animation. Simply overwrite the transition / animation duration. In the case of the spinner, this would be:
```
.spinner.ng-animate {
animation: 0s none;
transition: 0s none;
}
```
If you do have CSS transitions / animations defined for the animation events, make sure they have a higher priority than any styles that are not related to `ngAnimate`.
You can also use one of the other [strategies to disable animations](animations#how-to-selectively-enable-disable-and-skip-animations.html).
Enable animations outside of the application DOM tree: [$animate.pin()](../api/ng/service/%24animate#pin.html)
--------------------------------------------------------------------------------------------------------------
Before animating, `ngAnimate` checks if the animated element is inside the application DOM tree. If not, no animation is run. Usually, this is not a problem since most apps use the `html` or `body` elements as their root.
Problems arise when the application is bootstrapped on a different element, and animations are attempted on elements that are outside the application tree, e.g. when libraries append popup or modal elements to the body tag.
You can use [`$animate.pin(element, parentHost)`](../api/ng/service/%24animate#pin.html) to associate an element with another element that belongs to your application. Simply call it before the element is added to the DOM / before the animation starts, with the element you want to animate, and the element which should be its assumed parent.
More about animations
---------------------
For a full breakdown of each method available on `$animate`, see the [API documentation](../api/ng/service/%24animate).
To see a complete demo, see the [animation step in the phonecat tutorial](https://code.angularjs.org/1.8.2/docs/guide/tutorial/step_14).
| programming_docs |
angularjs
Improve this DocServices
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/services.ngdoc?message=docs(guide%2FServices)%3A%20describe%20your%20change...)Services
================================================================================================================================================================================
AngularJS services are substitutable objects that are wired together using [dependency injection (DI)](di). You can use services to organize and share code across your app.
AngularJS services are:
* Lazily instantiated – AngularJS only instantiates a service when an application component depends on it.
* Singletons – Each component dependent on a service gets a reference to the single instance generated by the service factory.
AngularJS offers several useful services (like [`$http`](../api/ng/service/%24http)), but for most applications you'll also want to [create your own](services#creating-services.html).
**Note:** Like other core AngularJS identifiers, built-in services always start with `$` (e.g. `$http`). Using a Service
---------------
To use an AngularJS service, you add it as a dependency for the component (controller, service, filter or directive) that depends on the service. AngularJS's [dependency injection](di) subsystem takes care of the rest.
Creating Services
-----------------
Application developers are free to define their own services by registering the service's name and **service factory function**, with an AngularJS module.
The **service factory function** generates the single object or function that represents the service to the rest of the application. The object or function returned by the service is injected into any component (controller, service, filter or directive) that specifies a dependency on the service.
### Registering Services
Services are registered to modules via the [Module API](../api/ng/type/angular.module). Typically you use the [Module factory](../api/ng/type/angular.module#factory.html) API to register a service:
```
var myModule = angular.module('myModule', []);
myModule.factory('serviceId', function() {
var shinyNewServiceInstance;
// factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;
});
```
Note that you are not registering a **service instance**, but rather a **factory function** that will create this instance when called.
### Dependencies
Services can have their own dependencies. Just like declaring dependencies in a controller, you declare dependencies by specifying them in the service's factory function signature.
For more on dependencies, see the [dependency injection](di) docs.
The example module below has two services, each with various dependencies:
```
var batchModule = angular.module('batchModule', []);
/**
* The `batchLog` service allows for messages to be queued in memory and flushed
* to the console.log every 50 seconds.
*
* @param {*} message Message to be logged.
*/
batchModule.factory('batchLog', ['$interval', '$log', function($interval, $log) {
var messageQueue = [];
function log() {
if (messageQueue.length) {
$log.log('batchLog messages: ', messageQueue);
messageQueue = [];
}
}
// start periodic checking
$interval(log, 50000);
return function(message) {
messageQueue.push(message);
}
}]);
/**
* `routeTemplateMonitor` monitors each `$route` change and logs the current
* template via the `batchLog` service.
*/
batchModule.factory('routeTemplateMonitor', ['$route', 'batchLog', '$rootScope',
function($route, batchLog, $rootScope) {
return {
startMonitoring: function() {
$rootScope.$on('$routeChangeSuccess', function() {
batchLog($route.current ? $route.current.template : null);
});
}
};
}]);
```
In the example, note that:
* The `batchLog` service depends on the built-in [`$interval`](../api/ng/service/%24interval) and [`$log`](../api/ng/service/%24log) services.
* The `routeTemplateMonitor` service depends on the built-in [`$route`](../api/ngroute/service/%24route) service and our custom `batchLog` service.
* Both services use the array notation to declare their dependencies.
* The order of identifiers in the array is the same as the order of argument names in the factory function.
### Registering a Service with $provide
You can also register services via the [`$provide`](../api/auto/service/%24provide) service inside of a module's `config` function:
```
angular.module('myModule', []).config(['$provide', function($provide) {
$provide.factory('serviceId', function() {
var shinyNewServiceInstance;
// factory function body that constructs shinyNewServiceInstance
return shinyNewServiceInstance;
});
}]);
```
This technique is often used in unit tests to mock out a service's dependencies.
Unit Testing
------------
The following is a unit test for the `notify` service from the [Creating AngularJS Services](services#creating-services.html) example above. The unit test example uses a Jasmine spy (mock) instead of a real browser alert.
```
var mock, notify;
beforeEach(module('myServiceModule'));
beforeEach(function() {
mock = {alert: jasmine.createSpy()};
module(function($provide) {
$provide.value('$window', mock);
});
inject(function($injector) {
notify = $injector.get('notify');
});
});
it('should not alert first two notifications', function() {
notify('one');
notify('two');
expect(mock.alert).not.toHaveBeenCalled();
});
it('should alert all after third notification', function() {
notify('one');
notify('two');
notify('three');
expect(mock.alert).toHaveBeenCalledWith("one\ntwo\nthree");
});
it('should clear messages after alert', function() {
notify('one');
notify('two');
notify('third');
notify('more');
notify('two');
notify('third');
expect(mock.alert.calls.count()).toEqual(2);
expect(mock.alert.calls.mostRecent().args).toEqual(["more\ntwo\nthird"]);
});
```
Related Topics
--------------
* [Dependency Injection in AngularJS](di)
Related API
-----------
* [AngularJS Service API](../api/ng/service)
* [Injector API](../api/ng/function/angular.injector)
angularjs
Improve this DocWhat Is AngularJS?
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/introduction.ngdoc?message=docs(guide%2FIntroduction)%3A%20describe%20your%20change...)What Is AngularJS?
==================================================================================================================================================================================================
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. AngularJS's data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology.
AngularJS is what HTML would have been, had it been designed for applications. HTML is a great declarative language for static documents. It does not contain much in the way of creating applications, and as a result building web applications is an exercise in *what do I have to do to trick the browser into doing what I want?*
The impedance mismatch between dynamic applications and static documents is often solved with:
* **a library** - a collection of functions which are useful when writing web apps. Your code is in charge and it calls into the library when it sees fit. E.g., `jQuery`.
* **frameworks** - a particular implementation of a web application, where your code fills in the details. The framework is in charge and it calls into your code when it needs something app specific. E.g., `durandal`, `ember`, etc.
AngularJS takes another approach. It attempts to minimize the impedance mismatch between document centric HTML and what an application needs by creating new HTML constructs. AngularJS teaches the browser new syntax through a construct we call *directives*. Examples include:
* Data binding, as in `{{}}`.
* DOM control structures for repeating, showing and hiding DOM fragments.
* Support for forms and form validation.
* Attaching new behavior to DOM elements, such as DOM event handling.
* Grouping of HTML into reusable components.
A complete client-side solution
-------------------------------
AngularJS is not a single piece in the overall puzzle of building the client-side of a web application. It handles all of the DOM and AJAX glue code you once wrote by hand and puts it in a well-defined structure. This makes AngularJS opinionated about how a CRUD (Create, Read, Update, Delete) application should be built. But while it is opinionated, it also tries to make sure that its opinion is just a starting point you can easily change. AngularJS comes with the following out-of-the-box:
* Everything you need to build a CRUD app in a cohesive set: Data-binding, basic templating directives, form validation, routing, deep-linking, reusable components and dependency injection.
* Testability story: Unit-testing, end-to-end testing, mocks and test harnesses.
* Seed application with directory layout and test scripts as a starting point.
AngularJS's sweet spot
----------------------
AngularJS simplifies application development by presenting a higher level of abstraction to the developer. Like any abstraction, it comes at a cost of flexibility. In other words, not every app is a good fit for AngularJS. AngularJS was built with the CRUD application in mind. Luckily CRUD applications represent the majority of web applications. To understand what AngularJS is good at, though, it helps to understand when an app is not a good fit for AngularJS.
Games and GUI editors are examples of applications with intensive and tricky DOM manipulation. These kinds of apps are different from CRUD apps, and as a result are probably not a good fit for AngularJS. In these cases it may be better to use a library with a lower level of abstraction, such as `jQuery`.
The Zen of AngularJS
--------------------
AngularJS is built around the belief that declarative code is better than imperative when it comes to building UIs and wiring software components together, while imperative code is excellent for expressing business logic.
* It is a very good idea to decouple DOM manipulation from app logic. This dramatically improves the testability of the code.
* It is a really, *really* good idea to regard app testing as equal in importance to app writing. Testing difficulty is dramatically affected by the way the code is structured.
* It is an excellent idea to decouple the client side of an app from the server side. This allows development work to progress in parallel, and allows for reuse of both sides.
* It is very helpful indeed if the framework guides developers through the entire journey of building an app: From designing the UI, through writing the business logic, to testing.
* It is always good to make common tasks trivial and difficult tasks possible.
AngularJS frees you from the following pains:
* **Registering callbacks:** Registering callbacks clutters your code, making it hard to see the forest for the trees. Removing common boilerplate code such as callbacks is a good thing. It vastly reduces the amount of JavaScript coding *you* have to do, and it makes it easier to see what your application does.
* **Manipulating HTML DOM programmatically:** Manipulating HTML DOM is a cornerstone of AJAX applications, but it's cumbersome and error-prone. By declaratively describing how the UI should change as your application state changes, you are freed from low-level DOM manipulation tasks. Most applications written with AngularJS never have to programmatically manipulate the DOM, although you can if you want to.
* **Marshaling data to and from the UI:** CRUD operations make up the majority of AJAX applications' tasks. The flow of marshaling data from the server to an internal object to an HTML form, allowing users to modify the form, validating the form, displaying validation errors, returning to an internal model, and then back to the server, creates a lot of boilerplate code. AngularJS eliminates almost all of this boilerplate, leaving code that describes the overall flow of the application rather than all of the implementation details.
* **Writing tons of initialization code just to get started:** Typically you need to write a lot of plumbing just to get a basic "Hello World" AJAX app working. With AngularJS you can bootstrap your app easily using services, which are auto-injected into your application in a [Guice](https://github.com/google/guice)-like dependency-injection style. This allows you to get started developing features quickly. As a bonus, you get full control over the initialization process in automated tests.
angularjs
Improve this DocFilters
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/docs/content/guide/filter.ngdoc?message=docs(guide%2FFilters)%3A%20describe%20your%20change...)Filters
============================================================================================================================================================================
Filters format the value of an expression for display to the user. They can be used in view templates, controllers or services. AngularJS comes with a collection of [built-in filters](../api/ng/filter), but it is easy to define your own as well.
The underlying API is the [`$filterProvider`](../api/ng/provider/%24filterprovider).
Using filters in view templates
-------------------------------
Filters can be applied to expressions in view templates using the following syntax:
```
{{ expression | filter }}
```
E.g. the markup `{{ 12 | currency }}` formats the number 12 as a currency using the [`currency`](../api/ng/filter/currency) filter. The resulting value is `$12.00`.
Filters can be applied to the result of another filter. This is called "chaining" and uses the following syntax:
```
{{ expression | filter1 | filter2 | ... }}
```
Filters may have arguments. The syntax for this is
```
{{ expression | filter:argument1:argument2:... }}
```
E.g. the markup `{{ 1234 | number:2 }}` formats the number 1234 with 2 decimal points using the [`number`](../api/ng/filter/number) filter. The resulting value is `1,234.00`.
### When filters are executed
In templates, filters are only executed when their inputs have changed. This is more performant than executing a filter on each [`$digest`](../api/ng/type/%24rootscope.scope#%24digest.html) as is the case with [expressions](expression).
There are two exceptions to this rule:
1. In general, this applies only to filters that take [primitive values](https://developer.mozilla.org/docs/Glossary/Primitive) as inputs. Filters that receive [Objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Objects) as input are executed on each `$digest`, as it would be too costly to track if the inputs have changed.
2. Filters that are marked as `$stateful` are also executed on each $digest. See [Stateful filters](filter#stateful-filters.html) for more information. Note that no AngularJS core filters are $stateful.
Using filters in controllers, services, and directives
------------------------------------------------------
You can also use filters in controllers, services, and directives.
For this, inject a dependency with the name `<filterName>Filter` into your controller/service/directive. E.g. a filter called `number` is injected by using the dependency `numberFilter`. The injected argument is a function that takes the value to format as first argument, and filter parameters starting with the second argument. The example below uses the filter called [`filter`](../api/ng/filter/filter). This filter reduces arrays into sub arrays based on conditions. The filter can be applied in the view template with markup like `{{ctrl.array | filter:'a'}}`, which would do a fulltext search for "a". However, using a filter in a view template will reevaluate the filter on every digest, which can be costly if the array is big.
The example below therefore calls the filter directly in the controller. By this, the controller is able to call the filter only when needed (e.g. when the data is loaded from the backend or the filter expression is changed).
Creating custom filters
-----------------------
Writing your own filter is very easy: just register a new filter factory function with your module. Internally, this uses the [`filterProvider`](../api/ng/provider/%24filterprovider). This factory function should return a new filter function which takes the input value as the first argument. Any filter arguments are passed in as additional arguments to the filter function.
The filter function should be a [pure function](http://en.wikipedia.org/wiki/Pure_function), which means that it should always return the same result given the same input arguments and should not affect external state, for example, other AngularJS services. AngularJS relies on this contract and will by default execute a filter only when the inputs to the function change. [Stateful filters](filter#stateful-filters.html) are possible, but less performant.
**Note:** Filter names must be valid AngularJS [`Expressions`](expression) identifiers, such as `uppercase` or `orderBy`. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores (`myapp_subsection_filterx`). The following sample filter reverses a text string. In addition, it conditionally makes the text upper-case.
### Stateful filters
It is strongly discouraged to write filters that are stateful, because the execution of those can't be optimized by AngularJS, which often leads to performance issues. Many stateful filters can be converted into stateless filters just by exposing the hidden state as a model and turning it into an argument for the filter.
If you however do need to write a stateful filter, you have to mark the filter as `$stateful`, which means that it will be executed one or more times during the each `$digest` cycle.
Testing custom filters
----------------------
See the [phonecat tutorial](http://docs.angularjs.org/tutorial/step_11#testing) for an example.
angularjs
Improve this Doc ngMessageFormat
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessageFormat/messageFormatService.js?message=docs(ngMessageFormat)%3A%20describe%20your%20change...#L14) ngMessageFormat
=====================================================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-message-format.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-message-format#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-message-format.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-message-format.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-message-format.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngMessageFormat']);
```
With that you're ready to get started!
What is ngMessageFormat?
------------------------
The ngMessageFormat module extends the AngularJS [`$interpolate`](ng/service/%24interpolate) service with a syntax for handling pluralization and gender specific messages, which is based on the [ICU MessageFormat syntax](http://userguide.icu-project.org/formatparse/messages#TOC-MessageFormat).
See [the design doc](https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit) for more information.
Examples
--------
### Gender
This example uses the "select" keyword to specify the message based on gender.
### Plural
This example shows how the "plural" keyword is used to account for a variable number of entities. The "#" variable holds the current number and can be embedded in the message.
Note that "=1" takes precedence over "one".
The example also shows the "offset" keyword, which allows you to offset the value of the "#" variable.
### Plural and Gender together
This example shows how you can specify gender rules for specific plural matches - in this case, =1 is special cased for gender.
| programming_docs |
angularjs
Improve this Doc ngTouch
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngTouch/touch.js?message=docs(ngTouch)%3A%20describe%20your%20change...#L3) ngTouch
=============================================================================================================================================================
**Deprecated:** (since 1.7.0) The ngTouch module with the [`$swipe`](ngtouch/service/%24swipe) service and the [`ngSwipeLeft`](ngtouch/directive/ngswipeleft) and [`ngSwipeRight`](ngtouch/directive/ngswiperight) directives are deprecated. Instead, stand-alone libraries for touch handling and gesture interaction should be used, for example [HammerJS](https://hammerjs.github.io/) (which is also used by Angular).
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-touch.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-touch#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-touch.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-touch.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-touch.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngTouch']);
```
With that you're ready to get started!
The `ngTouch` module provides helpers for touch-enabled devices. The implementation is based on jQuery Mobile touch event handling ([jquerymobile.com](http://jquerymobile.com/)). \*
See [`$swipe`](ngtouch/service/%24swipe) for usage.
Module Components
-----------------
### Directive
| Name | Description |
| --- | --- |
| [ngSwipeLeft](ngtouch/directive/ngswipeleft) | Specify custom behavior when an element is swiped to the left on a touchscreen device. A leftward swipe is a quick, right-to-left slide of the finger. Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag too. |
| [ngSwipeRight](ngtouch/directive/ngswiperight) | Specify custom behavior when an element is swiped to the right on a touchscreen device. A rightward swipe is a quick, left-to-right slide of the finger. Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag too. |
### Service
| Name | Description |
| --- | --- |
| [$swipe](ngtouch/service/%24swipe) | The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe behavior, to make implementing swipe-related directives more convenient. |
angularjs
Improve this Doc ngParseExt
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngParseExt/module.js?message=docs(ngParseExt)%3A%20describe%20your%20change...#L5) ngParseExt
=======================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-parse-ext.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-parse-ext#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-parse-ext.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-parse-ext.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-parse-ext.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngParseExt']);
```
With that you're ready to get started!
The `ngParseExt` module provides functionality to allow Unicode characters in identifiers inside AngularJS expressions.
This module allows the usage of any identifier that follows ES6 identifier naming convention to be used as an identifier in an AngularJS expression. ES6 delegates some of the identifier rules definition to Unicode, this module uses ES6 and Unicode 8.0 identifiers convention.
You cannot use Unicode characters for variable names in the [`ngRepeat`](ng/directive/ngrepeat) or [`ngOptions`](ng/directive/ngoptions) expressions (e.g. `ng-repeat="f in поля"`), because even with `ngParseExt` included, these special expressions are not parsed by the [`$parse`](ng/service/%24parse) service.
angularjs
Improve this Doc ngCookies
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngCookies/cookies.js?message=docs(ngCookies)%3A%20describe%20your%20change...#L3) ngCookies
=====================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-cookies.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-cookies#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-cookies.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-cookies.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-cookies.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngCookies']);
```
With that you're ready to get started!
The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
See [`$cookies`](ngcookies/service/%24cookies) for usage.
Module Components
-----------------
### Provider
| Name | Description |
| --- | --- |
| [$cookiesProvider](ngcookies/provider/%24cookiesprovider) | Use `$cookiesProvider` to change the default behavior of the [$cookies](ngcookies/service/%24cookies) service. |
### Service
| Name | Description |
| --- | --- |
| [$cookies](ngcookies/service/%24cookies) | Provides read/write access to browser's cookies. |
angularjs
Improve this Doc ngSanitize
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngSanitize/sanitize.js?message=docs(ngSanitize)%3A%20describe%20your%20change...#L26) ngSanitize
==========================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-sanitize.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-sanitize#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-sanitize.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-sanitize.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-sanitize.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngSanitize']);
```
With that you're ready to get started!
The `ngSanitize` module provides functionality to sanitize HTML.
See [`$sanitize`](ngsanitize/service/%24sanitize) for usage.
Module Components
-----------------
### Filter
| Name | Description |
| --- | --- |
| [linky](ngsanitize/filter/linky) | Finds links in text input and turns them into html links. Supports `http/https/ftp/sftp/mailto` and plain email address links. |
### Service
| Name | Description |
| --- | --- |
| [$sanitize](ngsanitize/service/%24sanitize) | Sanitizes an html string by stripping all potentially dangerous tokens. |
### Provider
| Name | Description |
| --- | --- |
| [$sanitizeProvider](ngsanitize/provider/%24sanitizeprovider) | Creates and configures [`$sanitize`](ngsanitize/service/%24sanitize) instance. |
angularjs
Improve this Doc auto
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/auto/injector.js?message=docs(auto)%3A%20describe%20your%20change...#L57) auto
========================================================================================================================================================
Installation
------------
Implicit module which gets automatically added to each [$injector](auto/service/%24injector).
Module Components
-----------------
### Service
| Name | Description |
| --- | --- |
| [$injector](auto/service/%24injector) | `$injector` is used to retrieve object instances as defined by [provider](auto/service/%24provide), instantiate types, invoke methods, and load modules. |
| [$provide](auto/service/%24provide) | The [$provide](auto/service/%24provide) service has a number of methods for registering components with the [$injector](auto/service/%24injector). Many of these functions are also exposed on [`angular.Module`](ng/type/angular.module). |
angularjs
Improve this Doc ngMock
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(ngMock)%3A%20describe%20your%20change...#L2563) ngMock
=====================================================================================================================================================================
Installation
------------
First, download the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g. `"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js"`
* [NPM](https://www.npmjs.com/) e.g. `npm install [email protected]`
* [Yarn](https://yarnpkg.com) e.g. `yarn add [email protected]`
* [Bower](http://bower.io) e.g. `bower install angular-mocks#X.Y.Z`
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g. `"//code.angularjs.org/X.Y.Z/angular-mocks.js"`
where X.Y.Z is the AngularJS version you are running.
Then, configure your test runner to load `angular-mocks.js` after `angular.js`. This example uses [Karma](http://karma-runner.github.io/):
```
config.set({
files: [
'build/angular.js', // and other module files you need
'build/angular-mocks.js',
'<path/to/application/files>',
'<path/to/spec/files>'
]
});
```
Including the `angular-mocks.js` file automatically adds the `ngMock` module, so your tests are ready to go!
The `ngMock` module provides support to inject and mock AngularJS services into unit tests. In addition, ngMock also extends various core AngularJS services such that they can be inspected and controlled in a synchronous manner within test code.
Module Components
-----------------
### Object
| Name | Description |
| --- | --- |
| [angular.mock](ngmock/object/angular.mock) | Namespace from 'angular-mocks.js' which contains testing related code. |
### Service
| Name | Description |
| --- | --- |
| [$flushPendingTasks](ngmock/service/%24flushpendingtasks) | Flushes all currently pending tasks and executes the corresponding callbacks. |
| [$verifyNoPendingTasks](ngmock/service/%24verifynopendingtasks) | Verifies that there are no pending tasks that need to be flushed. It throws an error if there are still pending tasks. |
| [$exceptionHandler](ngmock/service/%24exceptionhandler) | Mock implementation of [`$exceptionHandler`](ng/service/%24exceptionhandler) that rethrows or logs errors passed to it. See [$exceptionHandlerProvider](ngmock/provider/%24exceptionhandlerprovider) for configuration information. |
| [$log](ngmock/service/%24log) | Mock implementation of [`$log`](ng/service/%24log) that gathers all logged messages in arrays (one array per logging level). These arrays are exposed as `logs` property of each of the level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`. |
| [$interval](ngmock/service/%24interval) | Mock implementation of the $interval service. |
| [$animate](ngmock/service/%24animate) | Mock implementation of the [`$animate`](ng/service/%24animate) service. Exposes two additional methods for testing animations. |
| [$httpBackend](ngmock/service/%24httpbackend) | Fake HTTP backend implementation suitable for unit testing applications that use the [$http service](ng/service/%24http). |
| [$timeout](ngmock/service/%24timeout) | This service is just a simple decorator for [$timeout](ng/service/%24timeout) service that adds a "flush" and "verifyNoPendingTasks" methods. |
| [$controller](ngmock/service/%24controller) | A decorator for [`$controller`](ng/service/%24controller) with additional `bindings` parameter, useful when testing controllers of directives that use [`bindToController`](ng/service/%24compile#-bindtocontroller-.html). |
| [$componentController](ngmock/service/%24componentcontroller) | A service that can be used to create instances of component controllers. Useful for unit-testing. |
### Provider
| Name | Description |
| --- | --- |
| [$exceptionHandlerProvider](ngmock/provider/%24exceptionhandlerprovider) | Configures the mock implementation of [`$exceptionHandler`](ng/service/%24exceptionhandler) to rethrow or to log errors passed to the `$exceptionHandler`. |
### Type
| Name | Description |
| --- | --- |
| [angular.mock.TzDate](ngmock/type/angular.mock.tzdate) | *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`. |
| [$rootScope.Scope](ngmock/type/%24rootscope.scope) | [Scope](ng/type/%24rootscope.scope) type decorated with helper methods useful for testing. These methods are automatically available on any [Scope](ng/type/%24rootscope.scope) instance when `ngMock` module is loaded. |
### Function
| Name | Description |
| --- | --- |
| [angular.mock.dump](ngmock/function/angular.mock.dump) | *NOTE*: This is not an injectable instance, just a globally available function. |
| [angular.mock.module](ngmock/function/angular.mock.module) | *NOTE*: This function is also published on window for easy access. *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha |
| [angular.mock.module.sharedInjector](ngmock/function/angular.mock.module.sharedinjector) | *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha |
| [angular.mock.inject](ngmock/function/angular.mock.inject) | *NOTE*: This function is also published on window for easy access. *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha |
| [browserTrigger](ngmock/function/browsertrigger) | This is a global (window) function that is only available when the [`ngMock`](ngmock) module is included. |
angularjs
Improve this Doc ngResource
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngResource/resource.js?message=docs(ngResource)%3A%20describe%20your%20change...#L46) ngResource
==========================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-resource.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-resource#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-resource.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-resource.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-resource.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngResource']);
```
With that you're ready to get started!
The `ngResource` module provides interaction support with RESTful services via the $resource service.
See [`$resourceProvider`](ngresource/provider/%24resourceprovider) and [`$resource`](ngresource/service/%24resource) for usage.
Module Components
-----------------
### Provider
| Name | Description |
| --- | --- |
| [$resourceProvider](ngresource/provider/%24resourceprovider) | Use `$resourceProvider` to change the default behavior of the [`$resource`](ngresource/service/%24resource) service. |
### Service
| Name | Description |
| --- | --- |
| [$resource](ngresource/service/%24resource) | A factory which creates a resource object that lets you interact with [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources. |
angularjs
Improve this Doc ngMockE2E
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(ngMockE2E)%3A%20describe%20your%20change...#L2620) ngMockE2E
===========================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-mocks#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-mocks.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-mocks.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-mocks.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngMockE2E']);
```
With that you're ready to get started!
The `ngMockE2E` is an AngularJS module which contains mocks suitable for end-to-end testing. Currently there is only one mock present in this module - the [e2e $httpBackend](ngmocke2e/service/%24httpbackend) mock.
Module Components
-----------------
### Service
| Name | Description |
| --- | --- |
| [$httpBackend](ngmocke2e/service/%24httpbackend) | Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of applications that use the [$http service](ng/service/%24http). |
angularjs
Improve this Doc ngMessages
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessages/messages.js?message=docs(ngMessages)%3A%20describe%20your%20change...#L8) ngMessages
=========================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-messages.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-messages#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-messages.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-messages.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-messages.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngMessages']);
```
With that you're ready to get started!
The `ngMessages` module provides enhanced support for displaying messages within templates (typically within forms or when rendering message objects that return key/value data). Instead of relying on JavaScript code and/or complex ng-if statements within your form template to show and hide error messages specific to the state of an input field, the `ngMessages` and `ngMessage` directives are designed to handle the complexity, inheritance and priority sequencing based on the order of how the messages are defined in the template.
Currently, the ngMessages module only contains the code for the `ngMessages`, `ngMessagesInclude` `ngMessage`, `ngMessageExp` and `ngMessageDefault` directives.
Usage
-----
The `ngMessages` directive allows keys in a key/value collection to be associated with a child element (or 'message') that will show or hide based on the truthiness of that key's value in the collection. A common use case for `ngMessages` is to display error messages for inputs using the `$error` object exposed by the [ngModel](ng/directive/ngmodel) directive.
The child elements of the `ngMessages` directive are matched to the collection keys by a `ngMessage` or `ngMessageExp` directive. The value of these attributes must match a key in the collection that is provided by the `ngMessages` directive.
Consider the following example, which illustrates a typical use case of `ngMessages`. Within the form `myForm` we have a text input named `myField` which is bound to the scope variable `field` using the [ngModel](ng/directive/ngmodel) directive.
The `myField` field is a required input of type `email` with a maximum length of 15 characters.
```
<form name="myForm">
<label>
Enter text:
<input type="email" ng-model="field" name="myField" required maxlength="15" />
</label>
<div ng-messages="myForm.myField.$error" role="alert">
<div ng-message="required">Please enter a value for this field.</div>
<div ng-message="email">This field must be a valid email address.</div>
<div ng-message="maxlength">This field can be at most 15 characters long.</div>
</div>
</form>
```
In order to show error messages corresponding to `myField` we first create an element with an `ngMessages` attribute set to the `$error` object owned by the `myField` input in our `myForm` form.
Within this element we then create separate elements for each of the possible errors that `myField` could have. The `ngMessage` attribute is used to declare which element(s) will appear for which error - for example, setting `ng-message="required"` specifies that this particular element should be displayed when there is no value present for the required field `myField` (because the key `required` will be `true` in the object `myForm.myField.$error`).
### Message order
By default, `ngMessages` will only display one message for a particular key/value collection at any time. If more than one message (or error) key is currently true, then which message is shown is determined by the order of messages in the HTML template code (messages declared first are prioritised). This mechanism means the developer does not have to prioritize messages using custom JavaScript code.
Given the following error object for our example (which informs us that the field `myField` currently has both the `required` and `email` errors):
```
<!-- keep in mind that ngModel automatically sets these error flags -->
myField.$error = { required : true, email: true, maxlength: false };
```
The `required` message will be displayed to the user since it appears before the `email` message in the DOM. Once the user types a single character, the `required` message will disappear (since the field now has a value) but the `email` message will be visible because it is still applicable.
### Displaying multiple messages at the same time
While `ngMessages` will by default only display one error element at a time, the `ng-messages-multiple` attribute can be applied to the `ngMessages` container element to cause it to display all applicable error messages at once:
```
<!-- attribute-style usage -->
<div ng-messages="myForm.myField.$error" ng-messages-multiple>...</div>
<!-- element-style usage -->
<ng-messages for="myForm.myField.$error" multiple>...</ng-messages>
```
Reusing and Overriding Messages
-------------------------------
In addition to prioritization, ngMessages also allows for including messages from a remote or an inline template. This allows for generic collection of messages to be reused across multiple parts of an application.
```
<script type="text/ng-template" id="error-messages">
<div ng-message="required">This field is required</div>
<div ng-message="minlength">This field is too short</div>
</script>
<div ng-messages="myForm.myField.$error" role="alert">
<div ng-messages-include="error-messages"></div>
</div>
```
However, including generic messages may not be useful enough to match all input fields, therefore, `ngMessages` provides the ability to override messages defined in the remote template by redefining them within the directive container.
```
<!-- a generic template of error messages known as "my-custom-messages" -->
<script type="text/ng-template" id="my-custom-messages">
<div ng-message="required">This field is required</div>
<div ng-message="minlength">This field is too short</div>
</script>
<form name="myForm">
<label>
Email address
<input type="email"
id="email"
name="myEmail"
ng-model="email"
minlength="5"
required />
</label>
<!-- any ng-message elements that appear BEFORE the ng-messages-include will
override the messages present in the ng-messages-include template -->
<div ng-messages="myForm.myEmail.$error" role="alert">
<!-- this required message has overridden the template message -->
<div ng-message="required">You did not enter your email address</div>
<!-- this is a brand new message and will appear last in the prioritization -->
<div ng-message="email">Your email address is invalid</div>
<!-- and here are the generic error messages -->
<div ng-messages-include="my-custom-messages"></div>
</div>
</form>
```
In the example HTML code above the message that is set on required will override the corresponding required message defined within the remote template. Therefore, with particular input fields (such email addresses, date fields, autocomplete inputs, etc...), specialized error messages can be applied while more generic messages can be used to handle other, more general input errors.
Dynamic Messaging
-----------------
ngMessages also supports using expressions to dynamically change key values. Using arrays and repeaters to list messages is also supported. This means that the code below will be able to fully adapt itself and display the appropriate message when any of the expression data changes:
```
<form name="myForm">
<label>
Email address
<input type="email"
name="myEmail"
ng-model="email"
minlength="5"
required />
</label>
<div ng-messages="myForm.myEmail.$error" role="alert">
<div ng-message="required">You did not enter your email address</div>
<div ng-repeat="errorMessage in errorMessages">
<!-- use ng-message-exp for a message whose key is given by an expression -->
<div ng-message-exp="errorMessage.type">{{ errorMessage.text }}</div>
</div>
</div>
</form>
```
The `errorMessage.type` expression can be a string value or it can be an array so that multiple errors can be associated with a single error message:
```
<label>
Email address
<input type="email"
ng-model="data.email"
name="myEmail"
ng-minlength="5"
ng-maxlength="100"
required />
</label>
<div ng-messages="myForm.myEmail.$error" role="alert">
<div ng-message-exp="'required'">You did not enter your email address</div>
<div ng-message-exp="['minlength', 'maxlength']">
Your email must be between 5 and 100 characters long
</div>
</div>
```
Feel free to use other structural directives such as ng-if and ng-switch to further control what messages are active and when. Be careful, if you place ng-message on the same element as these structural directives, AngularJS may not be able to determine if a message is active or not. Therefore it is best to place the ng-message on a child element of the structural directive.
```
<div ng-messages="myForm.myEmail.$error" role="alert">
<div ng-if="showRequiredError">
<div ng-message="required">Please enter something</div>
</div>
</div>
```
Animations
----------
If the `ngAnimate` module is active within the application then the `ngMessages`, `ngMessage` and `ngMessageExp` directives will trigger animations whenever any messages are added and removed from the DOM by the `ngMessages` directive.
Whenever the `ngMessages` directive contains one or more visible messages then the `.ng-active` CSS class will be added to the element. The `.ng-inactive` CSS class will be applied when there are no messages present. Therefore, CSS transitions and keyframes as well as JavaScript animations can hook into the animations whenever these classes are added/removed.
Let's say that our HTML code for our messages container looks like so:
```
<div ng-messages="myMessages" class="my-messages" role="alert">
<div ng-message="alert" class="some-message">...</div>
<div ng-message="fail" class="some-message">...</div>
</div>
```
Then the CSS animation code for the message container looks like so:
```
.my-messages {
transition:1s linear all;
}
.my-messages.ng-active {
// messages are visible
}
.my-messages.ng-inactive {
// messages are hidden
}
```
Whenever an inner message is attached (becomes visible) or removed (becomes hidden) then the enter and leave animation is triggered for each particular element bound to the `ngMessage` directive.
Therefore, the CSS code for the inner messages looks like so:
```
.some-message {
transition:1s linear all;
}
.some-message.ng-enter {}
.some-message.ng-enter.ng-enter-active {}
.some-message.ng-leave {}
.some-message.ng-leave.ng-leave-active {}
```
[See the ngAnimate docs](nganimate) to learn how to use JavaScript animations or to learn more about ngAnimate.
Displaying a default message
----------------------------
If the ngMessages renders no inner ngMessage directive (i.e. when none of the truthy keys are matched by a defined message), then it will render a default message using the [`ngMessageDefault`](ngmessages/directive/ngmessagedefault) directive. Note that matched messages will always take precedence over unmatched messages. That means the default message will not be displayed when another message is matched. This is also true for `ng-messages-multiple`.
```
<div ng-messages="myForm.myField.$error" role="alert">
<div ng-message="required">This field is required</div>
<div ng-message="minlength">This field is too short</div>
<div ng-message-default>This field has an input error</div>
</div>
```
Module Components
-----------------
### Directive
| Name | Description |
| --- | --- |
| [ngMessages](ngmessages/directive/ngmessages) | `ngMessages` is a directive that is designed to show and hide messages based on the state of a key/value object that it listens on. The directive itself complements error message reporting with the `ngModel` $error object (which stores a key/value state of validation errors). |
| [ngMessagesInclude](ngmessages/directive/ngmessagesinclude) | `ngMessagesInclude` is a directive with the purpose to import existing ngMessage template code from a remote template and place the downloaded template code into the exact spot that the ngMessagesInclude directive is placed within the ngMessages container. This allows for a series of pre-defined messages to be reused and also allows for the developer to determine what messages are overridden due to the placement of the ngMessagesInclude directive. |
| [ngMessage](ngmessages/directive/ngmessage) | `ngMessage` is a directive with the purpose to show and hide a particular message. For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element must be situated since it determines which messages are visible based on the state of the provided key/value map that `ngMessages` listens on. |
| [ngMessageExp](ngmessages/directive/ngmessageexp) | `ngMessageExp` is the same as [`ngMessage`](ngmessages/directive/ngmessage), but instead of a static value, it accepts an expression to be evaluated for the message key. |
| [ngMessageDefault](ngmessages/directive/ngmessagedefault) | `ngMessageDefault` is a directive with the purpose to show and hide a default message for [`ngMessages`](ngmessages/directive/ngmessages), when none of provided messages matches. |
| programming_docs |
angularjs
Improve this Doc ngAnimate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAnimate/module.js?message=docs(ngAnimate)%3A%20describe%20your%20change...#L3) ngAnimate
====================================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-animate.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-animate#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-animate.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-animate.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-animate.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngAnimate']);
```
With that you're ready to get started!
The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an AngularJS app.
Usage
-----
Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within the HTML element that the animation will be triggered on.
Directive Support
-----------------
The following directives are "animation aware":
| Directive | Supported Animations |
| --- | --- |
| [form / ngForm](ng/directive/form#animations.html) | add and remove ([various classes](ng/directive/form#css-classes.html)) |
| [ngAnimateSwap](nganimate/directive/nganimateswap#animations.html) | enter and leave |
| [ngClass / {{class}}](ng/directive/ngclass#animations.html) | add and remove |
| [ngClassEven](ng/directive/ngclasseven#animations.html) | add and remove |
| [ngClassOdd](ng/directive/ngclassodd#animations.html) | add and remove |
| [ngHide](ng/directive/nghide#animations.html) | add and remove (the `ng-hide` class) |
| [ngIf](ng/directive/ngif#animations.html) | enter and leave |
| [ngInclude](ng/directive/nginclude#animations.html) | enter and leave |
| [ngMessage / ngMessageExp](ngmessages#animations.html) | enter and leave |
| [ngMessages](ngmessages#animations.html) | add and remove (the `ng-active`/`ng-inactive` classes) |
| [ngModel](ng/directive/ngmodel#animations.html) | add and remove ([various classes](ng/directive/ngmodel#css-classes.html)) |
| [ngRepeat](ng/directive/ngrepeat#animations.html) | enter, leave, and move |
| [ngShow](ng/directive/ngshow#animations.html) | add and remove (the `ng-hide` class) |
| [ngSwitch](ng/directive/ngswitch#animations.html) | enter and leave |
| [ngView](ngroute/directive/ngview#animations.html) | enter and leave |
(More information can be found by visiting the documentation associated with each directive.)
For a full breakdown of the steps involved during each animation event, refer to the [`$animate` API docs](ng/service/%24animate).
CSS-based Animations
--------------------
CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML and CSS code we can create an animation that will be picked up by AngularJS when an underlying directive performs an operation.
The example below shows how an `enter` animation can be made possible on an element using `ng-if`:
```
<div ng-if="bool" class="fade">
Fade me in out
</div>
<button ng-click="bool=true">Fade In!</button>
<button ng-click="bool=false">Fade Out!</button>
```
Notice the CSS class **fade**? We can now create the CSS transition code that references this class:
```
/* The starting CSS styles for the enter animation */
.fade.ng-enter {
transition:0.5s linear all;
opacity:0;
}
/* The finishing CSS styles for the enter animation */
.fade.ng-enter.ng-enter-active {
opacity:1;
}
```
The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.
If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:
```
/* now the element will fade out before it is removed from the DOM */
.fade.ng-leave {
transition:0.5s linear all;
opacity:1;
}
.fade.ng-leave.ng-leave-active {
opacity:0;
}
```
We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:
```
/* there is no need to define anything inside of the destination
CSS class since the keyframe will take charge of the animation */
.fade.ng-leave {
animation: my_fade_animation 0.5s linear;
-webkit-animation: my_fade_animation 0.5s linear;
}
@keyframes my_fade_animation {
from { opacity:1; }
to { opacity:0; }
}
@-webkit-keyframes my_fade_animation {
from { opacity:1; }
to { opacity:0; }
}
```
Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.
### CSS Class-based Animations
Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added and removed.
For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:
```
<div ng-show="bool" class="fade">
Show and hide me
</div>
<button ng-click="bool=!bool">Toggle</button>
<style>
.fade.ng-hide {
transition:0.5s linear all;
opacity:0;
}
</style>
```
All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.
In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation with CSS styles.
```
<div ng-class="{on:onOff}" class="highlight">
Highlight this box
</div>
<button ng-click="onOff=!onOff">Toggle</button>
<style>
.highlight {
transition:0.5s linear all;
}
.highlight.on-add {
background:white;
}
.highlight.on {
background:yellow;
}
.highlight.on-remove {
background:black;
}
</style>
```
We can also make use of CSS keyframes by placing them within the CSS classes.
### CSS Staggering Animations
A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for the animation. The style property expected within the stagger class can either be a **transition-delay** or an **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
```
.my-animation.ng-enter {
/* standard transition code */
transition: 1s linear all;
opacity:0;
}
.my-animation.ng-enter-stagger {
/* this will have a 100ms delay between each successive leave animation */
transition-delay: 0.1s;
/* As of 1.4.4, this must always be set: it signals ngAnimate
to not accidentally inherit a delay property from another CSS class */
transition-duration: 0s;
/* if you are using animations instead of transitions you should configure as follows:
animation-delay: 0.1s;
animation-duration: 0s; */
}
.my-animation.ng-enter.ng-enter-active {
/* standard transition styles */
opacity:1;
}
```
Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.
The following code will issue the **ng-leave-stagger** event on the element provided:
```
var kids = parent.children();
$animate.leave(kids[0]); //stagger index=0
$animate.leave(kids[1]); //stagger index=1
$animate.leave(kids[2]); //stagger index=2
$animate.leave(kids[3]); //stagger index=3
$animate.leave(kids[4]); //stagger index=4
window.requestAnimationFrame(function() {
//stagger has reset itself
$animate.leave(kids[5]); //stagger index=0
$animate.leave(kids[6]); //stagger index=1
$scope.$digest();
});
```
Stagger animations are currently only supported within CSS-defined animations.
### The ng-animate CSS class
When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).
Therefore, animations can be applied to an element using this temporary class directly via CSS.
```
.zipper.ng-animate {
transition:0.5s linear all;
}
.zipper.ng-enter {
opacity:0;
}
.zipper.ng-enter.ng-enter-active {
opacity:1;
}
.zipper.ng-leave {
opacity:1;
}
.zipper.ng-leave.ng-leave-active {
opacity:0;
}
```
(Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove the CSS class once an animation has completed.)
### The ng-[event]-prepare class
This is a special class that can be used to prevent unwanted flickering / flash of content before the actual animation starts. The class is added as soon as an animation is initialized, but removed before the actual animation starts (after waiting for a $digest). It is also only added for *structural* animations (`enter`, `move`, and `leave`).
In practice, flickering can appear when nesting elements with structural animations such as `ngIf` into elements that have class-based animations such as `ngClass`.
```
<div ng-class="{red: myProp}">
<div ng-class="{blue: myProp}">
<div class="message" ng-if="myProp"></div>
</div>
</div>
```
It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating. In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:
```
.message.ng-enter-prepare {
opacity: 0;
}
```
### Animating between value changes
Sometimes you need to animate between different expression states, whose values don't necessary need to be known or referenced in CSS styles. Unless possible with another ["animation aware" directive](nganimate#directive-support.html), that specific use case can always be covered with [`ngAnimateSwap`](nganimate/directive/nganimateswap) as can be seen in [this example](nganimate/directive/nganimateswap#examples.html).
Note that [`ngAnimateSwap`](nganimate/directive/nganimateswap) is a *structural directive*, which means it creates a new instance of the element (including any other/child directives it may have) and links it to a new scope every time *swap* happens. In some cases this might not be desirable (e.g. for performance reasons, or when you wish to retain internal state on the original element instance).
JavaScript-based Animations
---------------------------
ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the `module.animation()` module function we can register the animation.
Let's see an example of a enter/leave animation using `ngRepeat`:
```
<div ng-repeat="item in items" class="slide">
{{ item }}
</div>
```
See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:
```
myModule.animation('.slide', [function() {
return {
// make note that other events (like addClass/removeClass)
// have different function input parameters
enter: function(element, doneFn) {
jQuery(element).fadeIn(1000, doneFn);
// remember to call doneFn so that AngularJS
// knows that the animation has concluded
},
move: function(element, doneFn) {
jQuery(element).fadeIn(1000, doneFn);
},
leave: function(element, doneFn) {
jQuery(element).fadeOut(1000, doneFn);
}
}
}]);
```
The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as greensock.js and velocity.js.
If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define our animations inside of the same registered animation, however, the function input arguments are a bit different:
```
<div ng-class="color" class="colorful">
this box is moody
</div>
<button ng-click="color='red'">Change to red</button>
<button ng-click="color='blue'">Change to blue</button>
<button ng-click="color='green'">Change to green</button>
```
```
myModule.animation('.colorful', [function() {
return {
addClass: function(element, className, doneFn) {
// do some cool animation and call the doneFn
},
removeClass: function(element, className, doneFn) {
// do some cool animation and call the doneFn
},
setClass: function(element, addedClass, removedClass, doneFn) {
// do some cool animation and call the doneFn
}
}
}]);
```
CSS + JS Animations Together
----------------------------
AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of AngularJS, defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking charge of the animation**:
```
<div ng-if="bool" class="slide">
Slide in and out
</div>
```
```
myModule.animation('.slide', [function() {
return {
enter: function(element, doneFn) {
jQuery(element).slideIn(1000, doneFn);
}
}
}]);
```
```
.slide.ng-enter {
transition:0.5s linear all;
transform:translateY(-100px);
}
.slide.ng-enter.ng-enter-active {
transform:translateY(0);
}
```
Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from our own JS-based animation code:
```
myModule.animation('.slide', ['$animateCss', function($animateCss) {
return {
enter: function(element) {
// this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.
return $animateCss(element, {
event: 'enter',
structural: true
});
}
}
}]);
```
The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.
The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that data into `$animateCss` directly:
```
myModule.animation('.slide', ['$animateCss', function($animateCss) {
return {
enter: function(element) {
return $animateCss(element, {
event: 'enter',
structural: true,
addClass: 'maroon-setting',
from: { height:0 },
to: { height: 200 }
});
}
}
}]);
```
Now we can fill in the rest via our transition CSS code:
```
/* the transition tells ngAnimate to make the animation happen */
.slide.ng-enter { transition:0.5s linear all; }
/* this extra CSS class will be absorbed into the transition
since the $animateCss code is adding the class */
.maroon-setting { background:red; }
```
And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.
To learn more about what's possible be sure to visit the [$animateCss service](nganimate/service/%24animatecss).
Animation Anchoring (via ng-animate-ref)
----------------------------------------
ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between structural areas of an application (like views) by pairing up elements using an attribute called `ng-animate-ref`.
Let's say for example we have two views that are managed by `ng-view` and we want to show that there is a relationship between two components situated in within these views. By using the `ng-animate-ref` attribute we can identify that the two components are paired together and we can then attach an animation, which is triggered when the view changes.
Say for example we have the following template code:
```
<!-- index.html -->
<div ng-view class="view-animation">
</div>
<!-- home.html -->
<a href="#/banner-page">
<img src="./banner.jpg" class="banner" ng-animate-ref="banner">
</a>
<!-- banner-page.html -->
<img src="./banner.jpg" class="banner" ng-animate-ref="banner">
```
Now, when the view changes (once the link is clicked), ngAnimate will examine the HTML contents to see if there is a match reference between any components in the view that is leaving and the view that is entering. It will scan both the view which is being removed (leave) and inserted (enter) to see if there are any paired DOM elements that contain a matching ref value.
The two images match since they share the same ref value. ngAnimate will now create a transport element (which is a clone of the first image element) and it will then attempt to animate to the position of the second image element in the next view. For the animation to work a special CSS class called `ng-anchor` will be added to the transported element.
We can now attach a transition onto the `.banner.ng-anchor` CSS class and then ngAnimate will handle the entire transition for us as well as the addition and removal of any changes of CSS classes between the elements:
```
.banner.ng-anchor {
/* this animation will last for 1 second since there are
two phases to the animation (an `in` and an `out` phase) */
transition:0.5s linear all;
}
```
We also **must** include animations for the views that are being entered and removed (otherwise anchoring wouldn't be possible since the new view would be inserted right away).
```
.view-animation.ng-enter, .view-animation.ng-leave {
transition:0.5s linear all;
position:fixed;
left:0;
top:0;
width:100%;
}
.view-animation.ng-enter {
transform:translateX(100%);
}
.view-animation.ng-leave,
.view-animation.ng-enter.ng-enter-active {
transform:translateX(0%);
}
.view-animation.ng-leave.ng-leave-active {
transform:translateX(-100%);
}
```
Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away from its origin. Once that animation is over then the `in` stage occurs which animates the element to its destination. The reason why there are two animations is to give enough time for the enter animation on the new element to be ready.
The example above sets up a transition for both the in and out phases, but we can also target the out or in phases directly via `ng-anchor-out` and `ng-anchor-in`.
```
.banner.ng-anchor-out {
transition: 0.5s linear all;
/* the scale will be applied during the out animation,
but will be animated away when the in animation runs */
transform: scale(1.2);
}
.banner.ng-anchor-in {
transition: 1s linear all;
}
```
### Anchoring Demo
### How is the element transported?
When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting element is located on screen via absolute positioning. The cloned element will be placed inside of the root element of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element will become visible since the shim class will be removed.
### How is the morphing handled?
CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out what CSS classes differ between the starting element and the destination element. These different CSS classes will be added/removed on the anchor element and a transition will be applied (the transition that is provided in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since the cloned element is placed inside of root element which is likely close to the body element).
Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.
Using $animate in your directive code
-------------------------------------
So far we've explored how to feed in animations into an AngularJS application, but how do we trigger animations within our own directives in our application? By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's imagine we have a greeting box that shows and hides itself when the data changes
```
<greeting-box active="onOrOff">Hi there</greeting-box>
```
```
ngModule.directive('greetingBox', ['$animate', function($animate) {
return function(scope, element, attrs) {
attrs.$observe('active', function(value) {
value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');
});
});
}]);
```
Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element in our HTML code then we can trigger a CSS or JS animation to happen.
```
/* normally we would create a CSS class to reference on the element */
greeting-box.on { transition:0.5s linear all; background:green; color:white; }
```
The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's possible be sure to visit the [$animate service API page](ng/service/%24animate).
Callbacks and Promises
----------------------
When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has ended by chaining onto the returned promise that animation method returns.
```
// somewhere within the depths of the directive
$animate.enter(element, parent).then(function() {
//the animation has completed
});
```
(Note that earlier versions of AngularJS prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case anymore.)
In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view routing controller to hook into that:
```
ngModule.controller('HomePageController', ['$animate', function($animate) {
$animate.on('enter', ngViewElement, function(element) {
// the animation for this route has completed
}]);
}])
```
(Note that you will need to trigger a digest within the callback to get AngularJS to notice any scope-related changes.)
Module Components
-----------------
### Directive
| Name | Description |
| --- | --- |
| [ngAnimateChildren](nganimate/directive/nganimatechildren) | ngAnimateChildren allows you to specify that children of this element should animate even if any of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` (structural) animation, child elements that also have an active structural animation are not animated. |
| [ngAnimateSwap](nganimate/directive/nganimateswap) | ngAnimateSwap is a animation-oriented directive that allows for the container to be removed and entered in whenever the associated expression changes. A common usecase for this directive is a rotating banner or slider component which contains one image being present at a time. When the active image changes then the old image will perform a `leave` animation and the new element will be inserted via an `enter` animation. |
### Service
| Name | Description |
| --- | --- |
| [$animateCss](nganimate/service/%24animatecss) | The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or directives to create more complex animations that can be purely driven using CSS code. |
| [$animate](nganimate/service/%24animate) | The ngAnimate `$animate` service documentation is the same for the core `$animate` service. |
| programming_docs |
angularjs
Improve this Doc ngRoute
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngRoute/route.js?message=docs(ngRoute)%3A%20describe%20your%20change...#L13) ngRoute
==============================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-route.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-route#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-route.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-route.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-route.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngRoute']);
```
With that you're ready to get started!
The `ngRoute` module provides routing and deeplinking services and directives for AngularJS apps.
See [$route](ngroute/service/%24route#examples.html) for an example of configuring and using `ngRoute`.
Module Components
-----------------
### Directive
| Name | Description |
| --- | --- |
| [ngView](ngroute/directive/ngview) | `ngView` is a directive that complements the [$route](ngroute/service/%24route) service by including the rendered template of the current route into the main layout (`index.html`) file. Every time the current route changes, the included view changes with it according to the configuration of the `$route` service. |
### Provider
| Name | Description |
| --- | --- |
| [$routeProvider](ngroute/provider/%24routeprovider) | Used for configuring routes. |
### Service
| Name | Description |
| --- | --- |
| [$route](ngroute/service/%24route) | `$route` is used for deep-linking URLs to controllers and views (HTML partials). It watches `$location.url()` and tries to map the path to an existing route definition. |
| [$routeParams](ngroute/service/%24routeparams) | The `$routeParams` service allows you to retrieve the current set of route parameters. |
angularjs
Improve this Doc ngComponentRouter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(ngComponentRouter)%3A%20describe%20your%20change...#L1) ngComponentRouter
============================================================================================================================================================================================
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Installation
------------
Currently, the **Component Router** module must be installed via `npm`/`yarn`, it is not available on Bower or the Google CDN.
```
yarn add @angular/[email protected]
```
Include `angular_1_router.js` in your HTML:
```
<script src="/node_modules/@angular/router/angular1/angular_1_router.js"></script>
```
You also need to include ES6 shims for browsers that do not support ES6 code (Internet Explorer, iOs < 8, Android < 5.0, Windows Mobile < 10):
```
<!-- IE required polyfills, in this exact order -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.20/system-polyfills.js"></script>
<script src="https://unpkg.com/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
```
Then load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngComponentRouter']);
```
Module Components
-----------------
### Type
| Name | Description |
| --- | --- |
| [Router](ngcomponentrouter/type/router) | A `Router` is responsible for mapping URLs to components. |
| [ChildRouter](ngcomponentrouter/type/childrouter) | This type extends the [`Router`](ngcomponentrouter/type/router). |
| [RootRouter](ngcomponentrouter/type/rootrouter) | This type extends the [`Router`](ngcomponentrouter/type/router). |
| [ComponentInstruction](ngcomponentrouter/type/componentinstruction) | A `ComponentInstruction` represents the route state for a single component. An `Instruction` is composed of a tree of these `ComponentInstruction`s. |
| [RouteDefinition](ngcomponentrouter/type/routedefinition) | Each item in the **RouteConfig** for a **Routing Component** is an instance of this type. It can have the following properties: |
| [RouteParams](ngcomponentrouter/type/routeparams) | A map of parameters for a given route, passed as part of the [`ComponentInstruction`](ngcomponentrouter/type/componentinstruction) to the Lifecycle Hooks, such as `$routerOnActivate` and `$routerOnDeactivate`. |
### Directive
| Name | Description |
| --- | --- |
| [ngOutlet](ngcomponentrouter/directive/ngoutlet) | The directive that identifies where the [`Router`](ngcomponentrouter/type/router) should render its **Components**. |
### Service
| Name | Description |
| --- | --- |
| [$rootRouter](ngcomponentrouter/service/%24rootrouter) | The singleton instance of the [`RootRouter`](ngcomponentrouter/type/rootrouter) type, which is associated with the top level [`$routerRootComponent`](ngcomponentrouter/service/%24routerrootcomponent). |
| [$routerRootComponent](ngcomponentrouter/service/%24routerrootcomponent) | The top level **Routing Component** associated with the [`$rootRouter`](ngcomponentrouter/service/%24rootrouter). |
angularjs
Improve this Doc ngAria
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAria/aria.js?message=docs(ngAria)%3A%20describe%20your%20change...#L3) ngAria
=========================================================================================================================================================
Installation
------------
First, get the file:
* [Google CDN](https://developers.google.com/speed/libraries/devguide#angularjs) e.g.
```
"//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-aria.js"
```
* [NPM](https://www.npmjs.com/) e.g.
```
npm install --save [email protected]
```
or
```
yarn add [email protected]
```
* [Bower](http://bower.io) e.g.
```
bower install angular-aria#X.Y.Z
```
* [code.angularjs.org](https://code.angularjs.org/) (discouraged for production use) e.g.
```
"//code.angularjs.org/X.Y.Z/angular-aria.js"
```
where X.Y.Z is the AngularJS version you are running.
Then, include `angular-aria.js` in your HTML:
```
<script src="path/to/angular.js"></script>
<script src="path/to/angular-aria.js"></script>
```
Finally, load the module in your application by adding it as a dependent module:
```
angular.module('app', ['ngAria']);
```
With that you're ready to get started!
The `ngAria` module provides support for common [ARIA](http://www.w3.org/TR/wai-aria/) attributes that convey state or semantic information about the application for users of assistive technologies, such as screen readers.
Usage
-----
For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following directives are supported: `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`, `ngDblClick`, and `ngMessages`.
Below is a more detailed breakdown of the attributes handled by ngAria:
| Directive | Supported Attributes |
| --- | --- |
| [ngModel](ng/directive/ngmodel) | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
| [ngDisabled](ng/directive/ngdisabled) | aria-disabled |
| [ngRequired](ng/directive/ngrequired) | aria-required |
| [ngChecked](ng/directive/ngchecked) | aria-checked |
| [ngReadonly](ng/directive/ngreadonly) | aria-readonly |
| [ngValue](ng/directive/ngvalue) | aria-checked |
| [ngShow](ng/directive/ngshow) | aria-hidden |
| [ngHide](ng/directive/nghide) | aria-hidden |
| [ngDblclick](ng/directive/ngdblclick) | tabindex |
| [ngMessages](ngmessages) | aria-live |
| [ngClick](ng/directive/ngclick) | tabindex, keydown event, button role |
Find out more information about each directive by reading the [ngAria Developer Guide](../guide/accessibility).
Using ngDisabled with ngAria:
```
<md-checkbox ng-disabled="disabled">
```
Becomes:
```
<md-checkbox ng-disabled="disabled" aria-disabled="true">
```
Disabling Specific Attributes
-----------------------------
It is possible to disable individual attributes added by ngAria with the [config](ngaria/provider/%24ariaprovider#config.html) method. For more details, see the [Developer Guide](../guide/accessibility).
Disabling ngAria on Specific Elements
-------------------------------------
It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable` attribute on it. Note that only the element itself (and not its child elements) will be ignored.
Module Components
-----------------
### Provider
| Name | Description |
| --- | --- |
| [$ariaProvider](ngaria/provider/%24ariaprovider) | Used for configuring the ARIA attributes injected and managed by ngAria. |
### Service
| Name | Description |
| --- | --- |
| [$aria](ngaria/service/%24aria) | The $aria service contains helper methods for applying common [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. |
angularjs Provider components in ngAria Provider components in ngAria
=============================
| Name | Description |
| --- | --- |
| [$ariaProvider](provider/%24ariaprovider) | Used for configuring the ARIA attributes injected and managed by ngAria. |
angularjs Service components in ngAria Service components in ngAria
============================
| Name | Description |
| --- | --- |
| [$aria](service/%24aria) | The $aria service contains helper methods for applying common [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. |
angularjs
Improve this Doc View Source $ariaProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAria/aria.js?message=docs(%24ariaProvider)%3A%20describe%20your%20change...#L74) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngAria/aria.js#L74) $ariaProvider
==================================================================================================================================================================================================================================================================
1. [$aria](../service/%24aria)
2. provider in module [ngAria](../../ngaria)
Overview
--------
Used for configuring the ARIA attributes injected and managed by ngAria.
```
angular.module('myApp', ['ngAria'], function config($ariaProvider) {
$ariaProvider.config({
ariaValue: true,
tabindex: false
});
});
```
Dependencies
------------
Requires the [`ngAria`](../../ngaria) module to be installed.
Methods
-------
* ### config(config);
Enables/disables various ARIA attributes
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| config | `object` | object to enable/disable specific ARIA attributes
+ **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags
+ **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags
+ **ariaReadonly** – `{boolean}` – Enables/disables aria-readonly tags
+ **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
+ **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
+ **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
+ **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
+ **tabindex** – `{boolean}` – Enables/disables tabindex tags
+ **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive elements (such as `div` or `li`) using ng-click, making them more accessible to users of assistive technologies
+ **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as `div` or `li`) using ng-click, making them more accessible to users of assistive technologies |
angularjs
Improve this Doc View Source $aria
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAria/aria.js?message=docs(%24aria)%3A%20describe%20your%20change...#L153) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngAria/aria.js#L153) $aria
====================================================================================================================================================================================================================================================
1. [$ariaProvider](../provider/%24ariaprovider)
2. service in module [ngAria](../../ngaria)
Overview
--------
The $aria service contains helper methods for applying common [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, let's review a code snippet from ngAria itself:
```
ngAriaModule.directive('ngDisabled', ['$aria', function($aria) {
return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false);
}])
```
Shown above, the ngAria module creates a directive with the same signature as the traditional `ng-disabled` directive. But this ngAria version is dedicated to solely managing accessibility attributes on custom elements. The internal `$aria` service is used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the developer, `aria-disabled` is injected as an attribute with its value synchronized to the value in `ngDisabled`.
Because ngAria hooks into the `ng-disabled` directive, developers do not have to do anything to enable this feature. The `aria-disabled` attribute is automatically managed simply as a silent side-effect of using `ng-disabled` with the ngAria module.
The full list of directives that interface with ngAria:
* **ngModel**
* **ngChecked**
* **ngReadonly**
* **ngRequired**
* **ngDisabled**
* **ngValue**
* **ngShow**
* **ngHide**
* **ngClick**
* **ngDblclick**
* **ngMessages**
Read the [ngAria Developer Guide](../../../guide/accessibility) for a thorough explanation of each directive.
Dependencies
------------
Requires the [`ngAria`](../../ngaria) module to be installed.
angularjs Directive components in ngMessages Directive components in ngMessages
==================================
| Name | Description |
| --- | --- |
| [ngMessages](directive/ngmessages) | `ngMessages` is a directive that is designed to show and hide messages based on the state of a key/value object that it listens on. The directive itself complements error message reporting with the `ngModel` $error object (which stores a key/value state of validation errors). |
| [ngMessagesInclude](directive/ngmessagesinclude) | `ngMessagesInclude` is a directive with the purpose to import existing ngMessage template code from a remote template and place the downloaded template code into the exact spot that the ngMessagesInclude directive is placed within the ngMessages container. This allows for a series of pre-defined messages to be reused and also allows for the developer to determine what messages are overridden due to the placement of the ngMessagesInclude directive. |
| [ngMessage](directive/ngmessage) | `ngMessage` is a directive with the purpose to show and hide a particular message. For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element must be situated since it determines which messages are visible based on the state of the provided key/value map that `ngMessages` listens on. |
| [ngMessageExp](directive/ngmessageexp) | `ngMessageExp` is the same as [`ngMessage`](directive/ngmessage), but instead of a static value, it accepts an expression to be evaluated for the message key. |
| [ngMessageDefault](directive/ngmessagedefault) | `ngMessageDefault` is a directive with the purpose to show and hide a default message for [`ngMessages`](directive/ngmessages), when none of provided messages matches. |
angularjs
Improve this Doc View Source ngMessage
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessages/messages.js?message=docs(ngMessage)%3A%20describe%20your%20change...#L633) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMessages/messages.js#L633) ngMessage
==========================================================================================================================================================================================================================================================================
1. directive in module [ngMessages](../../ngmessages)
Overview
--------
`ngMessage` is a directive with the purpose to show and hide a particular message. For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element must be situated since it determines which messages are visible based on the state of the provided key/value map that `ngMessages` listens on.
More information about using `ngMessage` can be found in the [`ngMessages` module documentation](../../ngmessages).
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 1.
Usage
-----
```
<!-- using attribute directives -->
<ANY ng-messages="expression" role="alert">
<ANY ng-message="stringValue">...</ANY>
<ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
</ANY>
<!-- or by using element directives -->
<ng-messages for="expression" role="alert">
<ng-message when="stringValue">...</ng-message>
<ng-message when="stringValue1, stringValue2, ...">...</ng-message>
</ng-messages>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMessage | when | `expression` | a string value corresponding to the message key. |
angularjs
Improve this Doc View Source ngMessages
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessages/messages.js?message=docs(ngMessages)%3A%20describe%20your%20change...#L291) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMessages/messages.js#L291) ngMessages
============================================================================================================================================================================================================================================================================
1. directive in module [ngMessages](../../ngmessages)
Overview
--------
`ngMessages` is a directive that is designed to show and hide messages based on the state of a key/value object that it listens on. The directive itself complements error message reporting with the `ngModel` $error object (which stores a key/value state of validation errors).
`ngMessages` manages the state of internal messages within its container element. The internal messages use the `ngMessage` directive and will be inserted/removed from the page depending on if they're present within the key/value object. By default, only one message will be displayed at a time and this depends on the prioritization of the messages within the template. (This can be changed by using the `ng-messages-multiple` or `multiple` attribute on the directive container.)
A remote template can also be used (With [`ngMessagesInclude`](ngmessagesinclude)) to promote message reusability and messages can also be overridden.
A default message can also be displayed when no `ngMessage` directive is inserted, using the [`ngMessageDefault`](ngmessagedefault) directive.
[Click here](../../ngmessages) to learn more about `ngMessages` and `ngMessage`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<!-- using attribute directives -->
<ANY ng-messages="expression" role="alert">
<ANY ng-message="stringValue">...</ANY>
<ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
<ANY ng-message-exp="expressionValue">...</ANY>
<ANY ng-message-default>...</ANY>
</ANY>
<!-- or by using element directives -->
<ng-messages for="expression" role="alert">
<ng-message when="stringValue">...</ng-message>
<ng-message when="stringValue1, stringValue2, ...">...</ng-message>
<ng-message when-exp="expressionValue">...</ng-message>
<ng-message-default>...</ng-message-default>
</ng-messages>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMessages | `string` | an AngularJS expression evaluating to a key/value object (this is typically the $error object on an ngModel instance). |
| ngMessagesMultiple | multiple *(optional)* | `string` | when set, all messages will be displayed with true |
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source ngMessageDefault
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessages/messages.js?message=docs(ngMessageDefault)%3A%20describe%20your%20change...#L699) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMessages/messages.js#L699) ngMessageDefault
========================================================================================================================================================================================================================================================================================
1. directive in module [ngMessages](../../ngmessages)
Overview
--------
`ngMessageDefault` is a directive with the purpose to show and hide a default message for [`ngMessages`](ngmessages), when none of provided messages matches.
More information about using `ngMessageDefault` can be found in the [`ngMessages` module documentation](../../ngmessages).
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 0.
Usage
-----
```html
... ... ... ... ... ...
angularjs
Improve this Doc View Source ngMessagesInclude
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessages/messages.js?message=docs(ngMessagesInclude)%3A%20describe%20your%20change...#L564) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMessages/messages.js#L564) ngMessagesInclude
==========================================================================================================================================================================================================================================================================================
1. directive in module [ngMessages](../../ngmessages)
Overview
--------
`ngMessagesInclude` is a directive with the purpose to import existing ngMessage template code from a remote template and place the downloaded template code into the exact spot that the ngMessagesInclude directive is placed within the ngMessages container. This allows for a series of pre-defined messages to be reused and also allows for the developer to determine what messages are overridden due to the placement of the ngMessagesInclude directive.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 0.
Usage
-----
```
<!-- using attribute directives -->
<ANY ng-messages="expression" role="alert">
<ANY ng-messages-include="remoteTplString">...</ANY>
</ANY>
<!-- or by using element directives -->
<ng-messages for="expression" role="alert">
<ng-messages-include src="expressionValue1">...</ng-messages-include>
</ng-messages>
```
[Click here](../../ngmessages) to learn more about `ngMessages` and `ngMessage`.
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMessagesInclude | src | `string` | a string value corresponding to the remote template. |
angularjs
Improve this Doc View Source ngMessageExp
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMessages/messages.js?message=docs(ngMessageExp)%3A%20describe%20your%20change...#L669) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMessages/messages.js#L669) ngMessageExp
================================================================================================================================================================================================================================================================================
1. directive in module [ngMessages](../../ngmessages)
Overview
--------
`ngMessageExp` is the same as [`ngMessage`](ngmessage), but instead of a static value, it accepts an expression to be evaluated for the message key.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 1.
Usage
-----
```
<!-- using attribute directives -->
<ANY ng-messages="expression">
<ANY ng-message-exp="expressionValue">...</ANY>
</ANY>
<!-- or by using element directives -->
<ng-messages for="expression">
<ng-message when-exp="expressionValue">...</ng-message>
</ng-messages>
```
[Click here](../../ngmessages) to learn more about `ngMessages` and `ngMessage`.
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMessageExp | whenExp | `expression` | an expression value corresponding to the message key. |
angularjs Type components in ng Type components in ng
=====================
| Name | Description |
| --- | --- |
| [angular.Module](type/angular.module) | Interface for configuring AngularJS [modules](function/angular.module). |
| [$cacheFactory.Cache](type/%24cachefactory.cache) | A cache object used to store and retrieve data, primarily used by [$templateRequest](service/%24templaterequest) and the [script](directive/script) directive to cache templates and other data. |
| [$compile.directive.Attributes](type/%24compile.directive.attributes) | A shared object between directive compile / linking functions which contains normalized DOM element attributes. The values reflect current binding state `{{ }}`. The normalization is needed since all of these are treated as equivalent in AngularJS: |
| [form.FormController](type/form.formcontroller) | `FormController` keeps track of all its controls and nested forms as well as the state of them, such as being valid/invalid or dirty/pristine. |
| [ngModel.NgModelController](type/ngmodel.ngmodelcontroller) | `NgModelController` provides API for the [`ngModel`](directive/ngmodel) directive. The controller contains services for data-binding, validation, CSS updates, and value formatting and parsing. It purposefully does not contain any logic which deals with DOM rendering or listening to DOM events. Such DOM related logic should be provided by other directives which make use of `NgModelController` for data-binding to control elements. AngularJS provides this DOM logic for most [`input`](directive/input) elements. At the end of this page you can find a [custom control example](type/ngmodel.ngmodelcontroller#custom-control-example.html) that uses `ngModelController` to bind to `contenteditable` elements. |
| [ModelOptions](type/modeloptions) | A container for the options set by the [`ngModelOptions`](directive/ngmodeloptions) directive |
| [select.SelectController](type/select.selectcontroller) | The controller for the [select](directive/select) directive. The controller exposes a few utility methods that can be used to augment the behavior of a regular or an [ngOptions](directive/ngoptions) select element. |
| [$rootScope.Scope](type/%24rootscope.scope) | A root scope can be retrieved using the [$rootScope](service/%24rootscope) key from the [$injector](../auto/service/%24injector). Child scopes are created using the [$new()](type/%24rootscope.scope#%24new.html) method. (Most scopes are created automatically when compiled HTML template is executed.) See also the [Scopes guide](../../guide/scope) for an in-depth introduction and usage examples. |
angularjs Provider components in ng Provider components in ng
=========================
| Name | Description |
| --- | --- |
| [$anchorScrollProvider](provider/%24anchorscrollprovider) | Use `$anchorScrollProvider` to disable automatic scrolling whenever [$location.hash()](service/%24location#hash.html) changes. |
| [$animateProvider](provider/%24animateprovider) | Default implementation of $animate that doesn't perform any animations, instead just synchronously performs DOM updates and resolves the returned runner promise. |
| [$compileProvider](provider/%24compileprovider) | |
| [$controllerProvider](provider/%24controllerprovider) | The [$controller service](service/%24controller) is used by AngularJS to create new controllers. |
| [$filterProvider](provider/%24filterprovider) | Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. |
| [$httpProvider](provider/%24httpprovider) | Use `$httpProvider` to change the default behavior of the [$http](service/%24http) service. |
| [$interpolateProvider](provider/%24interpolateprovider) | Used for configuring the interpolation markup. Defaults to `{{` and `}}`. |
| [$locationProvider](provider/%24locationprovider) | Use the `$locationProvider` to configure how the application deep linking paths are stored. |
| [$logProvider](provider/%24logprovider) | Use the `$logProvider` to configure how the application logs messages |
| [$parseProvider](provider/%24parseprovider) | `$parseProvider` can be used for configuring the default behavior of the [$parse](service/%24parse) service. |
| [$qProvider](provider/%24qprovider) | |
| [$rootScopeProvider](provider/%24rootscopeprovider) | Provider for the $rootScope service. |
| [$sceDelegateProvider](provider/%24scedelegateprovider) | The `$sceDelegateProvider` provider allows developers to configure the [$sceDelegate service](service/%24scedelegate), used as a delegate for [Strict Contextual Escaping (SCE)](service/%24sce). |
| [$sceProvider](provider/%24sceprovider) | The $sceProvider provider allows developers to configure the [$sce](service/%24sce) service.* enable/disable Strict Contextual Escaping (SCE) in a module
* override the default implementation with a custom delegate
|
| [$templateRequestProvider](provider/%24templaterequestprovider) | Used to configure the options passed to the [`$http`](service/%24http) service when making a template request. |
angularjs Object components in ng Object components in ng
=======================
| Name | Description |
| --- | --- |
| [angular.version](object/angular.version) | An object that contains information about the current AngularJS version. |
angularjs Directive components in ng Directive components in ng
==========================
| Name | Description |
| --- | --- |
| [ngJq](directive/ngjq) | Use this directive to force the angular.element library. This should be used to force either jqLite by leaving ng-jq blank or setting the name of the jquery variable under window (eg. jQuery). |
| [ngApp](directive/ngapp) | Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive designates the **root element** of the application and is typically placed near the root element of the page - e.g. on the `<body>` or `<html>` tags. |
| [ngProp](directive/ngprop) | The `ngProp` directive binds an expression to a DOM element property. `ngProp` allows writing to arbitrary properties by including the property name in the attribute, e.g. `ng-prop-value="'my value'"` binds 'my value' to the `value` property. |
| [ngOn](directive/ngon) | The `ngOn` directive adds an event listener to a DOM element via [angular.element().on()](function/angular.element), and evaluates an expression when the event is fired. `ngOn` allows adding listeners for arbitrary events by including the event name in the attribute, e.g. `ng-on-drop="onDrop()"` executes the 'onDrop()' expression when the `drop` event is fired. |
| [a](directive/a) | Modifies the default behavior of the html a tag so that the default action is prevented when the href attribute is empty. |
| [ngHref](directive/nghref) | Using AngularJS markup like `{{hash}}` in an href attribute will make the link go to the wrong URL if the user clicks it before AngularJS has a chance to replace the `{{hash}}` markup with its value. Until AngularJS replaces the markup the link will be broken and will most likely return a 404 error. The `ngHref` directive solves this problem. |
| [ngSrc](directive/ngsrc) | Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't work right: The browser will fetch from the URL with the literal text `{{hash}}` until AngularJS replaces the expression inside `{{hash}}`. The `ngSrc` directive solves this problem. |
| [ngSrcset](directive/ngsrcset) | Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't work right: The browser will fetch from the URL with the literal text `{{hash}}` until AngularJS replaces the expression inside `{{hash}}`. The `ngSrcset` directive solves this problem. |
| [ngDisabled](directive/ngdisabled) | This directive sets the `disabled` attribute on the element (typically a form control, e.g. `input`, `button`, `select` etc.) if the [expression](../../guide/expression) inside `ngDisabled` evaluates to truthy. |
| [ngChecked](directive/ngchecked) | Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy. |
| [ngReadonly](directive/ngreadonly) | Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy. Note that `readonly` applies only to `input` elements with specific types. [See the input docs on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information. |
| [ngSelected](directive/ngselected) | Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy. |
| [ngOpen](directive/ngopen) | Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy. |
| [ngForm](directive/ngform) | Helper directive that makes it possible to create control groups inside a [`form`](directive/form) directive. These "child forms" can be used, for example, to determine the validity of a sub-group of controls. |
| [form](directive/form) | Directive that instantiates [FormController](type/form.formcontroller). |
| [textarea](directive/textarea) | HTML textarea element control with AngularJS data-binding. The data-binding and validation properties of this element are exactly the same as those of the [input element](directive/input). |
| [input](directive/input) | HTML input element control. When used together with [`ngModel`](directive/ngmodel), it provides data-binding, input state control, and validation. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers. |
| [ngValue](directive/ngvalue) | Binds the given expression to the value of the element. |
| [ngBind](directive/ngbind) | The `ngBind` attribute tells AngularJS to replace the text content of the specified HTML element with the value of a given expression, and to update the text content when the value of that expression changes. |
| [ngBindTemplate](directive/ngbindtemplate) | The `ngBindTemplate` directive specifies that the element text content should be replaced with the interpolation of the template in the `ngBindTemplate` attribute. Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}` expressions. This directive is needed since some HTML elements (such as TITLE and OPTION) cannot contain SPAN elements. |
| [ngBindHtml](directive/ngbindhtml) | Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default, the resulting HTML content will be sanitized using the [$sanitize](../ngsanitize/service/%24sanitize) service. To utilize this functionality, ensure that `$sanitize` is available, for example, by including [`ngSanitize`](../ngsanitize) in your module's dependencies (not in core AngularJS). In order to use [`ngSanitize`](../ngsanitize) in your module's dependencies, you need to include "angular-sanitize.js" in your application. |
| [ngChange](directive/ngchange) | Evaluate the given expression when the user changes the input. The expression is evaluated immediately, unlike the JavaScript onchange event which only triggers at the end of a change (usually, when the user leaves the form element or presses the return key). |
| [ngClass](directive/ngclass) | The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding an expression that represents all classes to be added. |
| [ngClassOdd](directive/ngclassodd) | The `ngClassOdd` and `ngClassEven` directives work exactly as [ngClass](directive/ngclass), except they work in conjunction with `ngRepeat` and take effect only on odd (even) rows. |
| [ngClassEven](directive/ngclasseven) | The `ngClassOdd` and `ngClassEven` directives work exactly as [ngClass](directive/ngclass), except they work in conjunction with `ngRepeat` and take effect only on odd (even) rows. |
| [ngCloak](directive/ngcloak) | The `ngCloak` directive is used to prevent the AngularJS html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display. |
| [ngController](directive/ngcontroller) | The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular supports the principles behind the Model-View-Controller design pattern. |
| [ngCsp](directive/ngcsp) | AngularJS has some features that can conflict with certain restrictions that are applied when using [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules. |
| [ngClick](directive/ngclick) | The ngClick directive allows you to specify custom behavior when an element is clicked. |
| [ngDblclick](directive/ngdblclick) | The `ngDblclick` directive allows you to specify custom behavior on a dblclick event. |
| [ngMousedown](directive/ngmousedown) | The ngMousedown directive allows you to specify custom behavior on mousedown event. |
| [ngMouseup](directive/ngmouseup) | Specify custom behavior on mouseup event. |
| [ngMouseover](directive/ngmouseover) | Specify custom behavior on mouseover event. |
| [ngMouseenter](directive/ngmouseenter) | Specify custom behavior on mouseenter event. |
| [ngMouseleave](directive/ngmouseleave) | Specify custom behavior on mouseleave event. |
| [ngMousemove](directive/ngmousemove) | Specify custom behavior on mousemove event. |
| [ngKeydown](directive/ngkeydown) | Specify custom behavior on keydown event. |
| [ngKeyup](directive/ngkeyup) | Specify custom behavior on keyup event. |
| [ngKeypress](directive/ngkeypress) | Specify custom behavior on keypress event. |
| [ngSubmit](directive/ngsubmit) | Enables binding AngularJS expressions to onsubmit events. |
| [ngFocus](directive/ngfocus) | Specify custom behavior on focus event. |
| [ngBlur](directive/ngblur) | Specify custom behavior on blur event. |
| [ngCopy](directive/ngcopy) | Specify custom behavior on copy event. |
| [ngCut](directive/ngcut) | Specify custom behavior on cut event. |
| [ngPaste](directive/ngpaste) | Specify custom behavior on paste event. |
| [ngIf](directive/ngif) | The `ngIf` directive removes or recreates a portion of the DOM tree based on an {expression}. If the expression assigned to `ngIf` evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM. |
| [ngInclude](directive/nginclude) | Fetches, compiles and includes an external HTML fragment. |
| [ngInit](directive/nginit) | The `ngInit` directive allows you to evaluate an expression in the current scope. |
| [ngList](directive/nglist) | Text input that converts between a delimited string and an array of strings. The default delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`. |
| [ngModel](directive/ngmodel) | The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a property on the scope using [NgModelController](type/ngmodel.ngmodelcontroller), which is created and exposed by this directive. |
| [ngModelOptions](directive/ngmodeloptions) | This directive allows you to modify the behaviour of [`ngModel`](directive/ngmodel) directives within your application. You can specify an `ngModelOptions` directive on any element. All [`ngModel`](directive/ngmodel) directives will use the options of their nearest `ngModelOptions` ancestor. |
| [ngNonBindable](directive/ngnonbindable) | The `ngNonBindable` directive tells AngularJS not to compile or bind the contents of the current DOM element, including directives on the element itself that have a lower priority than `ngNonBindable`. This is useful if the element contains what appears to be AngularJS directives and bindings but which should be ignored by AngularJS. This could be the case if you have a site that displays snippets of code, for instance. |
| [ngOptions](directive/ngoptions) | The `ngOptions` attribute can be used to dynamically generate a list of `<option>` elements for the `<select>` element using the array or object obtained by evaluating the `ngOptions` comprehension expression. |
| [ngPluralize](directive/ngpluralize) | `ngPluralize` is a directive that displays messages according to en-US localization rules. These rules are bundled with angular.js, but can be overridden (see [AngularJS i18n](../../guide/i18n) dev guide). You configure ngPluralize directive by specifying the mappings between [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) and the strings to be displayed. |
| [ngRef](directive/ngref) | The `ngRef` attribute tells AngularJS to assign the controller of a component (or a directive) to the given property in the current scope. It is also possible to add the jqlite-wrapped DOM element to the scope. |
| [ngRepeat](directive/ngrepeat) | The `ngRepeat` directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop variable is set to the current collection item, and `$index` is set to the item index or key. |
| [ngShow](directive/ngshow) | The `ngShow` directive shows or hides the given HTML element based on the expression provided to the `ngShow` attribute. |
| [ngHide](directive/nghide) | The `ngHide` directive shows or hides the given HTML element based on the expression provided to the `ngHide` attribute. |
| [ngStyle](directive/ngstyle) | The `ngStyle` directive allows you to set CSS style on an HTML element conditionally. |
| [ngSwitch](directive/ngswitch) | The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression. Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location as specified in the template. |
| [ngTransclude](directive/ngtransclude) | Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion. |
| [script](directive/script) | Load the content of a `<script>` element into [`$templateCache`](service/%24templatecache), so that the template can be used by [`ngInclude`](directive/nginclude), [`ngView`](../ngroute/directive/ngview), or [directives](../../guide/directive). The type of the `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be assigned through the element's `id`, which can then be used as a directive's `templateUrl`. |
| [select](directive/select) | HTML `select` element with AngularJS data-binding. |
| [ngRequired](directive/ngrequired) | ngRequired adds the required [`validator`](type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](directive/ngmodel). It is most often used for [`input`](directive/input) and [`select`](directive/select) controls, but can also be applied to custom controls. |
| [ngPattern](directive/ngpattern) | ngPattern adds the pattern [`validator`](type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](directive/ngmodel). It is most often used for text-based [`input`](directive/input) controls, but can also be applied to custom text-based controls. |
| [ngMaxlength](directive/ngmaxlength) | ngMaxlength adds the maxlength [`validator`](type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](directive/ngmodel). It is most often used for text-based [`input`](directive/input) controls, but can also be applied to custom text-based controls. |
| [ngMinlength](directive/ngminlength) | ngMinlength adds the minlength [`validator`](type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](directive/ngmodel). It is most often used for text-based [`input`](directive/input) controls, but can also be applied to custom text-based controls. |
| programming_docs |
angularjs Service components in ng Service components in ng
========================
| Name | Description |
| --- | --- |
| [$anchorScroll](service/%24anchorscroll) | When called, it scrolls to the element related to the specified `hash` or (if omitted) to the current value of [$location.hash()](service/%24location#hash.html), according to the rules specified in the [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document). |
| [$animate](service/%24animate) | The $animate service exposes a series of DOM utility methods that provide support for animation hooks. The default behavior is the application of DOM operations, however, when an animation is detected (and animations are enabled), $animate will do the heavy lifting to ensure that animation runs with the triggered DOM operation. |
| [$animateCss](service/%24animatecss) | This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included, then the `$animateCss` service will actually perform animations. |
| [$cacheFactory](service/%24cachefactory) | Factory that constructs [Cache](type/%24cachefactory.cache) objects and gives access to them. |
| [$templateCache](service/%24templatecache) | `$templateCache` is a [Cache object](type/%24cachefactory.cache) created by the [$cacheFactory](service/%24cachefactory). |
| [$compile](service/%24compile) | Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link [`scope`](type/%24rootscope.scope) and the template together. |
| [$controller](service/%24controller) | `$controller` service is responsible for instantiating controllers. |
| [$document](service/%24document) | A [jQuery or jqLite](function/angular.element) wrapper for the browser's `window.document` object. |
| [$exceptionHandler](service/%24exceptionhandler) | Any uncaught exception in AngularJS expressions is delegated to this service. The default implementation simply delegates to `$log.error` which logs it into the browser console. |
| [$filter](service/%24filter) | Filters are used for formatting data displayed to the user. |
| [$httpParamSerializer](service/%24httpparamserializer) | Default [`$http`](service/%24http) params serializer that converts objects to strings according to the following rules: |
| [$httpParamSerializerJQLike](service/%24httpparamserializerjqlike) | Alternative [`$http`](service/%24http) params serializer that follows jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic. The serializer will also sort the params alphabetically. |
| [$http](service/%24http) | The `$http` service is a core AngularJS service that facilitates communication with the remote HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest) object or via [JSONP](http://en.wikipedia.org/wiki/JSONP). |
| [$xhrFactory](service/%24xhrfactory) | Factory function used to create XMLHttpRequest objects. |
| [$httpBackend](service/%24httpbackend) | HTTP backend used by the [service](service/%24http) that delegates to XMLHttpRequest object or JSONP and deals with browser incompatibilities. |
| [$interpolate](service/%24interpolate) | Compiles a string with markup into an interpolation function. This service is used by the HTML [$compile](service/%24compile) service for data binding. See [$interpolateProvider](provider/%24interpolateprovider) for configuring the interpolation markup. |
| [$interval](service/%24interval) | AngularJS's wrapper for `window.setInterval`. The `fn` function is executed every `delay` milliseconds. |
| [$jsonpCallbacks](service/%24jsonpcallbacks) | This service handles the lifecycle of callbacks to handle JSONP requests. Override this service if you wish to customise where the callbacks are stored and how they vary compared to the requested url. |
| [$locale](service/%24locale) | $locale service provides localization rules for various AngularJS components. As of right now the only public api is: |
| [$location](service/%24location) | The $location service parses the URL in the browser address bar (based on the [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL available to your application. Changes to the URL in the address bar are reflected into $location service and changes to $location are reflected into the browser address bar. |
| [$log](service/%24log) | Simple service for logging. Default implementation safely writes the message into the browser's console (if present). |
| [$parse](service/%24parse) | Converts AngularJS [expression](../../guide/expression) into a function. |
| [$q](service/%24q) | A service that helps you run functions asynchronously, and use their return values (or exceptions) when they are done processing. |
| [$rootElement](service/%24rootelement) | The root element of AngularJS application. This is either the element where [ngApp](directive/ngapp) was declared or the element passed into [`angular.bootstrap`](function/angular.bootstrap). The element represents the root element of application. It is also the location where the application's [$injector](../auto/service/%24injector) service gets published, and can be retrieved using `$rootElement.injector()`. |
| [$rootScope](service/%24rootscope) | Every application has a single root [scope](type/%24rootscope.scope). All other scopes are descendant scopes of the root scope. Scopes provide separation between the model and the view, via a mechanism for watching the model for changes. They also provide event emission/broadcast and subscription facility. See the [developer guide on scopes](../../guide/scope). |
| [$sceDelegate](service/%24scedelegate) | `$sceDelegate` is a service that is used by the `$sce` service to provide [Strict Contextual Escaping (SCE)](service/%24sce) services to AngularJS. |
| [$sce](service/%24sce) | `$sce` is a service that provides Strict Contextual Escaping services to AngularJS. |
| [$templateRequest](service/%24templaterequest) | The `$templateRequest` service runs security checks then downloads the provided template using `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the exception can be thwarted by setting the 2nd parameter of the function to true). Note that the contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted when `tpl` is of type string and `$templateCache` has the matching entry. |
| [$timeout](service/%24timeout) | AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch block and delegates any exceptions to [$exceptionHandler](service/%24exceptionhandler) service. |
| [$window](service/%24window) | A reference to the browser's `window` object. While `window` is globally available in JavaScript, it causes testability problems, because it is a global variable. In AngularJS we always refer to it through the `$window` service, so it may be overridden, removed or mocked for testing. |
angularjs Function components in ng Function components in ng
=========================
| Name | Description |
| --- | --- |
| [angular.forEach](function/angular.foreach) | Invokes the `iterator` function once for each item in `obj` collection, which can be either an object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value` is the value of an object property or an array element, `key` is the object property key or array element index and obj is the `obj` itself. Specifying a `context` for the function is optional. |
| [angular.extend](function/angular.extend) | Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`. |
| [angular.merge](function/angular.merge) | Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s) to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`. |
| [angular.noop](function/angular.noop) | A function that performs no operations. This function can be useful when writing code in the functional style.
```
function foo(callback) {
var result = calculateResult();
(callback || angular.noop)(result);
}
```
|
| [angular.identity](function/angular.identity) | A function that returns its first argument. This function is useful when writing code in the functional style. |
| [angular.isUndefined](function/angular.isundefined) | Determines if a reference is undefined. |
| [angular.isDefined](function/angular.isdefined) | Determines if a reference is defined. |
| [angular.isObject](function/angular.isobject) | Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not considered to be objects. Note that JavaScript arrays are objects. |
| [angular.isString](function/angular.isstring) | Determines if a reference is a `String`. |
| [angular.isNumber](function/angular.isnumber) | Determines if a reference is a `Number`. |
| [angular.isDate](function/angular.isdate) | Determines if a value is a date. |
| [angular.isArray](function/angular.isarray) | Determines if a reference is an `Array`. |
| [angular.isFunction](function/angular.isfunction) | Determines if a reference is a `Function`. |
| [angular.isElement](function/angular.iselement) | Determines if a reference is a DOM element (or wrapped jQuery element). |
| [angular.copy](function/angular.copy) | Creates a deep copy of `source`, which should be an object or an array. This functions is used internally, mostly in the change-detection code. It is not intended as an all-purpose copy function, and has several limitations (see below). |
| [angular.equals](function/angular.equals) | Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and objects. |
| [angular.bind](function/angular.bind) | Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for `fn`). You can supply optional `args` that are prebound to the function. This feature is also known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application). |
| [angular.toJson](function/angular.tojson) | Serializes input into a JSON-formatted string. Properties with leading $$ characters will be stripped since AngularJS uses this notation internally. |
| [angular.fromJson](function/angular.fromjson) | Deserializes a JSON string. |
| [angular.bootstrap](function/angular.bootstrap) | Use this function to manually start up AngularJS application. |
| [angular.reloadWithDebugInfo](function/angular.reloadwithdebuginfo) | Use this function to reload the current application with debug information turned on. This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`. |
| [angular.UNSAFE\_restoreLegacyJqLiteXHTMLReplacement](function/angular.unsafe_restorelegacyjqlitexhtmlreplacement) | Restores the pre-1.8 behavior of jqLite that turns XHTML-like strings like `<div /><span />` to `<div></div><span></span>` instead of `<div><span></span></div>`. The new behavior is a security fix. Thus, if you need to call this function, please try to adjust your code for this change and remove your use of this function as soon as possible. |
| [angular.injector](function/angular.injector) | Creates an injector object that can be used for retrieving services as well as for dependency injection (see [dependency injection](../../guide/di)). |
| [angular.element](function/angular.element) | Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. |
| [angular.module](function/angular.module) | The `angular.module` is a global place for creating, registering and retrieving AngularJS modules. All modules (AngularJS core or 3rd party) that should be available to an application must be registered using this mechanism. |
| [angular.errorHandlingConfig](function/angular.errorhandlingconfig) | Configure several aspects of error handling in AngularJS if used as a setter or return the current configuration if used as a getter. The following options are supported: |
angularjs Filter components in ng Filter components in ng
=======================
| Name | Description |
| --- | --- |
| [filter](filter/filter) | Selects a subset of items from `array` and returns it as a new array. |
| [currency](filter/currency) | Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. |
| [number](filter/number) | Formats a number as text. |
| [date](filter/date) | Formats `date` to a string based on the requested `format`. |
| [json](filter/json) | Allows you to convert a JavaScript object into JSON string. |
| [lowercase](filter/lowercase) | Converts string to lowercase. |
| [uppercase](filter/uppercase) | Converts string to uppercase. |
| [limitTo](filter/limitto) | Creates a new array or string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of `limit`. Other array-like objects are also supported (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input, it is converted to a string. |
| [orderBy](filter/orderby) | Returns an array containing the items from the specified `collection`, ordered by a `comparator` function based on the values computed using the `expression` predicate. |
angularjs
Improve this Doc View Source input[radio]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bradio%5D)%3A%20describe%20your%20change...#L1002) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L1002) input[radio]
====================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
HTML radio button.
**Note:**
All inputs controlled by [ngModel](../directive/ngmodel) (including those of type `radio`) will use the value of their `name` attribute to determine the property under which their [NgModelController](../type/ngmodel.ngmodelcontroller) will be published on the parent [FormController](../type/form.formcontroller). Thus, if you use the same `name` for multiple inputs of a form (e.g. a group of radio inputs), only *one* `NgModelController` will be published on the parent `FormController` under that name. The rest of the controllers will continue to work as expected, but you won't be able to access them as properties on the parent `FormController`.
In plain HTML forms, the `name` attribute is used to identify groups of radio inputs, so that the browser can manage their state (checked/unchecked) based on the state of other inputs in the same group.
In AngularJS forms, this is not necessary. The input's state will be updated based on the value of the underlying model data.
If you omit the `name` attribute on a radio input, `ngModel` will automatically assign it a unique name. Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="radio"
ng-model="string"
value="string"
[name="string"]
[ng-change="string"]
ng-value="string">
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| value | `string` | The value to which the `ngModel` expression should be set when selected. Note that `value` only supports `string` values, i.e. the scope model needs to be a string, too. Use `ngValue` if you need complex models (`number`, `object`, ...). |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
| ngValue | `string` | AngularJS expression to which `ngModel` will be be set when the radio is selected. Should be used instead of the `value` attribute if you need a non-string `ngModel` (`boolean`, `array`, ...). |
Example
-------
angularjs
Improve this Doc View Source input[week]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bweek%5D)%3A%20describe%20your%20change...#L457) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L457) input[week]
================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 week format (yyyy-W##), for example: `2013-W02`.
The model must always be a Date object, otherwise AngularJS will throw an error. Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
The value of the resulting Date object will be set to Thursday at 00:00:00 of the requested week, due to ISO-8601 week numbering standards. Information on ISO's system for numbering the weeks of the year can be found at: <https://en.wikipedia.org/wiki/ISO_8601#Week_dates>
The timezone to be used to read/write the `Date` instance in the model can be defined using [ngModelOptions](../directive/ngmodeloptions). By default, this is the timezone of the browser.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="week"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[ng-min=""]
[ng-max=""]
[required="string"]
[ng-required="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation error key if the value entered is less than `min`. This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add native HTML5 constraint validation. |
| max *(optional)* | `string` | Sets the `max` validation error key if the value entered is greater than `max`. This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add native HTML5 constraint validation. |
| ngMin *(optional)* | `date``string` | Sets the `min` validation constraint to the Date / ISO week string the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. |
| ngMax *(optional)* | `date``string` | Sets the `max` validation constraint to the Date / ISO week string the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source input[email]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bemail%5D)%3A%20describe%20your%20change...#L902) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L902) input[email]
==================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Text input with email validation. Sets the `email` validation error key if not a valid email address.
**Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex used in Chromium, which may not fulfill your app's requirements. If you need stricter (e.g. requiring a top-level domain), or more relaxed validation (e.g. allowing IPv6 address literals) you can use `ng-pattern` or modify the built-in validators (see the [Forms guide](../../../guide/forms)). Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="email"
ng-model="string"
[name="string"]
[required="string"]
[ng-required="string"]
[ng-minlength="number"]
[ng-maxlength="number"]
[pattern="string"]
[ng-pattern="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngMinlength *(optional)* | `number` | Sets `minlength` validation error key if the value is shorter than minlength. |
| ngMaxlength *(optional)* | `number` | Sets `maxlength` validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length. |
| pattern *(optional)* | `string` | Similar to `ngPattern` except that the attribute value is the actual string that contains the regular expression body that will be converted to a regular expression as in the ngPattern directive. |
| ngPattern *(optional)* | `string` | Sets `pattern` validation error key if the ngModel [$viewValue](../type/ngmodel.ngmodelcontroller#%24viewValue.html) does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. If the expression evaluates to a RegExp object, then this is used directly. If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[checkbox]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bcheckbox%5D)%3A%20describe%20your%20change...#L1216) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L1216) input[checkbox]
==========================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
HTML checkbox.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="checkbox"
ng-model="string"
[name="string"]
[ng-true-value="expression"]
[ng-false-value="expression"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| ngTrueValue *(optional)* | `expression` | The value to which the expression should be set when selected. |
| ngFalseValue *(optional)* | `expression` | The value to which the expression should be set when not selected. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[text]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Btext%5D)%3A%20describe%20your%20change...#L43) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L43) input[text]
==============================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Standard HTML text input with AngularJS data binding, inherited by most of the `input` elements.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="text"
ng-model="string"
[name="string"]
[required="string"]
[ng-required="string"]
[ng-minlength="number"]
[ng-maxlength="number"]
[pattern="string"]
[ng-pattern="string"]
[ng-change="string"]
[ng-trim="boolean"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| required *(optional)* | `string` | Adds `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngMinlength *(optional)* | `number` | Sets `minlength` validation error key if the value is shorter than minlength. |
| ngMaxlength *(optional)* | `number` | Sets `maxlength` validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length. |
| pattern *(optional)* | `string` | Similar to `ngPattern` except that the attribute value is the actual string that contains the regular expression body that will be converted to a regular expression as in the ngPattern directive. |
| ngPattern *(optional)* | `string` | Sets `pattern` validation error key if the ngModel [$viewValue](../type/ngmodel.ngmodelcontroller#%24viewValue.html) does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. If the expression evaluates to a RegExp object, then this is used directly. If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
| ngTrim *(optional)* | `boolean` | If set to false AngularJS will not automatically trim the input. This parameter is ignored for input[type=password] controls, which will never trim the input. *(default: true)* |
Example
-------
angularjs
Improve this Doc View Source input[month]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bmonth%5D)%3A%20describe%20your%20change...#L563) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L563) input[month]
==================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Input with month validation and transformation. In browsers that do not yet support the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 month format (yyyy-MM), for example: `2009-01`.
The model must always be a Date object, otherwise AngularJS will throw an error. Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. If the model is not set to the first of the month, the next view to model update will set it to the first of the month.
The timezone to be used to read/write the `Date` instance in the model can be defined using [ngModelOptions](../directive/ngmodeloptions). By default, this is the timezone of the browser.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="month"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[ng-min=""]
[ng-max=""]
[required="string"]
[ng-required="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation error key if the value entered is less than `min`. This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add native HTML5 constraint validation. |
| max *(optional)* | `string` | Sets the `max` validation error key if the value entered is greater than `max`. This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add native HTML5 constraint validation. |
| ngMin *(optional)* | `date``string` | Sets the `min` validation constraint to the Date / ISO week string the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. |
| ngMax *(optional)* | `date``string` | Sets the `max` validation constraint to the Date / ISO week string the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[date]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bdate%5D)%3A%20describe%20your%20change...#L139) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L139) input[date]
================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Input with date validation and transformation. In browsers that do not yet support the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601 date format (yyyy-MM-dd), for example: `2009-01-06`. Since many modern browsers do not yet support this input type, it is important to provide cues to users on the expected input format via a placeholder or label.
The model must always be a Date object, otherwise AngularJS will throw an error. Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
The timezone to be used to read/write the `Date` instance in the model can be defined using [ngModelOptions](../directive/ngmodeloptions). By default, this is the timezone of the browser.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="date"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[ng-min=""]
[ng-max=""]
[required="string"]
[ng-required="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation error key if the value entered is less than `min`. This must be a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5 constraint validation. |
| max *(optional)* | `string` | Sets the `max` validation error key if the value entered is greater than `max`. This must be a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5 constraint validation. |
| ngMin *(optional)* | `date``string` | Sets the `min` validation constraint to the Date / ISO date string the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. |
| ngMax *(optional)* | `date``string` | Sets the `max` validation constraint to the Date / ISO date string the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[datetime-local]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bdatetime-local%5D)%3A%20describe%20your%20change...#L243) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L243) input[datetime-local]
====================================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Input with datetime validation and transformation. In browsers that do not yet support the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.
The model must always be a Date object, otherwise AngularJS will throw an error. Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
The timezone to be used to read/write the `Date` instance in the model can be defined using [ngModelOptions](../directive/ngmodeloptions). By default, this is the timezone of the browser.
The format of the displayed time can be adjusted with the [ngModelOptions](../directive/ngmodeloptions#ngModelOptions-arguments.html) `timeSecondsFormat` and `timeStripZeroSeconds`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="datetime-local"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[ng-min=""]
[ng-max=""]
[required="string"]
[ng-required="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation error key if the value entered is less than `min`. This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). Note that `min` will also add native HTML5 constraint validation. |
| max *(optional)* | `string` | Sets the `max` validation error key if the value entered is greater than `max`. This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). Note that `max` will also add native HTML5 constraint validation. |
| ngMin *(optional)* | `date``string` | Sets the `min` validation error key to the Date / ISO datetime string the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. |
| ngMax *(optional)* | `date``string` | Sets the `max` validation error key to the Date / ISO datetime string the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[range]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Brange%5D)%3A%20describe%20your%20change...#L1097) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L1097) input[range]
====================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Native range input with validation and transformation.
The model for the range input must always be a `Number`.
IE9 and other browsers that do not support the `range` type fall back to a text input without any default values for `min`, `max` and `step`. Model binding, validation and number parsing are nevertheless supported.
Browsers that support range (latest Chrome, Safari, Firefox, Edge) treat `input[range]` in a way that never allows the input to hold an invalid value. That means:
* any non-numerical value is set to `(max + min) / 2`.
* any numerical value that is less than the current min val, or greater than the current max val is set to the min / max val respectively.
* additionally, the current `step` is respected, so the nearest value that satisfies a step is used.
See the [HTML Spec on input[type=range]](https://www.w3.org/TR/html5/forms.html#range-state-(type=range)) for more info.
This has the following consequences for AngularJS:
Since the element value should always reflect the current model value, a range input will set the bound ngModel expression to the value that the browser has set for the input element. For example, in the following input `<input type="range" ng-model="model.value">`, if the application sets `model.value = null`, the browser will set the input to `'50'`. AngularJS will then set the model to `50`, to prevent input and model value being out of sync.
That means the model for range will immediately be set to `50` after `ngModel` has been initialized. It also means a range input can never have the required error.
This does not only affect changes to the model value, but also to the values of the `min`, `max`, and `step` attributes. When these change in a way that will cause the browser to modify the input value, AngularJS will also update the model value.
Automatic value adjustment also means that a range input element can never have the `required`, `min`, or `max` errors.
However, `step` is currently only fully implemented by Firefox. Other browsers have problems when the step value changes dynamically - they do not adjust the element value correctly, but instead may set the `stepMismatch` error. If that's the case, the AngularJS will set the `step` error on the input, and set the model to `undefined`.
Note that `input[range]` is not compatible with`ngMax`, `ngMin`, and `ngStep`, because they do not set the `min` and `max` attributes, which means that the browser won't automatically adjust the input value based on their values, and will always assume min = 0, max = 100, and step = 1.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="range"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[step="string"]
[ng-change="expression"]
[ng-checked="expression"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation to ensure that the value entered is greater than `min`. Can be interpolated. |
| max *(optional)* | `string` | Sets the `max` validation to ensure that the value entered is less than `max`. Can be interpolated. |
| step *(optional)* | `string` | Sets the `step` validation to ensure that the value entered matches the `step` Can be interpolated. |
| ngChange *(optional)* | `expression` | AngularJS expression to be executed when the ngModel value changes due to user interaction with the input element. |
| ngChecked *(optional)* | `expression` | If the expression is truthy, then the `checked` attribute will be set on the element. **Note** : `ngChecked` should not be used alongside `ngModel`. Checkout [ngChecked](../directive/ngchecked) for usage. |
Examples
--------
Range Input with ngMin & ngMax attributes
-----------------------------------------
| programming_docs |
angularjs
Improve this Doc View Source input[url]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Burl%5D)%3A%20describe%20your%20change...#L803) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L803) input[url]
==============================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Text input with URL validation. Sets the `url` validation error key if the content is not a valid URL.
**Note:** `input[url]` uses a regex to validate urls that is derived from the regex used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify the built-in validators (see the [Forms guide](../../../guide/forms)) Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="url"
ng-model="string"
[name="string"]
[required="string"]
[ng-required="string"]
[ng-minlength="number"]
[ng-maxlength="number"]
[pattern="string"]
[ng-pattern="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngMinlength *(optional)* | `number` | Sets `minlength` validation error key if the value is shorter than minlength. |
| ngMaxlength *(optional)* | `number` | Sets `maxlength` validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length. |
| pattern *(optional)* | `string` | Similar to `ngPattern` except that the attribute value is the actual string that contains the regular expression body that will be converted to a regular expression as in the ngPattern directive. |
| ngPattern *(optional)* | `string` | Sets `pattern` validation error key if the ngModel [$viewValue](../type/ngmodel.ngmodelcontroller#%24viewValue.html) does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. If the expression evaluates to a RegExp object, then this is used directly. If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[time]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Btime%5D)%3A%20describe%20your%20change...#L349) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L349) input[time]
================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Input with time validation and transformation. In browsers that do not yet support the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.
The model must always be a Date object, otherwise AngularJS will throw an error. Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
The timezone to be used to read/write the `Date` instance in the model can be defined using [ngModelOptions](../directive/ngmodeloptions#ngModelOptions-arguments.html). By default, this is the timezone of the browser.
The format of the displayed time can be adjusted with the [ngModelOptions](../directive/ngmodeloptions#ngModelOptions-arguments.html) `timeSecondsFormat` and `timeStripZeroSeconds`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="time"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[ng-min=""]
[ng-max=""]
[required="string"]
[ng-required="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation error key if the value entered is less than `min`. This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add native HTML5 constraint validation. |
| max *(optional)* | `string` | Sets the `max` validation error key if the value entered is greater than `max`. This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add native HTML5 constraint validation. |
| ngMin *(optional)* | `date``string` | Sets the `min` validation constraint to the Date / ISO time string the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. |
| ngMax *(optional)* | `date``string` | Sets the `max` validation constraint to the Date / ISO time string the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs
Improve this Doc View Source input[number]
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input%5Bnumber%5D)%3A%20describe%20your%20change...#L668) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L668) input[number]
====================================================================================================================================================================================================================================================================================
1. input in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Text input with number validation and transformation. Sets the `number` validation error if not a valid number.
The model must always be of type `number` otherwise AngularJS will throw an error. Be aware that a string containing a number is not enough. See the [`numfmt`](error/ngmodel/numfmt) error docs for more information and an example of how to convert your model if necessary. Known Issues
------------
### HTML5 constraint validation and allowInvalid
In browsers that follow the [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29), `input[number]` does not work as expected with [`ngModelOptions.allowInvalid`](../directive/ngmodeloptions). If a non-number is entered in the input, the browser will report the value as an empty string, which means the view / model values in `ngModel` and subsequently the scope value will also be an empty string.
### Large numbers and step validation
The `step` validation will not work correctly for very large numbers (e.g. 9999999999) due to Javascript's arithmetic limitations. If you need to handle large numbers, purpose-built libraries (e.g. <https://github.com/MikeMcl/big.js/>), can be included into AngularJS by [overwriting the validators](../../../guide/forms#modifying-built-in-validators.html) for `number` and / or `step`, or by [applying custom validators](../../../guide/forms#custom-validation.html) to an `input[text]` element. The source for `input[number]` type can be used as a starting point for both implementations.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<input type="number"
ng-model="string"
[name="string"]
[min="string"]
[max="string"]
[ng-min="string"]
[ng-max="string"]
[step="string"]
[ng-step="string"]
[required="string"]
[ng-required="string"]
[ng-minlength="number"]
[ng-maxlength="number"]
[pattern="string"]
[ng-pattern="string"]
[ng-change="string"]>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| min *(optional)* | `string` | Sets the `min` validation error key if the value entered is less than `min`. Can be interpolated. |
| max *(optional)* | `string` | Sets the `max` validation error key if the value entered is greater than `max`. Can be interpolated. |
| ngMin *(optional)* | `string` | Like `min`, sets the `min` validation error key if the value entered is less than `ngMin`, but does not trigger HTML5 native validation. Takes an expression. |
| ngMax *(optional)* | `string` | Like `max`, sets the `max` validation error key if the value entered is greater than `ngMax`, but does not trigger HTML5 native validation. Takes an expression. |
| step *(optional)* | `string` | Sets the `step` validation error key if the value entered does not fit the `step` constraint. Can be interpolated. |
| ngStep *(optional)* | `string` | Like `step`, sets the `step` validation error key if the value entered does not fit the `ngStep` constraint, but does not trigger HTML5 native validation. Takes an expression. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngMinlength *(optional)* | `number` | Sets `minlength` validation error key if the value is shorter than minlength. |
| ngMaxlength *(optional)* | `number` | Sets `maxlength` validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length. |
| pattern *(optional)* | `string` | Similar to `ngPattern` except that the attribute value is the actual string that contains the regular expression body that will be converted to a regular expression as in the ngPattern directive. |
| ngPattern *(optional)* | `string` | Sets `pattern` validation error key if the ngModel [$viewValue](../type/ngmodel.ngmodelcontroller#%24viewValue.html) does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. If the expression evaluates to a RegExp object, then this is used directly. If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
Example
-------
angularjs Show / Hide Table of Contents * [{{ navGroup.name }}](#)
+ [{{navItem.extra.text}}](#) [{{navItem.name}}](#)
[Close](tutorial) Loading … There was an error loading this resource. Please try again later.
angularjs Show / Hide Table of Contents * [{{ navGroup.name }}](#)
+ [{{navItem.extra.text}}](#) [{{navItem.name}}](#)
[Close](guide) Loading … There was an error loading this resource. Please try again later.
angularjs Show / Hide Table of Contents * [{{ navGroup.name }}](#)
+ [{{navItem.extra.text}}](#) [{{navItem.name}}](#)
[Close](numfmt) Loading … There was an error loading this resource. Please try again later.
angularjs Show / Hide Table of Contents * [{{ navGroup.name }}](#)
+ [{{navItem.extra.text}}](#) [{{navItem.name}}](#)
[Close](api) Loading … There was an error loading this resource. Please try again later.
angularjs Show / Hide Table of Contents * [{{ navGroup.name }}](#)
+ [{{navItem.extra.text}}](#) [{{navItem.name}}](#)
[Close](error) Loading … There was an error loading this resource. Please try again later.
angularjs
Improve this Doc View Source $controllerProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/controller.js?message=docs(%24controllerProvider)%3A%20describe%20your%20change...#L16) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/controller.js#L16) $controllerProvider
==================================================================================================================================================================================================================================================================================
1. [$controller](../service/%24controller)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The [$controller service](../service/%24controller) is used by AngularJS to create new controllers.
This provider allows controller registration via the [register](%24controllerprovider#register.html) method.
Methods
-------
* ### has(name);
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Controller name to check. |
* ### register(name, constructor);
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Controller name, or an object map of controllers where the keys are the names and the values are the constructors. |
| constructor | `function()``Array` | Controller constructor fn (optionally decorated with DI annotations in the array notation). |
angularjs
Improve this Doc View Source $logProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/log.js?message=docs(%24logProvider)%3A%20describe%20your%20change...#L49) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/log.js#L49) $logProvider
======================================================================================================================================================================================================================================================
1. [$log](../service/%24log)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use the `$logProvider` to configure how the application logs messages
Methods
-------
* ### debugEnabled([flag]);
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| flag *(optional)* | `boolean` | enable or disable debug level messages |
#### Returns
| | |
| --- | --- |
| `*` | current value if used as getter or itself (chaining) if used as setter |
angularjs
Improve this Doc View Source $filterProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter.js?message=docs(%24filterProvider)%3A%20describe%20your%20change...#L14) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter.js#L14) $filterProvider
==================================================================================================================================================================================================================================================================
1. [$filter](../service/%24filter)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function.
**Note:** Filter names must be valid AngularJS [`Expressions`](../../../guide/expression) identifiers, such as `uppercase` or `orderBy`. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores (`myapp_subsection_filterx`).
```
// Filter registration
function MyModule($provide, $filterProvider) {
// create a service to demonstrate injection (not always needed)
$provide.value('greet', function(name){
return 'Hello ' + name + '!';
});
// register a filter factory which uses the
// greet service to demonstrate DI.
$filterProvider.register('greet', function(greet){
// return the filter function which uses the greet service
// to generate salutation
return function(text) {
// filters need to be forgiving so check input validity
return text && greet(text) || text;
};
});
}
```
The filter function is registered with the `$injector` under the filter name suffix with `Filter`.
```
it('should be the same instance', inject(
function($filterProvider) {
$filterProvider.register('reverse', function(){
return ...;
});
},
function($filter, reverseFilter) {
expect($filter('reverse')).toBe(reverseFilter);
});
```
For more information about how AngularJS filters work, and how to create your own filters, see [Filters](../../../guide/filter) in the AngularJS Developer Guide.
Methods
-------
* ### register(name, factory);
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. **Note:** Filter names must be valid AngularJS [`Expressions`](../../../guide/expression) identifiers, such as `uppercase` or `orderBy`. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores (`myapp_subsection_filterx`). |
| factory | `Function` | If the first argument was a string, a factory function for the filter to be registered. |
#### Returns
| | |
| --- | --- |
| `Object` | Registered filter instance, or if a map of filters was provided then a map of the registered filter instances. |
| programming_docs |
angularjs
Improve this Doc View Source $compileProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/compile.js?message=docs(%24compileProvider)%3A%20describe%20your%20change...#L1372) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/compile.js#L1372) $compileProvider
==========================================================================================================================================================================================================================================================================
1. [$compile](../service/%24compile)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Methods
-------
* ### directive(name, directiveFactory);
Register a new directive with the compiler.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Name of the directive in camel-case (i.e. `ngBind` which will match as `ng-bind`), or an object map of directives where the keys are the names and the values are the factories. |
| directiveFactory | `function()``Array` | An injectable directive factory function. See the [directive guide](../../../guide/directive) and the [compile API](../service/%24compile) for more info. |
#### Returns
| | |
| --- | --- |
| `ng.$compileProvider` | Self for chaining. |
* ### component(name, options);
Register a **component definition** with the compiler. This is a shorthand for registering a special type of directive, which represents a self-contained UI component in your application. Such components are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).
Component definitions are very simple and do not require as much configuration as defining general directives. Component definitions usually consist only of a template and a controller backing it.
In order to make the definition easier, components enforce best practices like use of `controllerAs`, `bindToController`. They always have **isolate scope** and are restricted to elements.
Here are a few examples of how you would usually define components:
```
var myMod = angular.module(...);
myMod.component('myComp', {
template: '<div>My name is {{$ctrl.name}}</div>',
controller: function() {
this.name = 'shahar';
}
});
myMod.component('myComp', {
template: '<div>My name is {{$ctrl.name}}</div>',
bindings: {name: '@'}
});
myMod.component('myComp', {
templateUrl: 'views/my-comp.html',
controller: 'MyCtrl',
controllerAs: 'ctrl',
bindings: {name: '@'}
});
```
For more examples, and an in-depth guide, see the [component guide](../../../guide/component).
See also [$compileProvider.directive()](%24compileprovider#directive.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`), or an object map of components where the keys are the names and the values are the component definition objects. |
| options | `Object` | Component definition object (a simplified [directive definition object](../service/%24compile#directive-definition-object.html)), with the following properties (all optional):
+ `controller` – `{(string|function()=}` – controller constructor function that should be associated with newly created scope or the name of a [registered controller](../service/%24compile#-controller-.html) if passed as a string. An empty `noop` function by default.
+ `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope. If present, the controller will be published to scope under the `controllerAs` name. If not present, this will default to be `$ctrl`.
+ `template` – `{string=|function()=}` – html template as a string or a function that returns an html template as a string which should be used as the contents of this component. Empty string by default. If `template` is a function, then it is [injected](../../auto/service/%24injector#invoke.html) with the following locals:
- `$element` - Current element
- `$attrs` - Current attributes object for the element
+ `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html template that should be used as the contents of this component. If `templateUrl` is a function, then it is [injected](../../auto/service/%24injector#invoke.html) with the following locals:
- `$element` - Current element
- `$attrs` - Current attributes object for the element
+ `bindings` – `{object=}` – defines bindings between DOM attributes and component properties. Component properties are always bound to the component controller and not to the scope. See [`bindToController`](../service/%24compile#-bindtocontroller-.html).
+ `transclude` – `{boolean=}` – whether [content transclusion](../service/%24compile#transclusion.html) is enabled. Disabled by default.
+ `require` - `{Object<string, string>=}` - requires the controllers of other directives and binds them to this component's controller. The object keys specify the property names under which the required controllers (object values) will be bound. See [`require`](../service/%24compile#-require-.html).
+ `$...` – additional properties to attach to the directive factory function and the controller constructor function. (This is used by the component router to annotate) |
#### Returns
| | |
| --- | --- |
| `ng.$compileProvider` | the compile provider itself, for chaining of function calls. |
* ### aHrefSanitizationTrustedUrlList([regexp]);
Retrieves or overrides the default regular expression that is used for determining trusted safe urls during a[href] sanitization.
The sanitization is a security measure aimed at preventing XSS attacks via html links.
Any url about to be assigned to a[href] via data-binding is first normalized and turned into an absolute url. Afterwards, the url is matched against the `aHrefSanitizationTrustedUrlList` regular expression. If a match is found, the original url is written into the dom. Otherwise, the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| regexp *(optional)* | `RegExp` | New regexp to trust urls with. |
#### Returns
| | |
| --- | --- |
| `RegExp``ng.$compileProvider` | Current RegExp if called without value or self for chaining otherwise. |
* ### aHrefSanitizationWhitelist();
**Deprecated:** (since 1.8.1) This method is deprecated. Use [aHrefSanitizationTrustedUrlList](%24compileprovider#aHrefSanitizationTrustedUrlList.html) instead.
* ### imgSrcSanitizationTrustedUrlList([regexp]);
Retrieves or overrides the default regular expression that is used for determining trusted safe urls during img[src] sanitization.
The sanitization is a security measure aimed at prevent XSS attacks via html links.
Any url about to be assigned to img[src] via data-binding is first normalized and turned into an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationTrustedUrlList` regular expression. If a match is found, the original url is written into the dom. Otherwise, the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| regexp *(optional)* | `RegExp` | New regexp to trust urls with. |
#### Returns
| | |
| --- | --- |
| `RegExp``ng.$compileProvider` | Current RegExp if called without value or self for chaining otherwise. |
* ### imgSrcSanitizationWhitelist();
**Deprecated:** (since 1.8.1) This method is deprecated. Use [imgSrcSanitizationTrustedUrlList](%24compileprovider#imgSrcSanitizationTrustedUrlList.html) instead.
* ### debugInfoEnabled([enabled]);
Call this method to enable/disable various debug runtime information in the compiler such as adding binding information and a reference to the current scope on to DOM elements. If enabled, the compiler will add the following to DOM elements that have been bound to the scope
+ `ng-binding` CSS class
+ `ng-scope` and `ng-isolated-scope` CSS classes
+ `$binding` data property containing an array of the binding expressions
+ Data properties used by the [`scope()`/`isolateScope()` methods](../function/angular.element#methods.html) to return the element's scope.
+ Placeholder comments will contain information about what directive and binding caused the placeholder. E.g. `<!-- ngIf: shouldShow() -->`. You may want to disable this in production for a significant performance boost. See [Disabling Debug Data](../../../guide/production#disabling-debug-data.html) for more.
The default value is true.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| enabled *(optional)* | `boolean` | update the debugInfoEnabled state if provided, otherwise just return the current debugInfoEnabled state |
#### Returns
| | |
| --- | --- |
| `*` | current value if used as getter or itself (chaining) if used as setter |
* ### strictComponentBindingsEnabled([enabled]);
Call this method to enable / disable the strict component bindings check. If enabled, the compiler will enforce that all scope / controller bindings of a [directive](%24compileprovider#directive.html) / [component](%24compileprovider#component.html) that are not set as optional with `?`, must be provided when the directive is instantiated. If not provided, the compiler will throw the [$compile:missingattr error](https://code.angularjs.org/1.8.2/docs/api/ng/provider/error/%24compile/missingattr).
The default value is false.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| enabled *(optional)* | `boolean` | update the strictComponentBindingsEnabled state if provided, otherwise return the current strictComponentBindingsEnabled state. |
#### Returns
| | |
| --- | --- |
| `*` | current value if used as getter or itself (chaining) if used as setter |
* ### onChangesTtl(limit);
Sets the number of times `$onChanges` hooks can trigger new changes before giving up and assuming that the model is unstable.
The current default is 10 iterations.
In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result in several iterations of calls to these hooks. However if an application needs more than the default 10 iterations to stabilize then you should investigate what is causing the model to continuously change during the `$onChanges` hook execution.
Increasing the TTL could have performance implications, so you should not change it without proper justification.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| limit | `number` | The number of `$onChanges` hook iterations. |
#### Returns
| | |
| --- | --- |
| `number``object` | the current limit (or `this` if called as a setter for chaining) |
* ### commentDirectivesEnabled(enabled);
It indicates to the compiler whether or not directives on comments should be compiled. Defaults to `true`.
Calling this function with false disables the compilation of directives on comments for the whole application. This results in a compilation performance gain, as the compiler doesn't have to check comments when looking for directives. This should however only be used if you are sure that no comment directives are used in the application (including any 3rd party directives).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| enabled | `boolean` | `false` if the compiler may ignore directives on comments |
#### Returns
| | |
| --- | --- |
| `boolean``object` | the current value (or `this` if called as a setter for chaining) |
* ### cssClassDirectivesEnabled(enabled);
It indicates to the compiler whether or not directives on element classes should be compiled. Defaults to `true`.
Calling this function with false disables the compilation of directives on element classes for the whole application. This results in a compilation performance gain, as the compiler doesn't have to check element classes when looking for directives. This should however only be used if you are sure that no class directives are used in the application (including any 3rd party directives).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| enabled | `boolean` | `false` if the compiler may ignore directives on element classes |
#### Returns
| | |
| --- | --- |
| `boolean``object` | the current value (or `this` if called as a setter for chaining) |
* ### addPropertySecurityContext(elementName, propertyName, ctx);
Defines the security context for DOM properties bound by ng-prop-\*.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| elementName | `string` | The element name or '\*' to match any element. |
| propertyName | `string` | The DOM property name. |
| ctx | `string` | The [`$sce`](../service/%24sce) security context in which this value is safe for use, e.g. `$sce.URL` |
#### Returns
| | |
| --- | --- |
| `object` | `this` for chaining |
angularjs
Improve this Doc View Source $templateRequestProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/templateRequest.js?message=docs(%24templateRequestProvider)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/templateRequest.js#L5) $templateRequestProvider
====================================================================================================================================================================================================================================================================================================
1. [$templateRequest](../service/%24templaterequest)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Used to configure the options passed to the [`$http`](../service/%24http) service when making a template request.
For example, it can be used for specifying the "Accept" header that is sent to the server, when requesting a template.
Methods
-------
* ### httpOptions([value]);
The options to be passed to the [`$http`](../service/%24http) service when making the request. You can use this to override options such as the "Accept" header for template requests.
The [`$templateRequest`](../service/%24templaterequest) will set the `cache` and the `transformResponse` properties of the options if not overridden here.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `string` | new value for the [`$http`](../service/%24http) options. |
#### Returns
| | |
| --- | --- |
| `string``self` | Returns the [`$http`](../service/%24http) options when used as getter and self if used as setter. |
angularjs
Improve this Doc View Source $sceDelegateProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/sce.js?message=docs(%24sceDelegateProvider)%3A%20describe%20your%20change...#L127) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/sce.js#L127) $sceDelegateProvider
========================================================================================================================================================================================================================================================================
1. [$sceDelegate](../service/%24scedelegate)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `$sceDelegateProvider` provider allows developers to configure the [$sceDelegate service](../service/%24scedelegate), used as a delegate for [Strict Contextual Escaping (SCE)](../service/%24sce).
The `$sceDelegateProvider` allows one to get/set the `trustedResourceUrlList` and `bannedResourceUrlList` used to ensure that the URLs used for sourcing AngularJS templates and other script-running URLs are safe (all places that use the `$sce.RESOURCE_URL` context). See [$sceDelegateProvider.trustedResourceUrlList](%24scedelegateprovider#trustedResourceUrlList.html) and [$sceDelegateProvider.bannedResourceUrlList](%24scedelegateprovider#bannedResourceUrlList.html),
For the general details about this service in AngularJS, read the main page for [Strict Contextual Escaping (SCE)](../service/%24sce).
**Example**: Consider the following case.
* your app is hosted at url `http://myapp.example.com/`
* but some of your templates are hosted on other domains you control such as `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc.
* and you have an open redirect at `http://myapp.example.com/clickThru?...`.
Here is what a secure configuration for this scenario might look like:
```
angular.module('myApp', []).config(function($sceDelegateProvider) {
$sceDelegateProvider.trustedResourceUrlList([
// Allow same origin resource loads.
'self',
// Allow loading from our assets domain. Notice the difference between * and **.
'http://srv*.assets.example.com/**'
]);
// The banned resource URL list overrides the trusted resource URL list so the open redirect
// here is blocked.
$sceDelegateProvider.bannedResourceUrlList([
'http://myapp.example.com/clickThru**'
]);
});
```
Note that an empty trusted resource URL list will block every resource URL from being loaded, and will require you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates requested by [$templateRequest](../service/%24templaterequest) that are present in [$templateCache](../service/%24templatecache) will not go through this check. If you have a mechanism to populate your templates in that cache at config time, then it is a good idea to remove 'self' from the trusted resource URL lsit. This helps to mitigate the security impact of certain types of issues, like for instance attacker-controlled `ng-includes`.
Methods
-------
* ### trustedResourceUrlList([trustedResourceUrlList]);
Sets/Gets the list trusted of resource URLs.
The **default value** when no `trustedResourceUrlList` has been explicitly set is `['self']` allowing only same origin resource requests.
**Note:** the default `trustedResourceUrlList` of 'self' is not recommended if your app shares its origin with other apps! It is a good idea to limit it to only your application's directory.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| trustedResourceUrlList *(optional)* | `Array` | When provided, replaces the trustedResourceUrlList with the value provided. This must be an array or null. A snapshot of this array is used so further changes to the array are ignored. Follow [this link](../service/%24sce#resourceUrlPatternItem.html) for a description of the items allowed in this array. |
#### Returns
| | |
| --- | --- |
| `Array` | The currently set trusted resource URL array. |
* ### resourceUrlWhitelist();
**Deprecated:** (since 1.8.1) This method is deprecated. Use [trustedResourceUrlList](%24scedelegateprovider#trustedResourceUrlList.html) instead.
* ### bannedResourceUrlList([bannedResourceUrlList]);
Sets/Gets the `bannedResourceUrlList` of trusted resource URLs.
The **default value** when no trusted resource URL list has been explicitly set is the empty array (i.e. there is no `bannedResourceUrlList`.)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| bannedResourceUrlList *(optional)* | `Array` | When provided, replaces the `bannedResourceUrlList` with the value provided. This must be an array or null. A snapshot of this array is used so further changes to the array are ignored.
Follow [this link](../service/%24sce#resourceUrlPatternItem.html) for a description of the items allowed in this array.
The typical usage for the `bannedResourceUrlList` is to **block [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as these would otherwise be trusted but actually return content from the redirected domain.
Finally, **the banned resource URL list overrides the trusted resource URL list** and has the final say. |
#### Returns
| | |
| --- | --- |
| `Array` | The currently set `bannedResourceUrlList` array. |
* ### resourceUrlBlacklist();
**Deprecated:** (since 1.8.1) This method is deprecated. Use [bannedResourceUrlList](%24scedelegateprovider#bannedResourceUrlList.html) instead.
| programming_docs |
angularjs
Improve this Doc View Source $interpolateProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/interpolate.js?message=docs(%24interpolateProvider)%3A%20describe%20your%20change...#L15) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/interpolate.js#L15) $interpolateProvider
======================================================================================================================================================================================================================================================================================
1. [$interpolate](../service/%24interpolate)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
This feature is sometimes used to mix different markup languages, e.g. to wrap an AngularJS template within a Python Jinja template (or any other template language). Mixing templating languages is **very dangerous**. The embedding template language will not safely escape AngularJS expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS) security bugs! Methods
-------
* ### startSymbol([value]);
Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `string` | new value to set the starting symbol to. |
#### Returns
| | |
| --- | --- |
| `string``self` | Returns the symbol when used as getter and self if used as setter. |
* ### endSymbol([value]);
Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `string` | new value to set the ending symbol to. |
#### Returns
| | |
| --- | --- |
| `string``self` | Returns the symbol when used as getter and self if used as setter. |
Example
-------
angularjs
Improve this Doc View Source $qProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/q.js?message=docs(%24qProvider)%3A%20describe%20your%20change...#L220) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/q.js#L220) $qProvider
================================================================================================================================================================================================================================================
1. [$q](../service/%24q)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Methods
-------
* ### errorOnUnhandledRejections([value]);
Retrieves or overrides whether to generate an error when a rejected promise is not handled. This feature is enabled by default.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `boolean` | Whether to generate an error when a rejected promise is not handled. |
#### Returns
| | |
| --- | --- |
| `boolean``ng.$qProvider` | Current value when called without a new value or self for chaining otherwise. |
angularjs
Improve this Doc View Source $parseProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/parse.js?message=docs(%24parseProvider)%3A%20describe%20your%20change...#L1717) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/parse.js#L1717) $parseProvider
==================================================================================================================================================================================================================================================================
1. [$parse](../service/%24parse)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`$parseProvider` can be used for configuring the default behavior of the [$parse](../service/%24parse) service.
Methods
-------
* ### addLiteral(literalName, literalValue);
Configure $parse service to add literal values that will be present as literal at expressions.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| literalName | `string` | Token for the literal value. The literal name value must be a valid literal name. |
| literalValue | `*` | Value for this literal. All literal values must be primitives or `undefined`. |
* ### setIdentifierFns([identifierStart], [identifierContinue]);
Allows defining the set of characters that are allowed in AngularJS expressions. The function `identifierStart` will get called to know if a given character is a valid character to be the first character for an identifier. The function `identifierContinue` will get called to know if a given character is a valid character to be a follow-up identifier character. The functions `identifierStart` and `identifierContinue` will receive as arguments the single character to be identifier and the character code point. These arguments will be `string` and `numeric`. Keep in mind that the `string` parameter can be two characters long depending on the character representation. It is expected for the function to return `true` or `false`, whether that character is allowed or not.
Since this function will be called extensively, keep the implementation of these functions fast, as the performance of these functions have a direct impact on the expressions parsing speed.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| identifierStart *(optional)* | `function=` | The function that will decide whether the given character is a valid identifier start character. |
| identifierContinue *(optional)* | `function=` | The function that will decide whether the given character is a valid identifier continue character. |
angularjs
Improve this Doc View Source $rootScopeProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/rootScope.js?message=docs(%24rootScopeProvider)%3A%20describe%20your%20change...#L29) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/rootScope.js#L29) $rootScopeProvider
==============================================================================================================================================================================================================================================================================
1. [$rootScope](../service/%24rootscope)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Provider for the $rootScope service.
Methods
-------
* ### digestTtl(limit);
Sets the number of `$digest` iterations the scope should attempt to execute before giving up and assuming that the model is unstable.
The current default is 10 iterations.
In complex applications it's possible that the dependencies between `$watch`s will result in several digest iterations. However if an application needs more than the default 10 digest iterations for its model to stabilize then you should investigate what is causing the model to continuously change during the digest.
Increasing the TTL could have performance implications, so you should not change it without proper justification.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| limit | `number` | The number of digest iterations. |
angularjs
Improve this Doc View Source $httpProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/http.js?message=docs(%24httpProvider)%3A%20describe%20your%20change...#L257) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/http.js#L257) $httpProvider
============================================================================================================================================================================================================================================================
1. [$http](../service/%24http)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use `$httpProvider` to change the default behavior of the [$http](../service/%24http) service.
Methods
-------
* ### useApplyAsync([value]);
Configure $http service to combine processing of multiple http responses received at around the same time via [$rootScope.$applyAsync](../type/%24rootscope.scope#%24applyAsync.html). This can result in significant performance improvement for bigger applications that make many HTTP requests concurrently (common during application bootstrap).
Defaults to false. If no value is specified, returns the current configured value.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `boolean` | If true, when requests are loaded, they will schedule a deferred "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window to load and share the same digest cycle. |
#### Returns
| | |
| --- | --- |
| `boolean``Object` | If a value is specified, returns the $httpProvider for chaining. otherwise, returns the current configured value. |
Properties
----------
* ### defaults
| | |
| --- | --- |
| | Object containing default values for all [$http](../service/%24http) requests.
+ **`defaults.cache`** - {boolean|Object} - A boolean value or object created with [`$cacheFactory`](../service/%24cachefactory) to enable or disable caching of HTTP responses by default. See [$http Caching](../service/%24http#caching.html) for more information.
+ **`defaults.headers`** - {Object} - Default headers for all $http requests. Refer to [$http](../service/%24http#setting-http-headers.html) for documentation on setting default headers.
- **`defaults.headers.common`**
- **`defaults.headers.post`**
- **`defaults.headers.put`**
- **`defaults.headers.patch`**
+ **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the [`$jsonpCallbacks`](../service/%24jsonpcallbacks) service. Defaults to `'callback'`.
+ **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function used to the prepare string representation of request parameters (specified as an object). If specified as string, it is interpreted as a function registered with the [$injector](../../auto/service/%24injector). Defaults to [$httpParamSerializer](../service/%24httpparamserializer).
+ **`defaults.transformRequest`** - `{Array<function(data, headersGetter)>|function(data, headersGetter)}` - An array of functions (or a single function) which are applied to the request data. By default, this is an array with one request transformation function:
- If the `data` property of the request configuration object contains an object, serialize it into JSON format.
+ **`defaults.transformResponse`** - `{Array<function(data, headersGetter, status)>|function(data, headersGetter, status)}` - An array of functions (or a single function) which are applied to the response data. By default, this is an array which applies one response transformation function that does two things:
- If XSRF prefix is detected, strip it (see [Security Considerations in the $http docs](../service/%24http#security-considerations.html)).
- If the `Content-Type` is `application/json` or the response looks like JSON, deserialize it using a JSON parser.
+ **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. Defaults value is `'XSRF-TOKEN'`.
+ **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the XSRF token. Defaults value is `'X-XSRF-TOKEN'`. |
* ### interceptors
| | |
| --- | --- |
| | Array containing service factories for all synchronous or asynchronous [$http](../service/%24http) pre-processing of request or postprocessing of responses. These service factories are ordered by request, i.e. they are applied in the same order as the array, on request, but reverse order, on response. [Interceptors detailed info](../service/%24http#interceptors.html) |
* ### xsrfTrustedOrigins
| | |
| --- | --- |
| | Array containing URLs whose origins are trusted to receive the XSRF token. See the [Security Considerations](../service/%24http#security-considerations.html) sections for more details on XSRF. **Note:** An "origin" consists of the [URI scheme](https://en.wikipedia.org/wiki/URI_scheme), the [hostname](https://en.wikipedia.org/wiki/Hostname) and the [port number](https://en.wikipedia.org/wiki/Port_(computer_networking). For `http:` and `https:`, the port number can be omitted if using th default ports (80 and 443 respectively). Examples: `http://example.com`, `https://api.example.com:9876` It is not possible to trust specific URLs/paths. The `path`, `query` and `fragment` parts of a URL will be ignored. For example, `https://foo.com/path/bar?query=baz#fragment` will be treated as `https://foo.com`, meaning that **all** requests to URLs starting with `https://foo.com/` will include the XSRF token. |
* ### xsrfWhitelistedOrigins
| | |
| --- | --- |
| | |
**Deprecated:** (since 1.8.1) This property is deprecated. Use [xsrfTrustedOrigins](%24httpprovider#xsrfTrustedOrigins.html) instead.
angularjs
Improve this Doc View Source $locationProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/location.js?message=docs(%24locationProvider)%3A%20describe%20your%20change...#L721) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/location.js#L721) $locationProvider
============================================================================================================================================================================================================================================================================
1. [$location](../service/%24location)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use the `$locationProvider` to configure how the application deep linking paths are stored.
Methods
-------
* ### hashPrefix([prefix]);
The default value for the prefix is `'!'`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| prefix *(optional)* | `string` | Prefix for hash part (containing path and search) |
#### Returns
| | |
| --- | --- |
| `*` | current value if used as getter or itself (chaining) if used as setter |
* ### html5Mode([mode]);
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| mode *(optional)* | `boolean``Object` | If boolean, sets `html5Mode.enabled` to value. If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported properties:
+ **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to change urls where supported. Will fall back to hash-prefixed paths in browsers that do not support `pushState`.
+ **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies whether or not a tag is required to be present. If `enabled` and `requireBase` are true, and a base tag is not present, an error will be thrown when `$location` is injected. See the [$location guide for more information](../../../guide/%24location)
+ **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled, enables/disables URL rewriting for relative links. If set to a string, URL rewriting will only happen on links with an attribute that matches the given string. For example, if set to `'internal-link'`, then the URL will only be rewritten for `<a internal-link>` links. Note that [attribute name normalization](../../../guide/directive#normalization.html) does not apply here, so `'internalLink'` will **not** match `'internal-link'`. |
#### Returns
| | |
| --- | --- |
| `Object` | html5Mode object if used as getter or itself (chaining) if used as setter |
angularjs
Improve this Doc View Source $sceProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/sce.js?message=docs(%24sceProvider)%3A%20describe%20your%20change...#L508) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/sce.js#L508) $sceProvider
========================================================================================================================================================================================================================================================
1. [$sce](../service/%24sce)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The $sceProvider provider allows developers to configure the [$sce](../service/%24sce) service.
* enable/disable Strict Contextual Escaping (SCE) in a module
* override the default implementation with a custom delegate
Read more about [Strict Contextual Escaping (SCE)](../service/%24sce).
Methods
-------
* ### enabled([value]);
Enables/disables SCE and returns the current value.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `boolean` | If provided, then enables/disables SCE application-wide. |
#### Returns
| | |
| --- | --- |
| `boolean` | True if SCE is enabled, false otherwise. |
angularjs
Improve this Doc View Source $animateProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/animate.js?message=docs(%24animateProvider)%3A%20describe%20your%20change...#L168) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/animate.js#L168) $animateProvider
========================================================================================================================================================================================================================================================================
1. [$animate](../service/%24animate)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Default implementation of $animate that doesn't perform any animations, instead just synchronously performs DOM updates and resolves the returned runner promise.
In order to enable animations the `ngAnimate` module has to be loaded.
To see the functional implementation check out `src/ngAnimate/animate.js`.
Methods
-------
* ### register(name, factory);
Registers a new injectable animation factory function. The factory function produces the animation object which contains callback functions for each event that is expected to be animated.
+ `eventFn`: `function(element, ... , doneFunction, options)` The element to animate, the `doneFunction` and the options fed into the animation. Depending on the type of animation additional arguments will be injected into the animation function. The list below explains the function signatures for the different animation methods:
+ setClass: function(element, addedClasses, removedClasses, doneFunction, options)
+ addClass: function(element, addedClasses, doneFunction, options)
+ removeClass: function(element, removedClasses, doneFunction, options)
+ enter, leave, move: function(element, doneFunction, options)
+ animate: function(element, fromStyles, toStyles, doneFunction, options)
Make sure to trigger the `doneFunction` once the animation is fully complete.
```
return {
//enter, leave, move signature
eventFn : function(element, done, options) {
//code to run the animation
//once complete, then run done()
return function endFunction(wasCancelled) {
//code to cancel the animation
}
}
}
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the animation (this is what the class-based CSS value will be compared to). |
| factory | `Function` | The factory function that will be executed to return the animation object. |
* ### customFilter([filterFn]);
Sets and/or returns the custom filter function that is used to "filter" animations, i.e. determine if an animation is allowed or not. When no filter is specified (the default), no animation will be blocked. Setting the `customFilter` value will only allow animations for which the filter function's return value is truthy.
This allows to easily create arbitrarily complex rules for filtering animations, such as allowing specific events only, or enabling animations on specific subtrees of the DOM, etc. Filtering animations can also boost performance for low-powered devices, as well as applications containing a lot of structural operations.
**Best Practice:** Keep the filtering function as lean as possible, because it will be called for each DOM action (e.g. insertion, removal, class change) performed by "animation-aware" directives. See [here](../../../guide/animations#which-directives-support-animations-.html) for a list of built-in directives that support animations. Performing computationally expensive or time-consuming operations on each call of the filtering function can make your animations sluggish. **Note:** If present, `customFilter` will be checked before [classNameFilter](%24animateprovider#classNameFilter.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| filterFn *(optional)* | `Function=` | The filter function which will be used to filter all animations. If a falsy value is returned, no animation will be performed. The function will be called with the following arguments:
+ **node** `{DOMElement}` - The DOM element to be animated.
+ **event** `{String}` - The name of the animation event (e.g. `enter`, `leave`, `addClass` etc).
+ **options** `{Object}` - A collection of options/styles used for the animation. |
#### Returns
| | |
| --- | --- |
| `Function` | The current filter function or `null` if there is none set. |
* ### classNameFilter([expression]);
Sets and/or returns the CSS class regular expression that is checked when performing an animation. Upon bootstrap the classNameFilter value is not set at all and will therefore enable $animate to attempt to perform an animation on any element that is triggered. When setting the `classNameFilter` value, animations will only be performed on elements that successfully match the filter expression. This in turn can boost performance for low-powered devices as well as applications containing a lot of structural operations.
**Note:** If present, `classNameFilter` will be checked after [customFilter](%24animateprovider#customFilter.html). If `customFilter` is present and returns false, `classNameFilter` will not be checked.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression *(optional)* | `RegExp` | The className expression which will be checked against all animations |
#### Returns
| | |
| --- | --- |
| `RegExp` | The current CSS className expression value. If null then there is no expression value |
| programming_docs |
angularjs
Improve this Doc View Source $anchorScrollProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/anchorScroll.js?message=docs(%24anchorScrollProvider)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/anchorScroll.js#L3) $anchorScrollProvider
========================================================================================================================================================================================================================================================================================
1. [$anchorScroll](../service/%24anchorscroll)
2. provider in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use `$anchorScrollProvider` to disable automatic scrolling whenever [$location.hash()](../service/%24location#hash.html) changes.
Methods
-------
* ### disableAutoScrolling();
By default, [$anchorScroll()](../service/%24anchorscroll) will automatically detect changes to [$location.hash()](../service/%24location#hash.html) and scroll to the element matching the new hash.
Use this method to disable automatic scrolling.
If automatic scrolling is disabled, one must explicitly call [$anchorScroll()](../service/%24anchorscroll) in order to scroll to the element related to the current hash.
angularjs
Improve this Doc View Source angular.isDate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isDate)%3A%20describe%20your%20change...#L592) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L592) angular.isDate
============================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a value is a date.
Usage
-----
`angular.isDate(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is a `Date`. |
angularjs
Improve this Doc View Source angular.errorHandlingConfig
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/minErr.js?message=docs(angular.errorHandlingConfig)%3A%20describe%20your%20change...#L14) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/minErr.js#L14) angular.errorHandlingConfig
==================================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Configure several aspects of error handling in AngularJS if used as a setter or return the current configuration if used as a getter. The following options are supported:
* **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
Omitted or undefined options will leave the corresponding configuration values unchanged.
Usage
-----
`angular.errorHandlingConfig([config]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| config *(optional)* | `Object` | The configuration object. May only contain the options that need to be updated. Supported keys:* `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a non-positive or non-numeric value, removes the max depth limit. Default: 5
* `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will contain the parameters of the thrown error. Disabling the parameters can be useful if the generated error url is very long. Default: true. When used without argument, it returns the current value.
|
angularjs
Improve this Doc View Source angular.merge
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.merge)%3A%20describe%20your%20change...#L384) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L384) angular.merge
==========================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
**Deprecated:** (since 1.6.5) This function is deprecated, but will not be removed in the 1.x lifecycle. There are edge cases (see [known issues](angular.merge#known-issues.html)) that are not supported by this function. We suggest using another, similar library for all-purpose merging, such as [lodash's merge()](https://lodash.com/docs/4.17.4#merge).
Overview
--------
Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s) to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.
Unlike [extend()](angular.extend), `merge()` recursively descends into object properties of source objects, performing a deep copy.
Known Issues
------------
This is a list of (known) object types that are not handled correctly by this function:
* [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob)
* [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
* [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient)
* AngularJS [scopes](../type/%24rootscope.scope);
`angular.merge` also does not support merging objects with circular references.
Usage
-----
`angular.merge(dst, src);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| dst | `Object` | Destination object. |
| src | `Object` | Source object(s). |
### Returns
| | |
| --- | --- |
| `Object` | Reference to `dst`. |
angularjs
Improve this Doc View Source angular.isArray
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isArray)%3A%20describe%20your%20change...#L609) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L609) angular.isArray
==============================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is an `Array`.
Usage
-----
`angular.isArray(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is an `Array`. |
angularjs
Improve this Doc View Source angular.bind
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.bind)%3A%20describe%20your%20change...#L1224) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1224) angular.bind
==========================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for `fn`). You can supply optional `args` that are prebound to the function. This feature is also known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
Usage
-----
`angular.bind(self, fn, args);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| self | `Object` | Context which `fn` should be evaluated in. |
| fn | `function()` | Function to be bound. |
| args | `*` | Optional arguments to be prebound to the `fn` function call. |
### Returns
| | |
| --- | --- |
| `function()` | Function that wraps the `fn` with all the specified bindings. |
angularjs
Improve this Doc View Source angular.isUndefined
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isUndefined)%3A%20describe%20your%20change...#L497) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L497) angular.isUndefined
======================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is undefined.
Usage
-----
`angular.isUndefined(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is undefined. |
angularjs
Improve this Doc View Source angular.element
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/jqLite.js?message=docs(angular.element)%3A%20describe%20your%20change...#L24) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/jqLite.js#L24) angular.element
==========================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
If jQuery is available, `angular.element` is an alias for the [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or **jqLite**.
jqLite is a tiny, API-compatible subset of jQuery that allows AngularJS to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most commonly needed functionality with the goal of having a very small footprint.
To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the [`ngJq`](../directive/ngjq) directive to specify that jqlite should be used over jQuery, or to use a specific version of jQuery if multiple versions exist on the page.
**Note:** All element references in AngularJS are always wrapped with jQuery or jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.
**Note:** Keep in mind that this function will not find elements by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)` or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`. AngularJS's jqLite
------------------
jqLite provides only the following jQuery methods:
* [`addClass()`](http://api.jquery.com/addClass/) - Does not support a function as first argument
* [`after()`](http://api.jquery.com/after/)
* [`append()`](http://api.jquery.com/append/) - Contrary to jQuery, this doesn't clone elements so will not work correctly when invoked on a jqLite object containing more than one DOM node
* [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
* [`bind()`](http://api.jquery.com/bind/) (*deprecated*, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData
* [`children()`](http://api.jquery.com/children/) - Does not support selectors
* [`clone()`](http://api.jquery.com/clone/)
* [`contents()`](http://api.jquery.com/contents/)
* [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.
* [`data()`](http://api.jquery.com/data/)
* [`detach()`](http://api.jquery.com/detach/)
* [`empty()`](http://api.jquery.com/empty/)
* [`eq()`](http://api.jquery.com/eq/)
* [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
* [`hasClass()`](http://api.jquery.com/hasClass/)
* [`html()`](http://api.jquery.com/html/)
* [`next()`](http://api.jquery.com/next/) - Does not support selectors
* [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
* [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter
* [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
* [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
* [`prepend()`](http://api.jquery.com/prepend/)
* [`prop()`](http://api.jquery.com/prop/)
* [`ready()`](http://api.jquery.com/ready/) (*deprecated*, use `angular.element(callback)` instead of `angular.element(document).ready(callback)`)
* [`remove()`](http://api.jquery.com/remove/)
* [`removeAttr()`](http://api.jquery.com/removeAttr/) - Does not support multiple attributes
* [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument
* [`removeData()`](http://api.jquery.com/removeData/)
* [`replaceWith()`](http://api.jquery.com/replaceWith/)
* [`text()`](http://api.jquery.com/text/)
* [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument
* [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers
* [`unbind()`](http://api.jquery.com/unbind/) (*deprecated*, use [`off()`](http://api.jquery.com/off/)) - Does not support namespaces or event object as parameter
* [`val()`](http://api.jquery.com/val/)
* [`wrap()`](http://api.jquery.com/wrap/)
jqLite also provides a method restoring pre-1.8 insecure treatment of XHTML-like tags. This legacy behavior turns input like `<div /><span />` to `<div></div><span></span>` instead of `<div><span></span></div>` like version 1.8 & newer do. To restore it, invoke:
```
angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
```
Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details about the workarounds.
jQuery/jqLite Extras
--------------------
AngularJS also provides the following additional methods and events to both jQuery and jqLite:
### Events
* `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM element before it is removed.
### Methods
* `controller(name)` - retrieves the controller of the current element or its parent. By default retrieves controller associated with the `ngController` directive. If `name` is provided as camelCase directive name, then the controller for this directive will be retrieved (e.g. `'ngModel'`).
* `injector()` - retrieves the injector of the current element or its parent.
* `scope()` - retrieves the [scope](../type/%24rootscope.scope) of the current element or its parent. Requires [Debug Data](../../../guide/production#disabling-debug-data.html) to be enabled.
* `isolateScope()` - retrieves an isolate [scope](../type/%24rootscope.scope) if one is attached directly to the current element. This getter should be used only on elements that contain a directive which starts a new isolate scope. Calling `scope()` on this element always returns the original non-isolate scope. Requires [Debug Data](../../../guide/production#disabling-debug-data.html) to be enabled.
* `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top parent element is reached.
Known Issues
------------
You cannot spy on `angular.element` if you are using Jasmine version 1.x. See <https://github.com/angular/angular.js/issues/14251> for more information.
Usage
-----
`angular.element(element);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| element | `string``DOMElement` | HTML string or DOMElement to be wrapped into jQuery. |
### Returns
| | |
| --- | --- |
| `Object` | jQuery object. |
angularjs
Improve this Doc View Source angular.isNumber
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isNumber)%3A%20describe%20your%20change...#L571) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L571) angular.isNumber
================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is a `Number`.
This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`.
If you wish to exclude these then you can use the native [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite) method.
Usage
-----
`angular.isNumber(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is a `Number`. |
angularjs
Improve this Doc View Source angular.isElement
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isElement)%3A%20describe%20your%20change...#L737) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L737) angular.isElement
==================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is a DOM element (or wrapped jQuery element).
Usage
-----
`angular.isElement(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is a DOM element (or wrapped jQuery element). |
angularjs
Improve this Doc View Source angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement)%3A%20describe%20your%20change...#L1953) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1953) angular.UNSAFE\_restoreLegacyJqLiteXHTMLReplacement
=======================================================================================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Restores the pre-1.8 behavior of jqLite that turns XHTML-like strings like `<div /><span />` to `<div></div><span></span>` instead of `<div><span></span></div>`. The new behavior is a security fix. Thus, if you need to call this function, please try to adjust your code for this change and remove your use of this function as soon as possible.
Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details about the workarounds.
Usage
-----
`angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();`
| programming_docs |
angularjs
Improve this Doc View Source angular.module
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/loader.js?message=docs(angular.module)%3A%20describe%20your%20change...#L30) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/loader.js#L30) angular.module
========================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `angular.module` is a global place for creating, registering and retrieving AngularJS modules. All modules (AngularJS core or 3rd party) that should be available to an application must be registered using this mechanism.
Passing one argument retrieves an existing [`angular.Module`](../type/angular.module), whereas passing more than one argument creates a new [`angular.Module`](../type/angular.module)
Module
------
A module is a collection of services, directives, controllers, filters, and configuration information. `angular.module` is used to configure the [$injector](../../auto/service/%24injector).
```
// Create a new module
var myModule = angular.module('myModule', []);
// register a new service
myModule.value('appName', 'MyCoolApp');
// configure existing services inside initialization blocks.
myModule.config(['$locationProvider', function($locationProvider) {
// Configure existing providers
$locationProvider.hashPrefix('!');
}]);
```
Then you can create an injector and load your modules like this:
```
var injector = angular.injector(['ng', 'myModule'])
```
However it's more likely that you'll just use [ngApp](../directive/ngapp) or [`angular.bootstrap`](angular.bootstrap) to simplify this process for you.
Usage
-----
`angular.module(name, [requires], [configFn]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the module to create or retrieve. |
| requires *(optional)* | `!Array.<string>=` | If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. |
| configFn *(optional)* | `Function=` | Optional configuration function for the module. Same as [Module#config()](../type/angular.module#config.html). |
### Returns
| | |
| --- | --- |
| `angular.Module` | new module with the [`angular.Module`](../type/angular.module) api. |
angularjs
Improve this Doc View Source angular.isFunction
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isFunction)%3A%20describe%20your%20change...#L643) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L643) angular.isFunction
====================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is a `Function`.
Usage
-----
`angular.isFunction(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is a `Function`. |
angularjs
Improve this Doc View Source angular.identity
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.identity)%3A%20describe%20your%20change...#L458) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L458) angular.identity
================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A function that returns its first argument. This function is useful when writing code in the functional style.
```
function transformer(transformationFn, value) {
return (transformationFn || angular.identity)(value);
};
// E.g.
function getResult(fn, input) {
return (fn || angular.identity)(input);
};
getResult(function(n) { return n * 2; }, 21); // returns 42
getResult(null, 21); // returns 21
getResult(undefined, 21); // returns 21
```
Usage
-----
`angular.identity(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | to be returned. |
### Returns
| | |
| --- | --- |
| `*` | the value passed in. |
angularjs
Improve this Doc View Source angular.equals
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.equals)%3A%20describe%20your%20change...#L1021) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1021) angular.equals
==============================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and objects.
Two objects or values are considered equivalent if at least one of the following is true:
* Both objects or values pass `===` comparison.
* Both objects or values are of the same type and all of their properties are equal by comparing them with `angular.equals`.
* Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
* Both values represent the same regular expression (In JavaScript, /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual representation matches).
During a property comparison, properties of `function` type and properties with names that begin with `$` are ignored.
Scope and DOMWindow objects are being compared only by identify (`===`).
Usage
-----
`angular.equals(o1, o2);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| o1 | `*` | Object or value to compare. |
| o2 | `*` | Object or value to compare. |
### Returns
| | |
| --- | --- |
| `boolean` | True if arguments are equal. |
Example
-------
angularjs
Improve this Doc View Source angular.injector
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/auto/injector.js?message=docs(angular.injector)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/auto/injector.js#L3) angular.injector
========================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Creates an injector object that can be used for retrieving services as well as for dependency injection (see [dependency injection](../../../guide/di)).
Usage
-----
`angular.injector(modules, [strictDi]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| modules | `Array.<string|Function>` | A list of module functions or their aliases. See [`angular.module`](angular.module). The `ng` module must be explicitly added. |
| strictDi *(optional)* | `boolean` | Whether the injector should be in strict mode, which disallows argument name annotation inference. *(default: false)* |
### Returns
| | |
| --- | --- |
| `injector` | Injector object. See [$injector](../../auto/service/%24injector). |
Example
-------
Typical usage
```
// create an injector
var $injector = angular.injector(['ng']);
// use the injector to kick off your application
// use the type inference to auto inject arguments, or use implicit injection
$injector.invoke(function($rootScope, $compile, $document) {
$compile($document)($rootScope);
$rootScope.$digest();
});
```
Sometimes you want to get access to the injector of a currently running AngularJS app from outside AngularJS. Perhaps, you want to inject and compile some markup after the application has been bootstrapped. You can do this using the extra `injector()` added to JQuery/jqLite elements. See [`angular.element`](angular.element).
*This is fairly rare but could be the case if a third party library is injecting the markup.*
In the following example a new block of HTML containing a `ng-controller` directive is added to the end of the document body by JQuery. We then compile and link it into the current AngularJS scope.
```
var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
$(document.body).append($div);
angular.element(document).injector().invoke(function($compile) {
var scope = angular.element($div).scope();
$compile($div)(scope);
});
```
angularjs
Improve this Doc View Source angular.forEach
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.forEach)%3A%20describe%20your%20change...#L201) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L201) angular.forEach
==============================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Invokes the `iterator` function once for each item in `obj` collection, which can be either an object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value` is the value of an object property or an array element, `key` is the object property key or array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
It is worth noting that `.forEach` does not iterate over inherited properties because it filters using the `hasOwnProperty` method.
Unlike ES262's [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18), providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just return the value provided.
```
var values = {name: 'misko', gender: 'male'};
var log = [];
angular.forEach(values, function(value, key) {
this.push(key + ': ' + value);
}, log);
expect(log).toEqual(['name: misko', 'gender: male']);
```
Usage
-----
`angular.forEach(obj, iterator, [context]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| obj | `Object``Array` | Object to iterate over. |
| iterator | `Function` | Iterator function. |
| context *(optional)* | `Object` | Object to become context (`this`) for the iterator function. |
### Returns
| | |
| --- | --- |
| `Object``Array` | Reference to `obj`. |
angularjs
Improve this Doc View Source angular.fromJson
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.fromJson)%3A%20describe%20your%20change...#L1324) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1324) angular.fromJson
==================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Deserializes a JSON string.
Usage
-----
`angular.fromJson(json);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| json | `string` | JSON string to deserialize. |
### Returns
| | |
| --- | --- |
| `Object``Array``string``number` | Deserialized JSON string. |
angularjs
Improve this Doc View Source angular.reloadWithDebugInfo
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.reloadWithDebugInfo)%3A%20describe%20your%20change...#L1861) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1861) angular.reloadWithDebugInfo
========================================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use this function to reload the current application with debug information turned on. This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
See [`$compileProvider`](../provider/%24compileprovider#debugInfoEnabled.html) for more.
angularjs
Improve this Doc View Source angular.extend
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.extend)%3A%20describe%20your%20change...#L361) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L361) angular.extend
============================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.
**Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use [`angular.merge`](angular.merge) for this.
Usage
-----
`angular.extend(dst, src);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| dst | `Object` | Destination object. |
| src | `Object` | Source object(s). |
### Returns
| | |
| --- | --- |
| `Object` | Reference to `dst`. |
angularjs
Improve this Doc View Source angular.isObject
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isObject)%3A%20describe%20your%20change...#L527) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L527) angular.isObject
================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not considered to be objects. Note that JavaScript arrays are objects.
Usage
-----
`angular.isObject(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is an `Object` but not `null`. |
angularjs
Improve this Doc View Source angular.copy
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.copy)%3A%20describe%20your%20change...#L784) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L784) angular.copy
========================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Creates a deep copy of `source`, which should be an object or an array. This functions is used internally, mostly in the change-detection code. It is not intended as an all-purpose copy function, and has several limitations (see below).
* If no destination is supplied, a copy of the object or array is created.
* If a destination is provided, all of its elements (for arrays) or properties (for objects) are deleted and then all elements/properties from the source are copied to it.
* If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
* If `source` is identical to `destination` an exception will be thrown.
Only enumerable properties are taken into account. Non-enumerable properties (both on `source` and on `destination`) will be ignored. `angular.copy` does not check if destination and source are of the same type. It's the developer's responsibility to make sure they are compatible. Known Issues
------------
This is a non-exhaustive list of object types / features that are not handled correctly by `angular.copy`. Note that since this functions is used by the change detection code, this means binding or watching objects of these types (or that include these types) might not work correctly.
* [`File`](https://developer.mozilla.org/docs/Web/API/File)
* [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)
* [`ImageData`](https://developer.mozilla.org/docs/Web/API/ImageData)
* [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
* [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)
* [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
* [`getter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/ [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)
Usage
-----
`angular.copy(source, [destination]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| source | `*` | The source that will be used to make a copy. Can be any type, including primitives, `null`, and `undefined`. |
| destination *(optional)* | `Object``Array` | Destination into which the source is copied. If provided, must be of the same type as `source`. |
### Returns
| | |
| --- | --- |
| `*` | The copy or updated `destination`, if `destination` was specified. |
Example
-------
angularjs
Improve this Doc View Source angular.isString
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isString)%3A%20describe%20your%20change...#L556) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L556) angular.isString
================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is a `String`.
Usage
-----
`angular.isString(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is a `String`. |
angularjs
Improve this Doc View Source angular.isDefined
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.isDefined)%3A%20describe%20your%20change...#L512) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L512) angular.isDefined
==================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Determines if a reference is defined.
Usage
-----
`angular.isDefined(value);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Reference to check. |
### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is defined. |
| programming_docs |
angularjs
Improve this Doc View Source angular.toJson
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.toJson)%3A%20describe%20your%20change...#L1279) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1279) angular.toJson
==============================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Serializes input into a JSON-formatted string. Properties with leading $$ characters will be stripped since AngularJS uses this notation internally.
Known Issues
------------
The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date` object with an invalid date value. The only reliable way to prevent this is to monkeypatch the `Date.prototype.toJSON` method as follows:
```
var _DatetoJSON = Date.prototype.toJSON;
Date.prototype.toJSON = function() {
try {
return _DatetoJSON.call(this);
} catch(e) {
if (e instanceof RangeError) {
return null;
}
throw e;
}
};
```
See <https://github.com/angular/angular.js/pull/14221> for more information.
Usage
-----
`angular.toJson(obj, pretty);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| obj | `Object``Array``Date``string``number``boolean` | Input to be serialized into JSON. |
| pretty *(optional)* | `boolean``number` | If set to true, the JSON output will contain newlines and whitespace. If set to an integer, the JSON output will contain that many spaces per indentation. *(default: 2)* |
### Returns
| | |
| --- | --- |
| `string``undefined` | JSON-ified string representing `obj`. |
angularjs
Improve this Doc View Source angular.bootstrap
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.bootstrap)%3A%20describe%20your%20change...#L1734) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1734) angular.bootstrap
====================================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use this function to manually start up AngularJS application.
For more information, see the [Bootstrap guide](../../../guide/bootstrap).
AngularJS will detect if it has been loaded into the browser more than once and only allow the first loaded script to be bootstrapped and will report a warning to the browser console for each of the subsequent scripts. This prevents strange results in applications, where otherwise multiple instances of AngularJS try to work on the DOM.
**Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually. They must use [ngApp](../directive/ngapp). **Note:** Do not bootstrap the app on an element with a directive that uses [transclusion](../service/%24compile#transclusion.html), such as [`ngIf`](../directive/ngif), [`ngInclude`](../directive/nginclude) and [`ngView`](../../ngroute/directive/ngview). Doing this misplaces the app [`$rootElement`](../service/%24rootelement) and the app's [injector](../../auto/service/%24injector), causing animations to stop working and making the injector inaccessible from outside the app.
```
<!doctype html>
<html>
<body>
<div ng-controller="WelcomeController">
{{greeting}}
</div>
<script src="angular.js"></script>
<script>
var app = angular.module('demo', [])
.controller('WelcomeController', function($scope) {
$scope.greeting = 'Welcome!';
});
angular.bootstrap(document, ['demo']);
</script>
</body>
</html>
```
Usage
-----
`angular.bootstrap(element, [modules], [config]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | DOM element which is the root of AngularJS application. |
| modules *(optional)* | `Array<String|Function|Array>=` | an array of modules to load into the application. Each item in the array should be the name of a predefined module or a (DI annotated) function that will be invoked by the injector as a `config` block. See: [modules](angular.module) |
| config *(optional)* | `Object` | an object for defining configuration options for the application. The following keys are supported:* `strictDi` - disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to `false`.
|
### Returns
| | |
| --- | --- |
| `auto.$injector` | Returns the newly created injector for this app. |
angularjs
Improve this Doc View Source angular.noop
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(angular.noop)%3A%20describe%20your%20change...#L438) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L438) angular.noop
========================================================================================================================================================================================================================================================
1. function in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A function that performs no operations. This function can be useful when writing code in the functional style.
```
function foo(callback) {
var result = calculateResult();
(callback || angular.noop)(result);
}
```
Usage
-----
`angular.noop();`
angularjs
Improve this Doc View Source ngFocus
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngFocus)%3A%20describe%20your%20change...#L403) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L403) ngFocus
================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on focus event.
Note: As the `focus` event is executed synchronously when calling `input.focus()` AngularJS executes the expression using `scope.$evalAsync` if the event is fired during an `$apply` to ensure a consistent state.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<window, input, select, textarea, a
ng-focus="expression">
...
</window, input, select, textarea, a>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngFocus | `expression` | [Expression](../../../guide/expression) to evaluate upon focus. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
See [ngClick](ngclick)
angularjs
Improve this Doc View Source ngKeydown
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngKeydown)%3A%20describe%20your%20change...#L265) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L265) ngKeydown
====================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on keydown event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-keydown="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngKeydown | `expression` | [Expression](../../../guide/expression) to evaluate upon keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) |
Example
-------
angularjs
Improve this Doc View Source ngTransclude
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngTransclude.js?message=docs(ngTransclude)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngTransclude.js#L3) ngTransclude
========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name as the value of the `ng-transclude` or `ng-transclude-slot` attribute.
If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing content of this element will be removed before the transcluded content is inserted. If the transcluded content is empty (or only whitespace), the existing content is left intact. This lets you provide fallback content in the case that no transcluded content is provided.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-transclude
ng-transclude-slot="string">
...
</ng-transclude>
```
* as attribute:
```
<ANY
ng-transclude="string">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-transclude: string;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngTransclude | ngTranscludeSlot | `string` | the name of the slot to insert at this point. If this is not provided, is empty or its value is the same as the name of the attribute then the default slot is used. |
Examples
--------
### Basic transclusion
This example demonstrates basic transclusion of content into a component directive.
### Transclude fallback content
This example shows how to use `NgTransclude` with fallback content, that is displayed if no transcluded content is provided.
### Multi-slot transclusion
This example demonstrates using multi-slot transclusion in a component directive.
angularjs
Improve this Doc View Source select
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/select.js?message=docs(select)%3A%20describe%20your%20change...#L485) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/select.js#L485) select
====================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
HTML `select` element with AngularJS data-binding.
The `select` directive is used together with [`ngModel`](ngmodel) to provide data-binding between the scope and the `<select>` control (including setting default values). It also handles dynamic `<option>` elements, which can be added using the [`ngRepeat`](ngrepeat) or [`ngOptions`](ngoptions) directives.
When an item in the `<select>` menu is selected, the value of the selected option will be bound to the model identified by the `ngModel` directive. With static or repeated options, this is the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing. Value and textContent can be interpolated.
The [select controller](../type/select.selectcontroller) exposes utility functions that can be used to manipulate the select's behavior.
Matching model and option values
--------------------------------
In general, the match between the model and an option is evaluated by strictly comparing the model value against the value of the available options.
If you are setting the option value with the option's `value` attribute, or textContent, the value will always be a `string` which means that the model value must also be a string. Otherwise the `select` directive cannot match them correctly.
To bind the model to a non-string value, you can use one of the following strategies:
* the [`ngOptions`](ngoptions) directive ([`select`](select#using-select-with-ngoptions-and-setting-a-default-value.html))
* the [`ngValue`](ngvalue) directive, which allows arbitrary expressions to be option values ([Example](select#using-ngvalue-to-bind-the-model-to-an-array-of-objects.html))
* model $parsers / $formatters to convert the string value ([Example](select#binding-select-to-a-non-string-value-via-ngmodel-parsing-formatting.html))
If the viewValue of `ngModel` does not match any of the options, then the control will automatically add an "unknown" option, which it then removes when the mismatch is resolved.
Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can be nested into the `<select>` element. This element will then represent the `null` or "not selected" option. See example below for demonstration.
Choosing between ngRepeat and ngOptions
---------------------------------------
In many cases, `ngRepeat` can be used on `<option>` elements instead of [ngOptions](ngoptions) to achieve a similar result. However, `ngOptions` provides some benefits:
* more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the comprehension expression
* reduced memory consumption by not creating a new scope for each repeated instance
* increased render speed by creating the options in a documentFragment instead of individually
Specifically, select with repeated options slows down significantly starting at 2000 options in Chrome and Internet Explorer / Edge.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<select
ng-model="string"
[name="string"]
[multiple="string"]
[required="string"]
[ng-required="string"]
[ng-change="string"]
[ng-options="string"]
[ng-attr-size="string"]>
...
</select>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| multiple *(optional)* | `string` | Allows multiple options to be selected. The selected values will be bound to the model as an array. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds required attribute and required validation constraint to the element when the ngRequired expression evaluates to true. Use ngRequired instead of required when you want to data-bind to the required attribute. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when selected option(s) changes due to user interaction with the select element. |
| ngOptions *(optional)* | `string` | sets the options that the select is populated with and defines what is set on the model on selection. See [`ngOptions`](ngoptions). |
| ngAttrSize *(optional)* | `string` | sets the size of the select element dynamically. Uses the [ngAttr](../../../guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes.html) directive. |
Examples
--------
### Simple select elements with static options
### Using ngRepeat to generate select options
### Using ngValue to bind the model to an array of objects
### Using select with ngOptions and setting a default value
See the [ngOptions documentation](ngoptions) for more `ngOptions` usage examples.
### Binding select to a non-string value via ngModel parsing / formatting
angularjs
Improve this Doc View Source ngCut
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngCut)%3A%20describe%20your%20change...#L471) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L471) ngCut
============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on cut event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<window, input, select, textarea, a
ng-cut="expression">
...
</window, input, select, textarea, a>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngCut | `expression` | [Expression](../../../guide/expression) to evaluate upon cut. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngCloak
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngCloak.js?message=docs(ngCloak)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngCloak.js#L3) ngCloak
====================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngCloak` directive is used to prevent the AngularJS html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display.
The directive can be applied to the `<body>` element, but the preferred usage is to apply multiple `ngCloak` directives to small portions of the page to permit progressive rendering of the browser view.
`ngCloak` works in cooperation with the following css rule embedded within `angular.js` and `angular.min.js`. For CSP mode please add `angular-csp.css` to your html file (see [ngCsp](ngcsp)).
```
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
```
When this css rule is loaded by the browser, all html elements (including their children) that are tagged with the `ngCloak` directive are hidden. When AngularJS encounters this directive during the compilation of the template it deletes the `ngCloak` element attribute, making the compiled element visible.
For the best result, the `angular.js` script must be loaded in the head section of the html document; alternatively, the css rule above must be included in the external stylesheet of the application.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-cloak>
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-cloak"> ... </ANY>
```
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source ngModel
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngModel.js?message=docs(ngModel)%3A%20describe%20your%20change...#L1135) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngModel.js#L1135) ngModel
==========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a property on the scope using [NgModelController](../type/ngmodel.ngmodelcontroller), which is created and exposed by this directive.
`ngModel` is responsible for:
* Binding the view into the model, which other directives such as `input`, `textarea` or `select` require.
* Providing validation behavior (i.e. required, number, email, url).
* Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
* Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`, `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.
* Registering the control with its parent <form>.
Note: `ngModel` will try to bind to the property given by evaluating the expression on the current scope. If the property doesn't already exist on this scope, it will be created implicitly and added to the scope.
For best practices on using `ngModel`, see:
* [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
For basic examples, how to use `ngModel`, see:
* <input>
+ [text](../input/input%5Btext%5D)
+ [checkbox](../input/input%5Bcheckbox%5D)
+ [radio](../input/input%5Bradio%5D)
+ [number](../input/input%5Bnumber%5D)
+ [email](../input/input%5Bemail%5D)
+ [url](../input/input%5Burl%5D)
+ [date](../input/input%5Bdate%5D)
+ [datetime-local](../input/input%5Bdatetime-local%5D)
+ [time](../input/input%5Btime%5D)
+ [month](../input/input%5Bmonth%5D)
+ [week](../input/input%5Bweek%5D)
* <select>
* <textarea>
Complex Models (objects or collections)
---------------------------------------
By default, `ngModel` watches the model by reference, not value. This is important to know when binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the object or collection change, `ngModel` will not be notified and so the input will not be re-rendered.
The model must be assigned an entirely new object or collection before a re-rendering will occur.
Some directives have options that will cause them to use a custom `$watchCollection` on the model expression
* for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or if the select is given the `multiple` attribute.
The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the first level of the object (or only changing the properties of an item in the collection if it's an array) will still not trigger a re-rendering of the model.
CSS classes
-----------
The following CSS classes are added and removed on the associated input/select/textarea element depending on the validity of the model.
* `ng-valid`: the model is valid
* `ng-invalid`: the model is invalid
* `ng-valid-[key]`: for each valid key added by `$setValidity`
* `ng-invalid-[key]`: for each invalid key added by `$setValidity`
* `ng-pristine`: the control hasn't been interacted with yet
* `ng-dirty`: the control has been interacted with
* `ng-touched`: the control has been blurred
* `ng-untouched`: the control hasn't been blurred
* `ng-pending`: any `$asyncValidators` are unfulfilled
* `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined by the [`ngModel.NgModelController`](../type/ngmodel.ngmodelcontroller#%24isEmpty.html) method
* `ng-not-empty`: the view contains a non-empty value
Keep in mind that ngAnimate can detect each of these classes when added and removed.
Directive Info
--------------
* This directive executes at priority level 1.
Usage
-----
* as attribute:
```
<ANY
ng-model="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `expression` | assignable [Expression](../../../guide/expression) to bind to. |
Animations
----------
Animations within models are triggered when any of the associated CSS classes are added and removed on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself. The animations that are triggered within ngModel are similar to how they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well as JS animations.
The following example shows a simple way to utilize CSS transitions to style an input element that has been rendered as invalid after it has been validated:
```
//be sure to include ngAnimate as a module to hook into more
//advanced animations
.my-input {
transition:0.5s linear all;
background: white;
}
.my-input.ng-invalid {
background: red;
color:white;
}
```
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Examples
--------
### Basic Usage
### Binding to a getter/setter
Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a function that returns a representation of the model when called with zero arguments, and sets the internal state of a model when called with an argument. It's sometimes useful to use this for models that have an internal representation that's different from what the model exposes to the view.
**Best Practice:** It's best to keep getters fast because AngularJS is likely to call them more frequently than other parts of your code. You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to a `<form>`, which will enable this behavior for all `<input>`s within it. See [`ngModelOptions`](ngmodeloptions) for more.
The following example shows how to use `ngModel` with a getter/setter:
angularjs
Improve this Doc View Source ngRequired
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/validators.js?message=docs(ngRequired)%3A%20describe%20your%20change...#L2) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/validators.js#L2) ngRequired
================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
ngRequired adds the required [`validator`](../type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](ngmodel). It is most often used for [`input`](input) and [`select`](select) controls, but can also be applied to custom controls.
The directive sets the `required` attribute on the element if the AngularJS expression inside `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we cannot use interpolation inside `required`. See the [interpolation guide](../../../guide/interpolation) for more info.
The validator will set the `required` error key to true if the `required` attribute is set and calling [`NgModelController.$isEmpty`](../type/ngmodel.ngmodelcontroller#%24isEmpty.html) with the [`ngModel.$viewValue`](../type/ngmodel.ngmodelcontroller#%24viewValue.html) returns `true`. For example, the `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-required="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngRequired | `expression` | AngularJS expression. If it evaluates to `true`, it sets the `required` attribute to the element and adds the `required` [`validator`](../type/ngmodel.ngmodelcontroller#%24validators.html). |
Example
-------
angularjs
Improve this Doc View Source form
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/form.js?message=docs(form)%3A%20describe%20your%20change...#L398) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/form.js#L398) form
============================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Directive that instantiates [FormController](../type/form.formcontroller).
If the `name` attribute is specified, the form controller is published onto the current scope under this name.
Alias: [`ngForm`](ngform)
-------------------------
In AngularJS, forms can be nested. This means that the outer form is valid when all of the child forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so AngularJS provides the [`ngForm`](ngform) directive, which behaves identically to `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group of controls needs to be determined.
CSS classes
-----------
* `ng-valid` is set if the form is valid.
* `ng-invalid` is set if the form is invalid.
* `ng-pending` is set if the form is pending.
* `ng-pristine` is set if the form is pristine.
* `ng-dirty` is set if the form is dirty.
* `ng-submitted` is set if the form was submitted.
Keep in mind that ngAnimate can detect each of these classes when added and removed.
Submitting a form and preventing the default action
---------------------------------------------------
Since the role of forms in client-side AngularJS applications is different than in classical roundtrip apps, it is desirable for the browser not to translate the form submission into a full page reload that sends the data to the server. Instead some javascript logic should be triggered to handle the form submission in an application-specific way.
For this reason, AngularJS prevents the default action (form submission to the server) unless the `<form>` element has an `action` attribute specified.
You can use one of the following two ways to specify what javascript method should be called when a form is submitted:
* [ngSubmit](ngsubmit) directive on the form element
* [ngClick](ngclick) directive on the first button or input field of type submit (input[type=submit])
To prevent double execution of the handler, use only one of the [ngSubmit](ngsubmit) or [ngClick](ngclick) directives. This is because of the following form submission rules in the HTML specification:
* If a form has only one input field then hitting enter in this field triggers form submit (`ngSubmit`)
* if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter doesn't trigger submit
* if a form has one or more input fields and one or more buttons or input[type=submit] then hitting enter in any of the input fields will trigger the click handler on the *first* button or input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
Any pending `ngModelOptions` changes will take place immediately when an enclosing form is submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` to have access to the updated model.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<form
[name="string"]>
...
</form>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| name *(optional)* | `string` | Name of the form. If specified, the form controller will be published into related scope, under this name. |
Animations
----------
Animations in ngForm are triggered when any of the associated CSS classes are added and removed. These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any other validations that are performed within the form. Animations in ngForm are similar to how they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well as JS animations.
The following example shows a simple way to utilize CSS transitions to style a form element that has been rendered as invalid after it has been validated:
```
//be sure to include ngAnimate as a module to hook into more
//advanced animations
.my-form {
transition:0.5s linear all;
background: white;
}
.my-form.ng-invalid {
background: red;
color:white;
}
```
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Example
-------
angularjs
Improve this Doc View Source ngRef
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngRef.js?message=docs(ngRef)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngRef.js#L3) ngRef
============================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngRef` attribute tells AngularJS to assign the controller of a component (or a directive) to the given property in the current scope. It is also possible to add the jqlite-wrapped DOM element to the scope.
If the element with `ngRef` is destroyed `null` is assigned to the property.
Note that if you want to assign from a child into the parent scope, you must initialize the target property on the parent scope, otherwise `ngRef` will assign on the child scope. This commonly happens when assigning elements or components wrapped in [`ngIf`](ngif) or [`ngRepeat`](ngrepeat). See the second example below.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-ref="string"
[ng-ref-read="string"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngRef | `string` | property name - A valid AngularJS expression identifier to which the controller or jqlite-wrapped DOM element will be bound. |
| ngRefRead *(optional)* | `string` | read value - The name of a directive (or component) on this element, or the special string `$element`. If a name is provided, `ngRef` will assign the matching controller. If `$element` is provided, the element itself is assigned (even if a controller is available). |
Examples
--------
### Simple toggle
This example shows how the controller of the component toggle is reused in the template through the scope to use its logic.
### ngRef inside scopes
This example shows how `ngRef` works with child scopes. The `ngRepeat`-ed `myWrapper` components are assigned to the scope of `myRoot`, because the `toggles` property has been initialized. The repeated `myToggle` components are published to the child scopes created by `ngRepeat`. `ngIf` behaves similarly - the assignment of `myToggle` happens in the `ngIf` child scope, because the target property has not been initialized on the `myRoot` component controller.
angularjs
Improve this Doc View Source ngValue
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(ngValue)%3A%20describe%20your%20change...#L2282) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L2282) ngValue
======================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Binds the given expression to the value of the element.
It is mainly used on [`input[radio]`](../input/input%5Bradio%5D) and option elements, so that when the element is selected, the [`ngModel`](ngmodel) of that element (or its [`select`](select) parent element) is set to the bound value. It is especially useful for dynamically generated lists using [`ngRepeat`](ngrepeat), as shown below.
It can also be used to achieve one-way binding of a given expression to an input element such as an `input[text]` or a `textarea`, when that element does not use ngModel.
Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<ANY
[ng-value="string"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngValue *(optional)* | `string` | AngularJS expression, whose value will be bound to the `value` attribute and `value` property of the element. |
Example
-------
angularjs
Improve this Doc View Source ngMouseover
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngMouseover)%3A%20describe%20your%20change...#L165) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L165) ngMouseover
========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on mouseover event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-mouseover="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMouseover | `expression` | [Expression](../../../guide/expression) to evaluate upon mouseover. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngPattern
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/validators.js?message=docs(ngPattern)%3A%20describe%20your%20change...#L95) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/validators.js#L95) ngPattern
================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
ngPattern adds the pattern [`validator`](../type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](ngmodel). It is most often used for text-based [`input`](input) controls, but can also be applied to custom text-based controls.
The validator sets the `pattern` error key if the [`ngModel.$viewValue`](../type/ngmodel.ngmodelcontroller#%24viewValue.html) does not match a RegExp which is obtained from the `ngPattern` attribute value:
* the value is an AngularJS expression:
+ If the expression evaluates to a RegExp object, then this is used directly.
+ If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`.
* If the value is a RegExp literal, e.g. `ngPattern="/^\d+$/"`, it is used directly.
**Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. **Note:** This directive is also added when the plain `pattern` attribute is used, with two differences: 1. `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is not available.
2. The `ngPattern` attribute must be an expression, while the `pattern` value must be interpolated.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-pattern="">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngPattern | `expression``RegExp` | AngularJS expression that must evaluate to a `RegExp` or a `String` parsable into a `RegExp`, or a `RegExp` literal. See above for more details. |
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source ngIf
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngIf.js?message=docs(ngIf)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngIf.js#L3) ngIf
========================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngIf` directive removes or recreates a portion of the DOM tree based on an {expression}. If the expression assigned to `ngIf` evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.
`ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the element in the DOM rather than changing its visibility via the `display` css property. A common case when this difference is significant is when using css selectors that rely on an element's position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
Note that when an element is removed using `ngIf` its scope is destroyed and a new scope is created when the element is restored. The scope created within `ngIf` inherits from its parent scope using [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance). An important implication of this is if `ngModel` is used within `ngIf` to bind to a javascript primitive defined in the parent scope. In this case any modifications made to the variable within the child scope will override (hide) the value in the parent scope.
Also, `ngIf` recreates elements using their compiled state. An example of this behavior is if an element's class attribute is directly modified after it's compiled, using something like jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element the added class will be lost because the original compiled state is used to regenerate the element.
Additionally, you can provide animations via the `ngAnimate` module to animate the `enter` and `leave` effects.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 600.
* This directive can be used as [multiElement](../service/%24compile#-multielement-.html)
Usage
-----
* as attribute:
```
<ANY
ng-if="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngIf | `expression` | If the [expression](../../../guide/expression) is falsy then the element is removed from the DOM tree. If it is truthy a copy of the compiled element is added to the DOM tree. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [enter](../service/%24animate#enter.html) | just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container |
| [leave](../service/%24animate#leave.html) | just before the `ngIf` contents are removed from the DOM |
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Example
-------
angularjs
Improve this Doc View Source ngDisabled
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngDisabled)%3A%20describe%20your%20change...#L154) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L154) ngDisabled
==========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
This directive sets the `disabled` attribute on the element (typically a form control, e.g. `input`, `button`, `select` etc.) if the [expression](../../../guide/expression) inside `ngDisabled` evaluates to truthy.
A special directive is necessary because we cannot use interpolation inside the `disabled` attribute. See the [interpolation guide](../../../guide/interpolation) for more info.
Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<ANY
ng-disabled="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngDisabled | `expression` | If the [expression](../../../guide/expression) is truthy, then the `disabled` attribute will be set on the element |
Example
-------
angularjs
Improve this Doc View Source ngModelOptions
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngModelOptions.js?message=docs(ngModelOptions)%3A%20describe%20your%20change...#L92) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngModelOptions.js#L92) ngModelOptions
==================================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
This directive allows you to modify the behaviour of [`ngModel`](ngmodel) directives within your application. You can specify an `ngModelOptions` directive on any element. All [`ngModel`](ngmodel) directives will use the options of their nearest `ngModelOptions` ancestor.
The `ngModelOptions` settings are found by evaluating the value of the attribute directive as an AngularJS expression. This expression should evaluate to an object, whose properties contain the settings. For example: `<div ng-model-options="{ debounce: 100 }"`.
Inheriting Options
------------------
You can specify that an `ngModelOptions` setting should be inherited from a parent `ngModelOptions` directive by giving it the value of `"$inherit"`. Then it will inherit that setting from the first `ngModelOptions` directive found by traversing up the DOM tree. If there is no ancestor element containing an `ngModelOptions` directive then default settings will be used.
For example given the following fragment of HTML
```
<div ng-model-options="{ allowInvalid: true, debounce: 200 }">
<form ng-model-options="{ updateOn: 'blur', allowInvalid: '$inherit' }">
<input ng-model-options="{ updateOn: 'default', allowInvalid: '$inherit' }" />
</form>
</div>
```
the `input` element will have the following settings
```
{ allowInvalid: true, updateOn: 'default', debounce: 0 }
```
Notice that the `debounce` setting was not inherited and used the default value instead.
You can specify that all undefined settings are automatically inherited from an ancestor by including a property with key of `"*"` and value of `"$inherit"`.
For example given the following fragment of HTML
```
<div ng-model-options="{ allowInvalid: true, debounce: 200 }">
<form ng-model-options="{ updateOn: 'blur', "*": '$inherit' }">
<input ng-model-options="{ updateOn: 'default', "*": '$inherit' }" />
</form>
</div>
```
the `input` element will have the following settings
```
{ allowInvalid: true, updateOn: 'default', debounce: 200 }
```
Notice that the `debounce` setting now inherits the value from the outer `<div>` element.
If you are creating a reusable component then you should be careful when using `"*": "$inherit"` since you may inadvertently inherit a setting in the future that changes the behavior of your component.
Triggering and debouncing model updates
---------------------------------------
The `updateOn` and `debounce` properties allow you to specify a custom list of events that will trigger a model update and/or a debouncing delay so that the actual update only takes place when a timer expires; this timer will be reset after another change takes place.
Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might be different from the value in the actual model. This means that if you update the model you should also invoke [`ngModel.NgModelController`](../type/ngmodel.ngmodelcontroller#%24rollbackViewValue.html) on the relevant input field in order to make sure it is synchronized with the model and that any debounced action is canceled.
The easiest way to reference the control's [`ngModel.NgModelController`](../type/ngmodel.ngmodelcontroller#%24rollbackViewValue.html) method is by making sure the input is placed inside a form that has a `name` attribute. This is important because `form` controllers are published to the related scope under the name in their `name` attribute.
Any pending changes will take place immediately when an enclosing form is submitted via the `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` to have access to the updated model.
### Overriding immediate updates
The following example shows how to override immediate updates. Changes on the inputs within the form will update the model only when the control loses focus (blur event). If `escape` key is pressed while the input field is focused, the value is reset to the value in the current model.
### Debouncing updates
The next example shows how to debounce model changes. Model will be updated only 1 sec after last change. If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
### Default events, extra triggers, and catch-all debounce values
This example shows the relationship between "default" update events and additional `updateOn` triggers.
`default` events are those that are bound to the control, and when fired, update the `$viewValue` via [$setViewValue](../type/ngmodel.ngmodelcontroller#%24setViewValue.html). Every event that is not listed in `updateOn` is considered a "default" event, since different control types have different default events.
The control in this example updates by "default", "click", and "blur", with different `debounce` values. You can see that "click" doesn't have an individual `debounce` value - therefore it uses the `*` debounce value.
There is also a button that calls [$setViewValue](../type/ngmodel.ngmodelcontroller#%24setViewValue.html) directly with a "custom" event. Since "custom" is not defined in the `updateOn` list, it is considered a "default" event and will update the control if "default" is defined in `updateOn`, and will receive the "default" debounce value. Note that this is just to illustrate how custom controls would possibly call `$setViewValue`.
You can change the `updateOn` and `debounce` configuration to test different scenarios. This is done with [$overrideModelOptions](../type/ngmodel.ngmodelcontroller#%24overrideModelOptions.html).
Model updates and validation
----------------------------
The default behaviour in `ngModel` is that the model value is set to `undefined` when the validation determines that the value is invalid. By setting the `allowInvalid` property to true, the model will still be updated even if the value is invalid.
Connecting to the scope
-----------------------
By setting the `getterSetter` property to true you are telling ngModel that the `ngModel` expression on the scope refers to a "getter/setter" function rather than the value itself.
The following example shows how to bind to getter/setters:
Programmatically changing options
---------------------------------
The `ngModelOptions` expression is only evaluated once when the directive is linked; it is not watched for changes. However, it is possible to override the options on a single [`ngModel.NgModelController`](../type/ngmodel.ngmodelcontroller) instance with [`NgModelController#$overrideModelOptions()`](../type/ngmodel.ngmodelcontroller#%24overrideModelOptions.html). See also the example for [Default events, extra triggers, and catch-all debounce values](ngmodeloptions#default-events-extra-triggers-and-catch-all-debounce-values.html).
Specifying timezones
--------------------
You can specify the timezone that date/time input directives expect by providing its name in the `timezone` property.
Formatting the value of time and datetime-local
-----------------------------------------------
With the options `timeSecondsFormat` and `timeStripZeroSeconds` it is possible to adjust the value that is displayed in the control. Note that browsers may apply their own formatting in the user interface.
Directive Info
--------------
* This directive executes at priority level 10.
Usage
-----
* as attribute:
```
<ANY
ng-model-options="Object">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModelOptions | `Object` | options to apply to [`ngModel`](ngmodel) directives on this element and and its descendents. **General options**:* `updateOn`: string specifying which event should the input be bound to. You can set several events using an space delimited list. There is a special event called `default` that matches the default events belonging to the control. These are the events that are bound to the control, and when fired, update the `$viewValue` via `$setViewValue`. `ngModelOptions` considers every event that is not listed in `updateOn` a "default" event, since different control types use different default events. See also the section [Triggering and debouncing model updates](ngmodeloptions#triggering-and-debouncing-model-updates.html).
* `debounce`: integer value which contains the debounce model update value in milliseconds. A value of 0 triggers an immediate update. If an object is supplied instead, you can specify a custom value for each event. For example:
```
ng-model-options="{
updateOn: 'default blur',
debounce: { 'default': 500, 'blur': 0 }
}"
```
You can use the `*` key to specify a debounce value that applies to all events that are not specifically listed. In the following example, `mouseup` would have a debounce delay of 1000:
```
ng-model-options="{
updateOn: 'default blur mouseup',
debounce: { 'default': 500, 'blur': 0, '*': 1000 }
}"
```
* `allowInvalid`: boolean value which indicates that the model can be set with values that did not validate correctly instead of the default behavior of setting the model to undefined.
* `getterSetter`: boolean value which determines whether or not to treat functions bound to `ngModel` as getters/setters.
**Input-type specific options**:* `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for `<input type="date" />`, `<input type="time" />`, ... . It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. Note that changing the timezone will have no effect on the current date, and is only applied after the next input / model change.
* `timeSecondsFormat`: Defines if the `time` and `datetime-local` types should show seconds and milliseconds. The option follows the format string of [date filter](../filter/date). By default, the options is `undefined` which is equal to `'ss.sss'` (seconds and milliseconds). The other options are `'ss'` (strips milliseconds), and `''` (empty string), which strips both seconds and milliseconds. Note that browsers that support `time` and `datetime-local` require the hour and minutes part of the time string, and may show the value differently in the user interface. [See the example](ngmodeloptions#formatting-the-value-of-time-and-datetime-local-.html).
* `timeStripZeroSeconds`: Defines if the `time` and `datetime-local` types should strip the seconds and milliseconds from the formatted value if they are zero. This option is applied after `timeSecondsFormat`. This option can be used to make the formatting consistent over different browsers, as some browsers with support for `time` will natively hide the milliseconds and seconds if they are zero, but others won't, and browsers that don't implement these input types will always show the full string. [See the example](ngmodeloptions#formatting-the-value-of-time-and-datetime-local-.html).
|
angularjs
Improve this Doc View Source ngInclude
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngInclude.js?message=docs(ngInclude)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngInclude.js#L3) ngInclude
============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Fetches, compiles and includes an external HTML fragment.
By default, the template URL is restricted to the same domain and protocol as the application document. This is done by calling [$sce.getTrustedResourceUrl](../service/%24sce#getTrustedResourceUrl.html) on it. To load templates from other domains or protocols you may either add them to your [trusted resource URL list](../provider/%24scedelegateprovider#trustedResourceUrlList.html) or [wrap them](../service/%24sce#trustAsResourceUrl.html) as trusted values. Refer to AngularJS's [Strict Contextual Escaping](../service/%24sce).
In addition, the browser's [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) policy may further restrict whether the template is successfully loaded. For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://` access on some browsers.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level -400.
Usage
-----
* as element:
```
<ng-include
src="string"
[onload="string"]
[autoscroll="string"]>
...
</ng-include>
```
* as attribute:
```
<ANY
ng-include="string"
[onload="string"]
[autoscroll="string"]>
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-include: string; [onload: string;] [autoscroll: string;]"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngInclude | src | `string` | AngularJS expression evaluating to URL. If the source is a string constant, make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`. |
| onload *(optional)* | `string` | Expression to evaluate when a new partial is loaded.
**Note:** When using onload on SVG elements in IE11, the browser will try to call a function with the name on the window element, which will usually throw a "function is undefined" error. To fix this, you can instead use `data-onload` or a different form that [matches](../../../guide/directive#normalization.html) `onload`. |
| autoscroll *(optional)* | `string` | Whether `ngInclude` should call [$anchorScroll](../service/%24anchorscroll) to scroll the viewport after the content is loaded.
```
- If the attribute is not set, disable scrolling.
- If the attribute is set without value, enable scrolling.
- Otherwise enable scrolling only if the expression evaluates to truthy value.
```
|
Events
------
* ### $includeContentRequested
Emitted every time the ngInclude content is requested.
#### Type:
emit #### Target:
the scope ngInclude was declared in #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| src | `String` | URL of content to load. |
* ### $includeContentLoaded
Emitted every time the ngInclude content is reloaded.
#### Type:
emit #### Target:
the current ngInclude scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| src | `String` | URL of content to load. |
* ### $includeContentError
Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)
#### Type:
emit #### Target:
the scope ngInclude was declared in #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| src | `String` | URL of content to load. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [enter](../service/%24animate#enter.html) | when the expression changes, on the new include |
| [leave](../service/%24animate#leave.html) | when the expression changes, on the old include |
The enter and leave animation occur concurrently.
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Example
-------
| programming_docs |
angularjs
Improve this Doc View Source ngKeypress
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngKeypress)%3A%20describe%20your%20change...#L316) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L316) ngKeypress
======================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on keypress event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-keypress="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngKeypress | `expression` | [Expression](../../../guide/expression) to evaluate upon keypress. ([Event object is available as `$event`](../../../guide/expression#-event-.html) and can be interrogated for keyCode, altKey, etc.) |
Example
-------
angularjs
Improve this Doc View Source ngOpen
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngOpen)%3A%20describe%20your%20change...#L304) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L304) ngOpen
==================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
A special directive is necessary because we cannot use interpolation inside the `open` attribute. See the [interpolation guide](../../../guide/interpolation) for more info.
A note about browser compatibility
----------------------------------
Internet Explorer and Edge do not support the `details` element, it is recommended to use [`ngShow`](ngshow) and [`ngHide`](nghide) instead.
Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<DETAILS
ng-open="expression">
...
</DETAILS>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngOpen | `expression` | If the [expression](../../../guide/expression) is truthy, then special attribute "open" will be set on the element |
Example
-------
angularjs
Improve this Doc View Source ngCopy
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngCopy)%3A%20describe%20your%20change...#L449) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L449) ngCopy
==============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on copy event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<window, input, select, textarea, a
ng-copy="expression">
...
</window, input, select, textarea, a>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngCopy | `expression` | [Expression](../../../guide/expression) to evaluate upon copy. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source textarea
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(textarea)%3A%20describe%20your%20change...#L2034) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L2034) textarea
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
HTML textarea element control with AngularJS data-binding. The data-binding and validation properties of this element are exactly the same as those of the [input element](input).
Known Issues
------------
When specifying the `placeholder` attribute of `<textarea>`, Internet Explorer will temporarily insert the placeholder value as the textarea's content. If the placeholder value contains interpolation (`{{ ... }}`), an error will be logged in the console when AngularJS tries to update the value of the by-then-removed text node. This doesn't affect the functionality of the textarea, but can be undesirable.
You can work around this Internet Explorer issue by using `ng-attr-placeholder` instead of `placeholder` on textareas, whenever you need interpolation in the placeholder value. You can find more details on `ngAttr` in the [Interpolation](../../../guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes.html) section of the Developer Guide.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<textarea
ng-model="string"
[name="string"]
[required="string"]
[ng-required="string"]
[ng-minlength="number"]
[ng-maxlength="number"]
[ng-pattern="string"]
[ng-change="string"]
[ng-trim="boolean"]>
...
</textarea>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngMinlength *(optional)* | `number` | Sets `minlength` validation error key if the value is shorter than minlength. |
| ngMaxlength *(optional)* | `number` | Sets `maxlength` validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length. |
| ngPattern *(optional)* | `string` | Sets `pattern` validation error key if the ngModel [$viewValue](../type/ngmodel.ngmodelcontroller#%24viewValue.html) does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. If the expression evaluates to a RegExp object, then this is used directly. If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
| ngTrim *(optional)* | `boolean` | If set to false AngularJS will not automatically trim the input. *(default: true)* |
angularjs
Improve this Doc View Source ngBindHtml
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngBind.js?message=docs(ngBindHtml)%3A%20describe%20your%20change...#L139) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngBind.js#L139) ngBindHtml
============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default, the resulting HTML content will be sanitized using the [$sanitize](../../ngsanitize/service/%24sanitize) service. To utilize this functionality, ensure that `$sanitize` is available, for example, by including [`ngSanitize`](../../ngsanitize) in your module's dependencies (not in core AngularJS). In order to use [`ngSanitize`](../../ngsanitize) in your module's dependencies, you need to include "angular-sanitize.js" in your application.
You may also bypass sanitization for values you know are safe. To do so, bind to an explicitly trusted value via [$sce.trustAsHtml](../service/%24sce#trustAsHtml.html). See the example under [Strict Contextual Escaping (SCE)](../service/%24sce#show-me-an-example-using-sce-.html).
Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you will have an exception (instead of an exploit.)
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-bind-html
ng-bind-html="expression">
...
</ng-bind-html>
```
* as attribute:
```
<ANY
ng-bind-html="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngBindHtml | `expression` | [Expression](../../../guide/expression) to evaluate. |
Example
-------
angularjs
Improve this Doc View Source ngClick
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngClick)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L3) ngClick
============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The ngClick directive allows you to specify custom behavior when an element is clicked.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-click="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngClick | `expression` | [Expression](../../../guide/expression) to evaluate upon click. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngPluralize
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngPluralize.js?message=docs(ngPluralize)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngPluralize.js#L3) ngPluralize
====================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`ngPluralize` is a directive that displays messages according to en-US localization rules. These rules are bundled with angular.js, but can be overridden (see [AngularJS i18n](../../../guide/i18n) dev guide). You configure ngPluralize directive by specifying the mappings between [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) and the strings to be displayed.
Plural categories and explicit number rules
-------------------------------------------
There are two [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html) in AngularJS's default en-US locale: "one" and "other".
While a plural category may match many numbers (for example, in en-US locale, "other" can match any number that is not 1), an explicit number rule can only match one number. For example, the explicit number rule for "3" matches the number 3. There are examples of plural categories and explicit number rules throughout the rest of this documentation.
Configuring ngPluralize
-----------------------
You configure ngPluralize by providing 2 attributes: `count` and `when`. You can also provide an optional attribute, `offset`.
The value of the `count` attribute can be either a string or an [AngularJS expression](../../../guide/expression); these are evaluated on the current scope for its bound value.
The `when` attribute specifies the mappings between plural categories and the actual string to be displayed. The value of the attribute should be a JSON object.
The following example shows how to configure ngPluralize:
```
<ng-pluralize count="personCount"
when="{'0': 'Nobody is viewing.',
'one': '1 person is viewing.',
'other': '{} people are viewing.'}">
</ng-pluralize>
```
In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not specify this rule, 0 would be matched to the "other" category and "0 people are viewing" would be shown instead of "Nobody is viewing". You can specify an explicit number rule for other numbers, for example 12, so that instead of showing "12 people are viewing", you can show "a dozen people are viewing".
You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted into pluralized strings. In the previous example, AngularJS will replace `{}` with `{{personCount}}`. The closed braces `{}` is a placeholder for {{numberExpression}}.
If no rule is defined for a category, then an empty string is displayed and a warning is generated. Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.
Configuring ngPluralize with offset
-----------------------------------
The `offset` attribute allows further customization of pluralized text, which can result in a better user experience. For example, instead of the message "4 people are viewing this document", you might display "John, Kate and 2 others are viewing this document". The offset attribute allows you to offset a number by any desired value. Let's take a look at an example:
```
<ng-pluralize count="personCount" offset=2
when="{'0': 'Nobody is viewing.',
'1': '{{person1}} is viewing.',
'2': '{{person1}} and {{person2}} are viewing.',
'one': '{{person1}}, {{person2}} and one other person are viewing.',
'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
</ng-pluralize>
```
Notice that we are still using two plural categories(one, other), but we added three explicit number rules 0, 1 and 2. When one person, perhaps John, views the document, "John is viewing" will be shown. When three people view the document, no explicit number rule is found, so an offset of 2 is taken off 3, and AngularJS uses 1 to decide the plural category. In this case, plural category 'one' is matched and "John, Mary and one other person are viewing" is shown.
Note that when you specify offsets, you must provide explicit number rules for numbers from 0 up to and including the offset. If you use an offset of 3, for example, you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for plural categories "one" and "other".
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-pluralize
count=""
when="string"
[offset="number"]>
...
</ng-pluralize>
```
* as attribute:
```
<ANY
ng-pluralize
count=""
when="string"
[offset="number"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| count | `string``expression` | The variable to be bound to. |
| when | `string` | The mapping between plural category to its corresponding strings. |
| offset *(optional)* | `number` | Offset to deduct from the total number. |
Example
-------
angularjs
Improve this Doc View Source ngMaxlength
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/validators.js?message=docs(ngMaxlength)%3A%20describe%20your%20change...#L230) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/validators.js#L230) ngMaxlength
======================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
ngMaxlength adds the maxlength [`validator`](../type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](ngmodel). It is most often used for text-based [`input`](input) controls, but can also be applied to custom text-based controls.
The validator sets the `maxlength` error key if the [`ngModel.$viewValue`](../type/ngmodel.ngmodelcontroller#%24viewValue.html) is longer than the integer obtained by evaluating the AngularJS expression given in the `ngMaxlength` attribute value.
**Note:** This directive is also added when the plain `maxlength` attribute is used, with two differences: 1. `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint validation is not available.
2. The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be interpolated.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-maxlength="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMaxlength | `expression` | AngularJS expression that must evaluate to a `Number` or `String` parsable into a `Number`. Used as value for the `maxlength` [validator](../type/ngmodel.ngmodelcontroller#%24validators.html). |
Example
-------
angularjs
Improve this Doc View Source ngSwitch
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngSwitch.js?message=docs(ngSwitch)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngSwitch.js#L3) ngSwitch
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression. Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location as specified in the template.
The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element matches the value obtained from the evaluated expression. In other words, you define a container element (where you place the directive), place an expression on the **`on="..."` attribute** (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on expression is evaluated. If a matching expression is not found via a when attribute then an element with the default attribute is displayed.
Be aware that the attribute values to match against cannot be expressions. They are interpreted as literal string values to match against. For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the value of the expression `$scope.someVal`. Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 1200.
Usage
-----
```
<ANY ng-switch="expression">
<ANY ng-switch-when="matchValue1">...</ANY>
<ANY ng-switch-when="matchValue2">...</ANY>
<ANY ng-switch-default>...</ANY>
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSwitch | on | `*` | expression to match against `ng-switch-when`. On child elements add:* `ngSwitchWhen`: the case statement to match against. If match then this case will be displayed. If the same match appears multiple times, all the elements will be displayed. It is possible to associate multiple values to the same `ngSwitchWhen` by defining the optional attribute `ngSwitchWhenSeparator`. The separator will be used to split the value of the `ngSwitchWhen` attribute into multiple tokens, and the element will show if any of the `ngSwitch` evaluates to any of these tokens.
* `ngSwitchDefault`: the default case when no other case match. If there are multiple default cases, all of them will be displayed when no other case match.
|
Animations
----------
| Animation | Occurs |
| --- | --- |
| [enter](../service/%24animate#enter.html) | after the ngSwitch contents change and the matched child element is placed inside the container |
| [leave](../service/%24animate#leave.html) | after the ngSwitch contents change and just before the former contents are removed from the DOM |
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Example
-------
| programming_docs |
angularjs
Improve this Doc View Source ngHref
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngHref)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L3) ngHref
==============================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Using AngularJS markup like `{{hash}}` in an href attribute will make the link go to the wrong URL if the user clicks it before AngularJS has a chance to replace the `{{hash}}` markup with its value. Until AngularJS replaces the markup the link will be broken and will most likely return a 404 error. The `ngHref` directive solves this problem.
The wrong way to write it:
```
<a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
```
The correct way to write it:
```
<a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
```
Directive Info
--------------
* This directive executes at priority level 99.
Usage
-----
* as attribute:
```
<A
ng-href="template">
...
</A>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngHref | `template` | any string which can contain `{{}}` markup. |
Example
-------
This example shows various combinations of `href`, `ng-href` and `ng-click` attributes in links and their different behaviors:
angularjs
Improve this Doc View Source ngHide
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngShowHide.js?message=docs(ngHide)%3A%20describe%20your%20change...#L224) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngShowHide.js#L224) ngHide
============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngHide` directive shows or hides the given HTML element based on the expression provided to the `ngHide` attribute.
The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see [ngCsp](ngcsp)).
```
<!-- when $scope.myValue is truthy (element is hidden) -->
<div ng-hide="myValue" class="ng-hide"></div>
<!-- when $scope.myValue is falsy (element is visible) -->
<div ng-hide="myValue"></div>
```
When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed from the element causing the element not to appear hidden.
Why is !important used?
-----------------------
You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as simple as changing the display style on a HTML list item would make hidden elements appear visible. This also becomes a bigger issue when dealing with CSS frameworks.
By using `!important`, the show and hide behavior will work as expected despite any clash between CSS selector specificity (when `!important` isn't used with any conflicting styles). If a developer chooses to override the styling to change how to hide an element then it is just a matter of using `!important` in their own CSS code.
### Overriding .ng-hide
By default, the `.ng-hide` class will style the element with `display: none !important`. If you wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for the `.ng-hide` CSS class. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
```
.ng-hide:not(.ng-hide-animate) {
/* These are just alternative ways of hiding an element */
display: block!important;
position: absolute;
top: -9999px;
left: -9999px;
}
```
By default you don't need to override in CSS anything and the animations will work around the display style.
Known Issues
------------
### Flickering when using ngHide to toggle between elements
When using [`ngShow`](ngshow) and / or [`ngHide`](nghide) to toggle between elements, it can happen that both the element to show and the element to hide are visible for a very short time.
This usually happens when the [ngAnimate module](../../nganimate) is included, but no actual animations are defined for [`ngShow`](ngshow) / [`ngHide`](nghide). Internet Explorer is affected more often than other browsers.
There are several way to mitigate this problem:
* [Disable animations on the affected elements](../../../guide/animations#how-to-selectively-enable-disable-and-skip-animations.html).
* Use [`ngIf`](ngif) or [`ngSwitch`](ngswitch) instead of [`ngShow`](ngshow) / [`ngHide`](nghide).
* Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements.
* Use `ng-class="{'ng-hide': expression}` instead of instead of [`ngShow`](ngshow) / [`ngHide`](nghide).
* Define an animation on the affected elements.
Directive Info
--------------
* This directive executes at priority level 0.
* This directive can be used as [multiElement](../service/%24compile#-multielement-.html)
Usage
-----
* as element:
```
<ng-hide
ng-hide="expression">
...
</ng-hide>
```
* as attribute:
```
<ANY
ng-hide="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngHide | `expression` | If the [expression](../../../guide/expression) is truthy/falsy then the element is hidden/shown respectively. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [addClass](../service/%24animate#addClass.html) `.ng-hide` | After the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden. |
| [removeClass](../service/%24animate#removeClass.html) `.ng-hide` | After the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible. |
Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the directive expression is true and false. This system works like the animation system present with `ngClass` except that you must also include the `!important` flag to override the display property so that the elements are not actually hidden during the animation.
```
/* A working example can be found at the bottom of this page. */
.my-element.ng-hide-add, .my-element.ng-hide-remove {
transition: all 0.5s linear;
}
.my-element.ng-hide-add { ... }
.my-element.ng-hide-add.ng-hide-add-active { ... }
.my-element.ng-hide-remove { ... }
.my-element.ng-hide-remove.ng-hide-remove-active { ... }
```
Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property to block during animation states - ngAnimate will automatically handle the style toggling for you.
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Examples
--------
A simple example, animating the element's opacity:
A more complex example, featuring different show/hide animations:
angularjs
Improve this Doc View Source ngNonBindable
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngNonBindable.js?message=docs(ngNonBindable)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngNonBindable.js#L3) ngNonBindable
============================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngNonBindable` directive tells AngularJS not to compile or bind the contents of the current DOM element, including directives on the element itself that have a lower priority than `ngNonBindable`. This is useful if the element contains what appears to be AngularJS directives and bindings but which should be ignored by AngularJS. This could be the case if you have a site that displays snippets of code, for instance.
Directive Info
--------------
* This directive executes at priority level 1000.
Usage
-----
* as attribute:
```
<ANY
ng-non-bindable>
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-non-bindable"> ... </ANY>
```
Example
-------
In this example there are two locations where a simple interpolation binding (`{{}}`) is present, but the one wrapped in `ngNonBindable` is left alone.
angularjs
Improve this Doc View Source ngSubmit
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngSubmit)%3A%20describe%20your%20change...#L339) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L339) ngSubmit
==================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Enables binding AngularJS expressions to onsubmit events.
Additionally it prevents the default action (which for form means sending the request to the server and reloading the current page), but only if the form does not contain `action`, `data-action`, or `x-action` attributes.
**Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and `ngSubmit` handlers together. See the [`form` directive documentation](form#submitting-a-form-and-preventing-the-default-action.html) for a detailed discussion of when `ngSubmit` may be triggered. Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<form
ng-submit="expression">
...
</form>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSubmit | `expression` | [Expression](../../../guide/expression) to eval. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngStyle
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngStyle.js?message=docs(ngStyle)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngStyle.js#L3) ngStyle
====================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
Known Issues
------------
You should not use [interpolation](../../../guide/interpolation) in the value of the `style` attribute, when using the `ngStyle` directive on the same element. See [here](../../../guide/interpolation#known-issues.html) for more info.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-style="expression">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-style: expression;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngStyle | `expression` | [Expression](../../../guide/expression) which evals to an object whose keys are CSS style names and values are corresponding values for those CSS keys. Since some CSS style names are not valid keys for an object, they must be quoted. See the 'background-color' style in the example below. |
Example
-------
angularjs
Improve this Doc View Source ngDblclick
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngDblclick)%3A%20describe%20your%20change...#L91) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L91) ngDblclick
====================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-dblclick="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngDblclick | `expression` | [Expression](../../../guide/expression) to evaluate upon a dblclick. (The Event object is available as `$event`) |
Example
-------
angularjs
Improve this Doc View Source ngChange
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngChange.js?message=docs(ngChange)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngChange.js#L3) ngChange
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Evaluate the given expression when the user changes the input. The expression is evaluated immediately, unlike the JavaScript onchange event which only triggers at the end of a change (usually, when the user leaves the form element or presses the return key).
The `ngChange` expression is only evaluated when a change in the input value causes a new value to be committed to the model.
It will not be evaluated:
* if the value returned from the `$parsers` transformation pipeline has not changed
* if the input has continued to be invalid since the model will stay `null`
* if the model is changed programmatically and not by a change to the input value
Note, this directive requires `ngModel` to be present.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-change="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngChange | `expression` | [Expression](../../../guide/expression) to evaluate upon change in input value. |
Example
-------
angularjs
Improve this Doc View Source ngOn
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/compile.js?message=docs(ngOn)%3A%20describe%20your%20change...#L1241) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/compile.js#L1241) ngOn
================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngOn` directive adds an event listener to a DOM element via [angular.element().on()](../function/angular.element), and evaluates an expression when the event is fired. `ngOn` allows adding listeners for arbitrary events by including the event name in the attribute, e.g. `ng-on-drop="onDrop()"` executes the 'onDrop()' expression when the `drop` event is fired.
AngularJS provides specific directives for many events, such as [`ngClick`](ngclick), so in most cases it is not necessary to use `ngOn`. However, AngularJS does not support all events (e.g. the `drop` event in the example above), and new events might be introduced in later DOM standards.
Another use-case for `ngOn` is listening to [custom events](https://developer.mozilla.org/docs/Web/Guide/Events/Creating_and_triggering_events) fired by [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements).
Binding to camelCase properties
-------------------------------
Since HTML attributes are case-insensitive, camelCase properties like `myEvent` must be escaped. AngularJS uses the underscore (\_) in front of a character to indicate that it is uppercase, so `myEvent` must be written as `ng-on-my_event="expression"`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<ANY ng-on-eventname="expression">
</ANY>
```
or with uppercase letters in property (e.g. "eventName"):
```
<ANY ng-on-event_name="expression">
</ANY>
```
Examples
--------
### Bind to built-in DOM events
### Bind to custom DOM events
angularjs
Improve this Doc View Source ngMouseup
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngMouseup)%3A%20describe%20your%20change...#L141) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L141) ngMouseup
====================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on mouseup event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-mouseup="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMouseup | `expression` | [Expression](../../../guide/expression) to evaluate upon mouseup. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngBindTemplate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngBind.js?message=docs(ngBindTemplate)%3A%20describe%20your%20change...#L71) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngBind.js#L71) ngBindTemplate
==================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngBindTemplate` directive specifies that the element text content should be replaced with the interpolation of the template in the `ngBindTemplate` attribute. Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}` expressions. This directive is needed since some HTML elements (such as TITLE and OPTION) cannot contain SPAN elements.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-bind-template
ng-bind-template="string">
...
</ng-bind-template>
```
* as attribute:
```
<ANY
ng-bind-template="string">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngBindTemplate | `string` | template of form {{ expression }} to eval. |
Example
-------
Try it here: enter text in text box and watch the greeting change.
| programming_docs |
angularjs
Improve this Doc View Source ngForm
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/form.js?message=docs(ngForm)%3A%20describe%20your%20change...#L374) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/form.js#L374) ngForm
================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Helper directive that makes it possible to create control groups inside a [`form`](form) directive. These "child forms" can be used, for example, to determine the validity of a sub-group of controls.
**Note**: `ngForm` cannot be used as a replacement for `<form>`, because it lacks its [built-in HTML functionality](https://html.spec.whatwg.org/#the-form-element). Specifically, you cannot submit `ngForm` like a `<form>` tag. That means, you cannot send data to the server with `ngForm`, or integrate it with [`ngSubmit`](ngsubmit). Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-form
[name="string"]>
...
</ng-form>
```
* as attribute:
```
<ANY
[ng-form="string"]>
...
</ANY>
```
* as CSS class:
```
<ANY class="[ng-form: string;]"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngForm | name *(optional)* | `string` | Name of the form. If specified, the form controller will be published into the related scope, under this name. |
angularjs
Improve this Doc View Source ngClass
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngClass.js?message=docs(ngClass)%3A%20describe%20your%20change...#L146) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngClass.js#L146) ngClass
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding an expression that represents all classes to be added.
The directive operates in three different ways, depending on which of three types the expression evaluates to:
1. If the expression evaluates to a string, the string should be one or more space-delimited class names.
2. If the expression evaluates to an object, then for each key-value pair of the object with a truthy value the corresponding key is used as a class name.
3. If the expression evaluates to an array, each element of the array should either be a string as in type 1 or an object as in type 2. This means that you can mix strings and objects together in an array to give you more control over what CSS classes appear. See the code below for an example of this.
The directive won't add duplicate classes if a particular class was already set.
When the expression changes, the previously added classes are removed and only then are the new classes added.
Known Issues
------------
You should not use [interpolation](../../../guide/interpolation) in the value of the `class` attribute, when using the `ngClass` directive on the same element. See [here](../../../guide/interpolation#known-issues.html) for more info.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-class="expression">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-class: expression;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngClass | `expression` | [Expression](../../../guide/expression) to eval. The result of the evaluation can be a string representing space delimited class names, an array, or a map of class names to boolean values. In the case of a map, the names of the properties whose values are truthy will be added as css classes to the element. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [addClass](../service/%24animate#addClass.html) | just before the class is applied to the element |
| [removeClass](../service/%24animate#removeClass.html) | just before the class is removed from the element |
| [setClass](../service/%24animate#setClass.html) | just before classes are added and classes are removed from the element at the same time |
### ngClass and pre-existing CSS3 Transitions/Animations
The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure. Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure to view the step by step details of [$animate.addClass](../service/%24animate#addClass.html) and [$animate.removeClass](../service/%24animate#removeClass.html).
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Examples
--------
### Basic
### Animations
The example below demonstrates how to perform animations using ngClass.
angularjs
Improve this Doc View Source ngSrcset
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngSrcset)%3A%20describe%20your%20change...#L128) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L128) ngSrcset
======================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't work right: The browser will fetch from the URL with the literal text `{{hash}}` until AngularJS replaces the expression inside `{{hash}}`. The `ngSrcset` directive solves this problem.
The buggy way to write it:
```
<img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
```
The correct way to write it:
```
<img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
```
Directive Info
--------------
* This directive executes at priority level 99.
Usage
-----
* as attribute:
```
<IMG
ng-srcset="template">
...
</IMG>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSrcset | `template` | any string which can contain `{{}}` markup. |
angularjs
Improve this Doc View Source ngChecked
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngChecked)%3A%20describe%20your%20change...#L189) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L189) ngChecked
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
Note that this directive should not be used together with [`ngModel`](ngmodel), as this can lead to unexpected behavior.
A special directive is necessary because we cannot use interpolation inside the `checked` attribute. See the [interpolation guide](../../../guide/interpolation) for more info.
Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<INPUT
ng-checked="expression">
...
</INPUT>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngChecked | `expression` | If the [expression](../../../guide/expression) is truthy, then the `checked` attribute will be set on the element |
Example
-------
angularjs
Improve this Doc View Source ngShow
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngShowHide.js?message=docs(ngShow)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngShowHide.js#L5) ngShow
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngShow` directive shows or hides the given HTML element based on the expression provided to the `ngShow` attribute.
The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see [ngCsp](ngcsp)).
```
<!-- when $scope.myValue is truthy (element is visible) -->
<div ng-show="myValue"></div>
<!-- when $scope.myValue is falsy (element is hidden) -->
<div ng-show="myValue" class="ng-hide"></div>
```
When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed from the element causing the element not to appear hidden.
Why is !important used?
-----------------------
You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as simple as changing the display style on a HTML list item would make hidden elements appear visible. This also becomes a bigger issue when dealing with CSS frameworks.
By using `!important`, the show and hide behavior will work as expected despite any clash between CSS selector specificity (when `!important` isn't used with any conflicting styles). If a developer chooses to override the styling to change how to hide an element then it is just a matter of using `!important` in their own CSS code.
### Overriding .ng-hide
By default, the `.ng-hide` class will style the element with `display: none !important`. If you wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for the `.ng-hide` CSS class. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
```
.ng-hide:not(.ng-hide-animate) {
/* These are just alternative ways of hiding an element */
display: block!important;
position: absolute;
top: -9999px;
left: -9999px;
}
```
By default you don't need to override anything in CSS and the animations will work around the display style.
Known Issues
------------
### Flickering when using ngShow to toggle between elements
When using [`ngShow`](ngshow) and / or [`ngHide`](nghide) to toggle between elements, it can happen that both the element to show and the element to hide are visible for a very short time.
This usually happens when the [ngAnimate module](../../nganimate) is included, but no actual animations are defined for [`ngShow`](ngshow) / [`ngHide`](nghide). Internet Explorer is affected more often than other browsers.
There are several way to mitigate this problem:
* [Disable animations on the affected elements](../../../guide/animations#how-to-selectively-enable-disable-and-skip-animations.html).
* Use [`ngIf`](ngif) or [`ngSwitch`](ngswitch) instead of [`ngShow`](ngshow) / [`ngHide`](nghide).
* Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements.
* Use `ng-class="{'ng-hide': expression}` instead of instead of [`ngShow`](ngshow) / [`ngHide`](nghide).
* Define an animation on the affected elements.
Directive Info
--------------
* This directive executes at priority level 0.
* This directive can be used as [multiElement](../service/%24compile#-multielement-.html)
Usage
-----
* as element:
```
<ng-show
ng-show="expression">
...
</ng-show>
```
* as attribute:
```
<ANY
ng-show="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngShow | `expression` | If the [expression](../../../guide/expression) is truthy/falsy then the element is shown/hidden respectively. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [addClass](../service/%24animate#addClass.html) `.ng-hide` | After the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden. |
| [removeClass](../service/%24animate#removeClass.html) `.ng-hide` | After the `ngShow` expression evaluates to a truthy value and just before contents are set to visible. |
Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the directive expression is true and false. This system works like the animation system present with `ngClass` except that you must also include the `!important` flag to override the display property so that the elements are not actually hidden during the animation.
```
/* A working example can be found at the bottom of this page. */
.my-element.ng-hide-add, .my-element.ng-hide-remove {
transition: all 0.5s linear;
}
.my-element.ng-hide-add { ... }
.my-element.ng-hide-add.ng-hide-add-active { ... }
.my-element.ng-hide-remove { ... }
.my-element.ng-hide-remove.ng-hide-remove-active { ... }
```
Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property to block during animation states - ngAnimate will automatically handle the style toggling for you.
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Examples
--------
A simple example, animating the element's opacity:
A more complex example, featuring different show/hide animations:
angularjs
Improve this Doc View Source ngProp
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/compile.js?message=docs(ngProp)%3A%20describe%20your%20change...#L1048) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/compile.js#L1048) ngProp
====================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngProp` directive binds an expression to a DOM element property. `ngProp` allows writing to arbitrary properties by including the property name in the attribute, e.g. `ng-prop-value="'my value'"` binds 'my value' to the `value` property.
Usually, it's not necessary to write to properties in AngularJS, as the built-in directives handle the most common use cases (instead of the above example, you would use [`ngValue`](ngvalue)).
However, [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements) often use custom properties to hold data, and `ngProp` can be used to provide input to these custom elements.
Binding to camelCase properties
-------------------------------
Since HTML attributes are case-insensitive, camelCase properties like `innerHTML` must be escaped. AngularJS uses the underscore (\_) in front of a character to indicate that it is uppercase, so `innerHTML` must be written as `ng-prop-inner_h_t_m_l="expression"` (Note that this is just an example, and for binding HTML [`ngBindHtml`](ngbindhtml) should be used.
Security
--------
Binding expressions to arbitrary properties poses a security risk, as properties like `innerHTML` can insert potentially dangerous HTML into the application, e.g. script tags that execute malicious code. For this reason, `ngProp` applies Strict Contextual Escaping with the [$sce service](../service/%24sce). This means vulnerable properties require their content to be "trusted", based on the context of the property. For example, the `innerHTML` is in the `HTML` context, and the `iframe.src` property is in the `RESOURCE_URL` context, which requires that values written to this property are trusted as a `RESOURCE_URL`.
This can be set explicitly by calling $sce.trustAs(type, value) on the value that is trusted before passing it to the `ng-prop-*` directive. There are exist shorthand methods for each context type in the form of [$sce.trustAsResourceUrl()](../service/%24sce#trustAsResourceUrl.html) et al.
In some cases you can also rely upon automatic sanitization of untrusted values - see below.
Based on the context, other options may exist to mark a value as trusted / configure the behavior of [`$sce`](../service/%24sce). For example, to restrict the `RESOURCE_URL` context to specific origins, use the [trustedResourceUrlList()](../provider/%24scedelegateprovider#trustedResourceUrlList.html) and [bannedResourceUrlList()](../provider/%24scedelegateprovider#bannedResourceUrlList.html).
[Find out more about the different context types](../service/%24sce#what-trusted-context-types-are-supported-.html).
### HTML Sanitization
By default, `$sce` will throw an error if it detects untrusted HTML content, and will not bind the content. However, if you include the [ngSanitize module](../../ngsanitize), it will try to sanitize the potentially dangerous HTML, e.g. strip non-trusted tags and attributes when binding to `innerHTML`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
```
<ANY ng-prop-propname="expression">
</ANY>
```
or with uppercase letters in property (e.g. "propName"):
```
<ANY ng-prop-prop_name="expression">
</ANY>
```
Examples
--------
### Binding to different contexts
### Binding to innerHTML with ngSanitize
angularjs
Improve this Doc View Source ngJq
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(ngJq)%3A%20describe%20your%20change...#L1161) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1161) ngJq
==========================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use this directive to force the angular.element library. This should be used to force either jqLite by leaving ng-jq blank or setting the name of the jquery variable under window (eg. jQuery).
Since AngularJS looks for this directive when it is loaded (doesn't wait for the DOMContentLoaded event), it must be placed on an element that comes before the script which loads angular. Also, only the first instance of `ng-jq` will be used and all others ignored.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-jq
[ng-jq="string"]>
...
</ng-jq>
```
* as attribute:
```
<ANY
[ng-jq="string"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngJq *(optional)* | `string` | the name of the library available under `window` to be used for angular.element |
Examples
--------
This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
```
<!doctype html>
<html ng-app ng-jq>
...
...
</html>
```
This example shows how to use a jQuery based library of a different name. The library name must be available at the top most 'window'.
```
<!doctype html>
<html ng-app ng-jq="jQueryLib">
...
...
</html>
```
| programming_docs |
angularjs
Improve this Doc View Source ngOptions
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngOptions.js?message=docs(ngOptions)%3A%20describe%20your%20change...#L9) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngOptions.js#L9) ngOptions
============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngOptions` attribute can be used to dynamically generate a list of `<option>` elements for the `<select>` element using the array or object obtained by evaluating the `ngOptions` comprehension expression.
In many cases, [ngRepeat](ngrepeat) can be used on `<option>` elements instead of `ngOptions` to achieve a similar result. However, `ngOptions` provides some benefits:
* more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the comprehension expression
* reduced memory consumption by not creating a new scope for each repeated instance
* increased render speed by creating the options in a documentFragment instead of individually
When an item in the `<select>` menu is selected, the array element or object property represented by the selected option will be bound to the model identified by the `ngModel` directive.
Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can be nested into the `<select>` element. This element will then represent the `null` or "not selected" option. See example below for demonstration.
Complex Models (objects or collections)
---------------------------------------
By default, `ngModel` watches the model by reference, not value. This is important to know when binding the select to a model that is an object or a collection.
One issue occurs if you want to preselect an option. For example, if you set the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection, because the objects are not identical. So by default, you should always reference the item in your collection for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
Another solution is to use a `track by` clause, because then `ngOptions` will track the identity of the item not by reference, but by the result of the `track by` expression. For example, if your collection items have an id property, you would `track by item.id`.
A different issue with objects or collections is that ngModel won't detect if an object property or a collection item changes. For that reason, `ngOptions` additionally watches the model using `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute. This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection has not changed identity, but only a property on the object or an item in the collection changes.
Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection if the model is an array). This means that changing a property deeper than the first level inside the object/collection will not trigger a re-rendering.
select **`as`**
---------------
Using `select` **`as`** will bind the result of the `select` expression to the model, but the value of the `<select>` and `<option>` html elements will be either the index (for array data sources) or property name (for object data sources) of the value within the collection. If a **`track by`** expression is used, the result of that expression will be set as the value of the `option` and `select` elements.
### select **`as`** and **`track by`**
Be careful when using `select` **`as`** and **`track by`** in the same expression. Given this array of items on the $scope:
```
$scope.items = [{
id: 1,
label: 'aLabel',
subItem: { name: 'aSubItem' }
}, {
id: 2,
label: 'bLabel',
subItem: { name: 'bSubItem' }
}];
```
This will work:
```
<select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
```
```
$scope.selected = $scope.items[0];
```
but this will not work:
```
<select ng-options="item.subItem as item.label for item in items track by item.id" ng-model="selected"></select>
```
```
$scope.selected = $scope.items[0].subItem;
```
In both examples, the **`track by`** expression is applied successfully to each `item` in the `items` array. Because the selected option has been set programmatically in the controller, the **`track by`** expression is also applied to the `ngModel` value. In the first example, the `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`** expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value is not matched against any `<option>` and the `<select>` appears as having no selected value.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-model="string"
ng-options="comprehension_expression"
[name="string"]
[required="string"]
[ng-required="string"]
[ng-attr-size="string"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| ngOptions | `comprehension_expression` | in one of the following forms:* for array data sources:
+ `label` **`for`** `value` **`in`** `array`
+ `select` **`as`** `label` **`for`** `value` **`in`** `array`
+ `label` **`group by`** `group` **`for`** `value` **`in`** `array`
+ `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`
+ `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr` (for including a filter with `track by`)
* for object data sources:
+ `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ `select` **`as`** `label` **`group by`** `group` **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ `select` **`as`** `label` **`disable when`** `disable` **`for` `(`**`key`**`,`** `value`**`) in`** `object`
Where:* `array` / `object`: an expression which evaluates to an array / object to iterate over.
* `value`: local variable which will refer to each item in the `array` or each property value of `object` during iteration.
* `key`: local variable which will refer to a property name in `object` during iteration.
* `label`: The result of this expression will be the label for `<option>` element. The `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
* `select`: The result of this expression will be bound to the model of the parent `<select>` element. If not specified, `select` expression will default to `value`.
* `group`: The result of this expression will be used to group options using the `<optgroup>` DOM element.
* `disable`: The result of this expression will be used to disable the rendered `<option>` element. Return `true` to disable.
* `trackexpr`: Used when working with an array of objects. The result of this expression will be used to identify the objects in the array. The `trackexpr` will most likely refer to the `value` variable (e.g. `value.propertyName`). With this the selection is preserved even when the options are recreated (e.g. reloaded from the server).
|
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| required *(optional)* | `string` | The control is considered valid only if value is entered. |
| ngRequired *(optional)* | `string` | Adds `required` attribute and `required` validation constraint to the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of `required` when you want to data-bind to the `required` attribute. |
| ngAttrSize *(optional)* | `string` | sets the size of the select element dynamically. Uses the [ngAttr](../../../guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes.html) directive. |
Example
-------
angularjs
Improve this Doc View Source ngInit
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngInit.js?message=docs(ngInit)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngInit.js#L3) ngInit
================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngInit` directive allows you to evaluate an expression in the current scope.
This directive can be abused to add unnecessary amounts of logic into your templates. There are only a few appropriate uses of `ngInit`: * aliasing special properties of [`ngRepeat`](ngrepeat), as seen in the demo below.
* initializing data during development, or for examples, as seen throughout these docs.
* injecting data via server side scripting.
Besides these few cases, you should use [Components](../../../guide/component) or [Controllers](../../../guide/controller) rather than `ngInit` to initialize values on a scope. **Note**: If you have assignment in `ngInit` along with a [`filter`](../service/%24filter), make sure you have parentheses to ensure correct operator precedence:
```
<div ng-init="test1 = ($index | toString)"></div>
```
Directive Info
--------------
* This directive executes at priority level 450.
Usage
-----
* as attribute:
```
<ANY
ng-init="expression">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-init: expression;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngInit | `expression` | [Expression](../../../guide/expression) to eval. |
Example
-------
angularjs
Improve this Doc View Source input
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/input.js?message=docs(input)%3A%20describe%20your%20change...#L2084) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/input.js#L2084) input
==================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
HTML input element control. When used together with [`ngModel`](ngmodel), it provides data-binding, input state control, and validation. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.
**Note:** Not every feature offered is available for all input types. Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`. Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<input
ng-model="string"
[name="string"]
[required="string"]
[ng-required="boolean"]
[ng-minlength="number"]
[ng-maxlength="number"]
[ng-pattern="string"]
[ng-change="string"]
[ng-trim="boolean"]>
...
</input>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngModel | `string` | Assignable AngularJS expression to data-bind to. |
| name *(optional)* | `string` | Property name of the form under which the control is published. |
| required *(optional)* | `string` | Sets `required` validation error key if the value is not entered. |
| ngRequired *(optional)* | `boolean` | Sets `required` attribute if set to true |
| ngMinlength *(optional)* | `number` | Sets `minlength` validation error key if the value is shorter than minlength. |
| ngMaxlength *(optional)* | `number` | Sets `maxlength` validation error key if the value is longer than maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any length. |
| ngPattern *(optional)* | `string` | Sets `pattern` validation error key if the ngModel [$viewValue](../type/ngmodel.ngmodelcontroller#%24viewValue.html) value does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. If the expression evaluates to a RegExp object, then this is used directly. If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to start at the index of the last search's match, thus not taking the whole input value into account. |
| ngChange *(optional)* | `string` | AngularJS expression to be executed when input changes due to user interaction with the input element. |
| ngTrim *(optional)* | `boolean` | If set to false AngularJS will not automatically trim the input. This parameter is ignored for input[type=password] controls, which will never trim the input. *(default: true)* |
Example
-------
angularjs
Improve this Doc View Source ngMouseenter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngMouseenter)%3A%20describe%20your%20change...#L190) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L190) ngMouseenter
==========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on mouseenter event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-mouseenter="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMouseenter | `expression` | [Expression](../../../guide/expression) to evaluate upon mouseenter. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngCsp
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngCsp.js?message=docs(ngCsp)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngCsp.js#L3) ngCsp
============================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
AngularJS has some features that can conflict with certain restrictions that are applied when using [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
If you intend to implement CSP with these rules then you must tell AngularJS not to use these features.
This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
The following default rules in CSP affect AngularJS:
* The use of `eval()`, `Function(string)` and similar functions to dynamically create and execute code from strings is forbidden. AngularJS makes use of this in the [`$parse`](../service/%24parse) service to provide a 30% increase in the speed of evaluating AngularJS expressions. (This CSP rule can be disabled with the CSP keyword `unsafe-eval`, but it is generally not recommended as it would weaken the protections offered by CSP.)
* The use of inline resources, such as inline `<script>` and `<style>` elements, are forbidden. This prevents apps from injecting custom styles directly into the document. AngularJS makes use of this to include some CSS rules (e.g. [`ngCloak`](ngcloak) and [`ngHide`](nghide)). To make these directives work when a CSP rule is blocking inline styles, you must link to the `angular-csp.css` in your HTML manually. (This CSP rule can be disabled with the CSP keyword `unsafe-inline`, but it is generally not recommended as it would weaken the protections offered by CSP.)
If you do not provide `ngCsp` then AngularJS tries to autodetect if CSP is blocking dynamic code creation from strings (e.g., `unsafe-eval` not specified in CSP header) and automatically deactivates this feature in the [`$parse`](../service/%24parse) service. This autodetection, however, triggers a CSP error to be logged in the console:
```
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
script in the following Content Security Policy directive: "default-src 'self'". Note that
'script-src' was not explicitly set, so 'default-src' is used as a fallback.
```
This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp` directive on an element of the HTML document that appears before the `<script>` tag that loads the `angular.js` file.
*Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
You can specify which of the CSP related AngularJS features should be deactivated by providing a value for the `ng-csp` attribute. The options are as follows:
* no-inline-style: this stops AngularJS from injecting CSS styles into the DOM
* no-unsafe-eval: this stops AngularJS from optimizing $parse with unsafe eval of strings
You can use these values in the following combinations:
* No declaration means that AngularJS will assume that you can do inline styles, but it will do a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions of AngularJS.
* A simple `ng-csp` (or `data-ng-csp`) attribute will tell AngularJS to deactivate both inline styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions of AngularJS.
* Specifying only `no-unsafe-eval` tells AngularJS that we must not use eval, but that we can inject inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
* Specifying only `no-inline-style` tells AngularJS that we must not inject styles, but that we can run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
* Specifying both `no-unsafe-eval` and `no-inline-style` tells AngularJS that we must not inject styles nor use eval, which is the same as an empty: ng-csp. E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-csp>
...
</ANY>
```
Example
-------
This example shows how to apply the `ngCsp` directive to the `html` tag.
```
<!doctype html>
<html ng-app ng-csp>
...
...
</html>
```
| programming_docs |
angularjs
Improve this Doc View Source ngSelected
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngSelected)%3A%20describe%20your%20change...#L261) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L261) ngSelected
==========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
A special directive is necessary because we cannot use interpolation inside the `selected` attribute. See the [interpolation guide](../../../guide/interpolation) for more info.
**Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only sets the `selected` attribute on the element. If you are using `ngModel` on the select, you should not use `ngSelected` on the options, as `ngModel` will set the select value and selected options. Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<OPTION
ng-selected="expression">
...
</OPTION>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSelected | `expression` | If the [expression](../../../guide/expression) is truthy, then special attribute "selected" will be set on the element |
Example
-------
angularjs
Improve this Doc View Source ngBind
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngBind.js?message=docs(ngBind)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngBind.js#L3) ngBind
================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngBind` attribute tells AngularJS to replace the text content of the specified HTML element with the value of a given expression, and to update the text content when the value of that expression changes.
Typically, you don't use `ngBind` directly, but instead you use the double curly markup like `{{ expression }}` which is similar but less verbose.
It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily displayed by the browser in its raw state before AngularJS compiles it. Since `ngBind` is an element attribute, it makes the bindings invisible to the user while the page is loading.
An alternative solution to this problem would be using the [ngCloak](ngcloak) directive.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-bind="expression">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-bind: expression;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngBind | `expression` | [Expression](../../../guide/expression) to evaluate. |
Example
-------
Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
angularjs
Improve this Doc View Source ngList
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngList.js?message=docs(ngList)%3A%20describe%20your%20change...#L4) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngList.js#L4) ngList
================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Text input that converts between a delimited string and an array of strings. The default delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`.
The behaviour of the directive is affected by the use of the `ngTrim` attribute.
* If `ngTrim` is set to `"false"` then whitespace around both the separator and each list item is respected. This implies that the user of the directive is responsible for dealing with whitespace but also allows you to use whitespace as a delimiter, such as a tab or newline character.
* Otherwise whitespace around the delimiter is ignored when splitting (although it is respected when joining the list items back together) and whitespace around each list item is stripped before it is added to the model.
Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<ANY
[ng-list="string"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngList *(optional)* | `string` | optional delimiter that should be used to split the value. |
Examples
--------
### Validation
### Splitting on newline
angularjs
Improve this Doc View Source ngController
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngController.js?message=docs(ngController)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngController.js#L3) ngController
========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular supports the principles behind the Model-View-Controller design pattern.
MVC components in angular:
* Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties are accessed through bindings.
* View — The template (HTML with data bindings) that is rendered into the View.
* Controller — The `ngController` directive specifies a Controller class; the class contains business logic behind the application to decorate the scope with functions and values
Note that you can also attach controllers to the DOM by declaring it in a route definition via the [$route](../../ngroute/service/%24route) service. A common mistake is to declare the controller again using `ng-controller` in the template itself. This will cause the controller to be attached and executed twice.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 500.
Usage
-----
* as element:
```
<ng-controller
ng-controller="expression">
...
</ng-controller>
```
* as attribute:
```
<ANY
ng-controller="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngController | `expression` | Name of a constructor function registered with the current [$controllerProvider](../provider/%24controllerprovider) or an [expression](../../../guide/expression) that on the current scope evaluates to a constructor function. The controller instance can be published into a scope property by specifying `ng-controller="as propertyName"`. |
Example
-------
Here is a simple form for editing user contact information. Adding, removing, clearing, and greeting are methods declared on the controller (see source tab). These methods can easily be called from the AngularJS markup. Any changes to the data are automatically reflected in the View without the need for a manual update.
Two different declaration styles are included below:
* one binds methods and properties directly onto the controller using `this`: `ng-controller="SettingsController1 as settings"`
* one injects `$scope` into the controller: `ng-controller="SettingsController2"`
The second option is more common in the AngularJS community, and is generally used in boilerplates and in this guide. However, there are advantages to binding properties directly to the controller and avoiding scope.
* Using `controller as` makes it obvious which controller you are accessing in the template when multiple controllers apply to an element.
* If you are writing your controllers as classes you have easier access to the properties and methods, which will appear on the scope, from inside the controller code.
* Since there is always a `.` in the bindings, you don't have to worry about prototypal inheritance masking primitives.
This example demonstrates the `controller as` syntax.
This example demonstrates the "attach to `$scope`" style of controller.
angularjs
Improve this Doc View Source ngApp
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/Angular.js?message=docs(ngApp)%3A%20describe%20your%20change...#L1558) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/Angular.js#L1558) ngApp
============================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive designates the **root element** of the application and is typically placed near the root element of the page - e.g. on the `<body>` or `<html>` tags.
There are a few things to keep in mind when using `ngApp`:
* only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp` found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document you must manually bootstrap them using [`angular.bootstrap`](../function/angular.bootstrap) instead.
* AngularJS applications cannot be nested within each other.
* Do not use a directive that uses [transclusion](../service/%24compile#transclusion.html) on the same element as `ngApp`. This includes directives such as [`ngIf`](ngif), [`ngInclude`](nginclude) and [`ngView`](../../ngroute/directive/ngview). Doing this misplaces the app [`$rootElement`](../service/%24rootelement) and the app's [injector](../../auto/service/%24injector), causing animations to stop working and making the injector inaccessible from outside the app.
You can specify an **AngularJS module** to be used as the root module for the application. This module will be loaded into the [`$injector`](../../auto/service/%24injector) when the application is bootstrapped. It should contain the application code needed or have dependencies on other modules that will contain the code. See [`angular.module`](../function/angular.module) for more information.
In the example below if the `ngApp` directive were not placed on the `html` element then the document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}` would not be resolved to `3`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-app
ng-app="angular.Module"
[ng-strict-di="boolean"]>
...
</ng-app>
```
* as attribute:
```
<ANY
ng-app="angular.Module"
[ng-strict-di="boolean"]>
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngApp | `angular.Module` | an optional application [module](../function/angular.module) name to load. |
| ngStrictDi *(optional)* | `boolean` | if this attribute is present on the app element, the injector will be created in "strict-di" mode. This means that the application will fail to invoke functions which do not use explicit function annotation (and are thus unsuitable for minification), as described in [the Dependency Injection guide](../../../guide/di), and useful debugging info will assist in tracking down the root of these bugs. |
Examples
--------
### Simple Usage
`ngApp` is the easiest, and most common way to bootstrap an application.
### With ngStrictDi
Using `ngStrictDi`, you would see something like this:
angularjs
Improve this Doc View Source ngBlur
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngBlur)%3A%20describe%20your%20change...#L424) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L424) ngBlur
==============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on blur event.
A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when an element has lost focus.
Note: As the `blur` event is executed synchronously also during DOM manipulations (e.g. removing a focussed input), AngularJS executes the expression using `scope.$evalAsync` if the event is fired during an `$apply` to ensure a consistent state.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<window, input, select, textarea, a
ng-blur="expression">
...
</window, input, select, textarea, a>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngBlur | `expression` | [Expression](../../../guide/expression) to evaluate upon blur. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
See [ngClick](ngclick)
angularjs
Improve this Doc View Source ngMousemove
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngMousemove)%3A%20describe%20your%20change...#L240) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L240) ngMousemove
========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on mousemove event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-mousemove="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMousemove | `expression` | [Expression](../../../guide/expression) to evaluate upon mousemove. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source script
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/script.js?message=docs(script)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/script.js#L3) script
================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Load the content of a `<script>` element into [`$templateCache`](../service/%24templatecache), so that the template can be used by [`ngInclude`](nginclude), [`ngView`](../../ngroute/directive/ngview), or [directives](../../../guide/directive). The type of the `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<script
type="string"
id="string">
...
</script>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| type | `string` | Must be set to `'text/ng-template'`. |
| id | `string` | Cache name of the template. |
Example
-------
angularjs
Improve this Doc View Source ngReadonly
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngReadonly)%3A%20describe%20your%20change...#L225) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L225) ngReadonly
==========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy. Note that `readonly` applies only to `input` elements with specific types. [See the input docs on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
A special directive is necessary because we cannot use interpolation inside the `readonly` attribute. See the [interpolation guide](../../../guide/interpolation) for more info.
Directive Info
--------------
* This directive executes at priority level 100.
Usage
-----
* as attribute:
```
<INPUT
ng-readonly="expression">
...
</INPUT>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngReadonly | `expression` | If the [expression](../../../guide/expression) is truthy, then special attribute "readonly" will be set on the element |
Example
-------
angularjs
Improve this Doc View Source ngSrc
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/attrs.js?message=docs(ngSrc)%3A%20describe%20your%20change...#L102) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/attrs.js#L102) ngSrc
================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't work right: The browser will fetch from the URL with the literal text `{{hash}}` until AngularJS replaces the expression inside `{{hash}}`. The `ngSrc` directive solves this problem.
The buggy way to write it:
```
<img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
```
The correct way to write it:
```
<img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
```
Directive Info
--------------
* This directive executes at priority level 99.
Usage
-----
* as attribute:
```
<IMG
ng-src="template">
...
</IMG>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSrc | `template` | any string which can contain `{{}}` markup. |
| programming_docs |
angularjs
Improve this Doc View Source ngMinlength
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/validators.js?message=docs(ngMinlength)%3A%20describe%20your%20change...#L325) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/validators.js#L325) ngMinlength
======================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
ngMinlength adds the minlength [`validator`](../type/ngmodel.ngmodelcontroller#%24validators.html) to [`ngModel`](ngmodel). It is most often used for text-based [`input`](input) controls, but can also be applied to custom text-based controls.
The validator sets the `minlength` error key if the [`ngModel.$viewValue`](../type/ngmodel.ngmodelcontroller#%24viewValue.html) is shorter than the integer obtained by evaluating the AngularJS expression given in the `ngMinlength` attribute value.
**Note:** This directive is also added when the plain `minlength` attribute is used, with two differences: 1. `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint validation is not available.
2. The `ngMinlength` value must be an expression, while the `minlength` value must be interpolated.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-minlength="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMinlength | `expression` | AngularJS expression that must evaluate to a `Number` or `String` parsable into a `Number`. Used as value for the `minlength` [validator](../type/ngmodel.ngmodelcontroller#%24validators.html). |
Example
-------
angularjs
Improve this Doc View Source ngPaste
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngPaste)%3A%20describe%20your%20change...#L493) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L493) ngPaste
================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on paste event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<window, input, select, textarea, a
ng-paste="expression">
...
</window, input, select, textarea, a>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngPaste | `expression` | [Expression](../../../guide/expression) to evaluate upon paste. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngRepeat
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngRepeat.js?message=docs(ngRepeat)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngRepeat.js#L5) ngRepeat
========================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngRepeat` directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop variable is set to the current collection item, and `$index` is set to the item index or key.
Special properties are exposed on the local scope of each template instance, including:
| Variable | Type | Details |
| --- | --- | --- |
| `$index` | `number` | iterator offset of the repeated element (0..length-1) |
| `$first` | `boolean` | true if the repeated element is first in the iterator. |
| `$middle` | `boolean` | true if the repeated element is between the first and last in the iterator. |
| `$last` | `boolean` | true if the repeated element is last in the iterator. |
| `$even` | `boolean` | true if the iterator position `$index` is even (otherwise false). |
| `$odd` | `boolean` | true if the iterator position `$index` is odd (otherwise false). |
Creating aliases for these properties is possible with [`ngInit`](nginit). This may be useful when, for instance, nesting ngRepeats. Iterating over object properties
--------------------------------
It is possible to get `ngRepeat` to iterate over the properties of an object using the following syntax:
```
<div ng-repeat="(key, value) in myObj"> ... </div>
```
However, there are a few limitations compared to array iteration:
* The JavaScript specification does not define the order of keys returned for an object, so AngularJS relies on the order returned by the browser when running `for key in myObj`. Browsers generally follow the strategy of providing keys in the order in which they were defined, although there are exceptions when keys are deleted and reinstated. See the [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).
* `ngRepeat` will silently *ignore* object keys starting with `$`, because it's a prefix used by AngularJS for public (`$`) and private (`$$`) properties.
* The built-in filters [orderBy](../filter/orderby) and [filter](../filter/filter) do not work with objects, and will throw an error if used with one.
If you are hitting any of these limitations, the recommended workaround is to convert your object into an array that is sorted into the order that you prefer before providing it to `ngRepeat`. You could do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter) or implement a `$watch` on the object yourself.
Tracking and Duplicates
-----------------------
`ngRepeat` uses [$watchCollection](../type/%24rootscope.scope#%24watchCollection.html) to detect changes in the collection. When a change happens, `ngRepeat` then makes the corresponding changes to the DOM:
* When an item is added, a new instance of the template is added to the DOM.
* When an item is removed, its template instance is removed from the DOM.
* When items are reordered, their respective templates are reordered in the DOM.
To minimize creation of DOM elements, `ngRepeat` uses a function to "keep track" of all items in the collection and their corresponding DOM elements. For example, if an item is added to the collection, `ngRepeat` will know that all other items already have DOM elements, and will not re-render them.
All different types of tracking functions, their syntax, and their support for duplicate items in collections can be found in the [ngRepeat expression description](ngrepeat#ngRepeat-arguments.html).
**Best Practice:** If you are working with objects that have a unique identifier property, you should track by this identifier instead of the object instance, e.g. `item in items track by item.id`. Should you reload your data later, `ngRepeat` will not have to rebuild the DOM elements for items it has already rendered, even if the JavaScript objects in the collection have been substituted for new ones. For large collections, this significantly improves rendering performance. ### Effects of DOM Element re-use
When DOM elements are re-used, ngRepeat updates the scope for the element, which will automatically update any active bindings on the template. However, other functionality will not be updated, because the element is not re-created:
* Directives are not re-compiled
* [one-time expressions](../../../guide/expression#one-time-binding.html) on the repeated template are not updated if they have stabilized.
The above affects all kinds of element re-use due to tracking, but may be especially visible when tracking by `$index` due to the way ngRepeat re-uses elements.
The following example shows the effects of different actions with tracking:
Special repeat start and end points
-----------------------------------
To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively. The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on) up to and including the ending HTML tag where **ng-repeat-end** is placed.
The example below makes use of this feature:
```
<header ng-repeat-start="item in items">
Header {{ item }}
</header>
<div class="body">
Body {{ item }}
</div>
<footer ng-repeat-end>
Footer {{ item }}
</footer>
```
And with an input of `['A','B']` for the items variable in the example above, the output will evaluate to:
```
<header>
Header A
</header>
<div class="body">
Body A
</div>
<footer>
Footer A
</footer>
<header>
Header B
</header>
<div class="body">
Body B
</div>
<footer>
Footer B
</footer>
```
The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 1000.
* This directive can be used as [multiElement](../service/%24compile#-multielement-.html)
Usage
-----
* as attribute:
```
<ANY
ng-repeat="repeat_expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngRepeat | `repeat_expression` | The expression indicating how to enumerate a collection. These formats are currently supported:* `variable in expression` – where variable is the user defined loop variable and `expression` is a scope expression giving the collection to enumerate. For example: `album in artist.albums`.
* `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, and `expression` is the scope expression giving the collection to enumerate. For example: `(name, age) in {'adam':10, 'amalie':12}`.
* `variable in expression track by tracking_expression` – You can also provide an optional tracking expression which can be used to associate the objects in the collection with the DOM elements. If no tracking expression is specified, ng-repeat associates elements by identity. It is an error to have more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are mapped to the same DOM element, which is not possible.) *Default tracking: $id()*: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements will be associated by item identity in the collection. The built-in `$id()` function can be used to assign a unique `$$hashKey` property to each item in the collection. This property is then used as a key to associated DOM elements with the corresponding item in the collection by identity. Moving the same object would move the DOM element in the same way in the DOM. Note that the default id function does not support duplicate primitive values (`number`, `string`), but supports duplictae non-primitive values (`object`) that are *equal* in shape. *Custom Expression*: It is possible to use any AngularJS expression to compute the tracking id, for example with a function, or using a property on the collection items. `item in items track by item.id` is a typical pattern when the items have a unique identifier, e.g. database id. In this case the object identity does not matter. Two objects are considered equivalent as long as their `id` property is same. Tracking by unique identifier is the most performant way and should be used whenever possible. *$index*: This special property tracks the collection items by their index, and re-uses the DOM elements that match that index, e.g. `item in items track by $index`. This can be used for a performance improvement if no unique identfier is available and the identity of the collection items cannot be easily computed. It also allows duplicates. **Note:** Re-using DOM elements can have unforeseen effects. Read the [section on tracking and duplicates](ngrepeat#tracking-and-duplicates.html) for more info. **Note:** the `track by` expression must come last - after any filters, and the alias expression: `item in items | filter:searchText as results track by item.id`
* `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message when a filter is active on the repeater, but the filtered result set is empty. For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after the items have been processed through the filter. Please note that `as [variable name]` is not an operator but rather a part of ngRepeat micro-syntax so it can be used only after all filters (and not as operator, inside an expression). For example: `item in items | filter : x | orderBy : order | limitTo : limit as results track by item.id` .
|
Animations
----------
| Animation | Occurs |
| --- | --- |
| [enter](../service/%24animate#enter.html) | when a new item is added to the list or when an item is revealed after a filter |
| [leave](../service/%24animate#leave.html) | when an item is removed from the list or when an item is filtered out |
| [move](../service/%24animate#move.html) | when an adjacent item is filtered out causing a reorder or when the item contents are reordered |
See the example below for defining CSS animations with ngRepeat.
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Example
-------
This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed results by name or by age. New (entering) and removed (leaving) items are animated.
angularjs
Improve this Doc View Source ngClassEven
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngClass.js?message=docs(ngClassEven)%3A%20describe%20your%20change...#L443) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngClass.js#L443) ngClassEven
================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngClassOdd` and `ngClassEven` directives work exactly as [ngClass](ngclass), except they work in conjunction with `ngRepeat` and take effect only on odd (even) rows.
This directive can be applied only within the scope of an [ngRepeat](ngrepeat).
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-class-even="expression">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-class-even: expression;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngClassEven | `expression` | [Expression](../../../guide/expression) to eval. The result of the evaluation can be a string representing space delimited class names or an array. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [addClass](../service/%24animate#addClass.html) | just before the class is applied to the element |
| [removeClass](../service/%24animate#removeClass.html) | just before the class is removed from the element |
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Examples
--------
An example on how to implement animations using `ngClassEven`:
angularjs
Improve this Doc View Source ngClassOdd
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngClass.js?message=docs(ngClassOdd)%3A%20describe%20your%20change...#L333) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngClass.js#L333) ngClassOdd
==============================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `ngClassOdd` and `ngClassEven` directives work exactly as [ngClass](ngclass), except they work in conjunction with `ngRepeat` and take effect only on odd (even) rows.
This directive can be applied only within the scope of an [ngRepeat](ngrepeat).
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-class-odd="expression">
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-class-odd: expression;"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngClassOdd | `expression` | [Expression](../../../guide/expression) to eval. The result of the evaluation can be a string representing space delimited class names or an array. |
Animations
----------
| Animation | Occurs |
| --- | --- |
| [addClass](../service/%24animate#addClass.html) | just before the class is applied to the element |
| [removeClass](../service/%24animate#removeClass.html) | just before the class is removed from the element |
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Examples
--------
An example on how to implement animations using `ngClassOdd`:
angularjs
Improve this Doc View Source ngMousedown
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngMousedown)%3A%20describe%20your%20change...#L116) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L116) ngMousedown
========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The ngMousedown directive allows you to specify custom behavior on mousedown event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-mousedown="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMousedown | `expression` | [Expression](../../../guide/expression) to evaluate upon mousedown. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
angularjs
Improve this Doc View Source ngMouseleave
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngMouseleave)%3A%20describe%20your%20change...#L215) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L215) ngMouseleave
==========================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on mouseleave event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-mouseleave="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngMouseleave | `expression` | [Expression](../../../guide/expression) to evaluate upon mouseleave. ([Event object is available as `$event`](../../../guide/expression#-event-.html)) |
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source a
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/a.js?message=docs(a)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/a.js#L3) a
============================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Modifies the default behavior of the html a tag so that the default action is prevented when the href attribute is empty.
For dynamically creating `href` attributes for a tags, see the [`ngHref`](nghref) directive.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<a>
...
</a>
```
angularjs
Improve this Doc View Source ngKeyup
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngEventDirs.js?message=docs(ngKeyup)%3A%20describe%20your%20change...#L288) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngEventDirs.js#L288) ngKeyup
================================================================================================================================================================================================================================================================================
1. directive in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Specify custom behavior on keyup event.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-keyup="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngKeyup | `expression` | [Expression](../../../guide/expression) to evaluate upon keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) |
Example
-------
angularjs
Improve this Doc View Source $compile.directive.Attributes
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/compile.js?message=docs(%24compile.directive.Attributes)%3A%20describe%20your%20change...#L4262) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/compile.js#L4262) $compile.directive.Attributes
====================================================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A shared object between directive compile / linking functions which contains normalized DOM element attributes. The values reflect current binding state `{{ }}`. The normalization is needed since all of these are treated as equivalent in AngularJS:
```
<span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
```
Methods
-------
* ### $normalize(name);
Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or `data-`) to its normalized, camelCase form.
Also there is special case for Moz prefix starting with upper case letter.
For further information check out the guide on [Matching Directives](../../../guide/directive#matching-directives.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Name to normalize |
* ### $addClass(classVal);
Adds the CSS class value specified by the classVal parameter to the element. If animations are enabled then an animation will be triggered for the class addition.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| classVal | `string` | The className value that will be added to the element |
* ### $removeClass(classVal);
Removes the CSS class value specified by the classVal parameter from the element. If animations are enabled then an animation will be triggered for the class removal.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| classVal | `string` | The className value that will be removed from the element |
* ### $updateClass(newClasses, oldClasses);
Adds and removes the appropriate CSS class values to the element based on the difference between the new and old CSS class values (specified as newClasses and oldClasses).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| newClasses | `string` | The current CSS className value |
| oldClasses | `string` | The former CSS className value |
* ### $observe(key, fn);
Observes an interpolated attribute.
The observer function will be invoked once during the next `$digest` following compilation. The observer is then invoked whenever the interpolated value changes.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | Normalized key. (ie ngAttribute) . |
| fn | `function(interpolatedValue)` | Function that will be called whenever the interpolated value of the attribute changes. See the [Interpolation guide](../../../guide/interpolation#how-text-and-attribute-bindings-work.html) for more info. |
#### Returns
| | |
| --- | --- |
| `function()` | Returns a deregistration function for this observer. |
* ### $set(name, value);
Set DOM element attribute value.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Normalized element attribute name of the property to modify. The name is reverse-translated using the [$attr](%24compile.directive.attributes#%24attr.html) property to the original name. |
| value | `string` | Value to set the attribute to. The value can be an interpolated string. |
Properties
----------
* ### $attr
| | |
| --- | --- |
| | A map of DOM element attribute names to the normalized name. This is needed to do reverse lookup from normalized name back to actual name. |
angularjs
Improve this Doc View Source $rootScope.Scope
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/rootScope.js?message=docs(%24rootScope.Scope)%3A%20describe%20your%20change...#L135) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/rootScope.js#L135) $rootScope.Scope
============================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A root scope can be retrieved using the [$rootScope](../service/%24rootscope) key from the [$injector](../../auto/service/%24injector). Child scopes are created using the [$new()](%24rootscope.scope#%24new.html) method. (Most scopes are created automatically when compiled HTML template is executed.) See also the [Scopes guide](../../../guide/scope) for an in-depth introduction and usage examples.
Inheritance
-----------
A scope can inherit from a parent scope, as in this example:
```
var parent = $rootScope;
var child = parent.$new();
parent.salutation = "Hello";
expect(child.salutation).toEqual('Hello');
child.salutation = "Welcome";
expect(child.salutation).toEqual('Welcome');
expect(parent.salutation).toEqual('Hello');
```
When interacting with `Scope` in tests, additional helper methods are available on the instances of `Scope` type. See [ngMock Scope](../../ngmock/type/%24rootscope.scope) for additional details.
Usage
-----
`$rootScope.Scope([providers], [instanceCache]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| providers *(optional)* | `Object.<string, function()>=` | Map of service factory which need to be provided for the current scope. Defaults to [`ng`](https://code.angularjs.org/1.8.2/docs/api/ng). |
| instanceCache *(optional)* | `Object.<string, *>=` | Provides pre-instantiated services which should append/override services provided by `providers`. This is handy when unit-testing and having the need to override a default service. |
### Returns
| | |
| --- | --- |
| `Object` | Newly created scope. |
Methods
-------
* ### $new(isolate, parent);
Creates a new child [scope](%24rootscope.scope).
The parent scope will propagate the [$digest()](%24rootscope.scope#%24digest.html) event. The scope can be removed from the scope hierarchy using [$destroy()](%24rootscope.scope#%24destroy.html).
[$destroy()](%24rootscope.scope#%24destroy.html) must be called on a scope when it is desired for the scope and its child scopes to be permanently detached from the parent and thus stop participating in model change detection and listener notification by invoking.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| isolate | `boolean` | If true, then the scope does not prototypically inherit from the parent scope. The scope is isolated, as it can not see parent scope properties. When creating widgets, it is useful for the widget to not accidentally read parent state. |
| parent *(optional)* | `Scope` | The [`Scope`](%24rootscope.scope) that will be the `$parent` of the newly created scope. Defaults to `this` scope if not provided. This is used when creating a transclude scope to correctly place it in the scope hierarchy while maintaining the correct prototypical inheritance. *(default: this)* |
#### Returns
| | |
| --- | --- |
| `Object` | The newly created child scope. |
* ### $watch(watchExpression, listener, [objectEquality]);
Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+ The `watchExpression` is called on every call to [$digest()](%24rootscope.scope#%24digest.html) and should return the value that will be watched. (`watchExpression` should not change its value when executed multiple times with the same input because it may be executed multiple times by [$digest()](%24rootscope.scope#%24digest.html). That is, `watchExpression` should be [idempotent](http://en.wikipedia.org/wiki/Idempotence).)
+ The `listener` is called only when the value from the current `watchExpression` and the previous call to `watchExpression` are not equal (with the exception of the initial run, see below). Inequality is determined according to reference inequality, [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) via the `!==` Javascript operator, unless `objectEquality == true` (see next point)
+ When `objectEquality == true`, inequality of the `watchExpression` is determined according to the [`angular.equals`](../function/angular.equals) function. To save the value of the object for later comparison, the [`angular.copy`](../function/angular.copy) function is used. This therefore means that watching complex objects will have adverse memory and performance implications.
+ This should not be used to watch for changes in objects that are (or contain) [File](https://developer.mozilla.org/docs/Web/API/File) objects due to limitations with [`angular.copy`](../function/angular.copy).
+ The watch `listener` may change the model, which may trigger other `listener`s to fire. This is achieved by rerunning the watchers until no changes are detected. The rerun iteration limit is 10 to prevent an infinite loop deadlock. If you want to be notified whenever [$digest](%24rootscope.scope#%24digest.html) is called, you can register a `watchExpression` function with no `listener`. (Be prepared for multiple calls to your `watchExpression` because it will execute multiple times in a single [$digest](%24rootscope.scope#%24digest.html) cycle if a change is detected.)
After a watcher is registered with the scope, the `listener` fn is called asynchronously (via [$evalAsync](%24rootscope.scope#%24evalAsync.html)) to initialize the watcher. In rare cases, this is undesirable because the listener is called when the result of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the listener was called due to initialization.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| watchExpression | `function()``string` | Expression that is evaluated on each [$digest](%24rootscope.scope#%24digest.html) cycle. A change in the return value triggers a call to the `listener`.
+ `string`: Evaluated as [expression](../../../guide/expression)
+ `function(scope)`: called with current `scope` as a parameter. |
| listener | `function(newVal, oldVal, scope)` | Callback called whenever the value of `watchExpression` changes.
+ `newVal` contains the current value of the `watchExpression`
+ `oldVal` contains the previous value of the `watchExpression`
+ `scope` refers to the current scope |
| objectEquality *(optional)* | `boolean` | Compare for object equality using [`angular.equals`](../function/angular.equals) instead of comparing for reference equality. *(default: false)* |
#### Returns
| | |
| --- | --- |
| `function()` | Returns a deregistration function for this listener. |
#### Example
```
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
scope.name = 'misko';
scope.counter = 0;
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) {
scope.counter = scope.counter + 1;
});
expect(scope.counter).toEqual(0);
scope.$digest();
// the listener is always called during the first $digest loop after it was registered
expect(scope.counter).toEqual(1);
scope.$digest();
// but now it will not be called unless the value changes
expect(scope.counter).toEqual(1);
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(2);
// Using a function as a watchExpression
var food;
scope.foodCounter = 0;
expect(scope.foodCounter).toEqual(0);
scope.$watch(
// This function returns the value being watched. It is called for each turn of the $digest loop
function() { return food; },
// This is the change listener, called when the value returned from the above function changes
function(newValue, oldValue) {
if ( newValue !== oldValue ) {
// Only increment the counter if the value changed
scope.foodCounter = scope.foodCounter + 1;
}
}
);
// No digest has been run so the counter will be zero
expect(scope.foodCounter).toEqual(0);
// Run the digest but since food has not changed count will still be zero
scope.$digest();
expect(scope.foodCounter).toEqual(0);
// Update food and run digest. Now the counter will increment
food = 'cheeseburger';
scope.$digest();
expect(scope.foodCounter).toEqual(1);
```
* ### $watchGroup(watchExpressions, listener);
A variant of [$watch()](%24rootscope.scope#%24watch.html) where it watches an array of `watchExpressions`. If any one expression in the collection changes the `listener` is executed.
+ The items in the `watchExpressions` array are observed via the standard `$watch` operation. Their return values are examined for changes on every call to `$digest`.
+ The `listener` is called whenever any expression in the `watchExpressions` array changes. #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| watchExpressions | `Array.<string|Function(scope)>` | Array of expressions that will be individually watched using [$watch()](%24rootscope.scope#%24watch.html) |
| listener | `function(newValues, oldValues, scope)` | Callback called whenever the return value of any expression in `watchExpressions` changes The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching those of `watchExpression` and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching those of `watchExpression` The `scope` refers to the current scope. |
#### Returns
| | |
| --- | --- |
| `function()` | Returns a de-registration function for all listeners. |
* ### $watchCollection(obj, listener);
Shallow watches the properties of an object and fires whenever any of the properties change (for arrays, this implies watching the array items; for object maps, this implies watching the properties). If a change is detected, the `listener` callback is fired.
+ The `obj` collection is observed via standard $watch operation and is examined on every call to $digest() to see if any items have been added, removed, or moved.
+ The `listener` is called whenever anything within the `obj` has changed. Examples include adding, removing, and moving items belonging to an object or array. #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| obj | `string``function(scope)` | Evaluated as [expression](../../../guide/expression). The expression value should evaluate to an object or an array which is observed on each [$digest](%24rootscope.scope#%24digest.html) cycle. Any shallow change within the collection will trigger a call to the `listener`. |
| listener | `function(newCollection, oldCollection, scope)` | a callback function called when a change is detected.
+ The `newCollection` object is the newly modified data obtained from the `obj` expression
+ The `oldCollection` object is a copy of the former collection data. Due to performance considerations, the`oldCollection` value is computed only if the `listener` function declares two or more arguments.
+ The `scope` argument refers to the current scope. |
#### Returns
| | |
| --- | --- |
| `function()` | Returns a de-registration function for this listener. When the de-registration function is executed, the internal watch operation is terminated. |
#### Example
```
$scope.names = ['igor', 'matias', 'misko', 'james'];
$scope.dataCount = 4;
$scope.$watchCollection('names', function(newNames, oldNames) {
$scope.dataCount = newNames.length;
});
expect($scope.dataCount).toEqual(4);
$scope.$digest();
//still at 4 ... no changes
expect($scope.dataCount).toEqual(4);
$scope.names.pop();
$scope.$digest();
//now there's been a change
expect($scope.dataCount).toEqual(3);
```
* ### $digest();
Processes all of the [watchers](%24rootscope.scope#%24watch.html) of the current scope and its children. Because a [watcher](%24rootscope.scope#%24watch.html)'s listener can change the model, the `$digest()` keeps calling the [watchers](%24rootscope.scope#%24watch.html) until no more listeners are firing. This means that it is possible to get into an infinite loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 10.
Usually, you don't call `$digest()` directly in [controllers](../directive/ngcontroller) or in [directives](../provider/%24compileprovider#directive.html). Instead, you should call [$apply()](%24rootscope.scope#%24apply.html) (typically from within a [directive](../provider/%24compileprovider#directive.html)), which will force a `$digest()`.
If you want to be notified whenever `$digest()` is called, you can register a `watchExpression` function with [$watch()](%24rootscope.scope#%24watch.html) with no `listener`.
In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
#### Example
```
var scope = ...;
scope.name = 'misko';
scope.counter = 0;
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) {
scope.counter = scope.counter + 1;
});
expect(scope.counter).toEqual(0);
scope.$digest();
// the listener is always called during the first $digest loop after it was registered
expect(scope.counter).toEqual(1);
scope.$digest();
// but now it will not be called unless the value changes
expect(scope.counter).toEqual(1);
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(2);
```
* ### $suspend();
Suspend watchers of this scope subtree so that they will not be invoked during digest.
This can be used to optimize your application when you know that running those watchers is redundant.
**Warning**
Suspending scopes from the digest cycle can have unwanted and difficult to debug results. Only use this approach if you are confident that you know what you are doing and have ample tests to ensure that bindings get updated as you expect.
Some of the things to consider are:
+ Any external event on a directive/component will not trigger a digest while the hosting scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`.
+ Transcluded content exists on a scope that inherits from outside a directive but exists as a child of the directive's containing scope. If the containing scope is suspended the transcluded scope will also be suspended, even if the scope from which the transcluded scope inherits is not suspended.
+ Multiple directives trying to manage the suspended status of a scope can confuse each other:
- A call to `$suspend()` on an already suspended scope is a no-op.
- A call to `$resume()` on a non-suspended scope is a no-op.
- If two directives suspend a scope, then one of them resumes the scope, the scope will no longer be suspended. This could result in the other directive believing a scope to be suspended when it is not.
+ If a parent scope is suspended then all its descendants will be also excluded from future digests whether or not they have been suspended themselves. Note that this also applies to isolate child scopes.
+ Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers for that scope and its descendants. When digesting we only check whether the current scope is locally suspended, rather than checking whether it has a suspended ancestor.
+ Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be included in future digests until all its ancestors have been resumed.
+ Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()` against the `$rootScope` and so will still trigger a global digest even if the promise was initiated by a component that lives on a suspended scope.
* ### $isSuspended();
Call this method to determine if this scope has been explicitly suspended. It will not tell you whether an ancestor has been suspended. To determine if this scope will be excluded from a digest triggered at the $rootScope, for example, you must check all its ancestors:
```
function isExcludedFromDigest(scope) {
while(scope) {
if (scope.$isSuspended()) return true;
scope = scope.$parent;
}
return false;
```
Be aware that a scope may not be included in digests if it has a suspended ancestor, even if `$isSuspended()` returns false.
#### Returns
| | |
| --- | --- |
| | true if the current scope has been suspended. |
* ### $resume();
Resume watchers of this scope subtree in case it was suspended.
See [`$rootScope.Scope`](%24rootscope.scope#%24suspend.html) for information about the dangers of using this approach.
* ### $destroy();
Removes the current scope (and all of its children) from the parent scope. Removal implies that calls to [$digest()](%24rootscope.scope#%24digest.html) will no longer propagate to the current scope and its children. Removal also implies that the current scope is eligible for garbage collection.
The `$destroy()` is usually used by directives such as [ngRepeat](../directive/ngrepeat) for managing the unrolling of the loop.
Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope. Application code can register a `$destroy` event handler that will give it a chance to perform any necessary cleanup.
Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to clean up DOM bindings before an element is removed from the DOM.
* ### $eval([expression], [locals]);
Executes the `expression` on the current scope and returns the result. Any exceptions in the expression are propagated (uncaught). This is useful when evaluating AngularJS expressions.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression *(optional)* | `string``function()` | An AngularJS expression to be executed.
+ `string`: execute using the rules as defined in [expression](../../../guide/expression).
+ `function(scope)`: execute the function with the current `scope` parameter. |
| locals *(optional)* | `object` | Local variables object, useful for overriding values in scope. |
#### Returns
| | |
| --- | --- |
| `*` | The result of evaluating the expression. |
#### Example
```
var scope = ng.$rootScope.Scope();
scope.a = 1;
scope.b = 2;
expect(scope.$eval('a+b')).toEqual(3);
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
```
* ### $evalAsync([expression], [locals]);
Executes the expression on the current scope at a later point in time.
The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
+ it will execute after the function that scheduled the evaluation (preferably before DOM rendering).
+ at least one [$digest cycle](%24rootscope.scope#%24digest.html) will be performed after `expression` execution. Any exceptions from the execution of the expression are forwarded to the [$exceptionHandler](../service/%24exceptionhandler) service.
**Note:** if this function is called outside of a `$digest` cycle, a new `$digest` cycle will be scheduled. However, it is encouraged to always call code that changes the model from within an `$apply` call. That includes code evaluated via `$evalAsync`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression *(optional)* | `string``function()` | An AngularJS expression to be executed.
+ `string`: execute using the rules as defined in [expression](../../../guide/expression).
+ `function(scope)`: execute the function with the current `scope` parameter. |
| locals *(optional)* | `object` | Local variables object, useful for overriding values in scope. |
* ### $apply([exp]);
`$apply()` is used to execute an expression in AngularJS from outside of the AngularJS framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). Because we are calling into the AngularJS framework we need to perform proper scope life cycle of [exception handling](../service/%24exceptionhandler), [executing watches](%24rootscope.scope#%24digest.html).
**Life cycle: Pseudo-Code of `$apply()`**
```
function $apply(expr) {
try {
return $eval(expr);
} catch (e) {
$exceptionHandler(e);
} finally {
$root.$digest();
}
}
```
Scope's `$apply()` method transitions through the following stages:
1. The [expression](../../../guide/expression) is executed using the [$eval()](%24rootscope.scope#%24eval.html) method.
2. Any exceptions from the execution of the expression are forwarded to the [$exceptionHandler](../service/%24exceptionhandler) service.
3. The [watch](%24rootscope.scope#%24watch.html) listeners are fired immediately after the expression was executed using the [$digest()](%24rootscope.scope#%24digest.html) method. #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| exp *(optional)* | `string``function()` | An AngularJS expression to be executed.
+ `string`: execute using the rules as defined in [expression](../../../guide/expression).
+ `function(scope)`: execute the function with current `scope` parameter. |
#### Returns
| | |
| --- | --- |
| `*` | The result of evaluating the expression. |
* ### $applyAsync([exp]);
Schedule the invocation of $apply to occur at a later time. The actual time difference varies across browsers, but is typically around ~10 milliseconds.
This can be used to queue up multiple expressions which need to be evaluated in the same digest.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| exp *(optional)* | `string``function()` | An AngularJS expression to be executed.
+ `string`: execute using the rules as defined in [expression](../../../guide/expression).
+ `function(scope)`: execute the function with current `scope` parameter. |
* ### $on(name, listener);
Listens on events of a given type. See [$emit](%24rootscope.scope#%24emit.html) for discussion of event life cycle.
The event listener function format is: `function(event, args...)`. The `event` object passed into the listener has the following attributes:
+ `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
+ `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null.
+ `name` - `{string}`: name of the event.
+ `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel further event propagation (available only for events that were `$emit`-ed).
+ `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
+ `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Event name to listen on. |
| listener | `function(event, ...args)` | Function to call when the event is emitted. |
#### Returns
| | |
| --- | --- |
| `function()` | Returns a deregistration function for this listener. |
* ### $emit(name, args);
Dispatches an event `name` upwards through the scope hierarchy notifying the registered [`$rootScope.Scope`](%24rootscope.scope#%24on.html) listeners.
The event life cycle starts at the scope on which `$emit` was called. All [listeners](%24rootscope.scope#%24on.html) listening for `name` event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it.
Any exception emitted from the [listeners](%24rootscope.scope#%24on.html) will be passed onto the [$exceptionHandler](../service/%24exceptionhandler) service.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Event name to emit. |
| args | `*` | Optional one or more arguments which will be passed onto the event listeners. |
#### Returns
| | |
| --- | --- |
| `Object` | Event object (see [`$rootScope.Scope`](%24rootscope.scope#%24on.html)). |
* ### $broadcast(name, args);
Dispatches an event `name` downwards to all child scopes (and their children) notifying the registered [`$rootScope.Scope`](%24rootscope.scope#%24on.html) listeners.
The event life cycle starts at the scope on which `$broadcast` was called. All [listeners](%24rootscope.scope#%24on.html) listening for `name` event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled.
Any exception emitted from the [listeners](%24rootscope.scope#%24on.html) will be passed onto the [$exceptionHandler](../service/%24exceptionhandler) service.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Event name to broadcast. |
| args | `*` | Optional one or more arguments which will be passed onto the event listeners. |
#### Returns
| | |
| --- | --- |
| `Object` | Event object, see [`$rootScope.Scope`](%24rootscope.scope#%24on.html) |
Events
------
* ### $destroy
Broadcasted when a scope and its children are being destroyed.
Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to clean up DOM bindings before an element is removed from the DOM.
#### Type:
broadcast #### Target:
scope being destroyed
Properties
----------
* ### $id
| | |
| --- | --- |
| | Unique scope ID (monotonically increasing) useful for debugging. |
* ### $parent
| | |
| --- | --- |
| | Reference to the parent scope. |
* ### $root
| | |
| --- | --- |
| | Reference to the root scope. |
| programming_docs |
angularjs
Improve this Doc View Source ngModel.NgModelController
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngModel.js?message=docs(ngModel.NgModelController)%3A%20describe%20your%20change...#L27) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngModel.js#L27) ngModel.NgModelController
==========================================================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`NgModelController` provides API for the [`ngModel`](../directive/ngmodel) directive. The controller contains services for data-binding, validation, CSS updates, and value formatting and parsing. It purposefully does not contain any logic which deals with DOM rendering or listening to DOM events. Such DOM related logic should be provided by other directives which make use of `NgModelController` for data-binding to control elements. AngularJS provides this DOM logic for most [`input`](../directive/input) elements. At the end of this page you can find a [custom control example](ngmodel.ngmodelcontroller#custom-control-example.html) that uses `ngModelController` to bind to `contenteditable` elements.
Methods
-------
* ### $render();
Called when the view needs to be updated. It is expected that the user of the ng-model directive will implement this method.
The `$render()` method is invoked in the following situations:
+ `$rollbackViewValue()` is called. If we are rolling back the view value to the last committed value then `$render()` is called to update the input control.
+ The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and the `$viewValue` are different from last time. Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue` or `$viewValue` are objects (rather than a string or number) then `$render()` will not be invoked if you only change a property on the objects.
* ### $isEmpty(value);
This is called when we need to determine if the value of an input is empty.
For instance, the required directive does this to work out if the input has data or not.
The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
You can override this for input directives whose concept of being empty is different from the default. The `checkboxInputType` directive does this because in its case a value of `false` implies empty.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value of the input to check for emptiness. |
#### Returns
| | |
| --- | --- |
| `boolean` | True if `value` is "empty". |
* ### $setPristine();
Sets the control to its pristine state.
This method can be called to remove the `ng-dirty` class and set the control to its pristine state (`ng-pristine` class). A model is considered to be pristine when the control has not been changed from when first compiled.
* ### $setDirty();
Sets the control to its dirty state.
This method can be called to remove the `ng-pristine` class and set the control to its dirty state (`ng-dirty` class). A model is considered to be dirty when the control has been changed from when first compiled.
* ### $setUntouched();
Sets the control to its untouched state.
This method can be called to remove the `ng-touched` class and set the control to its untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched by default, however this function can be used to restore that state if the model has already been touched by the user.
* ### $setTouched();
Sets the control to its touched state.
This method can be called to remove the `ng-untouched` class and set the control to its touched state (`ng-touched` class). A model is considered to be touched when the user has first focused the control element and then shifted focus away from the control (blur event).
* ### $rollbackViewValue();
Cancel an update and reset the input element's value to prevent an update to the `$modelValue`, which may be caused by a pending debounced event or because the input is waiting for some future event.
If you have an input that uses `ng-model-options` to set up debounced updates or updates that depend on special events such as `blur`, there can be a period when the `$viewValue` is out of sync with the ngModel's `$modelValue`.
In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update and reset the input to the last committed view value.
It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue` programmatically before these debounced/future events have resolved/occurred, because AngularJS's dirty checking mechanism is not able to tell whether the model has actually changed or not.
The `$rollbackViewValue()` method should be called before programmatically changing the model of an input which may have such events pending. This is important in order to make sure that the input field will be updated with the new model value and any pending operations are cancelled.
#### Example
* ### $validate();
Runs each of the registered validators (first synchronous validators and then asynchronous validators). If the validity changes to invalid, the model will be set to `undefined`, unless [`ngModelOptions.allowInvalid`](../directive/ngmodeloptions) is `true`. If the validity changes to valid, it will set the model to the last available valid `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
* ### $commitViewValue();
Commit a pending update to the `$modelValue`.
Updates may be pending by a debounced event or because the input is waiting for a some future event defined in `ng-model-options`. this method is rarely needed as `NgModelController` usually handles calling this in response to input events.
* ### $setViewValue(value, trigger);
Update the view value.
This method should be called when a control wants to change the view value; typically, this is done from within a DOM event handler. For example, the [input](../directive/input) directive calls it when the value of the input changes and [select](../directive/select) calls it when an option is selected.
When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers` and `$validators` pipelines. If there are no special [`ngModelOptions`](../directive/ngmodeloptions) specified then the staged value is sent directly for processing through the `$parsers` pipeline. After this, the `$validators` and `$asyncValidators` are called and the value is applied to `$modelValue`. Finally, the value is set to the **expression** specified in the `ng-model` attribute and all the registered change listeners, in the `$viewChangeListeners` list are called.
In case the [ngModelOptions](../directive/ngmodeloptions) directive is used with `updateOn` and the `default` trigger is not listed, all those actions will remain pending until one of the `updateOn` events is triggered on the DOM element. All these actions will be debounced if the [ngModelOptions](../directive/ngmodeloptions) directive is used with a custom debounce for this particular event. Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce` is specified, once the timer runs out.
When used with standard inputs, the view value will always be a string (which is in some cases parsed into another type, such as a `Date` object for `input[date]`.) However, custom controls might also pass objects to this method. In this case, we should make a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not perform a deep watch of objects, it only looks for a change of identity. If you only change the property of the object then ngModel will not realize that the object has changed and will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should not change properties of the copy once it has been passed to `$setViewValue`. Otherwise you may cause the model value on the scope to change incorrectly.
In any case, the value passed to the method should always reflect the current value of the control. For example, if you are calling `$setViewValue` for an input element, you should pass the input DOM value. Otherwise, the control and the scope model become out of sync. It's also important to note that `$setViewValue` does not call `$render` or change the control's DOM value in any way. If we want to change the control's DOM value programmatically, we should update the `ngModel` scope expression. Its new value will be picked up by the model controller, which will run it through the `$formatters`, `$render` it to update the DOM, and finally call `$validate` on it.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | value from the view. |
| trigger | `string` | Event that triggered the update. |
* ### $overrideModelOptions(options);
Override the current model options settings programmatically.
The previous `ModelOptions` value will not be modified. Instead, a new `ModelOptions` object will inherit from the previous one overriding or inheriting settings that are defined in the given parameter.
See [`ngModelOptions`](../directive/ngmodeloptions) for information about what options can be specified and how model option inheritance works.
**Note:** this function only affects the options set on the `ngModelController`, and not the options on the [`ngModelOptions`](../directive/ngmodeloptions) directive from which they might have been obtained initially. **Note:** it is not possible to override the `getterSetter` option.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| options | `Object` | a hash of settings to override the previous options |
* ### $processModelValue();
Runs the model -> view pipeline on the current [$modelValue](ngmodel.ngmodelcontroller#%24modelValue.html).
The following actions are performed by this method:
+ the `$modelValue` is run through the [$formatters](ngmodel.ngmodelcontroller#%24formatters.html) and the result is set to the [$viewValue](ngmodel.ngmodelcontroller#%24viewValue.html)
+ the `ng-empty` or `ng-not-empty` class is set on the element
+ if the `$viewValue` has changed:
- [$render](ngmodel.ngmodelcontroller#%24render.html) is called on the control
- the [$validators](ngmodel.ngmodelcontroller#%24validators.html) are run and the validation status is set. This method is called by ngModel internally when the bound scope value changes. Application developers usually do not have to call this function themselves.
This function can be used when the `$viewValue` or the rendered DOM value are not correctly formatted and the `$modelValue` must be run through the `$formatters` again.
#### Example
Consider a text input with an autocomplete list (for fruit), where the items are objects with a name and an id. A user enters `ap` and then selects `Apricot` from the list. Based on this, the autocomplete widget will call `$setViewValue({name: 'Apricot', id: 443})`, but the rendered value will still be `ap`. The widget can then call `ctrl.$processModelValue()` to run the model -> view pipeline again, which formats the object to the string `Apricot`, then updates the `$viewValue`, and finally renders it in the DOM.
* ### $setValidity(validationErrorKey, isValid);
Change the validity state, and notify the form.
This method can be called within $parsers/$formatters or a custom validation implementation. However, in most cases it should be sufficient to use the `ngModel.$validators` and `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| validationErrorKey | `string` | Name of the validator. The `validationErrorKey` will be assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for unfulfilled `$asyncValidators`), so that it is available for data-binding. The `validationErrorKey` should be in camelCase and will get converted into dash-case for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` classes and can be bound to as `{{ someForm.someControl.$error.myError }}`. |
| isValid | `boolean` | Whether the current state is valid (true), invalid (false), pending (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`. Skipped is used by AngularJS when validators do not run because of parse errors and when `$asyncValidators` do not run because any of the `$validators` failed. |
Properties
----------
* ### $viewValue
| | |
| --- | --- |
| `*` | The actual value from the control's view. For `input` elements, this is a String. See [`ngModel.NgModelController`](ngmodel.ngmodelcontroller#%24setViewValue.html) for information about when the $viewValue is set. |
* ### $modelValue
| | |
| --- | --- |
| `*` | The value in the model that the control is bound to. |
* ### $parsers
| | |
| --- | --- |
| `Array.<Function>` | Array of functions to execute, as a pipeline, whenever the control updates the ngModelController with a new [`$viewValue`](ngmodel.ngmodelcontroller#%24viewValue.html) from the DOM, usually via user input. See [`$setViewValue()`](ngmodel.ngmodelcontroller#%24setViewValue.html) for a detailed lifecycle explanation. Note that the `$parsers` are not called when the bound ngModel expression changes programmatically. The functions are called in array order, each passing its return value through to the next. The last return value is forwarded to the [`$validators`](ngmodel.ngmodelcontroller#%24validators.html) collection. Parsers are used to sanitize / convert the [`$viewValue`](ngmodel.ngmodelcontroller#%24viewValue.html). Returning `undefined` from a parser means a parse error occurred. In that case, no [`$validators`](ngmodel.ngmodelcontroller#%24validators.html) will run and the `ngModel` will be set to `undefined` unless [`ngModelOptions.allowInvalid`](../directive/ngmodeloptions) is set to `true`. The parse error is stored in `ngModel.$error.parse`. This simple example shows a parser that would convert text input value to lowercase:
```
function parse(value) {
if (value) {
return value.toLowerCase();
}
}
ngModelController.$parsers.push(parse);
```
|
* ### $formatters
| | |
| --- | --- |
| `Array.<Function>` | Array of functions to execute, as a pipeline, whenever the bound ngModel expression changes programmatically. The `$formatters` are not called when the value of the control is changed by user interaction. Formatters are used to format / convert the [`$modelValue`](ngmodel.ngmodelcontroller#%24modelValue.html) for display in the control. The functions are called in reverse array order, each passing the value through to the next. The last return value is used as the actual DOM value. This simple example shows a formatter that would convert the model value to uppercase:
```
function format(value) {
if (value) {
return value.toUpperCase();
}
}
ngModel.$formatters.push(format);
```
|
* ### $validators
| | |
| --- | --- |
| `Object.<string, function>` | A collection of validators that are applied whenever the model value changes. The key value within the object refers to the name of the validator while the function refers to the validation operation. The validation operation is provided with the model value as an argument and must return a true or false value depending on the response of that validation.
```
ngModel.$validators.validCharacters = function(modelValue, viewValue) {
var value = modelValue || viewValue;
return /[0-9]+/.test(value) &&
/[a-z]+/.test(value) &&
/[A-Z]+/.test(value) &&
/\W+/.test(value);
};
```
|
* ### $asyncValidators
| | |
| --- | --- |
| `Object.<string, function>` | A collection of validations that are expected to perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided is expected to return a promise when it is run during the model validation process. Once the promise is delivered then the validation status will be set to true when fulfilled and false when rejected. When the asynchronous validators are triggered, each of the validators will run in parallel and the model value will only be updated once all validators have been fulfilled. As long as an asynchronous validator is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators will only run once all synchronous validators have passed. Please note that if $http is used then it is important that the server returns a success HTTP response code in order to fulfill the validation and a status level of `4xx` in order to reject the validation.
```
ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {
var value = modelValue || viewValue;
// Lookup user by username
return $http.get('/api/users/' + value).
then(function resolved() {
//username exists, this means validation fails
return $q.reject('exists');
}, function rejected() {
//username does not exist, therefore this validation passes
return true;
});
};
```
|
* ### $viewChangeListeners
| | |
| --- | --- |
| `Array.<Function>` | Array of functions to execute whenever a change to [`$viewValue`](ngmodel.ngmodelcontroller#%24viewValue.html) has caused a change to [`$modelValue`](ngmodel.ngmodelcontroller#%24modelValue.html). It is called with no arguments, and its return value is ignored. This can be used in place of additional $watches against the model value. |
* ### $error
| | |
| --- | --- |
| `Object` | An object hash with all failing validator ids as keys. |
* ### $pending
| | |
| --- | --- |
| `Object` | An object hash with all pending validator ids as keys. |
* ### $untouched
| | |
| --- | --- |
| `boolean` | True if control has not lost focus yet. |
* ### $touched
| | |
| --- | --- |
| `boolean` | True if control has lost focus. |
* ### $pristine
| | |
| --- | --- |
| `boolean` | True if user has not interacted with the control yet. |
* ### $dirty
| | |
| --- | --- |
| `boolean` | True if user has already interacted with the control. |
* ### $valid
| | |
| --- | --- |
| `boolean` | True if there is no error. |
* ### $invalid
| | |
| --- | --- |
| `boolean` | True if at least one error on the control. |
* ### $name
| | |
| --- | --- |
| `string` | The name attribute of the control. |
Example
-------
This example shows how to use `NgModelController` with a custom control to achieve data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) collaborate together to achieve the desired result.
`contenteditable` is an HTML5 attribute, which tells the browser to let the element contents be edited in place by the user.
We are using the [$sce](../service/%24sce) service here and include the [$sanitize](../../ngsanitize) module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`). However, as we are using `$sce` the model can still decide to provide unsafe content if it marks that content using the `$sce` service.
angularjs
Improve this Doc View Source $cacheFactory.Cache
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/cacheFactory.js?message=docs(%24cacheFactory.Cache)%3A%20describe%20your%20change...#L103) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/cacheFactory.js#L103) $cacheFactory.Cache
========================================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A cache object used to store and retrieve data, primarily used by [$templateRequest](../service/%24templaterequest) and the [script](../directive/script) directive to cache templates and other data.
```
angular.module('superCache')
.factory('superCache', ['$cacheFactory', function($cacheFactory) {
return $cacheFactory('super-cache');
}]);
```
Example test:
```
it('should behave like a cache', inject(function(superCache) {
superCache.put('key', 'value');
superCache.put('another key', 'another value');
expect(superCache.info()).toEqual({
id: 'super-cache',
size: 2
});
superCache.remove('another key');
expect(superCache.get('another key')).toBeUndefined();
superCache.removeAll();
expect(superCache.info()).toEqual({
id: 'super-cache',
size: 0
});
}));
```
Methods
-------
* ### put(key, value);
Inserts a named entry into the [Cache](%24cachefactory.cache) object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set.
It will not insert undefined values into the cache.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | the key under which the cached data is stored. |
| value | `*` | the value to store alongside the key. If it is undefined, the key will not be stored. |
#### Returns
| | |
| --- | --- |
| `*` | the value stored. |
* ### get(key);
Retrieves named data stored in the [Cache](%24cachefactory.cache) object.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | the key of the data to be retrieved |
#### Returns
| | |
| --- | --- |
| `*` | the value stored. |
* ### remove(key);
Removes an entry from the [Cache](%24cachefactory.cache) object.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | the key of the entry to be removed |
* ### removeAll();
Clears the cache object of any entries.
* ### destroy();
Destroys the [Cache](%24cachefactory.cache) object entirely, removing it from the [$cacheFactory](../service/%24cachefactory) set.
* ### info();
Retrieve information regarding a particular [Cache](%24cachefactory.cache).
#### Returns
| | |
| --- | --- |
| `object` | an object with the following properties:
+ **id**: the id of the cache instance
+ **size**: the number of entries kept in the cache instance
+ **...**: any additional properties from the options object when creating the cache. |
| programming_docs |
angularjs
Improve this Doc View Source form.FormController
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/form.js?message=docs(form.FormController)%3A%20describe%20your%20change...#L23) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/form.js#L23) form.FormController
========================================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`FormController` keeps track of all its controls and nested forms as well as the state of them, such as being valid/invalid or dirty/pristine.
Each [form](../directive/form) directive creates an instance of `FormController`.
Methods
-------
* ### $rollbackViewValue();
Rollback all form controls pending updates to the `$modelValue`.
Updates may be pending by a debounced event or because the input is waiting for a some future event defined in `ng-model-options`. This method is typically needed by the reset button of a form that uses `ng-model-options` to pend updates.
* ### $commitViewValue();
Commit all form controls pending updates to the `$modelValue`.
Updates may be pending by a debounced event or because the input is waiting for a some future event defined in `ng-model-options`. This method is rarely needed as `NgModelController` usually handles calling this in response to input events.
* ### $addControl(control);
Register a control with the form. Input elements using ngModelController do this automatically when they are linked.
Note that the current state of the control will not be reflected on the new parent form. This is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine` state.
However, if the method is used programmatically, for example by adding dynamically created controls, or controls that have been previously removed without destroying their corresponding DOM element, it's the developers responsibility to make sure the current state propagates to the parent form.
For example, if an input control is added that is already `$dirty` and has `$error` properties, calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| control | `object` | control object, either a [`form.FormController`](form.formcontroller) or an [`ngModel.NgModelController`](ngmodel.ngmodelcontroller) |
* ### $getControls();
This method returns a **shallow copy** of the controls that are currently part of this form. The controls can be instances of [`FormController`](form.formcontroller) (["child-forms"](../directive/ngform)) and of [`NgModelController`](ngmodel.ngmodelcontroller). If you need access to the controls of child-forms, you have to call `$getControls()` recursively on them. This can be used for example to iterate over all controls to validate them.
The controls can be accessed normally, but adding to, or removing controls from the array has no effect on the form. Instead, use [`$addControl()`](form.formcontroller#%24addControl.html) and [`$removeControl()`](form.formcontroller#%24removeControl.html) for this use-case. Likewise, adding a control to, or removing a control from the form is not reflected in the shallow copy. That means you should get a fresh copy from `$getControls()` every time you need access to the controls.
#### Returns
| | |
| --- | --- |
| `Array` | the controls that are currently part of this form |
* ### $removeControl(control);
Deregister a control from the form.
Input elements using ngModelController do this automatically when they are destroyed.
Note that only the removed control's validation state (`$errors`etc.) will be removed from the form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be different from case to case. For example, removing the only `$dirty` control from a form may or may not mean that the form is still `$dirty`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| control | `object` | control object, either a [`form.FormController`](form.formcontroller) or an [`ngModel.NgModelController`](ngmodel.ngmodelcontroller) |
* ### $setDirty();
Sets the form to a dirty state.
This method can be called to add the 'ng-dirty' class and set the form to a dirty state (ng-dirty class). This method will also propagate to parent forms.
* ### $setPristine();
Sets the form to its pristine state.
This method sets the form's `$pristine` state to true, the `$dirty` state to false, removes the `ng-dirty` class and adds the `ng-pristine` class. Additionally, it sets the `$submitted` state to false.
This method will also propagate to all the controls contained in this form.
Setting a form back to a pristine state is often useful when we want to 'reuse' a form after saving or resetting it.
* ### $setUntouched();
Sets the form to its untouched state.
This method can be called to remove the 'ng-touched' class and set the form controls to their untouched state (ng-untouched class).
Setting a form controls back to their untouched state is often useful when setting the form back to its pristine state.
* ### $setSubmitted();
Sets the form to its `$submitted` state. This will also set `$submitted` on all child and parent forms of the form.
* ### $setValidity(validationErrorKey, isValid, controller);
Change the validity state of the form, and notify the parent form (if any).
Application developers will rarely need to call this method directly. It is used internally, by [NgModelController.$setValidity()](ngmodel.ngmodelcontroller#%24setValidity.html), to propagate a control's validity state to the parent `FormController`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| validationErrorKey | `string` | Name of the validator. The `validationErrorKey` will be assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for unfulfilled `$asyncValidators`), so that it is available for data-binding. The `validationErrorKey` should be in camelCase and will get converted into dash-case for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` classes and can be bound to as `{{ someForm.$error.myError }}`. |
| isValid | `boolean` | Whether the current state is valid (true), invalid (false), pending (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`. Skipped is used by AngularJS when validators do not run because of parse errors and when `$asyncValidators` do not run because any of the `$validators` failed. |
| controller | `NgModelController``FormController` | The controller whose validity state is triggering the change. |
Properties
----------
* ### $pristine
| | |
| --- | --- |
| `boolean` | True if user has not interacted with the form yet. |
* ### $dirty
| | |
| --- | --- |
| `boolean` | True if user has already interacted with the form. |
* ### $valid
| | |
| --- | --- |
| `boolean` | True if all of the containing forms and controls are valid. |
* ### $invalid
| | |
| --- | --- |
| `boolean` | True if at least one containing control or form is invalid. |
* ### $submitted
| | |
| --- | --- |
| `boolean` | True if user has submitted the form even if its invalid. |
* ### $pending
| | |
| --- | --- |
| `Object` | An object hash, containing references to controls or forms with pending validators, where:
+ keys are validations tokens (error names).
+ values are arrays of controls or forms that have a pending validator for the given error name.See [$error](form.formcontroller#%24error.html) for a list of built-in validation tokens. |
* ### $error
| | |
| --- | --- |
| `Object` | An object hash, containing references to controls or forms with failing validators, where:
+ keys are validation tokens (error names),
+ values are arrays of controls or forms that have a failing validator for the given error name. Built-in validation tokens:
+ `email`
+ `max`
+ `maxlength`
+ `min`
+ `minlength`
+ `number`
+ `pattern`
+ `required`
+ `url`
+ `date`
+ `datetimelocal`
+ `time`
+ `week`
+ `month` |
angularjs
Improve this Doc View Source ModelOptions
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/ngModelOptions.js?message=docs(ModelOptions)%3A%20describe%20your%20change...#L7) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/ngModelOptions.js#L7) ModelOptions
============================================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A container for the options set by the [`ngModelOptions`](../directive/ngmodeloptions) directive
Methods
-------
* ### getOption(name);
Returns the value of the given option
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | the name of the option to retrieve |
#### Returns
| | |
| --- | --- |
| `*` | the value of the option |
* ### createChild(options);
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| options | `Object` | a hash of options for the new child that will override the parent's options |
#### Returns
| | |
| --- | --- |
| `ModelOptions` | a new `ModelOptions` object initialized with the given options. |
angularjs
Improve this Doc View Source angular.Module
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/loader.js?message=docs(angular.Module)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/loader.js#L3) angular.Module
======================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Interface for configuring AngularJS [modules](../function/angular.module).
Methods
-------
* ### info([info]);
Read and write custom information about this module. For example you could put the version of the module in here.
```
angular.module('myModule', []).info({ version: '1.0.0' });
```
The version could then be read back out by accessing the module elsewhere:
```
var version = angular.module('myModule').info().version;
```
You can also retrieve this information during runtime via the [`$injector.modules`](../../auto/service/%24injector#modules.html) property:
```
var version = $injector.modules['myModule'].info().version;
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| info *(optional)* | `Object` | Information about the module |
#### Returns
| | |
| --- | --- |
| `Object``Module` | The current info object for this module if called as a getter, or `this` if called as a setter. |
* ### provider(name, providerType);
See [$provide.provider()](../../auto/service/%24provide#provider.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | service name |
| providerType | `Function` | Construction function for creating new instance of the service. |
* ### factory(name, providerFunction);
See [$provide.factory()](../../auto/service/%24provide#factory.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | service name |
| providerFunction | `Function` | Function for creating new instance of the service. |
* ### service(name, constructor);
See [$provide.service()](../../auto/service/%24provide#service.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | service name |
| constructor | `Function` | A constructor function that will be instantiated. |
* ### value(name, object);
See [$provide.value()](../../auto/service/%24provide#value.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | service name |
| object | `*` | Service instance object. |
* ### constant(name, object);
Because the constants are fixed, they get applied before other provide methods. See [$provide.constant()](../../auto/service/%24provide#constant.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | constant name |
| object | `*` | Constant value. |
* ### decorator(name, decorFn);
See [$provide.decorator()](../../auto/service/%24provide#decorator.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the service to decorate. |
| decorFn | `Function` | This function will be invoked when the service needs to be instantiated and should return the decorated service instance. |
* ### animation(name, animationFactory);
**NOTE**: animations take effect only if the **ngAnimate** module is loaded.
Defines an animation hook that can be later used with [$animate](../service/%24animate) service and directives that use this service.
```
module.animation('.animation-name', function($inject1, $inject2) {
return {
eventName : function(element, done) {
//code to run the animation
//once complete, then run done()
return function cancellationFunction(element) {
//code to cancel the animation
}
}
}
})
```
See [$animateProvider.register()](../provider/%24animateprovider#register.html) and [ngAnimate module](../../nganimate) for more information.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | animation name |
| animationFactory | `Function` | Factory function for creating new instance of an animation. |
* ### filter(name, filterFactory);
See [$filterProvider.register()](../provider/%24filterprovider#register.html).
**Note:** Filter names must be valid AngularJS [`Expressions`](../../../guide/expression) identifiers, such as `uppercase` or `orderBy`. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores (`myapp_subsection_filterx`).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Filter name - this must be a valid AngularJS expression identifier |
| filterFactory | `Function` | Factory function for creating new instance of filter. |
* ### controller(name, constructor);
See [$controllerProvider.register()](../provider/%24controllerprovider#register.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Controller name, or an object map of controllers where the keys are the names and the values are the constructors. |
| constructor | `Function` | Controller constructor function. |
* ### directive(name, directiveFactory);
See [$compileProvider.directive()](../provider/%24compileprovider#directive.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Directive name, or an object map of directives where the keys are the names and the values are the factories. |
| directiveFactory | `Function` | Factory function for creating new instance of directives. |
* ### component(name, options);
See [$compileProvider.component()](../provider/%24compileprovider#component.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string``Object` | Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`), or an object map of components where the keys are the names and the values are the component definition objects. |
| options | `Object` | Component definition object (a simplified [directive definition object](../service/%24compile#directive-definition-object.html)) |
* ### config(configFn);
Use this method to configure services by injecting their [`providers`](angular.module#provider.html), e.g. for adding routes to the [$routeProvider](../../ngroute/provider/%24routeprovider).
Note that you can only inject [`providers`](angular.module#provider.html) and [`constants`](angular.module#constant.html) into this function.
For more about how to configure services, see [Provider Recipe](../../../guide/providers#provider-recipe.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| configFn | `Function` | Execute this function on module load. Useful for service configuration. |
* ### run(initializationFn);
Use this method to register work which should be performed when the injector is done loading all modules.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| initializationFn | `Function` | Execute this function after injector creation. Useful for application initialization. |
Properties
----------
* ### requires
| | |
| --- | --- |
| | Holds the list of modules which the injector will load before the current module is loaded. |
* ### name
| | |
| --- | --- |
| | Name of the module. |
angularjs
Improve this Doc View Source select.SelectController
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/directive/select.js?message=docs(select.SelectController)%3A%20describe%20your%20change...#L19) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/directive/select.js#L19) select.SelectController
====================================================================================================================================================================================================================================================================================================
1. type in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The controller for the [select](../directive/select) directive. The controller exposes a few utility methods that can be used to augment the behavior of a regular or an [ngOptions](../directive/ngoptions) select element.
Methods
-------
* ### $hasEmptyOption();
Returns `true` if the select element currently has an empty option element, i.e. an option that signifies that the select is empty / the selection is null.
* ### $isUnknownOptionSelected();
Returns `true` if the select element's unknown option is selected. The unknown option is added and automatically selected whenever the select model doesn't match any option.
* ### $isEmptyOptionSelected();
Returns `true` if the select element has an empty option and this empty option is currently selected. Returns `false` if the select element has no empty option or it is not selected.
Examples
--------
### Set a custom error when the unknown option is selected
This example sets a custom error "unknownValue" on the ngModelController when the select element's unknown option is selected, i.e. when the model is set to a value that is not matched by any option.
### Set the "required" error when the unknown option is selected.
By default, the "required" error on the ngModelController is only set on a required select when the empty option is selected. This example adds a custom directive that also sets the error when the unknown option is selected.
angularjs
Improve this Doc View Source angular.version
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/AngularPublic.js?message=docs(angular.version)%3A%20describe%20your%20change...#L104) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/AngularPublic.js#L104) angular.version
==========================================================================================================================================================================================================================================================================
1. object in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
An object that contains information about the current AngularJS version.
This object has the following properties:
* `full` – `{string}` – Full version string, such as "0.9.18".
* `major` – `{number}` – Major version number, such as "0".
* `minor` – `{number}` – Minor version number, such as "9".
* `dot` – `{number}` – Dot version number, such as "18".
* `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
| programming_docs |
angularjs
Improve this Doc View Source orderBy
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/orderBy.js?message=docs(orderBy)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/orderBy.js#L3) orderBy
==============================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Returns an array containing the items from the specified `collection`, ordered by a `comparator` function based on the values computed using the `expression` predicate.
For example, `[{id: 'foo'}, {id: 'bar'}] | orderBy:'id'` would result in `[{id: 'bar'}, {id: 'foo'}]`.
The `collection` can be an Array or array-like object (e.g. NodeList, jQuery object, TypedArray, String, etc).
The `expression` can be a single predicate, or a list of predicates each serving as a tie-breaker for the preceding one. The `expression` is evaluated against each item and the output is used for comparing with other items.
You can change the sorting order by setting `reverse` to `true`. By default, items are sorted in ascending order.
The comparison is done using the `comparator` function. If none is specified, a default, built-in comparator is used (see below for details - in a nutshell, it compares numbers numerically and strings alphabetically).
### Under the hood
Ordering the specified `collection` happens in two phases:
1. All items are passed through the predicate (or predicates), and the returned values are saved along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed through a predicate that extracts the value of the `label` property, would be transformed to:
```
{
value: 'foo',
type: 'string',
index: ...
}
```
**Note:** `null` values use `'null'` as their type.
2. The comparator function is used to sort the items, based on the derived values, types and indices.
If you use a custom comparator, it will be called with pairs of objects of the form `{value: ..., type: '...', index: ...}` and is expected to return `0` if the objects are equal (as far as the comparator is concerned), `-1` if the 1st one should be ranked higher than the second, or `1` otherwise.
In order to ensure that the sorting will be deterministic across platforms, if none of the specified predicates can distinguish between two items, `orderBy` will automatically introduce a dummy predicate that returns the item's index as `value`. (If you are using a custom comparator, make sure it can handle this predicate as well.)
If a custom comparator still can't distinguish between two items, then they will be sorted based on their index using the built-in comparator.
Finally, in an attempt to simplify things, if a predicate returns an object as the extracted value for an item, `orderBy` will try to convert that object to a primitive value, before passing it to the comparator. The following rules govern the conversion:
1. If the object has a `valueOf()` method that returns a primitive, its return value will be used instead.
(If the object has a `valueOf()` method that returns another object, then the returned object will be used in subsequent steps.)
2. If the object has a custom `toString()` method (i.e. not the one inherited from `Object`) that returns a primitive, its return value will be used instead.
(If the object has a `toString()` method that returns another object, then the returned object will be used in subsequent steps.)
3. No conversion; the object itself is used.
### The default comparator
The default, built-in comparator should be sufficient for most usecases. In short, it compares numbers numerically, strings alphabetically (and case-insensitively), for objects falls back to using their index in the original collection, sorts values of different types by type and puts `undefined` and `null` values at the end of the sorted list.
More specifically, it follows these steps to determine the relative order of items:
1. If the compared values are of different types:
* If one of the values is undefined, consider it "greater than" the other.
* Else if one of the values is null, consider it "greater than" the other.
* Else compare the types themselves alphabetically.
2. If both values are of type `string`, compare them alphabetically in a case- and locale-insensitive way.
3. If both values are objects, compare their indices instead.
4. Otherwise, return:
* `0`, if the values are equal (by strict equality comparison, i.e. using `===`).
* `-1`, if the 1st value is "less than" the 2nd value (compared using the `<` operator).
* `1`, otherwise.
**Note:** If you notice numbers not being sorted as expected, make sure they are actually being saved as numbers and not strings. **Note:** For the purpose of sorting, `null` and `undefined` are considered "greater than" any other value (with undefined "greater than" null). This effectively means that `null` and `undefined` values end up at the end of a list sorted in ascending order. **Note:** `null` values use `'null'` as their type to be able to distinguish them from objects.
Usage
-----
### In HTML Template Binding
```
{{ orderBy_expression | orderBy : expression : reverse : comparator}}
```
### In JavaScript
```
$filter('orderBy')(collection, expression, reverse, comparator)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| collection | `Array``ArrayLike` | The collection (array or array-like object) to sort. |
| expression *(optional)* | `function()``string``Array.<(function()|string)>` | A predicate (or list of predicates) to be used by the comparator to determine the order of elements. Can be one of:* `Function`: A getter function. This function will be called with each item as argument and the return value will be used for sorting.
* `string`: An AngularJS expression. This expression will be evaluated against each item and the result will be used for sorting. For example, use `'label'` to sort by a property called `label` or `'label.substring(0, 3)'` to sort by the first 3 characters of the `label` property. (The result of a constant expression is interpreted as a property name to be used for comparison. For example, use `'"special name"'` (note the extra pair of quotes) to sort by a property called `special name`.) An expression can be optionally prefixed with `+` or `-` to control the sorting direction, ascending or descending. For example, `'+label'` or `'-label'`. If no property is provided, (e.g. `'+'` or `'-'`), the collection element itself is used in comparisons.
* `Array`: An array of function and/or string predicates. If a predicate cannot determine the relative order of two items, the next predicate is used as a tie-breaker.
**Note:** If the predicate is missing or empty then it defaults to `'+'`. |
| reverse *(optional)* | `boolean` | If `true`, reverse the sorting order. |
| comparator *(optional)* | `function()` | The comparator function used to determine the relative order of value pairs. If omitted, the built-in comparator will be used. |
### Returns
| | |
| --- | --- |
| `Array` | * The sorted array.
|
Examples
--------
### Ordering a table with ngRepeat
The example below demonstrates a simple [ngRepeat](../directive/ngrepeat), where the data is sorted by age in descending order (expression is set to `'-age'`). The `comparator` is not set, which means it defaults to the built-in comparator.
### Changing parameters dynamically
All parameters can be changed dynamically. The next example shows how you can make the columns of a table sortable, by binding the `expression` and `reverse` parameters to scope properties.
### Using orderBy inside a controller
It is also possible to call the `orderBy` filter manually, by injecting `orderByFilter`, and calling it with the desired parameters. (Alternatively, you could inject the `$filter` factory and retrieve the `orderBy` filter with `$filter('orderBy')`.)
### Using a custom comparator
If you have very specific requirements about the way items are sorted, you can pass your own comparator function. For example, you might need to compare some strings in a locale-sensitive way. (When specifying a custom comparator, you also need to pass a value for the `reverse` argument - passing `false` retains the default sorting order, i.e. ascending.)
angularjs
Improve this Doc View Source json
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filters.js?message=docs(json)%3A%20describe%20your%20change...#L657) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filters.js#L657) json
============================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Allows you to convert a JavaScript object into JSON string.
This filter is mostly useful for debugging. When using the double curly {{value}} notation the binding is automatically converted to JSON.
Usage
-----
### In HTML Template Binding
```
{{ json_expression | json : spacing}}
```
### In JavaScript
```
$filter('json')(object, spacing)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| object | `*` | Any JavaScript object (including arrays and primitive types) to filter. |
| spacing *(optional)* | `number` | The number of spaces to use per indentation, defaults to 2. |
### Returns
| | |
| --- | --- |
| `string` | JSON string. |
Example
-------
angularjs
Improve this Doc View Source limitTo
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/limitTo.js?message=docs(limitTo)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/limitTo.js#L3) limitTo
==============================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Creates a new array or string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of `limit`. Other array-like objects are also supported (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input, it is converted to a string.
Usage
-----
### In HTML Template Binding
```
{{ limitTo_expression | limitTo : limit : begin}}
```
### In JavaScript
```
$filter('limitTo')(input, limit, begin)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| input | `Array``ArrayLike``string``number` | Array/array-like, string or number to be limited. |
| limit | `string``number` | The length of the returned array or string. If the `limit` number is positive, `limit` number of items from the beginning of the source array/string are copied. If the number is negative, `limit` number of items from the end of the source array/string are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined, the input will be returned unchanged. |
| begin *(optional)* | `string``number` | Index at which to begin limitation. As a negative index, `begin` indicates an offset from the end of `input`. Defaults to `0`. |
### Returns
| | |
| --- | --- |
| `Array``string` | A new sub-array or substring of length `limit` or less if the input had less than `limit` elements. |
Example
-------
angularjs
Improve this Doc View Source number
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filters.js?message=docs(number)%3A%20describe%20your%20change...#L82) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filters.js#L82) number
==============================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Formats a number as text.
If the input is null or undefined, it will just be returned. If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively. If the input is not a number an empty string is returned.
Usage
-----
### In HTML Template Binding
```
{{ number_expression | number : fractionSize}}
```
### In JavaScript
```
$filter('number')(number, fractionSize)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| number | `number``string` | Number to format. |
| fractionSize *(optional)* | `number``string` | Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3. |
### Returns
| | |
| --- | --- |
| `string` | Number rounded to `fractionSize` appropriately formatted based on the current locale (e.g., in the en\_US locale it will have "." as the decimal separator and include "," group separators after each third digit). |
Example
-------
angularjs
Improve this Doc View Source currency
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filters.js?message=docs(currency)%3A%20describe%20your%20change...#L7) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filters.js#L7) currency
================================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used.
Usage
-----
### In HTML Template Binding
```
{{ currency_expression | currency : symbol : fractionSize}}
```
### In JavaScript
```
$filter('currency')(amount, symbol, fractionSize)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| amount | `number` | Input to filter. |
| symbol *(optional)* | `string` | Currency symbol or identifier to be displayed. |
| fractionSize *(optional)* | `number` | Number of decimal places to round the amount to, defaults to default max fraction size for current locale |
### Returns
| | |
| --- | --- |
| `string` | Formatted number. |
Example
-------
angularjs
Improve this Doc View Source uppercase
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filters.js?message=docs(uppercase)%3A%20describe%20your%20change...#L712) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filters.js#L712) uppercase
======================================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Converts string to uppercase.
Usage
-----
### In HTML Template Binding
```
{{ uppercase_expression | uppercase}}
```
### In JavaScript
```
$filter('uppercase')()
```
Example
-------
angularjs
Improve this Doc View Source date
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filters.js?message=docs(date)%3A%20describe%20your%20change...#L484) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filters.js#L484) date
============================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Formats `date` to a string based on the requested `format`.
`format` string can be composed of the following elements:
* `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
* `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
* `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
* `'MMMM'`: Month in year (January-December)
* `'MMM'`: Month in year (Jan-Dec)
* `'MM'`: Month in year, padded (01-12)
* `'M'`: Month in year (1-12)
* `'LLLL'`: Stand-alone month in year (January-December)
* `'dd'`: Day in month, padded (01-31)
* `'d'`: Day in month (1-31)
* `'EEEE'`: Day in Week,(Sunday-Saturday)
* `'EEE'`: Day in Week, (Sun-Sat)
* `'HH'`: Hour in day, padded (00-23)
* `'H'`: Hour in day (0-23)
* `'hh'`: Hour in AM/PM, padded (01-12)
* `'h'`: Hour in AM/PM, (1-12)
* `'mm'`: Minute in hour, padded (00-59)
* `'m'`: Minute in hour (0-59)
* `'ss'`: Second in minute, padded (00-59)
* `'s'`: Second in minute (0-59)
* `'sss'`: Millisecond in second, padded (000-999)
* `'a'`: AM/PM marker
* `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
* `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
* `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
* `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
* `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
`format` string can also be one of the following predefined [localizable formats](../../../guide/i18n):
* `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en\_US locale (e.g. Sep 3, 2010 12:05:08 PM)
* `'short'`: equivalent to `'M/d/yy h:mm a'` for en\_US locale (e.g. 9/3/10 12:05 PM)
* `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en\_US locale (e.g. Friday, September 3, 2010)
* `'longDate'`: equivalent to `'MMMM d, y'` for en\_US locale (e.g. September 3, 2010)
* `'mediumDate'`: equivalent to `'MMM d, y'` for en\_US locale (e.g. Sep 3, 2010)
* `'shortDate'`: equivalent to `'M/d/yy'` for en\_US locale (e.g. 9/3/10)
* `'mediumTime'`: equivalent to `'h:mm:ss a'` for en\_US locale (e.g. 12:05:08 PM)
* `'shortTime'`: equivalent to `'h:mm a'` for en\_US locale (e.g. 12:05 PM)
`format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g. `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence (e.g. `"h 'o''clock'"`).
Any other characters in the `format` string will be output as-is.
Usage
-----
### In HTML Template Binding
```
{{ date_expression | date : format : timezone}}
```
### In JavaScript
```
$filter('date')(date, format, timezone)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| date | `Date``number``string` | Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone. |
| format *(optional)* | `string` | Formatting rules (see Description). If not specified, `mediumDate` is used. |
| timezone *(optional)* | `string` | Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. |
### Returns
| | |
| --- | --- |
| `string` | Formatted string or the input if input is not recognized as date/millis. |
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source lowercase
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filters.js?message=docs(lowercase)%3A%20describe%20your%20change...#L698) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filters.js#L698) lowercase
======================================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Converts string to lowercase.
See the [uppercase filter documentation](uppercase) for a functionally identical example.
Usage
-----
### In HTML Template Binding
```
{{ lowercase_expression | lowercase}}
```
### In JavaScript
```
$filter('lowercase')()
```
angularjs
Improve this Doc View Source filter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter/filter.js?message=docs(filter)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter/filter.js#L3) filter
==========================================================================================================================================================================================================================================================
1. filter in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Selects a subset of items from `array` and returns it as a new array.
Usage
-----
### In HTML Template Binding
```
{{ filter_expression | filter : expression : comparator : anyPropertyKey}}
```
### In JavaScript
```
$filter('filter')(array, expression, comparator, anyPropertyKey)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| array | `Array` | The source array. **Note**: If the array contains objects that reference themselves, filtering is not possible. |
| expression | `string``Object``function()` | The predicate to be used for selecting items from `array`. Can be one of:* `string`: The string is used for matching against the contents of the `array`. All strings or objects with string properties in `array` that match this string will be returned. This also applies to nested object properties. The predicate can be negated by prefixing the string with `!`.
* `Object`: A pattern object can be used to filter specific properties on objects contained by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items which have property `name` containing "M" and property `phone` containing "1". A special property name (`$` by default) can be used (e.g. as in `{$: "text"}`) to accept a match against any property of the object or its nested object properties. That's equivalent to the simple substring match with a `string` as described above. The special property name can be overwritten, using the `anyPropertyKey` parameter. The predicate can be negated by prefixing the string with `!`. For example `{name: "!M"}` predicate will return an array of items which have property `name` not containing "M". Note that a named property will match properties on the same level only, while the special `$` property will match properties on the same level or deeper. E.g. an array item like `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but **will** be matched by `{$: 'John'}`.
* `function(value, index, array)`: A predicate function can be used to write arbitrary filters. The function is called for each element of the array, with the element, its index, and the entire array itself as arguments. The final result is an array of those elements that the predicate returned true for.
|
| comparator *(optional)* | `function(actual, expected)``true``false` | Comparator which is used in determining if values retrieved using `expression` (when it is not a function) should be considered a match based on the expected value (from the filter expression) and actual value (from the object in the array). Can be one of:* `function(actual, expected)`: The function will be given the object value and the predicate value to compare and should return true if both values should be considered equal.
* `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`. This is essentially strict comparison of expected and actual.
* `false`: A short hand for a function which will look for a substring match in a case insensitive way. Primitive values are converted to strings. Objects are not compared against primitives, unless they have a custom `toString` method (e.g. `Date` objects).
Defaults to `false`. |
| anyPropertyKey *(optional)* | `string` | The special property name that matches against any property. By default `$`. |
Example
-------
angularjs
Improve this Doc View Source $rootScope
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/rootScope.js?message=docs(%24rootScope)%3A%20describe%20your%20change...#L59) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/rootScope.js#L59) $rootScope
==============================================================================================================================================================================================================================================================
1. [$rootScopeProvider](../provider/%24rootscopeprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Every application has a single root [scope](../type/%24rootscope.scope). All other scopes are descendant scopes of the root scope. Scopes provide separation between the model and the view, via a mechanism for watching the model for changes. They also provide event emission/broadcast and subscription facility. See the [developer guide on scopes](../../../guide/scope).
angularjs
Improve this Doc View Source $animateCss
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/animateCss.js?message=docs(%24animateCss)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/animateCss.js#L5) $animateCss
================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included, then the `$animateCss` service will actually perform animations.
Click here [to read the documentation for $animateCss](../../nganimate/service/%24animatecss).
angularjs
Improve this Doc View Source $jsonpCallbacks
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/jsonpCallbacks.js?message=docs(%24jsonpCallbacks)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/jsonpCallbacks.js#L3) $jsonpCallbacks
================================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
This service handles the lifecycle of callbacks to handle JSONP requests. Override this service if you wish to customise where the callbacks are stored and how they vary compared to the requested url.
Dependencies
------------
* [`$window`](%24window)
Methods
-------
* ### createCallback(url);
[`$httpBackend`](%24httpbackend) calls this method to create a callback and get hold of the path to the callback to pass to the server, which will be used to call the callback with its payload in the JSONP response.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string` | the url of the JSONP request |
#### Returns
| | |
| --- | --- |
| `string` | the callback path to send to the server as part of the JSONP request |
* ### wasCalled(callbackPath);
[`$httpBackend`](%24httpbackend) calls this method to find out whether the JSONP response actually called the callback that was passed in the request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| callbackPath | `string` | the path to the callback that was sent in the JSONP request |
#### Returns
| | |
| --- | --- |
| `boolean` | whether the callback has been called, as a result of the JSONP response |
* ### getResponse(callbackPath);
[`$httpBackend`](%24httpbackend) calls this method to get hold of the data that was provided to the callback in the JSONP response.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| callbackPath | `string` | the path to the callback that was sent in the JSONP request |
#### Returns
| | |
| --- | --- |
| `*` | the data received from the response via the registered callback |
* ### removeCallback(callbackPath);
[`$httpBackend`](%24httpbackend) calls this method to remove the callback after the JSONP request has completed or timed-out.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| callbackPath | `string` | the path to the callback that was sent in the JSONP request |
angularjs
Improve this Doc View Source $rootElement
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/rootElement.js?message=docs(%24rootElement)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/rootElement.js#L3) $rootElement
====================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The root element of AngularJS application. This is either the element where [ngApp](../directive/ngapp) was declared or the element passed into [`angular.bootstrap`](../function/angular.bootstrap). The element represents the root element of application. It is also the location where the application's [$injector](../../auto/service/%24injector) service gets published, and can be retrieved using `$rootElement.injector()`.
angularjs
Improve this Doc View Source $log
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/log.js?message=docs(%24log)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/log.js#L3) $log
====================================================================================================================================================================================================================================
1. [$logProvider](../provider/%24logprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Simple service for logging. Default implementation safely writes the message into the browser's console (if present).
The main purpose of this service is to simplify debugging and troubleshooting.
To reveal the location of the calls to `$log` in the JavaScript console, you can "blackbox" the AngularJS source in your browser:
[Mozilla description of blackboxing](https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Black_box_a_source). [Chrome description of blackboxing](https://developer.chrome.com/devtools/docs/blackboxing).
Note: Not all browsers support blackboxing.
The default is to log `debug` messages. You can use [ng.$logProvider#debugEnabled](../provider/%24logprovider) to change this.
Dependencies
------------
* [`$window`](%24window)
Methods
-------
* ### log();
Write a log message
* ### info();
Write an information message
* ### warn();
Write a warning message
* ### error();
Write an error message
* ### debug();
Write a debug message
Example
-------
angularjs
Improve this Doc View Source $httpParamSerializerJQLike
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/http.js?message=docs(%24httpParamSerializerJQLike)%3A%20describe%20your%20change...#L61) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/http.js#L61) $httpParamSerializerJQLike
====================================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Alternative [`$http`](%24http) params serializer that follows jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic. The serializer will also sort the params alphabetically.
To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:
```
$http({
url: myUrl,
method: 'GET',
params: myParams,
paramSerializer: '$httpParamSerializerJQLike'
});
```
It is also possible to set it as the default `paramSerializer` in the [`$httpProvider`](../provider/%24httpprovider#defaults.html).
Additionally, you can inject the serializer and use it explicitly, for example to serialize form data for submission:
```
.controller(function($http, $httpParamSerializerJQLike) {
//...
$http({
url: myUrl,
method: 'POST',
data: $httpParamSerializerJQLike(myData),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
});
```
angularjs
Improve this Doc View Source $location
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/location.js?message=docs(%24location)%3A%20describe%20your%20change...#L695) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/location.js#L695) $location
============================================================================================================================================================================================================================================================
1. [$locationProvider](../provider/%24locationprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The $location service parses the URL in the browser address bar (based on the [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL available to your application. Changes to the URL in the address bar are reflected into $location service and changes to $location are reflected into the browser address bar.
**The $location service:**
* Exposes the current URL in the browser address bar, so you can
+ Watch and observe the URL.
+ Change the URL.
* Synchronizes the URL with the browser when the user
+ Changes the address bar.
+ Clicks the back or forward button (or clicks a History link).
+ Clicks on a link.
* Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
For more information see [Developer Guide: Using $location](../../../guide/%24location)
Dependencies
------------
* [`$rootElement`](%24rootelement)
Methods
-------
* ### absUrl();
This method is getter only.
Return full URL representation with all segments encoded according to rules specified in [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var absUrl = $location.absUrl();
// => "http://example.com/#/some/path?foo=bar&baz=xoxo"
```
#### Returns
| | |
| --- | --- |
| `string` | full URL |
* ### url([url]);
This method is getter / setter.
Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
Change path, search and hash, when called with parameter and return `$location`.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var url = $location.url();
// => "/some/path?foo=bar&baz=xoxo"
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url *(optional)* | `string` | New URL without base prefix (e.g. `/path?a=b#hash`) |
#### Returns
| | |
| --- | --- |
| `string` | url |
* ### protocol();
This method is getter only.
Return protocol of current URL.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var protocol = $location.protocol();
// => "http"
```
#### Returns
| | |
| --- | --- |
| `string` | protocol of current URL |
* ### host();
This method is getter only.
Return host of current URL.
Note: compared to the non-AngularJS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var host = $location.host();
// => "example.com"
// given URL http://user:[email protected]:8080/#/some/path?foo=bar&baz=xoxo
host = $location.host();
// => "example.com"
host = location.host;
// => "example.com:8080"
```
#### Returns
| | |
| --- | --- |
| `string` | host of current URL. |
* ### port();
This method is getter only.
Return port of current URL.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var port = $location.port();
// => 80
```
#### Returns
| | |
| --- | --- |
| `Number` | port |
* ### path([path]);
This method is getter / setter.
Return path of current URL when called without any parameter.
Change path when called with parameter and return `$location`.
Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var path = $location.path();
// => "/some/path"
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| path *(optional)* | `string``number` | New path |
#### Returns
| | |
| --- | --- |
| `string``object` | path if called with no parameters, or `$location` if called with a parameter |
* ### search(search, [paramValue]);
This method is getter / setter.
Return search part (as object) of current URL when called without any parameter.
Change search part when called with parameter and return `$location`.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo
var searchObject = $location.search();
// => {foo: 'bar', baz: 'xoxo'}
// set foo to 'yipee'
$location.search('foo', 'yipee');
// $location.search() => {foo: 'yipee', baz: 'xoxo'}
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| search | `string``Object.<string>``Object.<Array.<string>>` | New search params - string or hash object. When called with a single argument the method acts as a setter, setting the `search` component of `$location` to the specified value. If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the URL. |
| paramValue *(optional)* | `string``Number``Array.<string>``boolean` | If `search` is a string or number, then `paramValue` will override only a single search property. If `paramValue` is an array, it will override the property of the `search` component of `$location` specified via the first argument. If `paramValue` is `null`, the property specified via the first argument will be deleted. If `paramValue` is `true`, the property specified via the first argument will be added with no value nor trailing equal sign. |
#### Returns
| | |
| --- | --- |
| `Object` | If called with no arguments returns the parsed `search` object. If called with one or more arguments returns `$location` object itself. |
* ### hash([hash]);
This method is getter / setter.
Returns the hash fragment when called without any parameters.
Changes the hash fragment when called with a parameter and returns `$location`.
```
// given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
var hash = $location.hash();
// => "hashValue"
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| hash *(optional)* | `string``number` | New hash fragment |
#### Returns
| | |
| --- | --- |
| `string` | hash |
* ### replace();
If called, all changes to $location during the current `$digest` will replace the current history record, instead of adding a new one.
* ### state([state]);
This method is getter / setter.
Return the history state object when called without any parameter.
Change the history state object when called with one parameter and return `$location`. The state object is later passed to `pushState` or `replaceState`.
NOTE: This method is supported only in HTML5 mode and only in browsers supporting the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support older browsers (like IE9 or Android < 4.0), don't use this method.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| state *(optional)* | `object` | State object for pushState or replaceState |
#### Returns
| | |
| --- | --- |
| `object` | state |
Events
------
* ### $locationChangeStart
Broadcasted before a URL will change.
This change can be prevented by calling `preventDefault` method of the event. See [`$rootScope.Scope`](../type/%24rootscope.scope#%24on.html) for more details about event object. Upon successful change [$locationChangeSuccess](%24location#%24locationChangeSuccess.html) is fired.
The `newState` and `oldState` parameters may be defined only in HTML5 mode and when the browser supports the HTML5 History API.
#### Type:
broadcast #### Target:
root scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| newUrl | `string` | New URL |
| oldUrl *(optional)* | `string` | URL that was before it was changed. |
| newState *(optional)* | `string` | New history state object |
| oldState *(optional)* | `string` | History state object that was before it was changed. |
* ### $locationChangeSuccess
Broadcasted after a URL was changed.
The `newState` and `oldState` parameters may be defined only in HTML5 mode and when the browser supports the HTML5 History API.
#### Type:
broadcast #### Target:
root scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| newUrl | `string` | New URL |
| oldUrl *(optional)* | `string` | URL that was before it was changed. |
| newState *(optional)* | `string` | New history state object |
| oldState *(optional)* | `string` | History state object that was before it was changed. |
| programming_docs |
angularjs
Improve this Doc View Source $animate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/animate.js?message=docs(%24animate)%3A%20describe%20your%20change...#L332) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/animate.js#L332) $animate
========================================================================================================================================================================================================================================================
1. [$animateProvider](../provider/%24animateprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The $animate service exposes a series of DOM utility methods that provide support for animation hooks. The default behavior is the application of DOM operations, however, when an animation is detected (and animations are enabled), $animate will do the heavy lifting to ensure that animation runs with the triggered DOM operation.
By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't included and only when it is active then the animation hooks that `$animate` triggers will be functional. Once active then all structural `ng-` directives will trigger animations as they perform their DOM-related operations (enter, leave and move). Other directives such as `ngClass`, `ngShow`, `ngHide` and `ngMessages` also provide support for animations.
It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.
To learn more about enabling animation support, click here to visit the [ngAnimate module page](../../nganimate).
Methods
-------
* ### on(event, container, callback);
Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...) has fired on the given element or among any of its children. Once the listener is fired, the provided callback is fired with the following params:
```
$animate.on('enter', container,
function callback(element, phase) {
// cool we detected an enter animation within the container
}
);
```
**Note**: Generally, the events that are fired correspond 1:1 to `$animate` method names, e.g. [addClass()](%24animate#addClass.html) will fire `addClass`, and [`ngClass`](../directive/ngclass) will fire `addClass` if classes are added, and `removeClass` if classes are removed. However, there are two exceptions:
+ if both an [addClass()](%24animate#addClass.html) and a [removeClass()](%24animate#removeClass.html) action are performed during the same animation, the event fired will be `setClass`. This is true even for `ngClass`.
+ an [animate()](%24animate#animate.html) call that adds and removes classes will fire the `setClass` event, but if it either removes or adds classes, it will fire `animate` instead.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| event | `string` | the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) |
| container | `DOMElement` | the container element that will capture each of the animation events that are fired on itself as well as among its children |
| callback | `Function` | the callback function that will be fired when the listener is triggered. The arguments present in the callback function are:
+ `element` - The captured DOM element that the animation was fired on.
+ `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
+ `data` - an object with these properties:
- addClass - `{string|null}` - space-separated CSS classes to add to the element
- removeClass - `{string|null}` - space-separated CSS classes to remove from the element
- from - `{Object|null}` - CSS properties & values at the beginning of the animation
- to - `{Object|null}` - CSS properties & values at the end of the animationNote that the callback does not trigger a scope digest. Wrap your call into a [scope.$apply](../type/%24rootscope.scope#%24apply.html) to propagate changes to the scope. |
* ### off(event, [container], [callback]);
Deregisters an event listener based on the event which has been associated with the provided element. This method can be used in three different ways depending on the arguments:
```
// remove all the animation event listeners listening for `enter`
$animate.off('enter');
// remove listeners for all animation events from the container element
$animate.off(container);
// remove all the animation event listeners listening for `enter` on the given element and its children
$animate.off('enter', container);
// remove the event listener function provided by `callback` that is set
// to listen for `enter` on the given `container` as well as its children
$animate.off('enter', container, callback);
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| event | container | `string``DOMElement` | the animation event (e.g. enter, leave, move, addClass, removeClass, etc...), or the container element. If it is the element, all other arguments are ignored. |
| container *(optional)* | `DOMElement` | the container element the event listener was placed on |
| callback *(optional)* | `Function=` | the callback function that was registered as the listener |
* ### pin(element, parentElement);
Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the AngularJS application. By doing so, any animation triggered via `$animate` can be issued on the element despite being outside the realm of the application or within another application. Say for example if the application was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.
Note that this feature is only active when the `ngAnimate` module is used.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the external element that will be pinned |
| parentElement | `DOMElement` | the host parent element that will be associated with the external element |
* ### enabled([element], [enabled]);
Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This function can be called in four ways:
```
// returns true or false
$animate.enabled();
// changes the enabled state for all animations
$animate.enabled(false);
$animate.enabled(true);
// returns true or false if animations are enabled for an element
$animate.enabled(element);
// changes the enabled state for an element and its children
$animate.enabled(element, true);
$animate.enabled(element, false);
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element *(optional)* | `DOMElement` | the element that will be considered for checking/setting the enabled state |
| enabled *(optional)* | `boolean` | whether or not the animations will be enabled for the element |
#### Returns
| | |
| --- | --- |
| `boolean` | whether or not animations are enabled |
* ### cancel(animationRunner);
Cancels the provided animation and applies the end state of the animation. Note that this does not cancel the underlying operation, e.g. the setting of classes or adding the element to the DOM.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| animationRunner | `animationRunner` | An animation runner returned by an $animate function. |
#### Example
* ### enter(element, parent, [after], [options]);
Inserts the element into the DOM either after the `after` element (if provided) or as the first child within the `parent` element and then triggers an animation. A promise is returned that will be resolved during the next digest once the animation has completed.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which will be inserted into the DOM |
| parent | `DOMElement` | the parent element which will append the element as a child (so long as the after element is not present) |
| after *(optional)* | `DOMElement` | the sibling element after which the element will be appended |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **addClass** - `{string}` - space-separated CSS classes to add to element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **removeClass** - `{string}` - space-separated CSS classes to remove from element
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | the animation runner |
* ### move(element, parent, [after], [options]);
Inserts (moves) the element into its new position in the DOM either after the `after` element (if provided) or as the first child within the `parent` element and then triggers an animation. A promise is returned that will be resolved during the next digest once the animation has completed.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which will be moved into the new DOM position |
| parent | `DOMElement` | the parent element which will append the element as a child (so long as the after element is not present) |
| after *(optional)* | `DOMElement` | the sibling element after which the element will be appended |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **addClass** - `{string}` - space-separated CSS classes to add to element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **removeClass** - `{string}` - space-separated CSS classes to remove from element
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | the animation runner |
* ### leave(element, [options]);
Triggers an animation and then removes the element from the DOM. When the function is called a promise is returned that will be resolved during the next digest once the animation has completed.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which will be removed from the DOM |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **addClass** - `{string}` - space-separated CSS classes to add to element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **removeClass** - `{string}` - space-separated CSS classes to remove from element
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | the animation runner |
* ### addClass(element, className, [options]);
Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon execution, the addClass operation will only be handled after the next digest and it will not trigger an animation if element already contains the CSS class or if the class is removed at a later step. Note that class-based animations are treated differently compared to structural animations (like enter, move and leave) since the CSS classes may be added/removed at different points depending if CSS or JavaScript animations are used.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which the CSS classes will be applied to |
| className | `string` | the CSS class(es) that will be added (multiple classes are separated via spaces) |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **removeClass** - `{string}` - space-separated CSS classes to remove from element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | animationRunner the animation runner |
* ### removeClass(element, className, [options]);
Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon execution, the removeClass operation will only be handled after the next digest and it will not trigger an animation if element does not contain the CSS class or if the class is added at a later step. Note that class-based animations are treated differently compared to structural animations (like enter, move and leave) since the CSS classes may be added/removed at different points depending if CSS or JavaScript animations are used.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which the CSS classes will be applied to |
| className | `string` | the CSS class(es) that will be removed (multiple classes are separated via spaces) |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **addClass** - `{string}` - space-separated CSS classes to add to element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | the animation runner |
* ### setClass(element, add, remove, [options]);
Performs both the addition and removal of a CSS classes on an element and (during the process) triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has passed. Note that class-based animations are treated differently compared to structural animations (like enter, move and leave) since the CSS classes may be added/removed at different points depending if CSS or JavaScript animations are used.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which the CSS classes will be applied to |
| add | `string` | the CSS class(es) that will be added (multiple classes are separated via spaces) |
| remove | `string` | the CSS class(es) that will be removed (multiple classes are separated via spaces) |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **addClass** - `{string}` - space-separated CSS classes to add to element
+ **removeClass** - `{string}` - space-separated CSS classes to remove from element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | the animation runner |
* ### animate(element, from, to, [className], [options]);
Performs an inline animation on the element which applies the provided to and from CSS styles to the element. If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding style in `to`, the style in `from` is applied immediately, and no animation is run. If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate` method (or as part of the `options` parameter):
```
ngModule.animation('.my-inline-animation', function() {
return {
animate : function(element, from, to, done, options) {
//animation
done();
}
}
});
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element which the CSS styles will be applied to |
| from | `object` | the from (starting) CSS styles that will be applied to the element and across the animation. |
| to | `object` | the to (destination) CSS styles that will be applied to the element and across the animation. |
| className *(optional)* | `string` | an optional CSS class that will be applied to the element for the duration of the animation. If this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element. (Note that if no animation is detected then this value will not be applied to the element.) |
| options *(optional)* | `object` | an optional collection of options/styles that will be applied to the element. The object can have the following properties:
+ **addClass** - `{string}` - space-separated CSS classes to add to element
+ **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+ **removeClass** - `{string}` - space-separated CSS classes to remove from element
+ **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` |
#### Returns
| | |
| --- | --- |
| `Runner` | the animation runner |
angularjs
Improve this Doc View Source $exceptionHandler
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/exceptionHandler.js?message=docs(%24exceptionHandler)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/exceptionHandler.js#L3) $exceptionHandler
========================================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Any uncaught exception in AngularJS expressions is delegated to this service. The default implementation simply delegates to `$log.error` which logs it into the browser console.
In unit tests, if `angular-mocks.js` is loaded, this service is overridden by [mock $exceptionHandler](../../ngmock/service/%24exceptionhandler) which aids in testing.
Example:
--------
The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead of `$log.error()`.
```
angular.
module('exceptionOverwrite', []).
factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) {
return function myExceptionHandler(exception, cause) {
logErrorsToBackend(exception, cause);
$log.warn(exception, cause);
};
}]);
```
Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind` methods) does not delegate exceptions to the [$exceptionHandler](%24exceptionhandler) (unless executed during a digest). If you wish, you can manually delegate exceptions, e.g. `try { ... } catch(e) { $exceptionHandler(e); }`
Dependencies
------------
* [`$log`](%24log)
Usage
-----
`$exceptionHandler(exception, [cause]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| exception | `Error` | Exception associated with the error. |
| cause *(optional)* | `string` | Optional information about the context in which the error was thrown. |
| programming_docs |
angularjs
Improve this Doc View Source $window
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/window.js?message=docs(%24window)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/window.js#L3) $window
================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A reference to the browser's `window` object. While `window` is globally available in JavaScript, it causes testability problems, because it is a global variable. In AngularJS we always refer to it through the `$window` service, so it may be overridden, removed or mocked for testing.
Expressions, like the one defined for the `ngClick` directive in the example below, are evaluated with respect to the current scope. Therefore, there is no risk of inadvertently coding in a dependency on a global value in such an expression.
Example
-------
angularjs
Improve this Doc View Source $templateRequest
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/templateRequest.js?message=docs(%24templateRequest)%3A%20describe%20your%20change...#L41) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/templateRequest.js#L41) $templateRequest
======================================================================================================================================================================================================================================================================================
1. [$templateRequestProvider](../provider/%24templaterequestprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `$templateRequest` service runs security checks then downloads the provided template using `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the exception can be thwarted by setting the 2nd parameter of the function to true). Note that the contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted when `tpl` is of type string and `$templateCache` has the matching entry.
If you want to pass custom options to the `$http` service, such as setting the Accept header you can configure this via [`$templateRequestProvider`](../provider/%24templaterequestprovider#httpOptions.html).
`$templateRequest` is used internally by [`$compile`](%24compile), [`$route`](../../ngroute/service/%24route), and directives such as [`ngInclude`](../directive/nginclude) to download and cache templates.
3rd party modules should use `$templateRequest` if their services or directives are loading templates.
Usage
-----
`$templateRequest(tpl, [ignoreRequestError]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| tpl | `string``TrustedResourceUrl` | The HTTP request template URL |
| ignoreRequestError *(optional)* | `boolean` | Whether or not to ignore the exception when the request fails or the template is empty |
### Returns
| | |
| --- | --- |
| `Promise` | a promise for the HTTP response data of the given URL. |
Properties
----------
* ### totalPendingRequests
| | |
| --- | --- |
| `number` | total amount of pending template requests being downloaded. |
angularjs
Improve this Doc View Source $parse
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/parse.js?message=docs(%24parse)%3A%20describe%20your%20change...#L1676) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/parse.js#L1676) $parse
==================================================================================================================================================================================================================================================
1. [$parseProvider](../provider/%24parseprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Converts AngularJS [expression](../../../guide/expression) into a function.
```
var getter = $parse('user.name');
var setter = getter.assign;
var context = {user:{name:'AngularJS'}};
var locals = {user:{name:'local'}};
expect(getter(context)).toEqual('AngularJS');
setter(context, 'newValue');
expect(context.user.name).toEqual('newValue');
expect(getter(context, locals)).toEqual('local');
```
Usage
-----
`$parse(expression);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| expression | `string` | String expression to compile. |
### Returns
| | |
| --- | --- |
| `function(context, locals)` | a function which represents the compiled expression:* `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
* `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. The returned function also has the following properties:
+ `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript literal.
+ `constant` – `{boolean}` – whether the expression is made entirely of JavaScript constant literals.
+ `assign` – `{?function(context, value)}` – if the expression is assignable, this will be set to a function to change its value on the given context.
|
angularjs
Improve this Doc View Source $sceDelegate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/sce.js?message=docs(%24sceDelegate)%3A%20describe%20your%20change...#L90) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/sce.js#L90) $sceDelegate
======================================================================================================================================================================================================================================================
1. [$sceDelegateProvider](../provider/%24scedelegateprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`$sceDelegate` is a service that is used by the `$sce` service to provide [Strict Contextual Escaping (SCE)](%24sce) services to AngularJS.
For an overview of this service and the functionnality it provides in AngularJS, see the main page for [SCE](%24sce). The current page is targeted for developers who need to alter how SCE works in their application, which shouldn't be needed in most cases.
AngularJS strongly relies on contextual escaping for the security of bindings: disabling or modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners, changes to this service will also influence users, so be extra careful and document your changes. Typically, you would configure or override the [$sceDelegate](%24scedelegate) instead of the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is because, while the `$sce` provides numerous shorthand methods, etc., you really only need to override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things work because `$sce` delegates to `$sceDelegate` for these operations.
Refer [$sceDelegateProvider](../provider/%24scedelegateprovider) to configure this service.
The default instance of `$sceDelegate` should work out of the box with little pain. While you can override it completely to change the behavior of `$sce`, the common case would involve configuring the [$sceDelegateProvider](../provider/%24scedelegateprovider) instead by setting your own trusted and banned resource lists for trusting URLs used for loading AngularJS resources such as templates. Refer [$sceDelegateProvider.trustedResourceUrlList](../provider/%24scedelegateprovider#trustedResourceUrlList.html) and [$sceDelegateProvider.bannedResourceUrlList](../provider/%24scedelegateprovider#bannedResourceUrlList.html)
Usage
-----
`$sceDelegate();`
Methods
-------
* ### trustAs(type, value);
Returns a trusted representation of the parameter for the specified context. This trusted object will later on be used as-is, without any security check, by bindings or directives that require this security context. For instance, marking a string as trusted for the `$sce.HTML` context will entirely bypass the potential `$sanitize` call in corresponding `$sce.HTML` bindings or directives, such as `ng-bind-html`. Note that in most cases you won't need to call this function: if you have the sanitizer loaded, passing the value itself will render all the HTML that does not pose a security risk.
See [getTrusted](%24scedelegate#getTrusted.html) for the function that will consume those trusted values, and [$sce](%24sce) for general documentation about strict contextual escaping.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| type | `string` | The context in which this value is safe for use, e.g. `$sce.URL`, `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. |
| value | `*` | The value that should be considered trusted. |
#### Returns
| | |
| --- | --- |
| `*` | A trusted representation of value, that can be used in the given context. |
* ### valueOf(value);
If the passed parameter had been returned by a prior call to [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html), returns the value that had been passed to [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html).
If the passed parameter is not a value that had been returned by [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html), it must be returned as-is.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The result of a prior [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html) call or anything else. |
#### Returns
| | |
| --- | --- |
| `*` | The `value` that was originally provided to [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html) if `value` is the result of such a call. Otherwise, returns `value` unchanged. |
* ### getTrusted(type, maybeTrusted);
Given an object and a security context in which to assign it, returns a value that's safe to use in this context, which was represented by the parameter. To do so, this function either unwraps the safe type it has been given (for instance, a [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html) result), or it might try to sanitize the value given, depending on the context and sanitizer availablility.
The contexts that can be sanitized are $sce.MEDIA\_URL, $sce.URL and $sce.HTML. The first two are available by default, and the third one relies on the `$sanitize` service (which may be loaded through the `ngSanitize` module). Furthermore, for $sce.RESOURCE\_URL context, a plain string may be accepted if the resource url policy defined by [`$sceDelegateProvider.trustedResourceUrlList`](../provider/%24scedelegateprovider#trustedResourceUrlList.html) and [`$sceDelegateProvider.bannedResourceUrlList`](../provider/%24scedelegateprovider#bannedResourceUrlList.html) accepts that resource.
This function will throw if the safe type isn't appropriate for this context, or if the value given cannot be accepted in the context (which might be caused by sanitization not being available, or the value not being recognized as safe).
Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting (XSS) vulnerability in your application.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| type | `string` | The context in which this value is to be used (such as `$sce.HTML`). |
| maybeTrusted | `*` | The result of a prior [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html) call, or anything else (which will not be considered trusted.) |
#### Returns
| | |
| --- | --- |
| `*` | A version of the value that's safe to use in the given context, or throws an exception if this is impossible. |
angularjs
Improve this Doc View Source $document
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/document.js?message=docs(%24document)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/document.js#L3) $document
========================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A [jQuery or jqLite](../function/angular.element) wrapper for the browser's `window.document` object.
Dependencies
------------
* [`$window`](%24window)
Example
-------
angularjs
Improve this Doc View Source $compile
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/compile.js?message=docs(%24compile)%3A%20describe%20your%20change...#L32) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/compile.js#L32) $compile
======================================================================================================================================================================================================================================================
1. [$compileProvider](../provider/%24compileprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link [`scope`](../type/%24rootscope.scope) and the template together.
The compilation is a process of walking the DOM tree and matching DOM elements to [directives](../provider/%24compileprovider#directive.html).
**Note:** This document is an in-depth reference of all directive options. For a gentle introduction to directives with examples of common use cases, see the [directive guide](../../../guide/directive). Comprehensive Directive API
---------------------------
There are many different options for a directive.
The difference resides in the return value of the factory function. You can either return a [Directive Definition Object (see below)](%24compile#directive-definition-object.html) that defines the directive properties, or just the `postLink` function (all other properties will have the default values).
**Best Practice:** It's recommended to use the "directive definition object" form. Here's an example directive declared with a Directive Definition Object:
```
var myModule = angular.module(...);
myModule.directive('directiveName', function factory(injectables) {
var directiveDefinitionObject = {
[priority](%24compile#-priority-.html): 0,
[template](%24compile#-template-.html): '<div></div>', // or // function(tElement, tAttrs) { ... },
// or
// [templateUrl](%24compile#-templateurl-.html): 'directive.html', // or // function(tElement, tAttrs) { ... },
[transclude](%24compile#-transclude-.html): false,
[restrict](%24compile#-restrict-.html): 'A',
[templateNamespace](%24compile#-templatenamespace-.html): 'html',
[scope](%24compile#-scope-.html): false,
[controller](%24compile#-controller-.html): function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
[controllerAs](%24compile#-controlleras-.html): 'stringIdentifier',
[bindToController](%24compile#-bindtocontroller-.html): false,
[require](%24compile#-require-.html): 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
[multiElement](%24compile#-multielement-.html): false,
[compile](%24compile#-compile-.html): function compile(tElement, tAttrs, transclude) {
return {
[pre](%24compile#pre-linking-function.html): function preLink(scope, iElement, iAttrs, controller) { ... },
[post](%24compile#post-linking-function.html): function postLink(scope, iElement, iAttrs, controller) { ... }
}
// or
// return function postLink( ... ) { ... }
},
// or
// [link](%24compile#-link-.html): {
// [pre](%24compile#pre-linking-function.html): function preLink(scope, iElement, iAttrs, controller) { ... },
// [post](%24compile#post-linking-function.html): function postLink(scope, iElement, iAttrs, controller) { ... }
// }
// or
// [link](%24compile#-link-.html): function postLink( ... ) { ... }
};
return directiveDefinitionObject;
});
```
**Note:** Any unspecified options will use the default value. You can see the default values below. Therefore the above can be simplified as:
```
var myModule = angular.module(...);
myModule.directive('directiveName', function factory(injectables) {
var directiveDefinitionObject = {
link: function postLink(scope, iElement, iAttrs) { ... }
};
return directiveDefinitionObject;
// or
// return function postLink(scope, iElement, iAttrs) { ... }
});
```
### Life-cycle hooks
Directive controllers can provide the following methods that are called by AngularJS at points in the life-cycle of the directive:
* `$onInit()` - Called on each controller after all the controllers on an element have been constructed and had their bindings initialized (and before the pre & post linking functions for the directives on this element). This is a good place to put initialization code for your controller.
* `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will also be called when your bindings are initialized.
* `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes. Any actions that you wish to take in response to the changes that you detect must be invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not be detected by AngularJS's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes, you must store the previous value(s) for comparison to the current values.
* `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent components will have their `$onDestroy()` hook called before child components.
* `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link function this hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain `templateUrl` directives will not have been compiled and linked since they are waiting for their template to load asynchronously and their own compilation and linking has been suspended until that occurs.
#### Comparison with life-cycle hooks in the new Angular
The new Angular also uses life-cycle hooks for its components. While the AngularJS life-cycle hooks are similar there are some differences that you should be aware of, especially when it comes to moving your code from AngularJS to Angular:
* AngularJS hooks are prefixed with `$`, such as `$onInit`. Angular hooks are prefixed with `ng`, such as `ngOnInit`.
* AngularJS hooks can be defined on the controller prototype or added to the controller inside its constructor. In Angular you can only define hooks on the prototype of the Component class.
* Due to the differences in change-detection, you may get many more calls to `$doCheck` in AngularJS than you would to `ngDoCheck` in Angular.
* Changes to the model inside `$doCheck` will trigger new turns of the digest loop, which will cause the changes to be propagated throughout the application. Angular does not allow the `ngDoCheck` hook to trigger a change outside of the component. It will either throw an error or do nothing depending upon the state of `enableProdMode()`.
#### Life-cycle hook examples
This example shows how you can check for mutations to a Date object even though the identity of the object has not changed.
This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large arrays or objects can have a negative impact on your application performance.)
### Directive Definition Object
The directive definition object provides instructions to the [compiler](%24compile). The attributes are:
#### multiElement
When this property is set to true (default is `false`), the HTML compiler will collect DOM nodes between nodes with the attributes `directive-name-start` and `directive-name-end`, and group them together as the directive elements. It is recommended that this feature be used on directives which are not strictly behavioral (such as [`ngClick`](../directive/ngclick)), and which do not manipulate or replace child nodes (such as [`ngInclude`](../directive/nginclude)).
#### priority
When there are multiple directives defined on a single DOM element, sometimes it is necessary to specify the order in which the directives are applied. The `priority` is used to sort the directives before their `compile` functions get called. Priority is defined as a number. Directives with greater numerical `priority` are compiled first. Pre-link functions are also run in priority order, but post-link functions are run in reverse order. The order of directives with the same priority is undefined. The default priority is `0`.
#### terminal
If set to true then the current `priority` will be the last set of directives which will execute (any directives at the current priority will still execute as the order of execution on same `priority` is undefined). Note that expressions and other directives used in the directive's template will also be excluded from execution.
#### scope
The scope property can be `false`, `true`, or an object:
* **`false` (default):** No scope will be created for the directive. The directive will use its parent's scope.
* **`true`:** A new child scope that prototypically inherits from its parent will be created for the directive's element. If multiple directives on the same element request a new scope, only one new scope is created.
* **`{...}` (an object hash):** A new "isolate" scope is created for the directive's template. The 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent scope. This is useful when creating reusable components, which should not accidentally read or modify data in the parent scope. Note that an isolate scope directive without a `template` or `templateUrl` will not apply the isolate scope to its children elements.
The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the directive's element. These local properties are useful for aliasing values for templates. The keys in the object hash map to the name of the property on the isolate scope; the values define how the property is bound to the parent scope, via matching attributes on the directive's element:
* `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is always a string since DOM attributes are strings. If no `attr` name is specified then the attribute name is assumed to be the same as the local name. Given `<my-component
my-attr="hello {{name}}">` and the isolate scope definition `scope: { localName:'@myAttr' }`, the directive's scope property `localName` will reflect the interpolated value of `hello
{{name}}`. As the `name` attribute changes so will the `localName` property on the directive's scope. The `name` is read from the parent scope (not the directive's scope).
* `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression passed via the attribute `attr`. The expression is evaluated in the context of the parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the local name. Given `<my-component my-attr="parentModel">` and the isolate scope definition `scope: {
localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in `localModel` and vice versa. If the binding expression is non-assignable, or if the attribute isn't optional and doesn't exist, an exception ([`$compile:nonassign`](https://code.angularjs.org/1.8.2/docs/api/ng/service/error/%24compile/nonassign)) will be thrown upon discovering changes to the local value, since it will be impossible to sync them back to the parent scope.
By default, the [`$watch`](../type/%24rootscope.scope#%24watch.html) method is used for tracking changes, and the equality check is based on object identity. However, if an object literal or an array literal is passed as the binding expression, the equality check is done by value (using the [`angular.equals`](../function/angular.equals) function). It's also possible to watch the evaluated value shallowly with [`$watchCollection`](../type/%24rootscope.scope#%24watchCollection.html): use `=*` or `=*attr`
* `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an expression passed via the attribute `attr`. The expression is evaluated in the context of the parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the local name.
For example, given `<my-component my-attr="parentModel">` and directive definition of `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however two caveats:
1. one-way binding does not copy the value from the parent to the isolate scope, it simply sets the same value. That means if your bound value is an object, changes to its properties in the isolated scope will be reflected in the parent scope (because both reference the same object).
2. one-way binding watches changes to the **identity** of the parent value. That means the [`$watch`](../type/%24rootscope.scope#%24watch.html) on the parent value only fires if the reference to the value has changed. In most cases, this should not be of concern, but can be important to know if you one-way bind to an object, and then replace that object in the isolated scope. If you now change a property of the object in your parent scope, the change will not be propagated to the isolated scope, because the identity of the object on the parent scope has not changed. Instead you must assign a new object.One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings back to the parent. However, it does not make this completely impossible.
By default, the [`$watch`](../type/%24rootscope.scope#%24watch.html) method is used for tracking changes, and the equality check is based on object identity. It's also possible to watch the evaluated value shallowly with [`$watchCollection`](../type/%24rootscope.scope#%24watchCollection.html): use `<*` or `<*attr`
* `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the local name. Given `<my-component my-attr="count = count + value">` and the isolate scope definition `scope: {
localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for the `count = count + value` expression. Often it's desirable to pass data from the isolated scope via an expression to the parent scope. This can be done by passing a map of local variable names and values into the expression wrapper fn. For example, if the expression is `increment(amount)` then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.
All 4 kinds of bindings (`@`, `=`, `<`, and `&`) can be made optional by adding `?` to the expression. The marker must come after the mode and before the attribute name. See the [Invalid Isolate Scope Definition error](https://code.angularjs.org/1.8.2/docs/api/ng/service/error/%24compile/iscp) for definition examples. This is useful to refine the interface directives provide. One subtle difference between optional and non-optional happens **when the binding attribute is not set**:
* the binding is optional: the property will not be defined
* the binding is not optional: the property is defined
```
app.directive('testDir', function() {
return {
scope: {
notoptional: '=',
optional: '=?',
},
bindToController: true,
controller: function() {
this.$onInit = function() {
console.log(this.hasOwnProperty('notoptional')) // true
console.log(this.hasOwnProperty('optional')) // false
}
}
}
})
```
##### Combining directives with different scope defintions
In general it's possible to apply more than one directive to one element, but there might be limitations depending on the type of scope required by the directives. The following points will help explain these limitations. For simplicity only two directives are taken into account, but it is also applicable for several directives:
* **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope
* **child scope** + **no scope** => Both directives will share one single child scope
* **child scope** + **child scope** => Both directives will share one single child scope
* **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use its parent's scope
* **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot be applied to the same element.
* **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot be applied to the same element.
#### bindToController
This property is used to bind scope properties directly to the controller. It can be either `true` or an object hash with the same format as the `scope` property.
When an isolate scope is used for a directive (see above), `bindToController: true` will allow a component to have its properties bound to the controller, rather than to scope.
After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller properties. You can access these bindings once they have been initialized by providing a controller method called `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings initialized.
It is also possible to set `bindToController` to an object hash with the same format as the `scope` property. This will set up the scope bindings to the controller directly. Note that `scope` can still be used to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate scope (useful for component directives).
If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.
#### controller
Controller constructor function. The controller is instantiated before the pre-linking phase and can be accessed by other directives (see `require` attribute). This allows the directives to communicate with each other and augment each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
* `$scope` - Current scope associated with the element
* `$element` - Current element
* `$attrs` - Current attributes object for the element
* `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: `function([scope], cloneLinkingFn, futureParentElement, slotName)`:
+ `scope`: (optional) override the scope.
+ `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.
+ `futureParentElement` (optional):
- defines the parent to which the `cloneLinkingFn` will add the cloned elements.
- default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.
- only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements) and when the `cloneLinkingFn` is passed, as those elements need to created and cloned in a special way when they are defined outside their usual containers (e.g. like `<svg>`).
- See also the `directive.templateNamespace` property.
+ `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`) then the default transclusion is provided. The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns `true` if the specified slot contains content (i.e. one or more DOM nodes).
#### require
Require another directive and inject its controller as the fourth argument to the linking function. The `require` property can be a string, an array or an object:
* a **string** containing the name of the directive to pass to the linking function
* an **array** containing the names of directives to pass to the linking function. The argument passed to the linking function will be an array of controllers in the same order as the names in the `require` property
* an **object** whose property values are the names of the directives to pass to the linking function. The argument passed to the linking function will also be an object with matching keys, whose values will hold the corresponding controllers.
If the `require` property is an object and `bindToController` is truthy, then the required controllers are bound to the controller using the keys of the `require` property. This binding occurs after all the controllers have been constructed but before `$onInit` is called. If the name of the required controller is the same as the local name (the key), the name can be omitted. For example, `{parentDir: '^^'}` is equivalent to `{parentDir: '^^parentDir'}`. See the [`$compileProvider`](../provider/%24compileprovider#component.html) helper for an example of how this can be used. If no such required directive(s) can be found, or if the directive does not have a controller, then an error is raised (unless no link function is specified and the required controllers are not being bound to the directive controller, in which case error checking is skipped). The name can be prefixed with:
* (no prefix) - Locate the required controller on the current element. Throw an error if not found.
* `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
* `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
* `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.
* `?^` - Attempt to locate the required controller by searching the element and its parents or pass `null` to the `link` fn if not found.
* `?^^` - Attempt to locate the required controller by searching the element's parents, or pass `null` to the `link` fn if not found.
#### controllerAs
Identifier name for a reference to the controller in the directive's scope. This allows the controller to be referenced from the directive template. This is especially useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the `controllerAs` reference might overwrite a property that already exists on the parent scope.
#### restrict
String of subset of `EACM` which restricts the directive to a specific directive declaration style. If omitted, the defaults (elements and attributes) are used.
* `E` - Element name (default): `<my-directive></my-directive>`
* `A` - Attribute (default): `<div my-directive="exp"></div>`
* `C` - Class: `<div class="my-directive: exp;"></div>`
* `M` - Comment: `<!-- directive: my-directive exp -->`
#### templateNamespace
String representing the document type used by the markup in the template. AngularJS needs this information as those elements need to be created and cloned in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.
* `html` - All root nodes in the template are HTML. Root nodes may also be top-level elements such as `<svg>` or `<math>`.
* `svg` - The root nodes in the template are SVG elements (excluding `<math>`).
* `math` - The root nodes in the template are MathML elements (excluding `<svg>`).
If no `templateNamespace` is specified, then the namespace is considered to be `html`.
#### template
HTML markup that may:
* Replace the contents of the directive's element (default).
* Replace the directive's element itself (if `replace` is true - DEPRECATED).
* Wrap the contents of the directive's element (if `transclude` is true).
Value may be:
* A string. For example `<div red-on-hover>{{delete_str}}</div>`.
* A function which takes two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns a string value.
#### templateUrl
This is similar to `template` but the template is loaded from the specified URL, asynchronously.
Because template loading is asynchronous the compiler will suspend compilation of directives on that element for later when the template has been resolved. In the meantime it will continue to compile and link sibling and parent elements as though this element had not contained any directives.
The compiler does not suspend the entire compilation to wait for templates to be loaded because this would result in the whole app "stalling" until all templates are loaded asynchronously - even in the case when only one deeply nested directive has `templateUrl`.
Template loading is asynchronous even if the template has been preloaded into the [`$templateCache`](%24templatecache).
You can specify `templateUrl` as a string representing the URL or as a function which takes two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns a string value representing the url. In either case, the template URL is passed through [$sce.getTrustedResourceUrl](%24sce#getTrustedResourceUrl.html).
#### replace
**Note:** `replace` is deprecated in AngularJS and has been removed in the new Angular (v2+). Specifies what the template should replace. Defaults to `false`.
* `true` - the template will replace the directive's element.
* `false` - the template will replace the contents of the directive's element.
The replacement process migrates all of the attributes / classes from the old element to the new one. See the [Directives Guide](../../../guide/directive#template-expanding-directive.html) for an example.
There are very few scenarios where element replacement is required for the application function, the main one being reusable custom components that are used within SVG contexts (because SVG doesn't work with custom elements in the DOM tree).
#### transclude
Extract the contents of the element where the directive appears and make it available to the directive. The contents are compiled and provided to the directive as a **transclusion function**. See the [Transclusion](%24compile#transclusion.html) section below.
#### compile
```
function compile(tElement, tAttrs, transclude) { ... }
```
The compile function deals with transforming the template DOM. Since most directives do not do template transformation, it is not used often. The compile function takes the following arguments:
* `tElement` - template element - The element where the directive has been declared. It is safe to do template transformation on the element and child elements only.
* `tAttrs` - template attributes - Normalized list of attributes declared on this element shared between all directive compile functions.
* `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
**Note:** The template instance and the link instance may be different objects if the template has been cloned. For this reason it is **not** safe to do anything other than DOM transformations that apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration should be done in a linking function rather than in a compile function. **Note:** The compile function cannot handle directives that recursively use themselves in their own templates or compile functions. Compiling these directives results in an infinite loop and stack overflow errors. This can be avoided by manually using `$compile` in the postLink function to imperatively compile a directive's template instead of relying on automatic template compilation via `template` or `templateUrl` declaration or manual compilation inside the compile function. **Note:** The `transclude` function that is passed to the compile function is deprecated, as it e.g. does not know about the right outer scope. Please use the transclude function that is passed to the link function instead. A compile function can have a return value which can be either a function or an object.
* returning a (post-link) function - is equivalent to registering the linking function via the `link` property of the config object when the compile function is empty.
* returning an object with function(s) registered via `pre` and `post` properties - allows you to control when a linking function should be called during the linking phase. See info about pre-linking and post-linking functions below.
#### link
This property is used only if the `compile` property is not defined.
```
function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
```
The link function is responsible for registering DOM listeners as well as updating the DOM. It is executed after the template has been cloned. This is where most of the directive logic will be put.
* `scope` - [Scope](../type/%24rootscope.scope) - The scope to be used by the directive for registering [watches](../type/%24rootscope.scope#%24watch.html).
* `iElement` - instance element - The element where the directive is to be used. It is safe to manipulate the children of the element only in `postLink` function since the children have already been linked.
* `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared between all directive linking functions.
* `controller` - the directive's required controller instance(s) - Instances are shared among all directives, which allows the directives to use the controllers as a communication channel. The exact value depends on the directive's `require` property:
+ no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one
+ `string`: the controller instance
+ `array`: array of controller instancesIf a required controller cannot be found, and it is optional, the instance is `null`, otherwise the [Missing Required Controller](https://code.angularjs.org/1.8.2/docs/api/ng/service/error/%24compile/ctreq) error is thrown.
Note that you can also require the directive's own controller - it will be made available like any other controller.
* `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope. This is the same as the `$transclude` parameter of directive controllers, see [the controller section for details](%24compile#-controller-.html). `function([scope], cloneLinkingFn, futureParentElement)`.
#### Pre-linking function
Executed before the child elements are linked. Not safe to do DOM transformation since the compiler linking function will fail to locate the correct elements for linking.
#### Post-linking function
Executed after the child elements are linked.
Note that child elements that contain `templateUrl` directives will not have been compiled and linked since they are waiting for their template to load asynchronously and their own compilation and linking has been suspended until that occurs.
It is safe to do DOM transformation in the post-linking function on elements that are not waiting for their async templates to be resolved.
### Transclusion
Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and copying them to another part of the DOM, while maintaining their connection to the original AngularJS scope from where they were taken.
Transclusion is used (often with [`ngTransclude`](../directive/ngtransclude)) to insert the original contents of a directive's element into a specified place in the template of the directive. The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded content has access to the properties on the scope from which it was taken, even if the directive has isolated scope. See the [Directives Guide](../../../guide/directive#creating-a-directive-that-wraps-other-elements.html).
This makes it possible for the widget to have private state for its template, while the transcluded content has access to its originating scope.
**Note:** When testing an element transclude directive you must not place the directive at the root of the DOM fragment that is being compiled. See [Testing Transclusion Directives](../../../guide/unit-testing#testing-transclusion-directives.html). There are three kinds of transclusion depending upon whether you want to transclude just the contents of the directive's element, the entire element or multiple parts of the element contents:
* `true` - transclude the content (i.e. the child nodes) of the directive's element.
* `'element'` - transclude the whole of the directive's element including any directives on this element that are defined at a lower priority than this directive. When used, the `template` property is ignored.
* **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
**Multi-slot transclusion** is declared by providing an object for the `transclude` property.
This object is a map where the keys are the name of the slot to fill and the value is an element selector used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`) and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
For further information check out the guide on [Matching Directives](../../../guide/directive#matching-directives.html).
If the element selector is prefixed with a `?` then that slot is optional.
For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to the `slotA` slot, which can be accessed via the `$transclude` function or via the [`ngTransclude`](../directive/ngtransclude) directive.
Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements in the transclude content. If you wish to know if an optional slot was filled with content, then you can call `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and injectable into the directive's controller.
#### Transclusion Functions
When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion function** to the directive's `link` function and `controller`. This transclusion function is a special **linking function** that will return the compiled contents linked to a new transclusion scope.
If you are just using [`ngTransclude`](../directive/ngtransclude) then you don't need to worry about this function, since ngTransclude will deal with it for us. If you want to manually control the insertion and removal of the transcluded content in your directive then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery object that contains the compiled DOM, which is linked to the correct transclusion scope.
When you call a transclusion function you can pass in a **clone attach function**. This function accepts two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded content and the `scope` is the newly created transclusion scope, which the clone will be linked to.
**Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function since you then get a fresh clone of the original DOM and also have access to the new transclusion scope. It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone attach function**:
```
var transcludedContent, transclusionScope;
$transclude(function(clone, scope) {
element.append(clone);
transcludedContent = clone;
transclusionScope = scope;
});
```
Later, if you want to remove the transcluded content from your DOM then you should also destroy the associated transclusion scope:
```
transcludedContent.remove();
transclusionScope.$destroy();
```
**Best Practice**: if you intend to add and remove transcluded content manually in your directive (by calling the transclude function to get the DOM and calling `element.remove()` to remove it), then you are also responsible for calling `$destroy` on the transclusion scope. The built-in DOM manipulation directives, such as [`ngIf`](../directive/ngif), [`ngSwitch`](../directive/ngswitch) and [`ngRepeat`](../directive/ngrepeat) automatically destroy their transcluded clones as necessary so you do not need to worry about this if you are simply using [`ngTransclude`](../directive/ngtransclude) to inject the transclusion into your directive.
#### Transclusion Scopes
When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed when the directive's scope gets destroyed) but it inherits the properties of the scope from which it was taken.
For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look like this:
```
<div ng-app>
<div isolate>
<div transclusion>
</div>
</div>
</div>
```
The `$parent` scope hierarchy will look like this:
```
- $rootScope
- isolate
- transclusion
```
but the scopes will inherit prototypically from different scopes to their `$parent`.
```
- $rootScope
- transclusion
- isolate
```
### Attributes
The [Attributes](../type/%24compile.directive.attributes) object - passed as a parameter in the `link()` or `compile()` functions. It has a variety of uses.
* *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways: `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access to the attributes.
* *Directive inter-communication:* All directives share the same instance of the attributes object which allows the directives to use the attributes object as inter directive communication.
* *Supports interpolation:* Interpolation attributes are assigned to the attribute object allowing other directives to read the interpolated value.
* *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also the only way to easily get the actual value because during the linking phase the interpolation hasn't been evaluated yet and so the value is at this time set to `undefined`.
```
function linkingFn(scope, elm, attrs, ctrl) {
// get the attribute value
console.log(attrs.ngModel);
// change the attribute
attrs.$set('ngModel', 'new value');
// observe changes to interpolated attribute
attrs.$observe('ngModel', function(value) {
console.log('ngModel has changed value to ' + value);
});
}
```
**Note**: Typically directives are registered with `module.directive`. The example below is to illustrate how `$compile` works. Known Issues
------------
### Double Compilation
Double compilation occurs when an already compiled part of the DOM gets compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues, and memory leaks. Refer to the Compiler Guide [section on double compilation](../../../guide/compiler#double-compilation-and-how-to-avoid-it.html) for an in-depth explanation and ways to avoid it.
### Issues with replace: true
**Note**: [`replace: true`](%24compile#-replace-.html) is deprecated and not recommended to use, mainly due to the issues listed here. It has been completely removed in the new Angular. #### Attribute values are not merged
When a `replace` directive encounters the same attribute on the original and the replace node, it will simply deduplicate the attribute and join the values with a space or with a `;` in case of the `style` attribute.
```
Original Node: <span class="original" style="color: red;"></span>
Replace Template: <span class="replaced" style="background: blue;"></span>
Result: <span class="original replaced" style="color: red; background: blue;"></span>
```
That means attributes that contain AngularJS expressions will not be merged correctly, e.g. [`ngShow`](../directive/ngshow) or [`ngClass`](../directive/ngclass) will cause a [`$parse`](%24parse) error:
```
Original Node: <span ng-class="{'something': something}" ng-show="!condition"></span>
Replace Template: <span ng-class="{'else': else}" ng-show="otherCondition"></span>
Result: <span ng-class="{'something': something} {'else': else}" ng-show="!condition otherCondition"></span>
```
See issue [#5695](https://github.com/angular/angular.js/issues/5695).
#### Directives are not deduplicated before compilation
When the original node and the replace template declare the same directive(s), they will be [compiled twice](../../../guide/compiler#double-compilation-and-how-to-avoid-it.html) because the compiler does not deduplicate them. In many cases, this is not noticeable, but e.g. [`ngModel`](../directive/ngmodel) will attach `$formatters` and `$parsers` twice.
See issue [#2573](https://github.com/angular/angular.js/issues/2573).
#### transclude: element in the replace template root can have unexpected effects
When the replace template has a directive at the root node that uses [`transclude: element`](%24compile#-transclude-.html), e.g. [`ngIf`](../directive/ngif) or [`ngRepeat`](../directive/ngrepeat), the DOM structure or scope inheritance can be incorrect. See the following issues:
* Incorrect scope on replaced element: [#9837](https://github.com/angular/angular.js/issues/9837)
* Different DOM between `template` and `templateUrl`: [#10612](https://github.com/angular/angular.js/issues/14326)
Usage
-----
`$compile(element, transclude, maxPriority);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| element | `string``DOMElement` | Element or HTML string to compile into a template function. |
| transclude | `function(angular.Scope, cloneAttachFn=)` | function available to directives - DEPRECATED. **Note:** Passing a `transclude` function to the $compile function is deprecated, as it e.g. will not use the right outer scope. Please pass the transclude function as a `parentBoundTranscludeFn` to the link function instead. |
| maxPriority | `number` | only apply directives lower than given priority (Only effects the root element(s), not their children) |
### Returns
| | |
| --- | --- |
| `function(scope, cloneAttachFn=, options=)` | a link function which is used to bind template (a DOM element/tree) to a scope. Where:* `scope` - A [Scope](../type/%24rootscope.scope) to bind to.
* `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the `template` and call the `cloneAttachFn` function allowing the caller to attach the cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is called as: `cloneAttachFn(clonedElement, scope)` where:
+ `clonedElement` - is a clone of the original `element` passed into the compiler.
+ `scope` - is the current scope with which the linking function is working with.
* `options` - An optional object hash with linking options. If `options` is provided, then the following keys may be used to control linking behavior:
+ `parentBoundTranscludeFn` - the transclude function made available to directives; if given, it will be passed through to the link functions of directives found in `element` during compilation.
+ `transcludeControllers` - an object hash with keys that map controller names to a hash with the key `instance`, which maps to the controller instance; if given, it will make the controllers available to directives on the compileNode:
```
{
parent: {
instance: parentControllerInstance
}
}
```
+ `futureParentElement` - defines the parent to which the `cloneAttachFn` will add the cloned elements; only needed for transcludes that are allowed to contain non HTML elements (e.g. SVG elements). See also the `directive.controller` property.
Calling the linking function returns the element of the template. It is either the original element passed in, or the clone of the element if the `cloneAttachFn` is provided. After linking the view is not updated until after a call to `$digest`, which typically is done by AngularJS automatically. If you need access to the bound view, there are two ways to do it:* If you are not asking the linking function to clone the template, create the DOM element(s) before you send them to the compiler and keep this reference around.
```
var element = angular.element('<p>{{total}}</p>');
$compile(element)(scope);
```
* if on the other hand, you need the element to be cloned, the view reference from the original example would not point to the clone, but rather to the original template that was cloned. In this case, you can access the clone either via the `cloneAttachFn` or the value returned by the linking function:
```
var templateElement = angular.element('<p>{{total}}</p>');
var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
// Attach the clone to DOM document at the right place.
});
// Now we have reference to the cloned DOM via `clonedElement`.
// NOTE: The `clonedElement` returned by the linking function is the same as the
// `clonedElement` passed to `cloneAttachFn`.
```
For information on how the compiler works, see the [AngularJS HTML Compiler](../../../guide/compiler) section of the Developer Guide. |
| programming_docs |
angularjs
Improve this Doc View Source $httpParamSerializer
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/http.js?message=docs(%24httpParamSerializer)%3A%20describe%20your%20change...#L23) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/http.js#L23) $httpParamSerializer
========================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Default [`$http`](%24http) params serializer that converts objects to strings according to the following rules:
* `{'foo': 'bar'}` results in `foo=bar`
* `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
* `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
* `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object)
Note that serializer will sort the request parameters alphabetically.
angularjs
Improve this Doc View Source $controller
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/controller.js?message=docs(%24controller)%3A%20describe%20your%20change...#L59) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/controller.js#L59) $controller
==================================================================================================================================================================================================================================================================
1. [$controllerProvider](../provider/%24controllerprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`$controller` service is responsible for instantiating controllers.
It's just a simple call to [$injector](../../auto/service/%24injector), but extracted into a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
Dependencies
------------
* [`$injector`](../../auto/service/%24injector)
Usage
-----
`$controller(constructor, locals);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| constructor | `function()``string` | If called with a function then it's considered to be the controller constructor function. Otherwise it's considered to be a string which is used to retrieve the controller constructor using the following steps:* check if a controller with given name is registered via `$controllerProvider`
* check if evaluating the string on the current scope returns a constructor The string can use the `controller as property` syntax, where the controller instance is published as the specified property on the `scope`; the `scope` must be injected into `locals` param for this to work correctly.
|
| locals | `Object` | Injection locals for Controller. |
### Returns
| | |
| --- | --- |
| `Object` | Instance of given controller. |
angularjs
Improve this Doc View Source $xhrFactory
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/httpBackend.js?message=docs(%24xhrFactory)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/httpBackend.js#L3) $xhrFactory
==================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Factory function used to create XMLHttpRequest objects.
Replace or decorate this service to create your own custom XMLHttpRequest objects.
```
angular.module('myApp', [])
.factory('$xhrFactory', function() {
return function createXhr(method, url) {
return new window.XMLHttpRequest({mozSystem: true});
};
});
```
Usage
-----
`$xhrFactory(method, url);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method of the request (GET, POST, PUT, ..) |
| url | `string` | URL of the request. |
angularjs
Improve this Doc View Source $filter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/filter.js?message=docs(%24filter)%3A%20describe%20your%20change...#L71) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/filter.js#L71) $filter
==================================================================================================================================================================================================================================================
1. [$filterProvider](../provider/%24filterprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Filters are used for formatting data displayed to the user.
They can be used in view templates, controllers or services. AngularJS comes with a collection of [built-in filters](../filter), but it is easy to define your own as well.
The general syntax in templates is as follows:
```
{{ expression [| filter_name[:parameter_value] ... ] }}
```
Usage
-----
`$filter(name);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| name | `String` | Name of the filter function to retrieve |
### Returns
| | |
| --- | --- |
| `Function` | the filter function |
Example
-------
angularjs
Improve this Doc View Source $interpolate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/interpolate.js?message=docs(%24interpolate)%3A%20describe%20your%20change...#L122) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/interpolate.js#L122) $interpolate
========================================================================================================================================================================================================================================================================
1. [$interpolateProvider](../provider/%24interpolateprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Compiles a string with markup into an interpolation function. This service is used by the HTML [$compile](%24compile) service for data binding. See [$interpolateProvider](../provider/%24interpolateprovider) for configuring the interpolation markup.
```
var $interpolate = ...; // injected
var exp = $interpolate('Hello {{name | uppercase}}!');
expect(exp({name:'AngularJS'})).toEqual('Hello ANGULARJS!');
```
`$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is `true`, the interpolation function will return `undefined` unless all embedded expressions evaluate to a value other than `undefined`.
```
var $interpolate = ...; // injected
var context = {greeting: 'Hello', name: undefined };
// default "forgiving" mode
var exp = $interpolate('{{greeting}} {{name}}!');
expect(exp(context)).toEqual('Hello !');
// "allOrNothing" mode
exp = $interpolate('{{greeting}} {{name}}!', false, null, true);
expect(exp(context)).toBeUndefined();
context.name = 'AngularJS';
expect(exp(context)).toEqual('Hello AngularJS!');
```
`allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.
#### Escaped Interpolation
$interpolate provides a mechanism for escaping interpolation markers. Start and end markers can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash). It will be rendered as a regular start/end marker, and will not be interpreted as an expression or binding.
This enables web-servers to prevent script injection attacks and defacing attacks, to some degree, while also enabling code examples to work without relying on the [ngNonBindable](../directive/ngnonbindable) directive.
**For security purposes, it is strongly encouraged that web servers escape user-supplied data, replacing angle brackets (<, >) with < and > respectively, and replacing all interpolation start/end markers with their escaped counterparts.**
Escaped interpolation markers are only replaced with the actual interpolation markers in rendered output when the $interpolate service processes the text. So, for HTML elements interpolated by [$compile](%24compile), or otherwise interpolated with the `mustHaveExpression` parameter set to `true`, the interpolated text must contain an unescaped interpolation expression. As such, this is typically useful only when user-data is used in rendering a template from the server, or when otherwise untrusted data is used by a directive.
Known Issues
------------
It is currently not possible for an interpolated expression to contain the interpolation end symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e. an interpolated expression consisting of a single-quote (`'`) and the `' }}` string.
All directives and components must use the standard `{{` `}}` interpolation symbols in their templates. If you change the application interpolation symbols the [`$compile`](%24compile) service will attempt to denormalize the standard symbols to the custom symbols. The denormalization process is not clever enough to know not to replace instances of the standard symbols where they would not normally be treated as interpolation symbols. For example in the following code snippet the closing braces of the literal object will get incorrectly denormalized:
```
<div data-context='{"context":{"id":3,"type":"page"}}">
```
The workaround is to ensure that such instances are separated by whitespace:
```
<div data-context='{"context":{"id":3,"type":"page"} }">
```
See <https://github.com/angular/angular.js/pull/14610#issuecomment-219401099> for more information.
Dependencies
------------
* [`$parse`](%24parse)
* [`$sce`](%24sce)
Usage
-----
`$interpolate(text, [mustHaveExpression], [trustedContext], [allOrNothing]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| text | `string` | The text with markup to interpolate. |
| mustHaveExpression *(optional)* | `boolean` | if set to true then the interpolation string must have embedded expression in order to return an interpolation function. Strings with no embedded expression will return null for the interpolation function. |
| trustedContext *(optional)* | `string` | when provided, the returned function passes the interpolated result through [$sce.getTrusted(interpolatedResult, trustedContext)](%24sce#getTrusted.html) before returning it. Refer to the [$sce](%24sce) service that provides Strict Contextual Escaping for details. |
| allOrNothing *(optional)* | `boolean` | if `true`, then the returned function returns undefined unless all embedded expressions evaluate to a value other than `undefined`. |
### Returns
| | |
| --- | --- |
| `function(context)` | an interpolation function which is used to compute the interpolated string. The function has these parameters:* `context`: evaluation context for all expressions embedded in the interpolated text
|
Methods
-------
* ### startSymbol();
Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
Use [`$interpolateProvider.startSymbol`](../provider/%24interpolateprovider#startSymbol.html) to change the symbol.
#### Returns
| | |
| --- | --- |
| `string` | start symbol. |
* ### endSymbol();
Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
Use [`$interpolateProvider.endSymbol`](../provider/%24interpolateprovider#endSymbol.html) to change the symbol.
#### Returns
| | |
| --- | --- |
| `string` | end symbol. |
angularjs
Improve this Doc View Source $q
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/q.js?message=docs(%24q)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/q.js#L3) $q
============================================================================================================================================================================================================================
1. [$qProvider](../provider/%24qprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
A service that helps you run functions asynchronously, and use their return values (or exceptions) when they are done processing.
This is a [Promises/A+](https://promisesaplus.com/)-compliant implementation of promises/deferred objects inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
$q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred implementations, and the other which resembles ES6 (ES2015) promises to some degree.
$q constructor
--------------
The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver` function as the first argument. This is similar to the native Promise implementation from ES6, see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
While the constructor-style use is supported, not all of the supporting methods from ES6 promises are available yet.
It can be used like so:
```
// for the purpose of this example let's assume that variables `$q` and `okToGreet`
// are available in the current lexical scope (they could have been injected or passed in).
function asyncGreet(name) {
// perform some asynchronous operation, resolve or reject the promise when appropriate.
return $q(function(resolve, reject) {
setTimeout(function() {
if (okToGreet(name)) {
resolve('Hello, ' + name + '!');
} else {
reject('Greeting ' + name + ' is not allowed.');
}
}, 1000);
});
}
var promise = asyncGreet('Robin Hood');
promise.then(function(greeting) {
alert('Success: ' + greeting);
}, function(reason) {
alert('Failed: ' + reason);
});
```
Note: progress/notify callbacks are not currently supported via the ES6-style interface.
Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.
However, the more traditional CommonJS-style usage is still available, and documented below.
[The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an interface for interacting with an object that represents the result of an action that is performed asynchronously, and may or may not be finished at any given point in time.
From the perspective of dealing with error handling, deferred and promise APIs are to asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
```
// for the purpose of this example let's assume that variables `$q` and `okToGreet`
// are available in the current lexical scope (they could have been injected or passed in).
function asyncGreet(name) {
var deferred = $q.defer();
setTimeout(function() {
deferred.notify('About to greet ' + name + '.');
if (okToGreet(name)) {
deferred.resolve('Hello, ' + name + '!');
} else {
deferred.reject('Greeting ' + name + ' is not allowed.');
}
}, 1000);
return deferred.promise;
}
var promise = asyncGreet('Robin Hood');
promise.then(function(greeting) {
alert('Success: ' + greeting);
}, function(reason) {
alert('Failed: ' + reason);
}, function(update) {
alert('Got notification: ' + update);
});
```
At first it might not be obvious why this extra complexity is worth the trouble. The payoff comes in the way of guarantees that promise and deferred APIs make, see <https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md>.
Additionally the promise api allows for composition that is very hard to do with the traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the section on serial or parallel joining of promises.
The Deferred API
----------------
A new instance of deferred is constructed by calling `$q.defer()`.
The purpose of the deferred object is to expose the associated Promise instance as well as APIs that can be used for signaling the successful or unsuccessful completion, as well as the status of the task.
**Methods**
* `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection constructed via `$q.reject`, the promise will be rejected instead.
* `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to resolving it with a rejection constructed via `$q.reject`.
* `notify(value)` - provides updates on the status of the promise's execution. This may be called multiple times before the promise is either resolved or rejected.
**Properties**
* promise – `{Promise}` – promise object associated with this deferred.
The Promise API
---------------
A new promise instance is created when a deferred instance is created and can be retrieved by calling `deferred.promise`.
The purpose of the promise object is to allow for interested parties to get access to the result of the deferred task when it completes.
**Methods**
* `then(successCallback, [errorCallback], [notifyCallback])` – regardless of when the promise was or will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
This method *returns a new promise* which is resolved or rejected via the return value of the `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved with the value which is resolved in that promise using [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)). It also notifies via the return value of the `notifyCallback` method. The promise cannot be resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback arguments are optional.
* `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
* `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the [full specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for more information.
Chaining promises
-----------------
Because calling the `then` method of a promise returns a new derived promise, it is easily possible to create a chain of promises:
```
promiseB = promiseA.then(function(result) {
return result + 1;
});
// promiseB will be resolved immediately after promiseA is resolved and its value
// will be the result of promiseA incremented by 1
```
It is possible to create chains of any length and since a promise can be resolved with another promise (which will defer its resolution further), it is possible to pause/defer resolution of the promises at any point in the chain. This makes it possible to implement powerful APIs like $http's response interceptors.
Differences between Kris Kowal's Q and $q
-----------------------------------------
There are two main differences:
* $q is integrated with the [`$rootScope.Scope`](../type/%24rootscope.scope) Scope model observation mechanism in AngularJS, which means faster propagation of resolution or rejection into your models and avoiding unnecessary browser repaints, which would result in flickering UI.
* Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains all the important functionality needed for common async tasks.
Testing
-------
```
it('should simulate promise', inject(function($q, $rootScope) {
var deferred = $q.defer();
var promise = deferred.promise;
var resolvedValue;
promise.then(function(value) { resolvedValue = value; });
expect(resolvedValue).toBeUndefined();
// Simulate resolving of promise
deferred.resolve(123);
// Note that the 'then' function does not get called synchronously.
// This is because we want the promise API to always be async, whether or not
// it got called synchronously or asynchronously.
expect(resolvedValue).toBeUndefined();
// Propagate promise resolution to 'then' functions using $apply().
$rootScope.$apply();
expect(resolvedValue).toEqual(123);
}));
```
Dependencies
------------
* [`$rootScope`](%24rootscope)
Usage
-----
`$q(resolver);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| resolver | `function(function, function)` | Function which is responsible for resolving or rejecting the newly created promise. The first parameter is a function which resolves the promise, the second parameter is a function which rejects the promise. |
### Returns
| | |
| --- | --- |
| `Promise` | The newly created promise. |
Methods
-------
* ### defer();
Creates a `Deferred` object which represents a task which will finish in the future.
#### Returns
| | |
| --- | --- |
| `Deferred` | Returns a new instance of deferred. |
* ### reject(reason);
Creates a promise that is resolved as rejected with the specified `reason`. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it.
When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via `reject`.
```
promiseB = promiseA.then(function(result) {
// success: do something and resolve promiseB
// with the old or a new result
return result;
}, function(reason) {
// error: handle the error if possible and
// resolve promiseB with newPromiseOrValue,
// otherwise forward the rejection to promiseB
if (canHandle(reason)) {
// handle the error and recover
return newPromiseOrValue;
}
return $q.reject(reason);
});
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| reason | `*` | Constant, message, exception or an object representing the rejection reason. |
#### Returns
| | |
| --- | --- |
| `Promise` | Returns a promise that was already resolved as rejected with the `reason`. |
* ### when(value, [successCallback], [errorCallback], [progressCallback]);
Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Value or a promise |
| successCallback *(optional)* | `Function=` | |
| errorCallback *(optional)* | `Function=` | |
| progressCallback *(optional)* | `Function=` | |
#### Returns
| | |
| --- | --- |
| `Promise` | Returns a promise of the passed value or promise |
* ### resolve(value, [successCallback], [errorCallback], [progressCallback]);
Alias of [when](%24q#when.html) to maintain naming consistency with ES6.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | Value or a promise |
| successCallback *(optional)* | `Function=` | |
| errorCallback *(optional)* | `Function=` | |
| progressCallback *(optional)* | `Function=` | |
#### Returns
| | |
| --- | --- |
| `Promise` | Returns a promise of the passed value or promise |
* ### all(promises);
Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| promises | `Array.<Promise>``Object.<Promise>` | An array or hash of promises. |
#### Returns
| | |
| --- | --- |
| `Promise` | Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the `promises` array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. |
* ### race(promises);
Returns a promise that resolves or rejects as soon as one of those promises resolves or rejects, with the value or reason from that promise.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| promises | `Array.<Promise>``Object.<Promise>` | An array or hash of promises. |
#### Returns
| | |
| --- | --- |
| `Promise` | a promise that resolves or rejects as soon as one of the `promises` resolves or rejects, with the value or reason from that promise. |
| programming_docs |
angularjs
Improve this Doc View Source $sce
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/sce.js?message=docs(%24sce)%3A%20describe%20your%20change...#L522) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/sce.js#L522) $sce
========================================================================================================================================================================================================================================
1. [$sceProvider](../provider/%24sceprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
Strict Contextual Escaping
--------------------------
Strict Contextual Escaping (SCE) is a mode in which AngularJS constrains bindings to only render trusted values. Its goal is to assist in writing code in a way that (a) is secure by default, and (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
### Overview
To systematically block XSS security bugs, AngularJS treats all values as untrusted by default in HTML or sensitive URL bindings. When binding untrusted values, AngularJS will automatically run security checks on them (sanitizations, trusted URL resource, depending on context), or throw when it cannot guarantee the security of the result. That behavior depends strongly on contexts: HTML can be sanitized, but template URLs cannot, for instance.
To illustrate this, consider the `ng-bind-html` directive. It renders its value directly as HTML: we call that the *context*. When given an untrusted input, AngularJS will attempt to sanitize it before rendering if a sanitizer is available, and throw otherwise. To bypass sanitization and render the input as-is, you will need to mark it as trusted for that context before attempting to bind it.
As of version 1.2, AngularJS ships with SCE enabled by default.
### In practice
Here's an example of a binding in a privileged context:
```
<input ng-model="userHtml" aria-label="User input">
<div ng-bind-html="userHtml"></div>
```
Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE disabled, this application allows the user to render arbitrary HTML into the DIV, which would be an XSS security bug. In a more realistic example, one may be rendering user comments, blog articles, etc. via bindings. (HTML is just one example of a context where rendering user controlled input creates security vulnerabilities.)
For the case of HTML, you might use a library, either on the client side, or on the server side, to sanitize unsafe HTML before binding to the value and rendering it in the document.
How would you ensure that every place that used these types of bindings was bound to a value that was sanitized by your library (or returned as safe for rendering by your server?) How can you ensure that you didn't accidentally delete the line that sanitized the value, or renamed some properties/fields and forgot to update the binding to the sanitized value?
To be secure by default, AngularJS makes sure bindings go through that sanitization, or any similar validation process, unless there's a good reason to trust the given value in this context. That trust is formalized with a function call. This means that as a developer, you can assume all untrusted bindings are safe. Then, to audit your code for binding security issues, you just need to ensure the values you mark as trusted indeed are safe - because they were received from your server, sanitized by your library, etc. You can organize your codebase to help with this - perhaps allowing only the files in a specific directory to do this. Ensuring that the internal API exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
In the case of AngularJS' SCE service, one uses [$sce.trustAs](%24sce#trustAs.html) (and shorthand methods such as [$sce.trustAsHtml](%24sce#trustAsHtml.html), etc.) to build the trusted versions of your values.
### How does it work?
In privileged contexts, directives and code will bind to the result of [$sce.getTrusted(context, value)](%24sce#getTrusted.html) rather than to the value directly. Think of this function as a way to enforce the required security context in your data sink. Directives use [$sce.parseAs](%24sce#parseAs.html) rather than `$parse` to watch attribute bindings, which performs the [$sce.getTrusted](%24sce#getTrusted.html) behind the scenes on non-constant literals. Also, when binding without directives, AngularJS will understand the context of your bindings automatically.
As an example, [ngBindHtml](../directive/ngbindhtml) uses [$sce.parseAsHtml(binding expression)](%24sce#parseAsHtml.html). Here's the actual code (slightly simplified):
```
var ngBindHtmlDirective = ['$sce', function($sce) {
return function(scope, element, attr) {
scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
element.html(value || '');
});
};
}];
```
### Impact on loading templates
This applies both to the [`ng-include`](../directive/nginclude) directive as well as `templateUrl`'s specified by [directives](../../../guide/directive).
By default, AngularJS only loads templates from the same domain and protocol as the application document. This is done by calling [$sce.getTrustedResourceUrl](%24sce#getTrustedResourceUrl.html) on the template URL. To load templates from other domains and/or protocols, you may either add them to the [trustedResourceUrlList](../provider/%24scedelegateprovider#trustedResourceUrlList.html) or [wrap them](%24sce#trustAsResourceUrl.html) into trusted values.
*Please note*: The browser's [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) policy apply in addition to this and may further restrict whether the template is successfully loaded. This means that without the right CORS policy, loading templates from a different domain won't work on all browsers. Also, loading templates from `file://` URL does not work on some browsers.
### This feels like too much overhead
It's important to remember that SCE only applies to interpolation expressions.
If your expressions are constant literals, they're automatically trusted and you don't need to call `$sce.trustAs` on them (e.g. `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works (remember to include the `ngSanitize` module). The `$sceDelegate` will also use the `$sanitize` service if it is available when binding untrusted values to `$sce.HTML` context. AngularJS provides an implementation in `angular-sanitize.js`, and if you wish to use it, you will also need to depend on the [`ngSanitize`](../../ngsanitize) module in your application.
The included [$sceDelegate](%24scedelegate) comes with sane defaults to allow you to load templates in `ng-include` from your application's domain without having to even know about SCE. It blocks loading templates from other domains or loading templates over http from an https served document. You can change these by setting your own custom [trusted resource URL list](../provider/%24scedelegateprovider#trustedResourceUrlList.html) and [banned resource URL list](../provider/%24scedelegateprovider#bannedResourceUrlList.html) for matching such URLs.
This significantly reduces the overhead. It is far easier to pay the small overhead and have an application that's secure and can be audited to verify that with much more ease than bolting security onto an application later.
### What trusted context types are supported?
| Context | Notes |
| --- | --- |
| `$sce.HTML` | For HTML that's safe to source into the application. The [ngBindHtml](../directive/ngbindhtml) directive uses this context for bindings. If an unsafe value is encountered and the [$sanitize](../../ngsanitize) module is present this will sanitize the value instead of throwing an error. |
| `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
| `$sce.MEDIA_URL` | For URLs that are safe to render as media. Is automatically converted from string by sanitizing when needed. |
| `$sce.URL` | For URLs that are safe to follow as links. Is automatically converted from string by sanitizing when needed. Note that `$sce.URL` makes a stronger statement about the URL than `$sce.MEDIA_URL` does and therefore contexts requiring values trusted for `$sce.URL` can be used anywhere that values trusted for `$sce.MEDIA_URL` are required. |
| `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` or `$sce.MEDIA_URL` do and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` or `$sce.MEDIA_URL` are required. The [$sceDelegateProvider#trustedResourceUrlList()](../provider/%24scedelegateprovider#trustedResourceUrlList.html) and [$sceDelegateProvider#bannedResourceUrlList()](../provider/%24scedelegateprovider#bannedResourceUrlList.html) can be used to restrict trusted origins for `RESOURCE_URL` |
| `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
Be aware that, before AngularJS 1.7.0, `a[href]` and `img[src]` used to sanitize their interpolated values directly rather than rely upon [`$sce.getTrusted`](%24sce#getTrusted.html). **As of 1.7.0, this is no longer the case.** Now such interpolations are marked as requiring `$sce.URL` (for `a[href]`) or `$sce.MEDIA_URL` (for `img[src]`), so that the sanitization happens (via `$sce.getTrusted...`) when the `$interpolate` service evaluates the expressions. There are no CSS or JS context bindings in AngularJS currently, so their corresponding `$sce.trustAs` functions aren't useful yet. This might evolve.
### Format of items in [trustedResourceUrlList](../provider/%24scedelegateprovider#trustedResourceUrlList.html)/[bannedResourceUrlList](../provider/%24scedelegateprovider#bannedResourceUrlList.html)
Each element in these arrays must be one of the following:
* **'self'**
+ The special **string**, `'self'`, can be used to match against all URLs of the **same domain** as the application document using the **same protocol**.
* **String** (except the special value `'self'`)
+ The string is matched against the full *normalized / absolute URL* of the resource being tested (substring matches are not good enough.)
+ There are exactly **two wildcard sequences** - `*` and `**`. All other characters match themselves.
+ `*`: matches zero or more occurrences of any character other than one of the following 6 characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use for matching resource URL lists.
+ `**`: matches zero or more occurrences of *any* character. As such, it's not appropriate for use in a scheme, domain, etc. as it would match too much. (e.g. [http://\*\*.example.com/](#) would match <http://evil.com/?ignore=.example.com/> and that might not have been the intention.) Its usage at the very end of the path is ok. (e.g. [http://foo.example.com/templates/\*\*](http://foo.example.com/templates/**)).
* **RegExp** (*see caveat below*)
+ *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax (and all the inevitable escaping) makes them *harder to maintain*. It's easy to accidentally introduce a bug when one updates a complex expression (imho, all regexes should have good test coverage). For instance, the use of `.` in the regex is correct only in a small number of cases. A `.` character in the regex used when matching the scheme or a subdomain could be matched against a `:` or literal `.` that was likely not intended. It is highly recommended to use the string patterns and only fall back to regular expressions as a last resort.
+ The regular expression must be an instance of RegExp (i.e. not a string.) It is matched against the **entire** *normalized / absolute URL* of the resource being tested (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+ If you are generating your JavaScript from some other templating engine (not recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)), remember to escape your regular expression (and be aware that you might need more than one level of escaping depending on your templating engine and the way you interpolated the value.) Do make use of your platform's escaping mechanism as it might be good enough before coding your own. E.g. Ruby has [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape) and Python has [re.escape](http://docs.python.org/library/re.html#re.escape). Javascript lacks a similar built in function for escaping. Take a look at Google Closure library's [goog.string.regExpEscape(s)](http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
Refer [$sceDelegateProvider](../provider/%24scedelegateprovider) for an example.
### Show me an example using SCE.
Can I disable SCE completely?
-----------------------------
Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits for little coding overhead. It will be much harder to take an SCE disabled application and either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE for cases where you have a lot of existing code that was written before SCE was introduced and you're migrating them a module at a time. Also do note that this is an app-wide setting, so if you are writing a library, you will cause security bugs applications using it.
That said, here's how you can completely disable SCE:
```
angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
// Completely disable SCE. For demonstration purposes only!
// Do not use in new projects or libraries.
$sceProvider.enabled(false);
});
```
Usage
-----
`$sce();`
Methods
-------
* ### isEnabled();
Returns a boolean indicating if SCE is enabled.
#### Returns
| | |
| --- | --- |
| `Boolean` | True if SCE is enabled, false otherwise. If you want to set the value, you have to do it at module config time on [$sceProvider](../provider/%24sceprovider). |
* ### parseAs(type, expression);
Converts AngularJS [expression](../../../guide/expression) into a function. This is like [$parse](%24parse) and is identical when the expression is a literal constant. Otherwise, it wraps the expression in a call to [$sce.getTrusted(*type*, *result*)](%24sce#getTrusted.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| type | `string` | The SCE context in which this result will be used. |
| expression | `string` | String expression to compile. |
#### Returns
| | |
| --- | --- |
| `function(context, locals)` | A function which represents the compiled expression:
+ `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
+ `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. |
* ### trustAs(type, value);
Delegates to [`$sceDelegate.trustAs`](%24scedelegate#trustAs.html). As such, returns a wrapped object that represents your value, and the trust you have in its safety for the given context. AngularJS can then use that value as-is in bindings of the specified secure context. This is used in bindings for `ng-bind-html`, `ng-include`, and most `src` attribute interpolations. See [$sce](%24sce) for strict contextual escaping.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| type | `string` | The context in which this value is safe for use, e.g. `$sce.URL`, `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. |
| value | `*` | The value that that should be considered trusted. |
#### Returns
| | |
| --- | --- |
| `*` | A wrapped version of value that can be used as a trusted variant of your `value` in the context you specified. |
* ### trustAsHtml(value);
Shorthand method. `$sce.trustAsHtml(value)` → [`$sceDelegate.trustAs($sce.HTML, value)`](%24scedelegate#trustAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to mark as trusted for `$sce.HTML` context. |
#### Returns
| | |
| --- | --- |
| `*` | A wrapped version of value that can be used as a trusted variant of your `value` in `$sce.HTML` context (like `ng-bind-html`). |
* ### trustAsCss(value);
Shorthand method. `$sce.trustAsCss(value)` → [`$sceDelegate.trustAs($sce.CSS, value)`](%24scedelegate#trustAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to mark as trusted for `$sce.CSS` context. |
#### Returns
| | |
| --- | --- |
| `*` | A wrapped version of value that can be used as a trusted variant of your `value` in `$sce.CSS` context. This context is currently unused, so there are almost no reasons to use this function so far. |
* ### trustAsUrl(value);
Shorthand method. `$sce.trustAsUrl(value)` → [`$sceDelegate.trustAs($sce.URL, value)`](%24scedelegate#trustAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to mark as trusted for `$sce.URL` context. |
#### Returns
| | |
| --- | --- |
| `*` | A wrapped version of value that can be used as a trusted variant of your `value` in `$sce.URL` context. That context is currently unused, so there are almost no reasons to use this function so far. |
* ### trustAsResourceUrl(value);
Shorthand method. `$sce.trustAsResourceUrl(value)` → [`$sceDelegate.trustAs($sce.RESOURCE_URL, value)`](%24scedelegate#trustAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to mark as trusted for `$sce.RESOURCE_URL` context. |
#### Returns
| | |
| --- | --- |
| `*` | A wrapped version of value that can be used as a trusted variant of your `value` in `$sce.RESOURCE_URL` context (template URLs in `ng-include`, most `src` attribute bindings, ...) |
* ### trustAsJs(value);
Shorthand method. `$sce.trustAsJs(value)` → [`$sceDelegate.trustAs($sce.JS, value)`](%24scedelegate#trustAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to mark as trusted for `$sce.JS` context. |
#### Returns
| | |
| --- | --- |
| `*` | A wrapped version of value that can be used as a trusted variant of your `value` in `$sce.JS` context. That context is currently unused, so there are almost no reasons to use this function so far. |
* ### getTrusted(type, maybeTrusted);
Delegates to [`$sceDelegate.getTrusted`](%24scedelegate#getTrusted.html). As such, takes any input, and either returns a value that's safe to use in the specified context, or throws an exception. This function is aware of trusted values created by the `trustAs` function and its shorthands, and when contexts are appropriate, returns the unwrapped value as-is. Finally, this function can also throw when there is no way to turn `maybeTrusted` in a safe value (e.g., no sanitization is available or possible.)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| type | `string` | The context in which this value is to be used. |
| maybeTrusted | `*` | The result of a prior [`$sce.trustAs`](%24sce#trustAs.html) call, or anything else (which will not be considered trusted.) |
#### Returns
| | |
| --- | --- |
| `*` | A version of the value that's safe to use in the given context, or throws an exception if this is impossible. |
* ### getTrustedHtml(value);
Shorthand method. `$sce.getTrustedHtml(value)` → [`$sceDelegate.getTrusted($sce.HTML, value)`](%24scedelegate#getTrusted.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to pass to `$sce.getTrusted`. |
#### Returns
| | |
| --- | --- |
| `*` | The return value of `$sce.getTrusted($sce.HTML, value)` |
* ### getTrustedCss(value);
Shorthand method. `$sce.getTrustedCss(value)` → [`$sceDelegate.getTrusted($sce.CSS, value)`](%24scedelegate#getTrusted.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to pass to `$sce.getTrusted`. |
#### Returns
| | |
| --- | --- |
| `*` | The return value of `$sce.getTrusted($sce.CSS, value)` |
* ### getTrustedUrl(value);
Shorthand method. `$sce.getTrustedUrl(value)` → [`$sceDelegate.getTrusted($sce.URL, value)`](%24scedelegate#getTrusted.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to pass to `$sce.getTrusted`. |
#### Returns
| | |
| --- | --- |
| `*` | The return value of `$sce.getTrusted($sce.URL, value)` |
* ### getTrustedResourceUrl(value);
Shorthand method. `$sce.getTrustedResourceUrl(value)` → [`$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`](%24scedelegate#getTrusted.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to pass to `$sceDelegate.getTrusted`. |
#### Returns
| | |
| --- | --- |
| `*` | The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` |
* ### getTrustedJs(value);
Shorthand method. `$sce.getTrustedJs(value)` → [`$sceDelegate.getTrusted($sce.JS, value)`](%24scedelegate#getTrusted.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value | `*` | The value to pass to `$sce.getTrusted`. |
#### Returns
| | |
| --- | --- |
| `*` | The return value of `$sce.getTrusted($sce.JS, value)` |
* ### parseAsHtml(expression);
Shorthand method. `$sce.parseAsHtml(expression string)` → [`$sce.parseAs($sce.HTML, value)`](%24sce#parseAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression | `string` | String expression to compile. |
#### Returns
| | |
| --- | --- |
| `function(context, locals)` | A function which represents the compiled expression:
+ `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
+ `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. |
* ### parseAsCss(expression);
Shorthand method. `$sce.parseAsCss(value)` → [`$sce.parseAs($sce.CSS, value)`](%24sce#parseAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression | `string` | String expression to compile. |
#### Returns
| | |
| --- | --- |
| `function(context, locals)` | A function which represents the compiled expression:
+ `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
+ `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. |
* ### parseAsUrl(expression);
Shorthand method. `$sce.parseAsUrl(value)` → [`$sce.parseAs($sce.URL, value)`](%24sce#parseAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression | `string` | String expression to compile. |
#### Returns
| | |
| --- | --- |
| `function(context, locals)` | A function which represents the compiled expression:
+ `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
+ `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. |
* ### parseAsResourceUrl(expression);
Shorthand method. `$sce.parseAsResourceUrl(value)` → [`$sce.parseAs($sce.RESOURCE_URL, value)`](%24sce#parseAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression | `string` | String expression to compile. |
#### Returns
| | |
| --- | --- |
| `function(context, locals)` | A function which represents the compiled expression:
+ `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
+ `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. |
* ### parseAsJs(expression);
Shorthand method. `$sce.parseAsJs(value)` → [`$sce.parseAs($sce.JS, value)`](%24sce#parseAs.html)
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| expression | `string` | String expression to compile. |
#### Returns
| | |
| --- | --- |
| `function(context, locals)` | A function which represents the compiled expression:
+ `context` – `{object}` – an object against which any expressions embedded in the strings are evaluated against (typically a scope object).
+ `locals` – `{object=}` – local variables context object, useful for overriding values in `context`. |
| programming_docs |
angularjs
Improve this Doc View Source $cacheFactory
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/cacheFactory.js?message=docs(%24cacheFactory)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/cacheFactory.js#L3) $cacheFactory
========================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
Factory that constructs [Cache](../type/%24cachefactory.cache) objects and gives access to them.
```
var cache = $cacheFactory('cacheId');
expect($cacheFactory.get('cacheId')).toBe(cache);
expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
cache.put("key", "value");
cache.put("another key", "another value");
// We've specified no options on creation
expect(cache.info()).toEqual({id: 'cacheId', size: 2});
```
Usage
-----
`$cacheFactory(cacheId, [options]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| cacheId | `string` | Name or id of the newly created cache. |
| options *(optional)* | `object` | Options object that specifies the cache behavior. Properties:* `{number=}` `capacity` — turns the cache into LRU cache.
|
### Returns
| | |
| --- | --- |
| `object` | Newly created cache object with the following set of methods:* `{object}` `info()` — Returns id, size, and options of cache.
* `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns it.
* `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
* `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
* `{void}` `removeAll()` — Removes all cached values.
* `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
|
Methods
-------
* ### info();
Get information about all the caches that have been created
#### Returns
| | |
| --- | --- |
| `Object` |
+ key-value map of `cacheId` to the result of calling `cache#info` |
* ### get(cacheId);
Get access to a cache object by the `cacheId` used when it was created.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| cacheId | `string` | Name or id of a cache to access. |
#### Returns
| | |
| --- | --- |
| `object` | Cache object identified by the cacheId or undefined if no such cache. |
Example
-------
angularjs
Improve this Doc View Source $locale
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/locale.js?message=docs(%24locale)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/locale.js#L3) $locale
================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
$locale service provides localization rules for various AngularJS components. As of right now the only public api is:
* `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
angularjs
Improve this Doc View Source $anchorScroll
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/anchorScroll.js?message=docs(%24anchorScroll)%3A%20describe%20your%20change...#L33) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/anchorScroll.js#L33) $anchorScroll
==========================================================================================================================================================================================================================================================================
1. [$anchorScrollProvider](../provider/%24anchorscrollprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
When called, it scrolls to the element related to the specified `hash` or (if omitted) to the current value of [$location.hash()](%24location#hash.html), according to the rules specified in the [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document).
It also watches the [$location.hash()](%24location#hash.html) and automatically scrolls to match any anchor whenever it changes. This can be disabled by calling [$anchorScrollProvider.disableAutoScrolling()](../provider/%24anchorscrollprovider#disableAutoScrolling.html).
Additionally, you can use its [yOffset](%24anchorscroll#yOffset.html) property to specify a vertical scroll-offset (either fixed or dynamic).
Dependencies
------------
* [`$window`](%24window)
* [`$location`](%24location)
* [`$rootScope`](%24rootscope)
Usage
-----
`$anchorScroll([hash]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| hash *(optional)* | `string` | The hash specifying the element to scroll to. If omitted, the value of [$location.hash()](%24location#hash.html) will be used. |
Properties
----------
* ### yOffset
| | |
| --- | --- |
| `number``function()``jqLite` | If set, specifies a vertical scroll-offset. This is often useful when there are fixed positioned elements at the top of the page, such as navbars, headers etc. `yOffset` can be specified in various ways:
+ **number**: A fixed number of pixels to be used as offset.
+ **function**: A getter function called everytime `$anchorScroll()` is executed. Must return a number representing the offset (in pixels).
+ **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from the top of the page to the element's bottom will be used as offset. **Note**: The element will be taken into account only as long as its `position` is set to `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust their height and/or positioning according to the viewport's size. In order for `yOffset` to work properly, scrolling should take place on the document's root and not some child element. |
Examples
--------
The example below illustrates the use of a vertical scroll-offset (specified as a fixed value). See [$anchorScroll.yOffset](%24anchorscroll#yOffset.html) for more details.
angularjs
Improve this Doc View Source $httpBackend
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/httpBackend.js?message=docs(%24httpBackend)%3A%20describe%20your%20change...#L33) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/httpBackend.js#L33) $httpBackend
======================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
HTTP backend used by the [service](%24http) that delegates to XMLHttpRequest object or JSONP and deals with browser incompatibilities.
You should never need to use this service directly, instead use the higher-level abstractions: [$http](%24http) or [$resource](../../ngresource/service/%24resource).
During testing this implementation is swapped with [mock $httpBackend](../../ngmock/service/%24httpbackend) which can be trained with responses.
Dependencies
------------
* [`$jsonpCallbacks`](%24jsonpcallbacks)
* [`$document`](%24document)
* [`$xhrFactory`](%24xhrfactory)
angularjs
Improve this Doc View Source $interval
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/interval.js?message=docs(%24interval)%3A%20describe%20your%20change...#L20) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/interval.js#L20) $interval
==========================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
AngularJS's wrapper for `window.setInterval`. The `fn` function is executed every `delay` milliseconds.
The return value of registering an interval function is a promise. This promise will be notified upon each tick of the interval, and will be resolved after `count` iterations, or run indefinitely if `count` is not defined. The value of the notification will be the number of iterations that have run. To cancel an interval, call `$interval.cancel(promise)`.
In tests you can use [`$interval.flush(millis)`](../../ngmock/service/%24interval#flush.html) to move forward by `millis` milliseconds and trigger any functions scheduled to run in that time.
**Note**: Intervals created by this service must be explicitly destroyed when you are finished with them. In particular they are not automatically destroyed when a controller's scope or a directive's element are destroyed. You should take this into consideration and make sure to always cancel the interval at the appropriate moment. See the example below for more details on how and when to do this. Usage
-----
`$interval(fn, delay, [count], [invokeApply], [Pass]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| fn | `function()` | A function that should be called repeatedly. If no additional arguments are passed (see below), the function is called with the current iteration count. |
| delay | `number` | Number of milliseconds between each function call. |
| count *(optional)* | `number` | Number of times to repeat. If not set, or 0, will repeat indefinitely. *(default: 0)* |
| invokeApply *(optional)* | `boolean` | If set to `false` skips model dirty checking, otherwise will invoke `fn` within the [$apply](../type/%24rootscope.scope#%24apply.html) block. *(default: true)* |
| Pass *(optional)* | `*` | additional parameters to the executed function. |
### Returns
| | |
| --- | --- |
| `promise` | A promise which will be notified on each iteration. It will resolve once all iterations of the interval complete. |
Methods
-------
* ### cancel([promise]);
Cancels a task associated with the `promise`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| promise *(optional)* | `Promise` | returned by the `$interval` function. |
#### Returns
| | |
| --- | --- |
| `boolean` | Returns `true` if the task was successfully canceled. |
Example
-------
angularjs
Improve this Doc View Source $http
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/http.js?message=docs(%24http)%3A%20describe%20your%20change...#L479) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/http.js#L479) $http
============================================================================================================================================================================================================================================
1. [$httpProvider](../provider/%24httpprovider)
2. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
The `$http` service is a core AngularJS service that facilitates communication with the remote HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest) object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
For unit testing applications that use `$http` service, see [$httpBackend mock](../../ngmock/service/%24httpbackend).
For a higher level of abstraction, please check out the [$resource](../../ngresource/service/%24resource) service.
The $http API is based on the [deferred/promise APIs](%24q) exposed by the $q service. While for simple usage patterns this doesn't matter much, for advanced usage it is important to familiarize yourself with these APIs and the guarantees they provide.
General usage
-------------
The `$http` service is a function which takes a single argument — a [configuration object](%24http#usage.html) — that is used to generate an HTTP request and returns a [promise](%24q) that is resolved (request success) or rejected (request failure) with a [response](%24http#%24http-returns.html) object.
```
// Simple GET request example:
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
```
Shortcut methods
----------------
Shortcut methods are also available. All shortcut methods require passing in the URL, and request data must be passed in for POST/PUT requests. An optional config can be passed as the last argument.
```
$http.get('/someUrl', config).then(successCallback, errorCallback);
$http.post('/someUrl', data, config).then(successCallback, errorCallback);
```
Complete list of shortcut methods:
* [$http.get](%24http#get.html)
* [$http.head](%24http#head.html)
* [$http.post](%24http#post.html)
* [$http.put](%24http#put.html)
* [$http.delete](%24http#delete.html)
* [$http.jsonp](%24http#jsonp.html)
* [$http.patch](%24http#patch.html)
Writing Unit Tests that use $http
---------------------------------
When unit testing (using [ngMock](../../ngmock)), it is necessary to call [$httpBackend.flush()](../../ngmock/service/%24httpbackend#flush.html) to flush each pending request using trained responses.
```
$httpBackend.expectGET(...);
$http.get(...);
$httpBackend.flush();
```
Setting HTTP Headers
--------------------
The $http service will automatically add certain HTTP headers to all requests. These defaults can be fully configured by accessing the `$httpProvider.defaults.headers` configuration object, which currently contains this default configuration:
* `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+ `Accept: application/json, text/plain, */*`
* `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+ `Content-Type: application/json`
* `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+ `Content-Type: application/json`
To add or overwrite these defaults, simply add or remove a property from these configuration objects. To add headers for an HTTP method other than POST or PUT, simply add a new object with the lowercased HTTP method name as the key, e.g. `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.
The defaults can also be set at runtime via the `$http.defaults` object in the same fashion. For example:
```
module.run(function($http) {
$http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
});
```
In addition, you can supply a `headers` property in the config object passed when calling `$http(config)`, which overrides the defaults without changing them globally.
To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis, Use the `headers` property, setting the desired header to `undefined`. For example:
```
var req = {
method: 'POST',
url: 'http://example.com',
headers: {
'Content-Type': undefined
},
data: { test: 'test' }
}
$http(req).then(function(){...}, function(){...});
```
Transforming Requests and Responses
-----------------------------------
Both requests and responses can be transformed using transformation functions: `transformRequest` and `transformResponse`. These properties can be a single function that returns the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions, which allows you to `push` or `unshift` a new transformation function into the transformation chain.
**Note:** AngularJS does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline. That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference). For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest function will be reflected on the scope and in any templates where the object is data-bound. To prevent this, transform functions should have no side-effects. If you need to modify properties, it is recommended to make a copy of the data, or create new object to return. ### Default Transformations
The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and `defaults.transformResponse` properties. If a request does not provide its own transformations then these will be applied.
You can augment or replace the default transformations by modifying these properties by adding to or replacing the array.
AngularJS provides the following default transformations:
Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`) is an array with one function that does the following:
* If the `data` property of the request configuration object contains an object, serialize it into JSON format.
Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`) is an array with one function that does the following:
* If XSRF prefix is detected, strip it (see Security Considerations section below).
* If the `Content-Type` is `application/json` or the response looks like JSON, deserialize it using a JSON parser.
### Overriding the Default Transformations Per Request
If you wish to override the request/response transformations only for a single request then provide `transformRequest` and/or `transformResponse` properties on the configuration object passed into `$http`.
Note that if you provide these properties on the config object the default transformations will be overwritten. If you wish to augment the default transformations then you must include them in your local transformation array.
The following code demonstrates adding a new response transformation to be run after the default response transformations have been run.
```
function appendTransform(defaults, transform) {
// We can't guarantee that the default transformation is an array
defaults = angular.isArray(defaults) ? defaults : [defaults];
// Append the new transformation to the defaults
return defaults.concat(transform);
}
$http({
url: '...',
method: 'GET',
transformResponse: appendTransform($http.defaults.transformResponse, function(value) {
return doTransform(value);
})
});
```
Caching
-------
[`$http`](%24http) responses are not cached by default. To enable caching, you must set the config.cache value or the default cache value to TRUE or to a cache object (created with [`$cacheFactory`](%24cachefactory)). If defined, the value of config.cache takes precedence over the default cache value.
In order to:
* cache all responses - set the default cache value to TRUE or to a cache object
* cache a specific response - set config.cache value to TRUE or to a cache object
If caching is enabled, but neither the default cache nor config.cache are set to a cache object, then the default `$cacheFactory("$http")` object is used.
The default cache value can be set by updating the [`$http.defaults.cache`](%24http#defaults.html) property or the [`$httpProvider.defaults.cache`](../provider/%24httpprovider#defaults.html) property.
When caching is enabled, [`$http`](%24http) stores the response from the server using the relevant cache object. The next time the same request is made, the response is returned from the cache without sending a request to the server.
Take note that:
* Only GET and JSONP requests are cached.
* The cache key is the request URL including search parameters; headers are not considered.
* Cached responses are returned asynchronously, in the same way as responses from the server.
* If multiple identical requests are made using the same cache, which is not yet populated, one request will be made to the server and remaining requests will return the same response.
* A cache-control header on the response does not affect if or how responses are cached.
Interceptors
------------
Before you start creating interceptors, be sure to understand the [$q and deferred/promise APIs](%24q).
For purposes of global error handling, authentication, or any kind of synchronous or asynchronous pre-processing of request or postprocessing of responses, it is desirable to be able to intercept requests before they are handed to the server and responses before they are handed over to the application code that initiated these requests. The interceptors leverage the [promise APIs](%24q) to fulfill this need for both synchronous and asynchronous pre-processing.
The interceptors are service factories that are registered with the `$httpProvider` by adding them to the `$httpProvider.interceptors` array. The factory is called and injected with dependencies (if specified) and returns the interceptor.
There are two kinds of interceptors (and two kinds of rejection interceptors):
* `request`: interceptors get called with a http [config](%24http#usage.html) object. The function is free to modify the `config` object or create a new one. The function needs to return the `config` object directly, or a promise containing the `config` or a new `config` object.
* `requestError`: interceptor gets called when a previous interceptor threw an error or resolved with a rejection.
* `response`: interceptors get called with http `response` object. The function is free to modify the `response` object or create a new one. The function needs to return the `response` object directly, or as a promise containing the `response` or a new `response` object.
* `responseError`: interceptor gets called when a previous interceptor threw an error or resolved with a rejection.
```
// register the interceptor as a service
$provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
return {
// optional method
'request': function(config) {
// do something on success
return config;
},
// optional method
'requestError': function(rejection) {
// do something on error
if (canRecover(rejection)) {
return responseOrNewPromise
}
return $q.reject(rejection);
},
// optional method
'response': function(response) {
// do something on success
return response;
},
// optional method
'responseError': function(rejection) {
// do something on error
if (canRecover(rejection)) {
return responseOrNewPromise
}
return $q.reject(rejection);
}
};
});
$httpProvider.interceptors.push('myHttpInterceptor');
// alternatively, register the interceptor via an anonymous factory
$httpProvider.interceptors.push(function($q, dependency1, dependency2) {
return {
'request': function(config) {
// same as above
},
'response': function(response) {
// same as above
}
};
});
```
Security Considerations
-----------------------
When designing web applications, consider security threats from:
* [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
* [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
Both server and the client must cooperate in order to eliminate these threats. AngularJS comes pre-configured with strategies that address these issues, but for this to work backend server cooperation is required.
### JSON Vulnerability Protection
A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) allows third party website to turn your JSON resource URL into [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To counter this your server can prefix all JSON requests with following string `")]}',\n"`. AngularJS will automatically strip the prefix before processing it as JSON.
For example if your server needs to return:
```
['one','two']
```
which is vulnerable to attack, your server can return:
```
)]}',
['one','two']
```
AngularJS will strip the prefix, before processing the JSON.
### Cross Site Request Forgery (XSRF) Protection
[XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by which the attacker can trick an authenticated user into unknowingly executing actions on your website. AngularJS provides a mechanism to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP header (by default `X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the cookie, your server can be assured that the XHR came from JavaScript running on your domain.
To take advantage of this, your server needs to set a token in a JavaScript readable session cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the server can verify that the cookie matches the `X-XSRF-TOKEN` HTTP header, and therefore be sure that only JavaScript running on your domain could have sent the request. The token must be unique for each user and must be verifiable by the server (to prevent the JavaScript from making up its own tokens). We recommend that the token is a digest of your site's authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) for added security.
The header will — by default — **not** be set for cross-domain requests. This prevents unauthorized servers (e.g. malicious or compromised 3rd-party APIs) from gaining access to your users' XSRF tokens and exposing them to Cross Site Request Forgery. If you want to, you can trust additional origins to also receive the XSRF token, by adding them to [xsrfTrustedOrigins](../provider/%24httpprovider#xsrfTrustedOrigins.html). This might be useful, for example, if your application, served from `example.com`, needs to access your API at `api.example.com`. See [$httpProvider.xsrfTrustedOrigins](../provider/%24httpprovider#xsrfTrustedOrigins.html) for more details.
**Warning**
Only trusted origins that you have control over and make sure you understand the implications of doing so. The name of the cookie and the header can be specified using the `xsrfCookieName` and `xsrfHeaderName` properties of either `$httpProvider.defaults` at config-time, `$http.defaults` at run-time, or the per-request config object.
In order to prevent collisions in environments where multiple AngularJS apps share the same domain or subdomain, we recommend that each application uses a unique cookie name.
Dependencies
------------
* [`$httpBackend`](%24httpbackend)
* [`$cacheFactory`](%24cachefactory)
* [`$rootScope`](%24rootscope)
* [`$q`](%24q)
* [`$injector`](../../auto/service/%24injector)
Usage
-----
`$http(config);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| config | `object` | Object describing the request to be made and how it should be processed. The object has following properties:* **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
* **url** – `{string|TrustedObject}` – Absolute or relative URL of the resource that is being requested; or an object created by a call to `$sce.trustAsResourceUrl(url)`.
* **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized with the `paramSerializer` and appended as GET parameters.
* **data** – `{string|Object}` – Data to be sent as the request message data.
* **headers** – `{Object}` – Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent. Functions accept a config object as an argument.
* **eventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest object. To bind events to the XMLHttpRequest upload object, use `uploadEventHandlers`. The handler will be called in the context of a `$apply` block.
* **uploadEventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest upload object. To bind events to the XMLHttpRequest object, use `eventHandlers`. The handler will be called in the context of a `$apply` block.
* **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
* **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
* **transformRequest** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version. See [Overriding the Default Transformations](%24http#overriding-the-default-transformations-per-request.html)
* **transformResponse** – `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` – transform function or an array of such functions. The transform function takes the http response body, headers and status and returns its transformed (typically deserialized) version. See [Overriding the Default Transformations](%24http#overriding-the-default-transformations-per-request.html)
* **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to prepare the string representation of request parameters (specified as an object). If specified as string, it is interpreted as function registered with the [$injector](../../auto/service/%24injector), which means you can create your own serializer by registering it as a [service](../../auto/service/%24provide#service.html). The default serializer is the [$httpParamSerializer](%24httpparamserializer); alternatively, you can use the [$httpParamSerializerJQLike](%24httpparamserializerjqlike)
* **cache** – `{boolean|Object}` – A boolean value or object created with [`$cacheFactory`](%24cachefactory) to enable or disable caching of the HTTP response. See [$http Caching](%24http#caching.html) for more information.
* **timeout** – `{number|Promise}` – timeout in milliseconds, or [promise](%24q) that should abort the request when resolved. A numerical timeout or a promise returned from [$timeout](%24timeout), will set the `xhrStatus` in the [response](%24http#%24http-returns.html) to "timeout", and any other resolved promise will set it to "abort", following standard XMLHttpRequest behavior.
* **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials) for more information.
* **responseType** - `{string}` - see [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
|
### Returns
| | |
| --- | --- |
| `HttpPromise` | A [`Promise`](%24q) that will be resolved (request success) or rejected (request failure) with a response object. The response object has these properties:* **data** – `{string|Object}` – The response body transformed with the transform functions.
* **status** – `{number}` – HTTP status code of the response.
* **headers** – `{function([headerName])}` – Header getter function.
* **config** – `{Object}` – The configuration object that was used to generate the request.
* **statusText** – `{string}` – HTTP status text of the response.
* **xhrStatus** – `{string}` – Status of the XMLHttpRequest (`complete`, `error`, `timeout` or `abort`).
A response status code between 200 and 299 is considered a success status and will result in the success callback being called. Any response status code outside of that range is considered an error status and will result in the error callback being called. Also, status codes less than -1 are normalized to zero. -1 usually means the request was aborted, e.g. using a `config.timeout`. More information about the status might be available in the `xhrStatus` property. Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning that the outcome (success or error) will be determined by the final response status code. |
Methods
-------
* ### get(url, [config]);
Shortcut method to perform `GET` request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``TrustedObject` | Absolute or relative URL of the resource that is being requested; or an object created by a call to `$sce.trustAsResourceUrl(url)`. |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
* ### delete(url, [config]);
Shortcut method to perform `DELETE` request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``TrustedObject` | Absolute or relative URL of the resource that is being requested; or an object created by a call to `$sce.trustAsResourceUrl(url)`. |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
* ### head(url, [config]);
Shortcut method to perform `HEAD` request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``TrustedObject` | Absolute or relative URL of the resource that is being requested; or an object created by a call to `$sce.trustAsResourceUrl(url)`. |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
* ### jsonp(url, [config]);
Shortcut method to perform `JSONP` request.
Note that, since JSONP requests are sensitive because the response is given full access to the browser, the url must be declared, via [`$sce`](%24sce) as a trusted resource URL. You can trust a URL by adding it to the trusted resource URL list via [`$sceDelegateProvider.trustedResourceUrlList`](../provider/%24scedelegateprovider#trustedResourceUrlList.html) or by explicitly trusting the URL via [`$sce.trustAsResourceUrl(url)`](%24sce#trustAsResourceUrl.html).
You should avoid generating the URL for the JSONP request from user provided data. Provide additional query parameters via `params` property of the `config` parameter, rather than modifying the URL itself.
JSONP requests must specify a callback to be used in the response from the server. This callback is passed as a query parameter in the request. You must specify the name of this parameter by setting the `jsonpCallbackParam` property on the request config object.
```
$http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'})
```
You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`. Initially this is set to `'callback'`.
You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback parameter value should go. If you would like to customise where and how the callbacks are stored then try overriding or decorating the [`$jsonpCallbacks`](%24jsonpcallbacks) service.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``TrustedObject` | Absolute or relative URL of the resource that is being requested; or an object created by a call to `$sce.trustAsResourceUrl(url)`. |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
* ### post(url, data, [config]);
Shortcut method to perform `POST` request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string` | Relative or absolute URL specifying the destination of the request |
| data | `*` | Request content |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
* ### put(url, data, [config]);
Shortcut method to perform `PUT` request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string` | Relative or absolute URL specifying the destination of the request |
| data | `*` | Request content |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
* ### patch(url, data, [config]);
Shortcut method to perform `PATCH` request.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string` | Relative or absolute URL specifying the destination of the request |
| data | `*` | Request content |
| config *(optional)* | `Object` | Optional configuration object. See [`$http()` arguments](%24http#%24http-arguments.html). |
#### Returns
| | |
| --- | --- |
| `HttpPromise` | A Promise that will be resolved or rejected with a response object. See [`$http()` return value](%24http#%24http-returns.html). |
Properties
----------
* ### pendingRequests
| | |
| --- | --- |
| `Array.<Object>` | Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. |
* ### defaults
| | |
| --- | --- |
| | Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of default headers, withCredentials as well as request and response transformations. See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. |
Example
-------
| programming_docs |
angularjs
Improve this Doc View Source $templateCache
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/cacheFactory.js?message=docs(%24templateCache)%3A%20describe%20your%20change...#L357) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/cacheFactory.js#L357) $templateCache
==============================================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
`$templateCache` is a [Cache object](../type/%24cachefactory.cache) created by the [$cacheFactory](%24cachefactory).
The first time a template is used, it is loaded in the template cache for quick retrieval. You can load templates directly into the cache in a `script` tag, by using [`$templateRequest`](%24templaterequest), or by consuming the `$templateCache` service directly.
Adding via the `script` tag:
```
<script type="text/ng-template" id="templateId.html">
<p>This is the content of the template</p>
</script>
```
**Note:** the `script` tag containing the template does not need to be included in the `head` of the document, but it must be a descendent of the [$rootElement](%24rootelement) (e.g. element with [`ngApp`](../directive/ngapp) attribute), otherwise the template will be ignored.
Adding via the `$templateCache` service:
```
var myApp = angular.module('myApp', []);
myApp.run(function($templateCache) {
$templateCache.put('templateId.html', 'This is the content of the template');
});
```
To retrieve the template later, simply use it in your component:
```
myApp.component('myComponent', {
templateUrl: 'templateId.html'
});
```
or get it via the `$templateCache` service:
```
$templateCache.get('templateId.html')
```
angularjs
Improve this Doc View Source $timeout
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ng/timeout.js?message=docs(%24timeout)%3A%20describe%20your%20change...#L13) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ng/timeout.js#L13) $timeout
======================================================================================================================================================================================================================================================
1. service in module [ng](https://code.angularjs.org/1.8.2/docs/api/ng)
Overview
--------
AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch block and delegates any exceptions to [$exceptionHandler](%24exceptionhandler) service.
The return value of calling `$timeout` is a promise, which will be resolved when the delay has passed and the timeout function, if provided, is executed.
To cancel a timeout request, call `$timeout.cancel(promise)`.
In tests you can use [`$timeout.flush()`](../../ngmock/service/%24timeout) to synchronously flush the queue of deferred functions.
If you only want a promise that will be resolved after some specified delay then you can call `$timeout` without the `fn` function.
Usage
-----
`$timeout([fn], [delay], [invokeApply], [Pass]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| fn *(optional)* | `function()=` | A function, whose execution should be delayed. |
| delay *(optional)* | `number` | Delay in milliseconds. *(default: 0)* |
| invokeApply *(optional)* | `boolean` | If set to `false` skips model dirty checking, otherwise will invoke `fn` within the [$apply](../type/%24rootscope.scope#%24apply.html) block. *(default: true)* |
| Pass *(optional)* | `*` | additional parameters to the executed function. |
### Returns
| | |
| --- | --- |
| `Promise` | Promise that will be resolved when the timeout is reached. The promise will be resolved with the return value of the `fn` function. |
Methods
-------
* ### cancel([promise]);
Cancels a task associated with the `promise`. As a result of this, the promise will be resolved with a rejection.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| promise *(optional)* | `Promise` | Promise returned by the `$timeout` function. |
#### Returns
| | |
| --- | --- |
| `boolean` | Returns `true` if the task hasn't executed yet and was successfully canceled. |
angularjs Provider components in ngCookies Provider components in ngCookies
================================
| Name | Description |
| --- | --- |
| [$cookiesProvider](provider/%24cookiesprovider) | Use `$cookiesProvider` to change the default behavior of the [$cookies](service/%24cookies) service. |
angularjs Service components in ngCookies Service components in ngCookies
===============================
| Name | Description |
| --- | --- |
| [$cookies](service/%24cookies) | Provides read/write access to browser's cookies. |
angularjs
Improve this Doc View Source $cookiesProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngCookies/cookies.js?message=docs(%24cookiesProvider)%3A%20describe%20your%20change...#L16) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngCookies/cookies.js#L16) $cookiesProvider
====================================================================================================================================================================================================================================================================================
1. [$cookies](../service/%24cookies)
2. provider in module [ngCookies](../../ngcookies)
Overview
--------
Use `$cookiesProvider` to change the default behavior of the [$cookies](../service/%24cookies) service.
Properties
----------
* ### defaults
| | |
| --- | --- |
| | Object containing default options to pass when setting cookies. The object may have following properties:
+ **path** - `{string}` - The cookie will be available only for this path and its sub-paths. By default, this is the URL that appears in your `<base>` tag.
+ **domain** - `{string}` - The cookie will be available only for this domain and its sub-domains. For security reasons the user agent will not accept the cookie if the current domain is not a sub-domain of this domain or equal to it.
+ **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object indicating the exact date/time this cookie will expire.
+ **secure** - `{boolean}` - If `true`, then the cookie will only be available through a secured connection.
+ **samesite** - `{string}` - prevents the browser from sending the cookie along with cross-site requests. Accepts the values `lax` and `strict`. See the [OWASP Wiki](https://www.owasp.org/index.php/SameSite) for more info. Note that as of May 2018, not all browsers support `SameSite`, so it cannot be used as a single measure against Cross-Site-Request-Forgery (CSRF) attacks.Note: By default, the address that appears in your `<base>` tag will be used as the path. This is important so that cookies will be visible for all routes when html5mode is enabled. |
angularjs
Improve this Doc View Source $cookies
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngCookies/cookies.js?message=docs(%24cookies)%3A%20describe%20your%20change...#L66) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngCookies/cookies.js#L66) $cookies
====================================================================================================================================================================================================================================================================
1. [$cookiesProvider](../provider/%24cookiesprovider)
2. service in module [ngCookies](../../ngcookies)
Overview
--------
Provides read/write access to browser's cookies.
Up until AngularJS 1.3, `$cookies` exposed properties that represented the current browser cookie values. In version 1.4, this behavior has changed, and `$cookies` now provides a standard api of getters, setters etc. Requires the [`ngCookies`](../../ngcookies) module to be installed.
Methods
-------
* ### get(key);
Returns the value of given cookie key
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | Id to use for lookup. |
#### Returns
| | |
| --- | --- |
| `string` | Raw cookie value. |
* ### getObject(key);
Returns the deserialized value of given cookie key
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | Id to use for lookup. |
#### Returns
| | |
| --- | --- |
| `Object` | Deserialized cookie value. |
* ### getAll();
Returns a key value object with all the cookies
#### Returns
| | |
| --- | --- |
| `Object` | All cookies |
* ### put(key, value, [options]);
Sets a value for given cookie key
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | Id for the `value`. |
| value | `string` | Raw value to be stored. |
| options *(optional)* | `Object` | Options object. See [$cookiesProvider.defaults](../provider/%24cookiesprovider#defaults.html) |
* ### putObject(key, value, [options]);
Serializes and sets a value for given cookie key
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | Id for the `value`. |
| value | `Object` | Value to be stored. |
| options *(optional)* | `Object` | Options object. See [$cookiesProvider.defaults](../provider/%24cookiesprovider#defaults.html) |
* ### remove(key, [options]);
Remove given cookie
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| key | `string` | Id of the key-value pair to delete. |
| options *(optional)* | `Object` | Options object. See [$cookiesProvider.defaults](../provider/%24cookiesprovider#defaults.html) |
Example
-------
```
angular.module('cookiesExample', ['ngCookies'])
.controller('ExampleController', ['$cookies', function($cookies) {
// Retrieving a cookie
var favoriteCookie = $cookies.get('myFavorite');
// Setting a cookie
$cookies.put('myFavorite', 'oatmeal');
}]);
```
angularjs Provider components in ngSanitize Provider components in ngSanitize
=================================
| Name | Description |
| --- | --- |
| [$sanitizeProvider](provider/%24sanitizeprovider) | Creates and configures [`$sanitize`](service/%24sanitize) instance. |
angularjs Service components in ngSanitize Service components in ngSanitize
================================
| Name | Description |
| --- | --- |
| [$sanitize](service/%24sanitize) | Sanitizes an html string by stripping all potentially dangerous tokens. |
angularjs Filter components in ngSanitize Filter components in ngSanitize
===============================
| Name | Description |
| --- | --- |
| [linky](filter/linky) | Finds links in text input and turns them into html links. Supports `http/https/ftp/sftp/mailto` and plain email address links. |
angularjs
Improve this Doc View Source $sanitizeProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngSanitize/sanitize.js?message=docs(%24sanitizeProvider)%3A%20describe%20your%20change...#L139) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngSanitize/sanitize.js#L139) $sanitizeProvider
============================================================================================================================================================================================================================================================================================
1. [$sanitize](../service/%24sanitize)
2. provider in module [ngSanitize](../../ngsanitize)
Overview
--------
Creates and configures [`$sanitize`](../service/%24sanitize) instance.
Methods
-------
* ### enableSvg([flag]);
Enables a subset of svg to be supported by the sanitizer.
By enabling this setting without taking other precautions, you might expose your application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned outside of the containing element and be rendered over other elements on the page (e.g. a login link). Such behavior can then result in phishing incidents.
To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg tags within the sanitized content:
```
.rootOfTheIncludedContent svg {
overflow: hidden !important;
}
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| flag *(optional)* | `boolean` | Enable or disable SVG support in the sanitizer. |
#### Returns
| | |
| --- | --- |
| `boolean``$sanitizeProvider` | Returns the currently configured value if called without an argument or self for chaining otherwise. |
* ### addValidElements(elements);
Extends the built-in lists of valid HTML/SVG elements, i.e. elements that are considered safe and are not stripped off during sanitization. You can extend the following lists of elements:
+ `htmlElements`: A list of elements (tag names) to extend the current list of safe HTML elements. HTML elements considered safe will not be removed during sanitization. All other elements will be stripped off.
+ `htmlVoidElements`: This is similar to `htmlElements`, but marks the elements as "void elements" (similar to HTML [void elements](https://rawgit.com/w3c/html/html5.1-2/single-page.html#void-elements)). These elements have no end tag and cannot have content.
+ `svgElements`: This is similar to `htmlElements`, but for SVG elements. This list is only taken into account if SVG is [enabled](%24sanitizeprovider#enableSvg.html) for `$sanitize`. This method must be called during the [config](../../ng/type/angular.module#config.html) phase. Once the `$sanitize` service has been instantiated, this method has no effect. Keep in mind that extending the built-in lists of elements may expose your app to XSS or other vulnerabilities. Be very mindful of the elements you add.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| elements | `Array.<String>``Object` | A list of valid HTML elements or an object with one or more of the following properties:
+ **htmlElements** - `{Array<String>}` - A list of elements to extend the current list of HTML elements.
+ **htmlVoidElements** - `{Array<String>}` - A list of elements to extend the current list of void HTML elements; i.e. elements that do not have an end tag.
+ **svgElements** - `{Array<String>}` - A list of elements to extend the current list of SVG elements. The list of SVG elements is only taken into account if SVG is [enabled](%24sanitizeprovider#enableSvg.html) for `$sanitize`.Passing an array (`[...]`) is equivalent to passing `{htmlElements: [...]}`. |
#### Returns
| | |
| --- | --- |
| `$sanitizeProvider` | Returns self for chaining. |
* ### addValidAttrs(attrs);
Extends the built-in list of valid attributes, i.e. attributes that are considered safe and are not stripped off during sanitization.
**Note**: The new attributes will not be treated as URI attributes, which means their values will not be sanitized as URIs using `$compileProvider`'s [aHrefSanitizationTrustedUrlList](../../ng/provider/%24compileprovider#aHrefSanitizationTrustedUrlList.html) and [imgSrcSanitizationTrustedUrlList](../../ng/provider/%24compileprovider#imgSrcSanitizationTrustedUrlList.html).
This method must be called during the [config](../../ng/type/angular.module#config.html) phase. Once the `$sanitize` service has been instantiated, this method has no effect. Keep in mind that extending the built-in list of attributes may expose your app to XSS or other vulnerabilities. Be very mindful of the attributes you add.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| attrs | `Array<String>` | A list of valid attributes. |
#### Returns
| | |
| --- | --- |
| `$sanitizeProvider` | Returns self for chaining. |
angularjs
Improve this Doc View Source linky
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngSanitize/filter/linky.js?message=docs(linky)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngSanitize/filter/linky.js#L3) linky
======================================================================================================================================================================================================================================================================
1. filter in module [ngSanitize](../../ngsanitize)
Overview
--------
Finds links in text input and turns them into html links. Supports `http/https/ftp/sftp/mailto` and plain email address links.
Requires the [`ngSanitize`](../../ngsanitize) module to be installed.
Usage
-----
### In HTML Template Binding
`<span ng-bind-html="linky_expression | linky"></span>` ### In JavaScript
```
$filter('linky')(text, target, attributes)
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| text | `string` | Input text. |
| target *(optional)* | `string` | Window (`_blank|_self|_parent|_top`) or named frame to open links in. |
| attributes *(optional)* | `object``function(url)` | Add custom attributes to the link element. Can be one of:* `object`: A map of attributes
* `function`: Takes the url as a parameter and returns a map of attributes If the map of attributes contains a value for `target`, it overrides the value of the target parameter.
|
### Returns
| | |
| --- | --- |
| `string` | Html-linkified and [sanitized](../service/%24sanitize) text. |
Example
-------
angularjs
Improve this Doc View Source $sanitize
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngSanitize/sanitize.js?message=docs(%24sanitize)%3A%20describe%20your%20change...#L36) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngSanitize/sanitize.js#L36) $sanitize
==========================================================================================================================================================================================================================================================================
1. [$sanitizeProvider](../provider/%24sanitizeprovider)
2. service in module [ngSanitize](../../ngsanitize)
Overview
--------
Sanitizes an html string by stripping all potentially dangerous tokens.
The input is sanitized by parsing the HTML into tokens. All safe tokens (from a trusted URI list) are then serialized back to a properly escaped HTML string. This means that no unsafe input can make it into the returned string.
The trusted URIs for URL sanitization of attribute values is configured using the functions `aHrefSanitizationTrustedUrlList` and `imgSrcSanitizationTrustedUrlList` of [`$compileProvider`](../../ng/provider/%24compileprovider).
The input may also contain SVG markup if this is enabled via [`$sanitizeProvider`](../provider/%24sanitizeprovider).
Usage
-----
`$sanitize(html);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| html | `string` | HTML input. |
### Returns
| | |
| --- | --- |
| `string` | Sanitized HTML. |
Example
-------
angularjs Service components in auto Service components in auto
==========================
| Name | Description |
| --- | --- |
| [$injector](service/%24injector) | `$injector` is used to retrieve object instances as defined by [provider](service/%24provide), instantiate types, invoke methods, and load modules. |
| [$provide](service/%24provide) | The [$provide](service/%24provide) service has a number of methods for registering components with the [$injector](service/%24injector). Many of these functions are also exposed on [`angular.Module`](../ng/type/angular.module). |
| programming_docs |
angularjs
Improve this Doc View Source $injector
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/auto/injector.js?message=docs(%24injector)%3A%20describe%20your%20change...#L130) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/auto/injector.js#L130) $injector
================================================================================================================================================================================================================================================================
1. service in module [auto](../../auto)
Overview
--------
`$injector` is used to retrieve object instances as defined by [provider](%24provide), instantiate types, invoke methods, and load modules.
The following always holds true:
```
var $injector = angular.injector();
expect($injector.get('$injector')).toBe($injector);
expect($injector.invoke(function($injector) {
return $injector;
})).toBe($injector);
```
Injection Function Annotation
-----------------------------
JavaScript does not have annotations, and annotations are needed for dependency injection. The following are all valid ways of annotating function with injection arguments and are equivalent.
```
// inferred (only works if code not minified/obfuscated)
$injector.invoke(function(serviceA){});
// annotated
function explicit(serviceA) {};
explicit.$inject = ['serviceA'];
$injector.invoke(explicit);
// inline
$injector.invoke(['serviceA', function(serviceA){}]);
```
### Inference
In JavaScript calling `toString()` on a function returns the function definition. The definition can then be parsed and the function arguments can be extracted. This method of discovering annotations is disallowed when the injector is in strict mode. *NOTE:* This does not work with minification, and obfuscation tools since these tools change the argument names.
### $inject Annotation
By adding an `$inject` property onto a function the injection parameters can be specified.
### Inline
As an array of injection names, where the last item in the array is the function to call.
Methods
-------
* ### get(name, [caller]);
Return an instance of the service.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the instance to retrieve. |
| caller *(optional)* | `string` | An optional string to provide the origin of the function call for error messages. |
#### Returns
| | |
| --- | --- |
| `*` | The instance. |
* ### invoke(fn, [self], [locals]);
Invoke the method and supply the method arguments from the `$injector`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| fn | `function()``Array.<(string|function())>` | The injectable function to invoke. Function parameters are injected according to the [$inject Annotation](../../../guide/di) rules. |
| self *(optional)* | `Object` | The `this` for the invoked method. |
| locals *(optional)* | `Object` | Optional object. If preset then any argument names are read from this object first, before the `$injector` is consulted. |
#### Returns
| | |
| --- | --- |
| `*` | the value returned by the invoked `fn` function. |
* ### has(name);
Allows the user to query if the particular service exists.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | Name of the service to query. |
#### Returns
| | |
| --- | --- |
| `boolean` | `true` if injector has given service. |
* ### instantiate(Type, [locals]);
Create a new instance of JS type. The method takes a constructor function, invokes the new operator, and supplies all of the arguments to the constructor function as specified by the constructor annotation.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| Type | `Function` | Annotated constructor function. |
| locals *(optional)* | `Object` | Optional object. If preset then any argument names are read from this object first, before the `$injector` is consulted. |
#### Returns
| | |
| --- | --- |
| `Object` | new instance of `Type`. |
* ### annotate(fn, [strictDi]);
Returns an array of service names which the function is requesting for injection. This API is used by the injector to determine which services need to be injected into the function when the function is invoked. There are three ways in which the function can be annotated with the needed dependencies.
#### Argument names
The simplest form is to extract the dependencies from the arguments of the function. This is done by converting the function into a string using `toString()` method and extracting the argument names.
```
// Given
function MyController($scope, $route) {
// ...
}
// Then
expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
```
You can disallow this method by using strict injection mode.
This method does not work with code minification / obfuscation. For this reason the following annotation strategies are supported.
#### The $inject property
If a function has an `$inject` property and its value is an array of strings, then the strings represent names of services to be injected into the function.
```
// Given
var MyController = function(obfuscatedScope, obfuscatedRoute) {
// ...
}
// Define function dependencies
MyController['$inject'] = ['$scope', '$route'];
// Then
expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
```
#### The array notation
It is often desirable to inline Injected functions and that's when setting the `$inject` property is very inconvenient. In these situations using the array notation to specify the dependencies in a way that survives minification is a better choice:
```
// We wish to write this (not minification / obfuscation safe)
injector.invoke(function($compile, $rootScope) {
// ...
});
// We are forced to write break inlining
var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
// ...
};
tmpFn.$inject = ['$compile', '$rootScope'];
injector.invoke(tmpFn);
// To better support inline function the inline annotation is supported
injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
// ...
}]);
// Therefore
expect(injector.annotate(
['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
).toEqual(['$compile', '$rootScope']);
```
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| fn | `function()``Array.<(string|function())>` | Function for which dependent service names need to be retrieved as described above. |
| strictDi *(optional)* | `boolean` | Disallow argument name annotation inference. *(default: false)* |
#### Returns
| | |
| --- | --- |
| `Array.<string>` | The names of the services which the function requires. |
* ### loadNewModules([mods]);
**This is a dangerous API, which you use at your own risk!**
Add the specified modules to the current injector.
This method will add each of the injectables to the injector and execute all of the config and run blocks for each module passed to the method.
If a module has already been loaded into the injector then it will not be loaded again.
+ The application developer is responsible for loading the code containing the modules; and for ensuring that lazy scripts are not downloaded and executed more often that desired.
+ Previously compiled HTML will not be affected by newly loaded directives, filters and components.
+ Modules cannot be unloaded. You can use [`$injector.modules`](%24injector#modules.html) to check whether a module has been loaded into the injector, which may indicate whether the script has been executed already.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| mods *(optional)* | `Array<String|Function|Array>=` | an array of modules to load into the application. Each item in the array should be the name of a predefined module or a (DI annotated) function that will be invoked by the injector as a `config` block. See: [modules](../../ng/function/angular.module) |
#### Example
Here is an example of loading a bundle of modules, with a utility method called `getScript`:
```
app.factory('loadModule', function($injector) {
return function loadModule(moduleName, bundleUrl) {
return getScript(bundleUrl).then(function() { $injector.loadNewModules([moduleName]); });
};
})
```
Properties
----------
* ### modules
| | |
| --- | --- |
| | A hash containing all the modules that have been loaded into the $injector. You can use this property to find out information about a module via the [`myModule.info(...)`](../../ng/type/angular.module#info.html) method. For example:
```
var info = $injector.modules['ngAnimate'].info();
```
**Do not use this property to attempt to modify the modules after the application has been bootstrapped.** |
angularjs
Improve this Doc View Source $provide
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/auto/injector.js?message=docs(%24provide)%3A%20describe%20your%20change...#L381) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/auto/injector.js#L381) $provide
==============================================================================================================================================================================================================================================================
1. service in module [auto](../../auto)
Overview
--------
The [$provide](%24provide) service has a number of methods for registering components with the [$injector](%24injector). Many of these functions are also exposed on [`angular.Module`](../../ng/type/angular.module).
An AngularJS **service** is a singleton object created by a **service factory**. These **service factories** are functions which, in turn, are created by a **service provider**. The **service providers** are constructor functions. When instantiated they must contain a property called `$get`, which holds the **service factory** function.
When you request a service, the [$injector](%24injector) is responsible for finding the correct **service provider**, instantiating it and then calling its `$get` **service factory** function to get the instance of the **service**.
Often services have no configuration options and there is no need to add methods to the service provider. The provider will be no more than a constructor function with a `$get` property. For these cases the [$provide](%24provide) service has additional helper methods to register services without specifying a provider.
* [provider(name, provider)](%24provide#provider.html) - registers a **service provider** with the [$injector](%24injector)
* [constant(name, obj)](%24provide#constant.html) - registers a value/object that can be accessed by providers and services.
* [value(name, obj)](%24provide#value.html) - registers a value/object that can only be accessed by services, not providers.
* [factory(name, fn)](%24provide#factory.html) - registers a service **factory function** that will be wrapped in a **service provider** object, whose `$get` property will contain the given factory function.
* [service(name, Fn)](%24provide#service.html) - registers a **constructor function** that will be wrapped in a **service provider** object, whose `$get` property will instantiate a new object using the given constructor function.
* [decorator(name, decorFn)](%24provide#decorator.html) - registers a **decorator function** that will be able to modify or replace the implementation of another service.
See the individual methods for more information and examples.
Methods
-------
* ### provider(name, provider);
Register a **provider function** with the [$injector](%24injector). Provider functions are constructor functions, whose instances are responsible for "providing" a factory for a service.
Service provider names start with the name of the service they provide followed by `Provider`. For example, the [$log](../../ng/service/%24log) service has a provider called [$logProvider](../../ng/provider/%24logprovider).
Service provider objects can have additional methods which allow configuration of the provider and its service. Importantly, you can configure what kind of service is created by the `$get` method, or how that service will act. For example, the [$logProvider](../../ng/provider/%24logprovider) has a method [debugEnabled](../../ng/provider/%24logprovider#debugEnabled.html) which lets you specify whether the [$log](../../ng/service/%24log) service will log debug messages to the console or not.
It is possible to inject other providers into the provider function, but the injected provider must have been defined before the one that requires it.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the instance. NOTE: the provider will be available under `name +
'Provider'` key. |
| provider | `Object``function()` | If the provider is:
+ `Object`: then it should have a `$get` method. The `$get` method will be invoked using [$injector.invoke()](%24injector#invoke.html) when an instance needs to be created.
+ `Constructor`: a new instance of the provider will be created using [$injector.instantiate()](%24injector#instantiate.html), then treated as `object`. |
#### Returns
| | |
| --- | --- |
| `Object` | registered provider instance |
#### Example
The following example shows how to create a simple event tracking service and register it using [$provide.provider()](%24provide#provider.html).
```
// Define the eventTracker provider
function EventTrackerProvider() {
var trackingUrl = '/track';
// A provider method for configuring where the tracked events should been saved
this.setTrackingUrl = function(url) {
trackingUrl = url;
};
// The service factory function
this.$get = ['$http', function($http) {
var trackedEvents = {};
return {
// Call this to track an event
event: function(event) {
var count = trackedEvents[event] || 0;
count += 1;
trackedEvents[event] = count;
return count;
},
// Call this to save the tracked events to the trackingUrl
save: function() {
$http.post(trackingUrl, trackedEvents);
}
};
}];
}
describe('eventTracker', function() {
var postSpy;
beforeEach(module(function($provide) {
// Register the eventTracker provider
$provide.provider('eventTracker', EventTrackerProvider);
}));
beforeEach(module(function(eventTrackerProvider) {
// Configure eventTracker provider
eventTrackerProvider.setTrackingUrl('/custom-track');
}));
it('tracks events', inject(function(eventTracker) {
expect(eventTracker.event('login')).toEqual(1);
expect(eventTracker.event('login')).toEqual(2);
}));
it('saves to the tracking url', inject(function(eventTracker, $http) {
postSpy = spyOn($http, 'post');
eventTracker.event('login');
eventTracker.save();
expect(postSpy).toHaveBeenCalled();
expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
}));
});
```
* ### factory(name, $getFn);
Register a **service factory**, which will be called to return the service instance. This is short for registering a service where its provider consists of only a `$get` property, which is the given service factory function. You should use [$provide.factory(getFn)](%24provide#factory.html) if you do not need to configure your service in a provider.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the instance. |
| $getFn | `function()``Array.<(string|function())>` | The injectable $getFn for the instance creation. Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`. |
#### Returns
| | |
| --- | --- |
| `Object` | registered provider instance |
#### Example
Here is an example of registering a service
```
$provide.factory('ping', ['$http', function($http) {
return function ping() {
return $http.send('/ping');
};
}]);
```
You would then inject and use this service like this:
```
someModule.controller('Ctrl', ['ping', function(ping) {
ping();
}]);
```
* ### service(name, constructor);
Register a **service constructor**, which will be invoked with `new` to create the service instance. This is short for registering a service where its provider's `$get` property is a factory function that returns an instance instantiated by the injector from the service constructor function.
Internally it looks a bit like this:
```
{
$get: function() {
return $injector.instantiate(constructor);
}
}
```
You should use [$provide.service(class)](%24provide#service.html) if you define your service as a type/class.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the instance. |
| constructor | `function()``Array.<(string|function())>` | An injectable class (constructor function) that will be instantiated. |
#### Returns
| | |
| --- | --- |
| `Object` | registered provider instance |
#### Example
Here is an example of registering a service using [$provide.service(class)](%24provide#service.html).
```
var Ping = function($http) {
this.$http = $http;
};
Ping.$inject = ['$http'];
Ping.prototype.send = function() {
return this.$http.get('/ping');
};
$provide.service('ping', Ping);
```
You would then inject and use this service like this:
```
someModule.controller('Ctrl', ['ping', function(ping) {
ping.send();
}]);
```
* ### value(name, value);
Register a **value service** with the [$injector](%24injector), such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's `$get` property is a factory function that takes no arguments and returns the **value service**. That also means it is not possible to inject other services into a value service.
Value services are similar to constant services, except that they cannot be injected into a module configuration function (see [`angular.Module`](../../ng/type/angular.module#config.html)) but they can be overridden by an AngularJS [decorator](%24provide#decorator.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the instance. |
| value | `*` | The value. |
#### Returns
| | |
| --- | --- |
| `Object` | registered provider instance |
#### Example
Here are some examples of creating value services.
```
$provide.value('ADMIN_USER', 'admin');
$provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
$provide.value('halfOf', function(value) {
return value / 2;
});
```
* ### constant(name, value);
Register a **constant service** with the [$injector](%24injector), such as a string, a number, an array, an object or a function. Like the [value](%24provide#value.html), it is not possible to inject other services into a constant.
But unlike [value](%24provide#value.html), a constant can be injected into a module configuration function (see [`angular.Module`](../../ng/type/angular.module#config.html)) and it cannot be overridden by an AngularJS [decorator](%24provide#decorator.html).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the constant. |
| value | `*` | The constant value. |
#### Returns
| | |
| --- | --- |
| `Object` | registered instance |
#### Example
Here a some examples of creating constants:
```
$provide.constant('SHARD_HEIGHT', 306);
$provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
$provide.constant('double', function(value) {
return value * 2;
});
```
* ### decorator(name, decorator);
Register a **decorator function** with the [$injector](%24injector). A decorator function intercepts the creation of a service, allowing it to override or modify the behavior of the service. The return value of the decorator function may be the original service, or a new service that replaces (or wraps and delegates to) the original service.
You can find out more about using decorators in the [decorators](../../../guide/decorators) guide.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| name | `string` | The name of the service to decorate. |
| decorator | `function()``Array.<(string|function())>` | This function will be invoked when the service needs to be provided and should return the decorated service instance. The function is called using the [injector.invoke](%24injector#invoke.html) method and is therefore fully injectable. Local injection arguments:
+ `$delegate` - The original service instance, which can be replaced, monkey patched, configured, decorated or delegated to. |
#### Example
Here we decorate the [$log](../../ng/service/%24log) service to convert warnings to errors by intercepting calls to [$log.warn()](../../ng/service/%24log#error.html).
```
$provide.decorator('$log', ['$delegate', function($delegate) {
$delegate.warn = $delegate.error;
return $delegate;
}]);
```
| programming_docs |
angularjs Type components in ngComponentRouter Type components in ngComponentRouter
====================================
| Name | Description |
| --- | --- |
| [Router](type/router) | A `Router` is responsible for mapping URLs to components. |
| [ChildRouter](type/childrouter) | This type extends the [`Router`](type/router). |
| [RootRouter](type/rootrouter) | This type extends the [`Router`](type/router). |
| [ComponentInstruction](type/componentinstruction) | A `ComponentInstruction` represents the route state for a single component. An `Instruction` is composed of a tree of these `ComponentInstruction`s. |
| [RouteDefinition](type/routedefinition) | Each item in the **RouteConfig** for a **Routing Component** is an instance of this type. It can have the following properties: |
| [RouteParams](type/routeparams) | A map of parameters for a given route, passed as part of the [`ComponentInstruction`](type/componentinstruction) to the Lifecycle Hooks, such as `$routerOnActivate` and `$routerOnDeactivate`. |
angularjs Directive components in ngComponentRouter Directive components in ngComponentRouter
=========================================
| Name | Description |
| --- | --- |
| [ngOutlet](directive/ngoutlet) | The directive that identifies where the [`Router`](type/router) should render its **Components**. |
angularjs Service components in ngComponentRouter Service components in ngComponentRouter
=======================================
| Name | Description |
| --- | --- |
| [$rootRouter](service/%24rootrouter) | The singleton instance of the [`RootRouter`](type/rootrouter) type, which is associated with the top level [`$routerRootComponent`](service/%24routerrootcomponent). |
| [$routerRootComponent](service/%24routerrootcomponent) | The top level **Routing Component** associated with the [`$rootRouter`](service/%24rootrouter). |
angularjs
Improve this Doc View Source ngOutlet
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(ngOutlet)%3A%20describe%20your%20change...#L153) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L153) ngOutlet
==================================================================================================================================================================================================================================================================================
1. directive in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
The directive that identifies where the [`Router`](../type/router) should render its **Components**.
Directive Info
--------------
* This directive executes at priority level 400 restrict: AE.
Usage
-----
* as element:
```
<ng-outlet>
...
</ng-outlet>
```
* as attribute:
```
<ANY
ng-outlet>
...
</ANY>
```
angularjs
Improve this Doc View Source RouteDefinition
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(RouteDefinition)%3A%20describe%20your%20change...#L118) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L118) RouteDefinition
================================================================================================================================================================================================================================================================================================
1. type in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
Each item in the **RouteConfig** for a **Routing Component** is an instance of this type. It can have the following properties:
* `path` or (`regex` and `serializer`) - defines how to recognize and generate this route
* `component`, `loader`, `redirectTo` (requires exactly one of these)
* `name` - the name used to identify the **Route Definition** when generating links
* `data` (optional)
angularjs
Improve this Doc View Source Router
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(Router)%3A%20describe%20your%20change...#L42) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L42) Router
============================================================================================================================================================================================================================================================================
1. type in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
A `Router` is responsible for mapping URLs to components.
* Routers and "Routing Component" instances have a 1:1 correspondence.
* The Router holds reference to one or more of Outlets.
* There are two kinds of Router: [`RootRouter`](rootrouter) and [`ChildRouter`](childrouter).
You can see the state of a router by inspecting the read-only field `router.navigating`. This may be useful for showing a spinner, for instance.
angularjs
Improve this Doc View Source ComponentInstruction
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(ComponentInstruction)%3A%20describe%20your%20change...#L98) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L98) ComponentInstruction
========================================================================================================================================================================================================================================================================================================
1. type in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
A `ComponentInstruction` represents the route state for a single component. An `Instruction` is composed of a tree of these `ComponentInstruction`s.
`ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed to route lifecycle hooks, like `$routerCanActivate`.
You should not modify this object. It should be treated as immutable.
angularjs
Improve this Doc View Source RouteParams
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(RouteParams)%3A%20describe%20your%20change...#L138) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L138) RouteParams
========================================================================================================================================================================================================================================================================================
1. type in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
A map of parameters for a given route, passed as part of the [`ComponentInstruction`](componentinstruction) to the Lifecycle Hooks, such as `$routerOnActivate` and `$routerOnDeactivate`.
angularjs
Improve this Doc View Source RootRouter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(RootRouter)%3A%20describe%20your%20change...#L80) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L80) RootRouter
====================================================================================================================================================================================================================================================================================
1. type in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
This type extends the [`Router`](router).
There is only one instance of this type in a Component Router application injectable as the [`$rootRouter`](../service/%24rootrouter) service. This **Router** is associate with the **Top Level Component** ([`$routerRootComponent`](../service/%24routerrootcomponent)). It acts as the connection between the **Routers** and the **Location**.
angularjs
Improve this Doc View Source ChildRouter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(ChildRouter)%3A%20describe%20your%20change...#L62) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L62) ChildRouter
======================================================================================================================================================================================================================================================================================
1. type in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
This type extends the [`Router`](router).
Apart from the **Top Level Component** ([`$routerRootComponent`](../service/%24routerrootcomponent)) which is associated with the [`$rootRouter`](../service/%24rootrouter), every **Routing Component** is associated with a `ChildRouter`, which manages the routing for that **Routing Component**.
angularjs
Improve this Doc View Source $routerRootComponent
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(%24routerRootComponent)%3A%20describe%20your%20change...#L206) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L206) $routerRootComponent
============================================================================================================================================================================================================================================================================================================
1. service in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
The top level **Routing Component** associated with the [`$rootRouter`](%24rootrouter).
angularjs
Improve this Doc View Source $rootRouter
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngComponentRouter/Router.js?message=docs(%24rootRouter)%3A%20describe%20your%20change...#L190) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngComponentRouter/Router.js#L190) $rootRouter
==========================================================================================================================================================================================================================================================================================
1. service in module [ngComponentRouter](../../ngcomponentrouter)
**Deprecated:** In an effort to keep synchronized with router changes in the new Angular, this implementation of the Component Router (ngComponentRouter module) has been deprecated and will not receive further updates. We are investigating backporting the Router for the new Angular to AngularJS, but alternatively, use the [`ngRoute`](../../ngroute) module or community developed projects (e.g. [ui-router](https://github.com/angular-ui/ui-router)).
Overview
--------
The singleton instance of the [`RootRouter`](../type/rootrouter) type, which is associated with the top level [`$routerRootComponent`](%24routerrootcomponent).
angularjs Service components in ngMockE2E Service components in ngMockE2E
===============================
| Name | Description |
| --- | --- |
| [$httpBackend](service/%24httpbackend) | Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of applications that use the [$http service](../ng/service/%24http). |
angularjs
Improve this Doc View Source $httpBackend
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24httpBackend)%3A%20describe%20your%20change...#L2635) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L2635) $httpBackend
======================================================================================================================================================================================================================================================================================
1. service in module [ngMockE2E](../../ngmocke2e)
Overview
--------
Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of applications that use the [$http service](../../ng/service/%24http).
**Note**: For fake http backend implementation suitable for unit testing please see [unit-testing $httpBackend mock](../../ngmock/service/%24httpbackend). This implementation can be used to respond with static or dynamic responses via the `when` api and its shortcuts (`whenGET`, `whenPOST`, etc) and optionally pass through requests to the real $httpBackend for specific requests (e.g. to interact with certain remote apis or to fetch templates from a webserver).
As opposed to unit-testing, in an end-to-end testing scenario or in scenario when an application is being developed with the real backend api replaced with a mock, it is often desirable for certain category of requests to bypass the mock and issue a real http request (e.g. to fetch templates or static files from the webserver). To configure the backend with this behavior use the `passThrough` request handler of `when` instead of `respond`.
Additionally, we don't want to manually have to flush mocked out requests like we do during unit testing. For this reason the e2e $httpBackend flushes mocked out requests automatically, closely simulating the behavior of the XMLHttpRequest object.
To setup the application to run with this http backend, you have to create a module that depends on the `ngMockE2E` and your application modules and defines the fake backend:
```
var myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']);
myAppDev.run(function($httpBackend) {
var phones = [{name: 'phone1'}, {name: 'phone2'}];
// returns the current list of phones
$httpBackend.whenGET('/phones').respond(phones);
// adds a new phone to the phones array
$httpBackend.whenPOST('/phones').respond(function(method, url, data) {
var phone = angular.fromJson(data);
phones.push(phone);
return [200, phone, {}];
});
$httpBackend.whenGET(/^\/templates\//).passThrough(); // Requests for templates are handled by the real server
//...
});
```
Afterwards, bootstrap your app with this new module.
Methods
-------
* ### when(method, url, [data], [headers], [keys]);
Creates a new backend definition.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method. |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled.
+ respond –
```
{ function([status,] data[, headers, statusText])
| function(function(method, url, data, headers, params)}
```
– The respond method takes a set of static data to be returned or a function that can return an array containing response status (number), response data (Array|Object|string), response headers (Object), and the text for the status (string).
+ passThrough – `{function()}` – Any request matching a backend definition with `passThrough` handler will be passed through to the real backend (an XHR request will be made to the server.)
+ Both methods return the `requestHandler` object for possible overrides. |
* ### whenGET(url, [headers], [keys]);
Creates a new backend definition for GET requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenHEAD(url, [headers], [keys]);
Creates a new backend definition for HEAD requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenDELETE(url, [headers], [keys]);
Creates a new backend definition for DELETE requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenPOST(url, [data], [headers], [keys]);
Creates a new backend definition for POST requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenPUT(url, [data], [headers], [keys]);
Creates a new backend definition for PUT requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenPATCH(url, [data], [headers], [keys]);
Creates a new backend definition for PATCH requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenJSONP(url, [keys]);
Creates a new backend definition for JSONP requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described on [$httpBackend mock](../../ngmock/service/%24httpbackend). |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### whenRoute(method, url);
Creates a new backend definition that compares only with the requested route.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method. |
| url | `string` | HTTP url string that supports colon param matching. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` and `passThrough` methods that control how a matched request is handled. You can save this object for later use and invoke `respond` or `passThrough` again in order to change how a matched request is handled. |
* ### matchLatestDefinitionEnabled([value]);
This method can be used to change which mocked responses `$httpBackend` returns, when defining them with [$httpBackend.when()](../../ngmock/service/%24httpbackend#when.html) (and shortcut methods). By default, `$httpBackend` returns the first definition that matches. When setting `$http.matchLatestDefinitionEnabled(true)`, it will use the last response that matches, i.e. the one that was added last.
```
hb.when('GET', '/url1').respond(200, 'content', {});
hb.when('GET', '/url1').respond(201, 'another', {});
hb('GET', '/url1'); // receives "content"
$http.matchLatestDefinitionEnabled(true)
hb('GET', '/url1'); // receives "another"
hb.when('GET', '/url1').respond(201, 'onemore', {});
hb('GET', '/url1'); // receives "onemore"
```
This is useful if a you have a default response that is overriden inside specific tests.
Note that different from config methods on providers, `matchLatestDefinitionEnabled()` can be changed even when the application is already running.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `Boolean` | value to set, either `true` or `false`. Default is `false`. If omitted, it will return the current value. |
#### Returns
| | |
| --- | --- |
| `$httpBackend``Boolean` | self when used as a setter, and the current value when used as a getter |
Example
-------
| programming_docs |
angularjs Provider components in ngRoute Provider components in ngRoute
==============================
| Name | Description |
| --- | --- |
| [$routeProvider](provider/%24routeprovider) | Used for configuring routes. |
angularjs Directive components in ngRoute Directive components in ngRoute
===============================
| Name | Description |
| --- | --- |
| [ngView](directive/ngview) | `ngView` is a directive that complements the [$route](service/%24route) service by including the rendered template of the current route into the main layout (`index.html`) file. Every time the current route changes, the included view changes with it according to the configuration of the `$route` service. |
angularjs Service components in ngRoute Service components in ngRoute
=============================
| Name | Description |
| --- | --- |
| [$route](service/%24route) | `$route` is used for deep-linking URLs to controllers and views (HTML partials). It watches `$location.url()` and tries to map the path to an existing route definition. |
| [$routeParams](service/%24routeparams) | The `$routeParams` service allows you to retrieve the current set of route parameters. |
angularjs
Improve this Doc View Source $routeProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngRoute/route.js?message=docs(%24routeProvider)%3A%20describe%20your%20change...#L37) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngRoute/route.js#L37) $routeProvider
========================================================================================================================================================================================================================================================================
1. [$route](../service/%24route)
2. provider in module [ngRoute](../../ngroute)
Overview
--------
Used for configuring routes.
See [$route](../service/%24route#examples.html) for an example of configuring and using `ngRoute`.
Dependencies
------------
Requires the [`ngRoute`](../../ngroute) module to be installed.
Methods
-------
* ### when(path, route);
Adds a new route definition to the `$route` service.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| path | `string` | Route path (matched against `$location.path`). If `$location.path` contains redundant trailing slash or is missing one, the route will still match and the `$location.path` will be updated to add or drop the trailing slash to exactly match the route definition.
+ `path` can contain named groups starting with a colon: e.g. `:name`. All characters up to the next slash are matched and stored in `$routeParams` under the given `name` when the route matches.
+ `path` can contain named groups starting with a colon and ending with a star: e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name` when the route matches.
+ `path` can contain optional named groups with a question mark: e.g.`:name?`. For example, routes like `/color/:color/largecode/:largecode*\/edit` will match `/color/brown/largecode/code/with/slashes/edit` and extract:
+ `color: brown`
+ `largecode: code/with/slashes`. |
| route | `Object` | Mapping information to be assigned to `$route.current` on route match. Object properties:
+ `controller` – `{(string|Function)=}` – Controller fn that should be associated with newly created scope or the name of a [registered controller](../../ng/type/angular.module#controller.html) if passed as a string.
+ `controllerAs` – `{string=}` – An identifier name for a reference to the controller. If present, the controller will be published to scope under the `controllerAs` name.
+ `template` – `{(string|Function)=}` – html template as a string or a function that returns an html template as a string which should be used by [ngView](../directive/ngview) or [ngInclude](../../ng/directive/nginclude) directives. This property takes precedence over `templateUrl`. If `template` is a function, it will be called with the following parameters:
- `{Array.<Object>}` - route parameters extracted from the current `$location.path()` by applying the current routeOne of `template` or `templateUrl` is required.
+ `templateUrl` – `{(string|Function)=}` – path or function that returns a path to an html template that should be used by [ngView](../directive/ngview). If `templateUrl` is a function, it will be called with the following parameters:
- `{Array.<Object>}` - route parameters extracted from the current `$location.path()` by applying the current routeOne of `templateUrl` or `template` is required.
+ `resolve` - `{Object.<string, Function>=}` - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and [$routeChangeSuccess](../service/%24route#%24routeChangeSuccess.html) event is fired. If any of the promises are rejected the [$routeChangeError](../service/%24route#%24routeChangeError.html) event is fired. For easier access to the resolved dependencies from the template, the `resolve` map will be available on the scope of the route, under `$resolve` (by default) or a custom name specified by the `resolveAs` property (see below). This can be particularly useful, when working with [components](../../ng/type/angular.module#component.html) as route templates.
**Note:** If your scope already contains a property with this name, it will be hidden or overwritten. Make sure, you specify an appropriate name for this property, that does not collide with other properties on the scope. The map object is:
- `key` – `{string}`: a name of a dependency to be injected into the controller.
- `factory` - `{string|Function}`: If `string` then it is an alias for a service. Otherwise if function, then it is [injected](../../auto/service/%24injector#invoke.html) and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that `ngRoute.$routeParams` will still refer to the previous route within these resolve functions. Use `$route.current.params` to access the new route parameters, instead.
+ `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on the scope of the route. If omitted, defaults to `$resolve`.
+ `redirectTo` – `{(string|Function)=}` – value to update [$location](../../ng/service/%24location) path with and trigger route redirection. If `redirectTo` is a function, it will be called with the following parameters:
- `{Object.<string>}` - route parameters extracted from the current `$location.path()` by applying the current route templateUrl.
- `{string}` - current `$location.path()`
- `{Object}` - current `$location.search()`The custom `redirectTo` function is expected to return a string which will be used to update `$location.url()`. If the function throws an error, no further processing will take place and the [$routeChangeError](../service/%24route#%24routeChangeError.html) event will be fired. Routes that specify `redirectTo` will not have their controllers, template functions or resolves called, the `$location` will be changed to the redirect url and route processing will stop. The exception to this is if the `redirectTo` is a function that returns `undefined`. In this case the route transition occurs as though there was no redirection.
+ `resolveRedirectTo` – `{Function=}` – a function that will (eventually) return the value to update [$location](../../ng/service/%24location) URL with and trigger route redirection. In contrast to `redirectTo`, dependencies can be injected into `resolveRedirectTo` and the return value can be either a string or a promise that will be resolved to a string. Similar to `redirectTo`, if the return value is `undefined` (or a promise that gets resolved to `undefined`), no redirection takes place and the route transition occurs as though there was no redirection. If the function throws an error or the returned promise gets rejected, no further processing will take place and the [$routeChangeError](../service/%24route#%24routeChangeError.html) event will be fired. `redirectTo` takes precedence over `resolveRedirectTo`, so specifying both on the same route definition, will cause the latter to be ignored.
+ `[reloadOnUrl=true]` - `{boolean=}` - reload route when any part of the URL changes (including the path) even if the new URL maps to the same route. If the option is set to `false` and the URL in the browser changes, but the new URL maps to the same route, then a `$routeUpdate` event is broadcasted on the root scope (without reloading the route).
+ `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()` or `$location.hash()` changes. If the option is set to `false` and the URL in the browser changes, then a `$routeUpdate` event is broadcasted on the root scope (without reloading the route). **Note:** This option has no effect if `reloadOnUrl` is set to `false`.
+ `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive If the option is set to `true`, then the particular route can be matched without being case sensitive |
#### Returns
| | |
| --- | --- |
| `Object` | self |
* ### otherwise(params);
Sets route definition that will be used on route change when no other route definition is matched.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| params | `Object``string` | Mapping information to be assigned to `$route.current`. If called with a string, the value maps to `redirectTo`. |
#### Returns
| | |
| --- | --- |
| `Object` | self |
* ### eagerInstantiationEnabled([enabled]);
Call this method as a setter to enable/disable eager instantiation of the [$route](../service/%24route) service upon application bootstrap. You can also call it as a getter (i.e. without any arguments) to get the current value of the `eagerInstantiationEnabled` flag.
Instantiating `$route` early is necessary for capturing the initial [$locationChangeStart](../../ng/service/%24location#%24locationChangeStart.html) event and navigating to the appropriate route. Usually, `$route` is instantiated in time by the [ngView](../directive/ngview) directive. Yet, in cases where `ngView` is included in an asynchronously loaded template (e.g. in another directive's template), the directive factory might not be called soon enough for `$route` to be instantiated *before* the initial `$locationChangeSuccess` event is fired. Eager instantiation ensures that `$route` is always instantiated in time, regardless of when `ngView` will be loaded.
The default value is true.
**Note**:
You may want to disable the default behavior when unit-testing modules that depend on `ngRoute`, in order to avoid an unexpected request for the default route's template.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| enabled *(optional)* | `boolean` | If provided, update the internal `eagerInstantiationEnabled` flag. |
#### Returns
| | |
| --- | --- |
| `*` | The current value of the `eagerInstantiationEnabled` flag if used as a getter or itself (for chaining) if used as a setter. |
Properties
----------
* ### caseInsensitiveMatch
| | |
| --- | --- |
| | A boolean property indicating if routes defined using this provider should be matched using a case insensitive algorithm. Defaults to `false`. |
angularjs
Improve this Doc View Source ngView
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngRoute/directive/ngView.js?message=docs(ngView)%3A%20describe%20your%20change...#L7) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngRoute/directive/ngView.js#L7) ngView
==========================================================================================================================================================================================================================================================================
1. directive in module [ngRoute](../../ngroute)
Overview
--------
`ngView` is a directive that complements the [$route](../service/%24route) service by including the rendered template of the current route into the main layout (`index.html`) file. Every time the current route changes, the included view changes with it according to the configuration of the `$route` service.
Requires the [`ngRoute`](../../ngroute) module to be installed.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 400.
Usage
-----
* as element:
```
<ng-view
[onload="string"]
[autoscroll="string"]>
...
</ng-view>
```
* as attribute:
```
<ANY
ng-view
[onload="string"]
[autoscroll="string"]>
...
</ANY>
```
* as CSS class:
```
<ANY class="ng-view [onload: string;] [autoscroll: string;]"> ... </ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| onload *(optional)* | `string` | Expression to evaluate whenever the view updates. |
| autoscroll *(optional)* | `string` | Whether `ngView` should call [$anchorScroll](../../ng/service/%24anchorscroll) to scroll the viewport after the view is updated.
```
- If the attribute is not set, disable scrolling.
- If the attribute is set without value, enable scrolling.
- Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
as an expression yields a truthy value.
```
|
Events
------
* ### $viewContentLoaded
Emitted every time the ngView content is reloaded.
#### Type:
emit #### Target:
the current ngView scope
Animations
----------
| Animation | Occurs |
| --- | --- |
| [enter](../../ng/service/%24animate#enter.html) | when the new element is inserted to the DOM |
| [leave](../../ng/service/%24animate#leave.html) | when the old element is removed from to the DOM |
The enter and leave animation occur concurrently.
[Click here](../../nganimate/service/%24animate) to learn more about the steps involved in the animation. Example
-------
angularjs
Improve this Doc View Source $routeParams
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngRoute/routeParams.js?message=docs(%24routeParams)%3A%20describe%20your%20change...#L6) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngRoute/routeParams.js#L6) $routeParams
==============================================================================================================================================================================================================================================================================
1. service in module [ngRoute](../../ngroute)
Overview
--------
The `$routeParams` service allows you to retrieve the current set of route parameters.
Requires the [`ngRoute`](../../ngroute) module to be installed.
The route parameters are a combination of [`$location`](../../ng/service/%24location)'s [`search()`](../../ng/service/%24location#search.html) and [`path()`](../../ng/service/%24location#path.html). The `path` parameters are extracted when the [`$route`](%24route) path is matched.
In case of parameter name collision, `path` params take precedence over `search` params.
The service guarantees that the identity of the `$routeParams` object will remain unchanged (but its properties will likely change) even when a route change occurs.
Note that the `$routeParams` are only updated *after* a route change completes successfully. This means that you cannot rely on `$routeParams` being correct in route resolve functions. Instead you can use `$route.current.params` to access the new route's parameters.
Dependencies
------------
* [`$route`](%24route)
Example
-------
```
// Given:
// URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
// Route: /Chapter/:chapterId/Section/:sectionId
//
// Then
$routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
```
angularjs
Improve this Doc View Source $route
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngRoute/route.js?message=docs(%24route)%3A%20describe%20your%20change...#L330) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngRoute/route.js#L330) $route
==========================================================================================================================================================================================================================================================
1. [$routeProvider](../provider/%24routeprovider)
2. service in module [ngRoute](../../ngroute)
Overview
--------
`$route` is used for deep-linking URLs to controllers and views (HTML partials). It watches `$location.url()` and tries to map the path to an existing route definition.
Requires the [`ngRoute`](../../ngroute) module to be installed.
You can define routes through [$routeProvider](../provider/%24routeprovider)'s API.
The `$route` service is typically used in conjunction with the [`ngView`](../directive/ngview) directive and the [`$routeParams`](%24routeparams) service.
Dependencies
------------
* [`$location`](../../ng/service/%24location)
* [`$routeParams`](%24routeparams)
Methods
-------
* ### reload();
Causes `$route` service to reload the current route even if [$location](../../ng/service/%24location) hasn't changed.
As a result of that, [ngView](../directive/ngview) creates new scope and reinstantiates the controller.
* ### updateParams(newParams);
Causes `$route` service to update the current URL, replacing current route parameters with those specified in `newParams`. Provided property names that match the route's path segment definitions will be interpolated into the location's path, while remaining properties will be treated as query params.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| newParams | `!Object<string, string>` | mapping of URL parameter names to values |
Events
------
* ### $routeChangeStart
Broadcasted before a route change. At this point the route services starts resolving all of the dependencies needed for the route change to occur. Typically this involves fetching the view template as well as any dependencies defined in `resolve` route property. Once all of the dependencies are resolved `$routeChangeSuccess` is fired.
The route change (and the `$location` change that triggered it) can be prevented by calling `preventDefault` method of the event. See [`$rootScope.Scope`](../../ng/type/%24rootscope.scope#%24on.html) for more details about event object.
#### Type:
broadcast #### Target:
root scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| next | `Route` | Future route information. |
| current | `Route` | Current route information. |
* ### $routeChangeSuccess
Broadcasted after a route change has happened successfully. The `resolve` dependencies are now available in the `current.locals` property.
[ngView](../directive/ngview) listens for the directive to instantiate the controller and render the view.
#### Type:
broadcast #### Target:
root scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object. |
| current | `Route` | Current route information. |
| previous | `Route``Undefined` | Previous route information, or undefined if current is first route entered. |
* ### $routeChangeError
Broadcasted if a redirection function fails or any redirection or resolve promises are rejected.
#### Type:
broadcast #### Target:
root scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object |
| current | `Route` | Current route information. |
| previous | `Route` | Previous route information. |
| rejection | `Route` | The thrown error or the rejection reason of the promise. Usually the rejection reason is the error that caused the promise to get rejected. |
* ### $routeUpdate
Broadcasted if the same instance of a route (including template, controller instance, resolved dependencies, etc.) is being reused. This can happen if either `reloadOnSearch` or `reloadOnUrl` has been set to `false`.
#### Type:
broadcast #### Target:
root scope #### Parameters
| Param | Type | Details |
| --- | --- | --- |
| angularEvent | `Object` | Synthetic event object |
| current | `Route` | Current/previous route information. |
Properties
----------
* ### current
| | |
| --- | --- |
| `Object` | Reference to the current route definition. The route definition contains:
+ `controller`: The controller constructor as defined in the route definition.
+ `locals`: A map of locals which is used by [$controller](../../ng/service/%24controller) service for controller instantiation. The `locals` contain the resolved values of the `resolve` map. Additionally the `locals` also contain:
- `$scope` - The current route scope.
- `$template` - The current route template HTML.The `locals` will be assigned to the route scope's `$resolve` property. You can override the property name, using `resolveAs` in the route definition. See [$routeProvider](../provider/%24routeprovider) for more info. |
* ### routes
| | |
| --- | --- |
| `Object` | Object with all route configuration Objects as its properties. |
Example
-------
This example shows how changing the URL hash causes the `$route` to match a route against the URL, and the `ngView` pulls in the partial.
| programming_docs |
angularjs Directive components in ngTouch Directive components in ngTouch
===============================
| Name | Description |
| --- | --- |
| [ngSwipeLeft](directive/ngswipeleft) | Specify custom behavior when an element is swiped to the left on a touchscreen device. A leftward swipe is a quick, right-to-left slide of the finger. Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag too. |
| [ngSwipeRight](directive/ngswiperight) | Specify custom behavior when an element is swiped to the right on a touchscreen device. A rightward swipe is a quick, left-to-right slide of the finger. Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag too. |
angularjs Service components in ngTouch Service components in ngTouch
=============================
| Name | Description |
| --- | --- |
| [$swipe](service/%24swipe) | The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe behavior, to make implementing swipe-related directives more convenient. |
angularjs
Improve this Doc View Source ngSwipeRight
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngTouch/directive/ngSwipe.js?message=docs(ngSwipeRight)%3A%20describe%20your%20change...#L46) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngTouch/directive/ngSwipe.js#L46) ngSwipeRight
==========================================================================================================================================================================================================================================================================================
1. directive in module [ngTouch](../../ngtouch)
**Deprecated:** (since 1.7.0) See the [module](../../ngtouch) documentation for more information.
Overview
--------
Specify custom behavior when an element is swiped to the right on a touchscreen device. A rightward swipe is a quick, left-to-right slide of the finger. Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag too.
Requires the [`ngTouch`](../../ngtouch) module to be installed.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-swipe-right
ng-swipe-right="expression">
...
</ng-swipe-right>
```
* as attribute:
```
<ANY
ng-swipe-right="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSwipeRight | `expression` | [Expression](../../../guide/expression) to evaluate upon right swipe. (Event object is available as `$event`) |
Example
-------
angularjs
Improve this Doc View Source ngSwipeLeft
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngTouch/directive/ngSwipe.js?message=docs(ngSwipeLeft)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngTouch/directive/ngSwipe.js#L5) ngSwipeLeft
======================================================================================================================================================================================================================================================================================
1. directive in module [ngTouch](../../ngtouch)
**Deprecated:** (since 1.7.0) See the [module](../../ngtouch) documentation for more information.
Overview
--------
Specify custom behavior when an element is swiped to the left on a touchscreen device. A leftward swipe is a quick, right-to-left slide of the finger. Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag too.
To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to the `ng-swipe-left` or `ng-swipe-right` DOM Element.
Requires the [`ngTouch`](../../ngtouch) module to be installed.
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-swipe-left
ng-swipe-left="expression">
...
</ng-swipe-left>
```
* as attribute:
```
<ANY
ng-swipe-left="expression">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngSwipeLeft | `expression` | [Expression](../../../guide/expression) to evaluate upon left swipe. (Event object is available as `$event`) |
Example
-------
angularjs
Improve this Doc View Source $swipe
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngTouch/swipe.js?message=docs(%24swipe)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngTouch/swipe.js#L5) $swipe
======================================================================================================================================================================================================================================================
1. service in module [ngTouch](../../ngtouch)
**Deprecated:** (since 1.7.0) See the [module](../../ngtouch) documentation for more information.
Overview
--------
The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe behavior, to make implementing swipe-related directives more convenient.
Requires the [`ngTouch`](../../ngtouch) module to be installed.
`$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`.
Usage
-----
The `$swipe` service is an object with a single method: `bind`. `bind` takes an element which is to be watched for swipes, and an object with four handler functions. See the documentation for `bind` below.
Methods
-------
* ### bind();
The main method of `$swipe`. It takes an element to be watched for swipe motions, and an object containing event handlers. The pointer types that should be used can be specified via the optional third argument, which is an array of strings `'mouse'`, `'touch'` and `'pointer'`. By default, `$swipe` will listen for `mouse`, `touch` and `pointer` events.
The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end` receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }` and the raw `event`. `cancel` receives the raw `event` as its single parameter.
`start` is called on either `mousedown`, `touchstart` or `pointerdown`. After this event, `$swipe` is watching for `touchmove`, `mousemove` or `pointermove` events. These events are ignored until the total distance moved in either dimension exceeds a small threshold.
Once this threshold is exceeded, either the horizontal or vertical delta is greater.
+ If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.
+ If the vertical distance is greater, this is a scroll, and we let the browser take over. A `cancel` event is sent. `move` is called on `mousemove`, `touchmove` and `pointermove` after the above logic has determined that a swipe is in progress.
`end` is called when a swipe is successfully completed with a `touchend`, `mouseup` or `pointerup`.
`cancel` is called either on a `touchcancel` or `pointercancel` from the browser, or when we begin scrolling as described above.
angularjs Provider components in ngResource Provider components in ngResource
=================================
| Name | Description |
| --- | --- |
| [$resourceProvider](provider/%24resourceprovider) | Use `$resourceProvider` to change the default behavior of the [`$resource`](service/%24resource) service. |
angularjs Service components in ngResource Service components in ngResource
================================
| Name | Description |
| --- | --- |
| [$resource](service/%24resource) | A factory which creates a resource object that lets you interact with [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources. |
angularjs
Improve this Doc View Source $resourceProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngResource/resource.js?message=docs(%24resourceProvider)%3A%20describe%20your%20change...#L57) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngResource/resource.js#L57) $resourceProvider
==========================================================================================================================================================================================================================================================================================
1. [$resource](../service/%24resource)
2. provider in module [ngResource](../../ngresource)
Overview
--------
Use `$resourceProvider` to change the default behavior of the [`$resource`](../service/%24resource) service.
Dependencies
------------
Requires the [`ngResource`](../../ngresource) module to be installed.
Properties
----------
* ### defaults
| | |
| --- | --- |
| | Object containing default options used when creating `$resource` instances. The default values satisfy a wide range of usecases, but you may choose to overwrite any of them to further customize your instances. The available properties are:
+ **stripTrailingSlashes** – `{boolean}` – If true, then the trailing slashes from any calculated URL will be stripped. (Defaults to true.)
+ **cancellable** – `{boolean}` – If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value. For more details, see [`$resource`](../service/%24resource). This can be overwritten per resource class or action. (Defaults to false.)
+ **actions** - `{Object.<Object>}` - A hash with default actions declarations. Actions are high-level methods corresponding to RESTful actions/methods on resources. An action may specify what HTTP method to use, what URL to hit, if the return value will be a single object or a collection (array) of objects etc. For more details, see [`$resource`](../service/%24resource). The actions can also be enhanced or overwritten per resource class. The default actions are:
```
{
get: {method: 'GET'},
save: {method: 'POST'},
query: {method: 'GET', isArray: true},
remove: {method: 'DELETE'},
delete: {method: 'DELETE'}
}
```For example, you can specify a new `update` action that uses the `PUT` HTTP verb:
```
angular.
module('myApp').
config(['$resourceProvider', function ($resourceProvider) {
$resourceProvider.defaults.actions.update = {
method: 'PUT'
};
}]);
```
Or you can even overwrite the whole `actions` list and specify your own:
```
angular.
module('myApp').
config(['$resourceProvider', function ($resourceProvider) {
$resourceProvider.defaults.actions = {
create: {method: 'POST'},
get: {method: 'GET'},
getAll: {method: 'GET', isArray:true},
update: {method: 'PUT'},
delete: {method: 'DELETE'}
};
});
```
|
angularjs
Improve this Doc View Source $resource
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngResource/resource.js?message=docs(%24resource)%3A%20describe%20your%20change...#L71) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngResource/resource.js#L71) $resource
==========================================================================================================================================================================================================================================================================
1. [$resourceProvider](../provider/%24resourceprovider)
2. service in module [ngResource](../../ngresource)
Overview
--------
A factory which creates a resource object that lets you interact with [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
The returned resource object has action methods which provide high-level behaviors without the need to interact with the low level [$http](../../ng/service/%24http) service.
Requires the [`ngResource`](../../ngresource) module to be installed.
By default, trailing slashes will be stripped from the calculated URLs, which can pose problems with server backends that do not expect that behavior. This can be disabled by configuring the `$resourceProvider` like this:
```
app.config(['$resourceProvider', function($resourceProvider) {
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
}]);
```
Dependencies
------------
* [`$http`](../../ng/service/%24http)
* [`$log`](../../ng/service/%24log)
* [`$q`](../../ng/service/%24q)
* [`$timeout`](../../ng/service/%24timeout)
Usage
-----
`$resource(url, [paramDefaults], [actions], options);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| url | `string` | A parameterized URL template with parameters prefixed by `:` as in `/user/:username`. If you are using a URL with a port number (e.g. `http://example.com:8080/api`), it will be respected. If you are using a url with a suffix, just add the suffix, like this: `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')` or even `$resource('http://example.com/resource/:resource_id.:format')` If the parameter before the suffix is empty, :resource\_id in this case, then the `/.` will be collapsed down to a single `.`. If you need this sequence to appear and not collapse then you can escape it with `/\.`. |
| paramDefaults *(optional)* | `Object` | Default values for `url` parameters. These can be overridden in `actions` methods. If a parameter value is a function, it will be called every time a param value needs to be obtained for a request (unless the param was overridden). The function will be passed the current data value as an argument. Each key value in the parameter object is first bound to url template if present and then any excess keys are appended to the url search query after the `?`. Given a template `/path/:verb` and parameter `{verb: 'greet', salutation: 'Hello'}` results in URL `/path/greet?salutation=Hello`. If the parameter value is prefixed with `@`, then the value for that parameter will be extracted from the corresponding property on the `data` object (provided when calling actions with a request body). For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of `someParam` will be `data.someProp`. Note that the parameter will be ignored, when calling a "GET" action method (i.e. an action method that does not accept a request body). |
| actions *(optional)* | `Object.<Object>=` | Hash with declaration of custom actions that will be available in addition to the default set of resource actions (see below). If a custom action has the same key as a default action (e.g. `save`), then the default action will be *overwritten*, and not extended. The declaration should be created in the format of [$http.config](../../ng/service/%24http#usage.html):
```
{
action1: {method:?, params:?, isArray:?, headers:?, ...},
action2: {method:?, params:?, isArray:?, headers:?, ...},
...
}
```
Where:* **`action`** – {string} – The name of action. This name becomes the name of the method on your resource object.
* **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`, `DELETE`, `JSONP`, etc).
* **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of the parameter value is a function, it will be called every time when a param value needs to be obtained for a request (unless the param was overridden). The function will be passed the current data value as an argument.
* **`url`** – {string} – Action specific `url` override. The url templating is supported just like for the resource-level urls.
* **`isArray`** – {boolean=} – If true then the returned object for this action is an array, see `returns` section.
* **`transformRequest`** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version. By default, transformRequest will contain one function that checks if the request data is an object and serializes it using `angular.toJson`. To prevent this behavior, set `transformRequest` to an empty array: `transformRequest: []`
* **`transformResponse`** – `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` – Transform function or an array of such functions. The transform function takes the HTTP response body, headers and status and returns its transformed (typically deserialized) version. By default, transformResponse will contain one function that checks if the response looks like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior, set `transformResponse` to an empty array: `transformResponse: []`
* **`cache`** – `{boolean|Cache}` – A boolean value or object created with [`$cacheFactory`](../../ng/service/%24cachefactory) to enable or disable caching of the HTTP response. See [$http Caching](../../ng/service/%24http#caching.html) for more information.
* **`timeout`** – `{number}` – Timeout in milliseconds. **Note:** In contrast to [$http.config](../../ng/service/%24http#usage.html), [promises](../../ng/service/%24q) are **not** supported in `$resource`, because the same value would be used for multiple requests. If you are looking for a way to cancel requests, you should use the `cancellable` option.
* **`cancellable`** – `{boolean}` – If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value. Calling `$cancelRequest()` for a non-cancellable or an already completed/cancelled request will have no effect.
* **`withCredentials`** – `{boolean}` – Whether to set the `withCredentials` flag on the XHR object. See [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) for more information.
* **`responseType`** – `{string}` – See [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).
* **`interceptor`** – `{Object=}` – The interceptor object has four optional methods - `request`, `requestError`, `response`, and `responseError`. See [$http interceptors](../../ng/service/%24http#interceptors.html) for details. Note that `request`/`requestError` interceptors are applied before calling `$http`, thus before any global `$http` interceptors. Also, rejecting or throwing an error inside the `request` interceptor will result in calling the `responseError` interceptor. The resource instance or collection is available on the `resource` property of the `http response` object passed to `response`/`responseError` interceptors. Keep in mind that the associated promise will be resolved with the value returned by the response interceptors. Make sure you return an appropriate value and not the `response` object passed as input. For reference, the default `response` interceptor (which gets applied if you don't specify a custom one) returns `response.resource`. See [below](%24resource#using-interceptors.html) for an example of using interceptors in `$resource`.
* **`hasBody`** – `{boolean}` – If true, then the request will have a body. If not specified, then only POST, PUT and PATCH requests will have a body. \*
|
| options | `Object` | Hash with custom settings that should extend the default `$resourceProvider` behavior. The supported options are:* **`stripTrailingSlashes`** – {boolean} – If true then the trailing slashes from any calculated URL will be stripped. (Defaults to true.)
* **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value. This can be overwritten per action. (Defaults to false.)
|
### Returns
| | |
| --- | --- |
| `Object` | A resource "class" object with methods for the default set of resource actions optionally extended with custom `actions`. The default set contains these actions:
```
{
'get': {method: 'GET'},
'save': {method: 'POST'},
'query': {method: 'GET', isArray: true},
'remove': {method: 'DELETE'},
'delete': {method: 'DELETE'}
}
```
Calling these methods invoke [`$http`](../../ng/service/%24http) with the specified http method, destination and parameters. When the data is returned from the server then the object is an instance of the resource class. The actions `save`, `remove` and `delete` are available on it as methods with the `$` prefix. This allows you to easily perform CRUD operations (create, read, update, delete) on server-side data like this:
```
var User = $resource('/user/:userId', {userId: '@id'});
User.get({userId: 123}).$promise.then(function(user) {
user.abc = true;
user.$save();
});
```
It is important to realize that invoking a `$resource` object method immediately returns an empty reference (object or array depending on `isArray`). Once the data is returned from the server the existing reference is populated with the actual data. This is a useful trick since usually the resource is assigned to a model which is then rendered by the view. Having an empty object results in no rendering, once the data arrives from the server then the object is populated with the data and the view automatically re-renders itself showing the new data. This means that in most cases one never has to write a callback function for the action methods. The action methods on the class object or instance object can be invoked with the following parameters:* "class" actions without a body: `Resource.action([parameters], [success], [error])`
* "class" actions with a body: `Resource.action([parameters], postData, [success], [error])`
* instance actions: `instance.$action([parameters], [success], [error])`
When calling instance methods, the instance itself is used as the request body (if the action should have a body). By default, only actions using `POST`, `PUT` or `PATCH` have request bodies, but you can use the `hasBody` configuration option to specify whether an action should have a body or not (regardless of its HTTP method). Success callback is called with (value (Object|Array), responseHeaders (Function), status (number), statusText (string)) arguments, where `value` is the populated resource instance or collection object. The error callback is called with (httpResponse) argument. Class actions return an empty instance (with the additional properties listed below). Instance actions return a promise for the operation. The Resource instances and collections have these additional properties:* `$promise`: The [promise](../../ng/service/%24q) of the original server interaction that created this instance or collection. On success, the promise is resolved with the same resource instance or collection object, updated with data from server. This makes it easy to use in the [`resolve` section of `$routeProvider.when()`](../../ngroute/provider/%24routeprovider) to defer view rendering until the resource(s) are loaded. On failure, the promise is rejected with the [http response](../../ng/service/%24http) object. If an interceptor object was provided, the promise will instead be resolved with the value returned by the response interceptor (on success) or responceError interceptor (on failure).
* `$resolved`: `true` after first server interaction is completed (either with success or rejection), `false` before that. Knowing if the Resource has been resolved is useful in data-binding. If there is a response/responseError interceptor and it returns a promise, `$resolved` will wait for that too. The Resource instances and collections have these additional methods:
* `$cancelRequest`: If there is a cancellable, pending request related to the instance or collection, calling this method will abort the request. The Resource instances have these additional methods:
* `toJSON`: It returns a simple object without any of the extra properties added as part of the Resource API. This object can be serialized through [`angular.toJson`](../../ng/function/angular.tojson) safely without attaching AngularJS-specific fields. Notice that `JSON.stringify` (and `angular.toJson`) automatically use this method when serializing a Resource instance (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior)).
|
Examples
--------
### Basic usage
```
// Define a CreditCard class
var CreditCard = $resource('/users/:userId/cards/:cardId',
{userId: 123, cardId: '@id'}, {
charge: {method: 'POST', params: {charge: true}}
});
// We can retrieve a collection from the server
var cards = CreditCard.query();
// GET: /users/123/cards
// server returns: [{id: 456, number: '1234', name: 'Smith'}]
// Wait for the request to complete
cards.$promise.then(function() {
var card = cards[0];
// Each item is an instance of CreditCard
expect(card instanceof CreditCard).toEqual(true);
// Non-GET methods are mapped onto the instances
card.name = 'J. Smith';
card.$save();
// POST: /users/123/cards/456 {id: 456, number: '1234', name: 'J. Smith'}
// server returns: {id: 456, number: '1234', name: 'J. Smith'}
// Our custom method is mapped as well (since it uses POST)
card.$charge({amount: 9.99});
// POST: /users/123/cards/456?amount=9.99&charge=true {id: 456, number: '1234', name: 'J. Smith'}
});
// We can create an instance as well
var newCard = new CreditCard({number: '0123'});
newCard.name = 'Mike Smith';
var savePromise = newCard.$save();
// POST: /users/123/cards {number: '0123', name: 'Mike Smith'}
// server returns: {id: 789, number: '0123', name: 'Mike Smith'}
savePromise.then(function() {
// Once the promise is resolved, the created instance
// is populated with the data returned by the server
expect(newCard.id).toEqual(789);
});
```
The object returned from a call to `$resource` is a resource "class" which has one "static" method for each action in the definition.
Calling these methods invokes `$http` on the `url` template with the given HTTP `method`, `params` and `headers`.
### Accessing the response
When the data is returned from the server then the object is an instance of the resource type and all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD operations (create, read, update, delete) on server-side data.
```
var User = $resource('/users/:userId', {userId: '@id'});
User.get({userId: 123}).$promise.then(function(user) {
user.abc = true;
user.$save();
});
```
It's worth noting that the success callback for `get`, `query` and other methods gets called with the resource instance (populated with the data that came from the server) as well as an `$http` header getter function, the HTTP status code and the response status text. So one could rewrite the above example and get access to HTTP headers as follows:
```
var User = $resource('/users/:userId', {userId: '@id'});
User.get({userId: 123}, function(user, getResponseHeaders) {
user.abc = true;
user.$save(function(user, putResponseHeaders) {
// `user` => saved `User` object
// `putResponseHeaders` => `$http` header getter
});
});
```
### Creating custom actions
In this example we create a custom method on our resource to make a PUT request:
```
var app = angular.module('app', ['ngResource']);
// Some APIs expect a PUT request in the format URL/object/ID
// Here we are creating an 'update' method
app.factory('Notes', ['$resource', function($resource) {
return $resource('/notes/:id', {id: '@id'}, {
update: {method: 'PUT'}
});
}]);
// In our controller we get the ID from the URL using `$location`
app.controller('NotesCtrl', ['$location', 'Notes', function($location, Notes) {
// First, retrieve the corresponding `Note` object from the server
// (Assuming a URL of the form `.../notes?id=XYZ`)
var noteId = $location.search().id;
var note = Notes.get({id: noteId});
note.$promise.then(function() {
note.content = 'Hello, world!';
// Now call `update` to save the changes on the server
Notes.update(note);
// This will PUT /notes/ID with the note object as the request payload
// Since `update` is a non-GET method, it will also be available on the instance
// (prefixed with `$`), so we could replace the `Note.update()` call with:
//note.$update();
});
}]);
```
### Cancelling requests
If an action's configuration specifies that it is cancellable, you can cancel the request related to an instance or collection (as long as it is a result of a "non-instance" call):
```
// ...defining the `Hotel` resource...
var Hotel = $resource('/api/hotels/:id', {id: '@id'}, {
// Let's make the `query()` method cancellable
query: {method: 'get', isArray: true, cancellable: true}
});
// ...somewhere in the PlanVacationController...
...
this.onDestinationChanged = function onDestinationChanged(destination) {
// We don't care about any pending request for hotels
// in a different destination any more
if (this.availableHotels) {
this.availableHotels.$cancelRequest();
}
// Let's query for hotels in `destination`
// (calls: /api/hotels?location=<destination>)
this.availableHotels = Hotel.query({location: destination});
};
```
### Using interceptors
You can use interceptors to transform the request or response, perform additional operations, and modify the returned instance/collection. The following example, uses `request` and `response` interceptors to augment the returned instance with additional info:
```
var Thing = $resource('/api/things/:id', {id: '@id'}, {
save: {
method: 'POST',
interceptor: {
request: function(config) {
// Before the request is sent out, store a timestamp on the request config
config.requestTimestamp = Date.now();
return config;
},
response: function(response) {
// Get the instance from the response object
var instance = response.resource;
// Augment the instance with a custom `saveLatency` property, computed as the time
// between sending the request and receiving the response.
instance.saveLatency = Date.now() - response.config.requestTimestamp;
// Return the instance
return instance;
}
}
}
});
Thing.save({foo: 'bar'}).$promise.then(function(thing) {
console.log('That thing was saved in ' + thing.saveLatency + 'ms.');
});
```
| programming_docs |
angularjs Directive components in ngAnimate Directive components in ngAnimate
=================================
| Name | Description |
| --- | --- |
| [ngAnimateChildren](directive/nganimatechildren) | ngAnimateChildren allows you to specify that children of this element should animate even if any of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` (structural) animation, child elements that also have an active structural animation are not animated. |
| [ngAnimateSwap](directive/nganimateswap) | ngAnimateSwap is a animation-oriented directive that allows for the container to be removed and entered in whenever the associated expression changes. A common usecase for this directive is a rotating banner or slider component which contains one image being present at a time. When the active image changes then the old image will perform a `leave` animation and the new element will be inserted via an `enter` animation. |
angularjs Service components in ngAnimate Service components in ngAnimate
===============================
| Name | Description |
| --- | --- |
| [$animateCss](service/%24animatecss) | The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or directives to create more complex animations that can be purely driven using CSS code. |
| [$animate](service/%24animate) | The ngAnimate `$animate` service documentation is the same for the core `$animate` service. |
angularjs
Improve this Doc View Source ngAnimateChildren
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAnimate/animateChildrenDirective.js?message=docs(ngAnimateChildren)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngAnimate/animateChildrenDirective.js#L3) ngAnimateChildren
====================================================================================================================================================================================================================================================================================================================
1. directive in module [ngAnimate](../../nganimate)
Overview
--------
ngAnimateChildren allows you to specify that children of this element should animate even if any of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` (structural) animation, child elements that also have an active structural animation are not animated.
Note that even if `ngAnimateChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).
Directive Info
--------------
* This directive executes at priority level 0.
Usage
-----
* as element:
```
<ng-animate-children
ng-animate-children="string">
...
</ng-animate-children>
```
* as attribute:
```
<ANY
ng-animate-children="string">
...
</ANY>
```
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| ngAnimateChildren | `string` | If the value is empty, `true` or `on`, then child animations are allowed. If the value is `false`, child animations are not allowed. |
Example
-------
angularjs
Improve this Doc View Source ngAnimateSwap
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAnimate/ngAnimateSwap.js?message=docs(ngAnimateSwap)%3A%20describe%20your%20change...#L3) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngAnimate/ngAnimateSwap.js#L3) ngAnimateSwap
======================================================================================================================================================================================================================================================================================
1. directive in module [ngAnimate](../../nganimate)
Overview
--------
ngAnimateSwap is a animation-oriented directive that allows for the container to be removed and entered in whenever the associated expression changes. A common usecase for this directive is a rotating banner or slider component which contains one image being present at a time. When the active image changes then the old image will perform a `leave` animation and the new element will be inserted via an `enter` animation.
Directive Info
--------------
* This directive creates new scope.
* This directive executes at priority level 0.
Usage
-----
* as attribute:
```
<ANY
ng-animate-swap>
...
</ANY>
```
Animations
----------
| Animation | Occurs |
| --- | --- |
| [enter](../../ng/service/%24animate#enter.html) | when the new element is inserted to the DOM |
| [leave](../../ng/service/%24animate#leave.html) | when the old element is removed from the DOM |
[Click here](../service/%24animate) to learn more about the steps involved in the animation. Example
-------
angularjs
Improve this Doc View Source $animateCss
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAnimate/animateCss.js?message=docs(%24animateCss)%3A%20describe%20your%20change...#L7) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngAnimate/animateCss.js#L7) $animateCss
==============================================================================================================================================================================================================================================================================
1. service in module [ngAnimate](../../nganimate)
Overview
--------
The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or directives to create more complex animations that can be purely driven using CSS code.
Note that only browsers that support CSS transitions and/or keyframe animations are capable of rendering animations triggered via `$animateCss` (bad news for IE9 and lower).
General Use
-----------
Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, any automatic control over cancelling animations and/or preventing animations from being run on child elements will not be handled by AngularJS. For this to work as expected, please use `$animate` to trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger the CSS animation.
The example below shows how we can create a folding animation on an element using `ng-if`:
```
<!-- notice the `fold-animation` CSS class -->
<div ng-if="onOff" class="fold-animation">
This element will go BOOM
</div>
<button ng-click="onOff=true">Fold In</button>
```
Now we create the **JavaScript animation** that will trigger the CSS transition:
```
ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
return {
enter: function(element, doneFn) {
var height = element[0].offsetHeight;
return $animateCss(element, {
from: { height:'0px' },
to: { height:height + 'px' },
duration: 1 // one second
});
}
}
}]);
```
More Advanced Uses
------------------
`$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.
This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order to provide a working animation that will run in CSS.
The example below showcases a more advanced version of the `.fold-animation` from the example above:
```
ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
return {
enter: function(element, doneFn) {
var height = element[0].offsetHeight;
return $animateCss(element, {
addClass: 'red large-text pulse-twice',
easing: 'ease-out',
from: { height:'0px' },
to: { height:height + 'px' },
duration: 1 // one second
});
}
}
}]);
```
Since we're adding/removing CSS classes then the CSS transition will also pick those up:
```
/* since a hardcoded duration value of 1 was provided in the JavaScript animation code,
the CSS classes below will be transitioned despite them being defined as regular CSS classes */
.red { background:red; }
.large-text { font-size:20px; }
/* we can also use a keyframe animation and $animateCss will make it work alongside the transition */
.pulse-twice {
animation: 0.5s pulse linear 2;
-webkit-animation: 0.5s pulse linear 2;
}
@keyframes pulse {
from { transform: scale(0.5); }
to { transform: scale(1.5); }
}
@-webkit-keyframes pulse {
from { -webkit-transform: scale(0.5); }
to { -webkit-transform: scale(1.5); }
}
```
Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.
How the Options are handled
---------------------------
`$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline styles using the `from` and `to` properties.
```
var animator = $animateCss(element, {
from: { background:'red' },
to: { background:'blue' }
});
animator.start();
```
```
.rotating-animation {
animation:0.5s rotate linear;
-webkit-animation:0.5s rotate linear;
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@-webkit-keyframes rotate {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
```
The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied and spread across the transition and keyframe animation.
What is returned
----------------
`$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:
```
var animator = $animateCss(element, { ... });
```
Now what do the contents of our `animator` variable look like:
```
{
// starts the animation
start: Function,
// ends (aborts) the animation
end: Function
}
```
To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties and that changing them will not reconfigure the parameters of the animation.
### runner.done() vs runner.then()
It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` unless you really need a digest to kick off afterwards.
Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). Check the [animation code above](%24animatecss#usage.html) to see how this works.
Usage
-----
`$animateCss(element, options);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| element | `DOMElement` | the element that will be animated |
| options | `object` | the animation-related options that will be applied during the animation* `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)
* `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted.
* `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).
* `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`).
* `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).
* `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.
* `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
* `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.
* `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.
* `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` is provided then the animation will be skipped entirely.
* `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same CSS delay value.
* `stagger` - A numeric time value representing the delay between successively animated elements ([Click here to learn how CSS-based staggering works in ngAnimate.](../../nganimate#css-staggering-animations.html))
* `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)
* `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.)
* `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once the animation is closed. This is useful for when the styles are used purely for the sake of the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation). By default this value is set to `false`.
|
### Returns
| | |
| --- | --- |
| `object` | an object with start and end methods and details about the animation.* `start` - The method to start the animation. This will return a `Promise` when called.
* `end` - This method will cancel the animation and remove all applied CSS classes and styles.
|
angularjs
Improve this Doc View Source $animate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngAnimate/module.js?message=docs(%24animate)%3A%20describe%20your%20change...#L756) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngAnimate/module.js#L756) $animate
====================================================================================================================================================================================================================================================================
1. service in module [ngAnimate](../../nganimate)
Overview
--------
The ngAnimate `$animate` service documentation is the same for the core `$animate` service.
Click here [to learn more about animations with `$animate`](../../ng/service/%24animate).
angularjs Type components in ngMock Type components in ngMock
=========================
| Name | Description |
| --- | --- |
| [angular.mock.TzDate](type/angular.mock.tzdate) | *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`. |
| [$rootScope.Scope](type/%24rootscope.scope) | [Scope](../ng/type/%24rootscope.scope) type decorated with helper methods useful for testing. These methods are automatically available on any [Scope](../ng/type/%24rootscope.scope) instance when `ngMock` module is loaded. |
angularjs Provider components in ngMock Provider components in ngMock
=============================
| Name | Description |
| --- | --- |
| [$exceptionHandlerProvider](provider/%24exceptionhandlerprovider) | Configures the mock implementation of [`$exceptionHandler`](../ng/service/%24exceptionhandler) to rethrow or to log errors passed to the `$exceptionHandler`. |
angularjs Object components in ngMock Object components in ngMock
===========================
| Name | Description |
| --- | --- |
| [angular.mock](object/angular.mock) | Namespace from 'angular-mocks.js' which contains testing related code. |
angularjs Service components in ngMock Service components in ngMock
============================
| Name | Description |
| --- | --- |
| [$flushPendingTasks](service/%24flushpendingtasks) | Flushes all currently pending tasks and executes the corresponding callbacks. |
| [$verifyNoPendingTasks](service/%24verifynopendingtasks) | Verifies that there are no pending tasks that need to be flushed. It throws an error if there are still pending tasks. |
| [$exceptionHandler](service/%24exceptionhandler) | Mock implementation of [`$exceptionHandler`](../ng/service/%24exceptionhandler) that rethrows or logs errors passed to it. See [$exceptionHandlerProvider](provider/%24exceptionhandlerprovider) for configuration information. |
| [$log](service/%24log) | Mock implementation of [`$log`](../ng/service/%24log) that gathers all logged messages in arrays (one array per logging level). These arrays are exposed as `logs` property of each of the level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`. |
| [$interval](service/%24interval) | Mock implementation of the $interval service. |
| [$animate](service/%24animate) | Mock implementation of the [`$animate`](../ng/service/%24animate) service. Exposes two additional methods for testing animations. |
| [$httpBackend](service/%24httpbackend) | Fake HTTP backend implementation suitable for unit testing applications that use the [$http service](../ng/service/%24http). |
| [$timeout](service/%24timeout) | This service is just a simple decorator for [$timeout](../ng/service/%24timeout) service that adds a "flush" and "verifyNoPendingTasks" methods. |
| [$controller](service/%24controller) | A decorator for [`$controller`](../ng/service/%24controller) with additional `bindings` parameter, useful when testing controllers of directives that use [`bindToController`](../ng/service/%24compile#-bindtocontroller-.html). |
| [$componentController](service/%24componentcontroller) | A service that can be used to create instances of component controllers. Useful for unit-testing. |
| programming_docs |
angularjs Function components in ngMock Function components in ngMock
=============================
| Name | Description |
| --- | --- |
| [angular.mock.dump](function/angular.mock.dump) | *NOTE*: This is not an injectable instance, just a globally available function. |
| [angular.mock.module](function/angular.mock.module) | *NOTE*: This function is also published on window for easy access. *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha |
| [angular.mock.module.sharedInjector](function/angular.mock.module.sharedinjector) | *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha |
| [angular.mock.inject](function/angular.mock.inject) | *NOTE*: This function is also published on window for easy access. *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha |
| [browserTrigger](function/browsertrigger) | This is a global (window) function that is only available when the [`ngMock`](../ngmock) module is included. |
angularjs
Improve this Doc View Source $exceptionHandlerProvider
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24exceptionHandlerProvider)%3A%20describe%20your%20change...#L320) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L320) $exceptionHandlerProvider
==============================================================================================================================================================================================================================================================================================================
1. [$exceptionHandler](../service/%24exceptionhandler)
2. provider in module [ngMock](../../ngmock)
Overview
--------
Configures the mock implementation of [`$exceptionHandler`](../../ng/service/%24exceptionhandler) to rethrow or to log errors passed to the `$exceptionHandler`.
Methods
-------
* ### mode(mode);
Sets the logging mode.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| mode | `string` | Mode of operation, defaults to `rethrow`.
+ `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log` mode stores an array of errors in `$exceptionHandler.errors`, to allow later assertion of them. See [assertEmpty()](../service/%24log#assertEmpty.html) and [reset()](../service/%24log#reset.html).
+ `rethrow`: If any errors are passed to the handler in tests, it typically means that there is a bug in the application or test, so this mock will make these tests fail. For any implementations that expect exceptions to be thrown, the `rethrow` mode will also maintain a log of thrown errors in `$exceptionHandler.errors`. |
angularjs
Improve this Doc View Source angular.mock.inject
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(angular.mock.inject)%3A%20describe%20your%20change...#L3267) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L3267) angular.mock.inject
==================================================================================================================================================================================================================================================================================================
1. function in module [ngMock](../../ngmock)
Overview
--------
*NOTE*: This function is also published on window for easy access.
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
The inject function wraps a function into an injectable function. The inject() creates new instance of [$injector](../../auto/service/%24injector) per test, which is then used for resolving references.
Resolving References (Underscore Wrapping)
------------------------------------------
Often, we would like to inject a reference once, in a `beforeEach()` block and reuse this in multiple `it()` clauses. To be able to do this we must assign the reference to a variable that is declared in the scope of the `describe()` block. Since we would, most likely, want the variable to have the same name of the reference we have a problem, since the parameter to the `inject()` function would hide the outer variable.
To help with this, the injected parameters can, optionally, be enclosed with underscores. These are ignored by the injector when the reference name is resolved.
For example, the parameter `_myService_` would be resolved as the reference `myService`. Since it is available in the function body as `_myService_`, we can then assign it to a variable defined in an outer scope.
```
// Defined out reference variable outside
var myService;
// Wrap the parameter in underscores
beforeEach( inject( function(_myService_){
myService = _myService_;
}));
// Use myService in a series of tests.
it('makes use of myService', function() {
myService.doStuff();
});
```
See also <angular.mock.module>
Example of what a typical jasmine tests looks like with the inject method.
```
angular.module('myApplicationModule', [])
.value('mode', 'app')
.value('version', 'v1.0.1');
describe('MyApp', function() {
// You need to load modules that you want to test,
// it loads only the "ng" module by default.
beforeEach(module('myApplicationModule'));
// inject() is used to inject arguments of all given functions
it('should provide a version', inject(function(mode, version) {
expect(version).toEqual('v1.0.1');
expect(mode).toEqual('app');
}));
// The inject and module method can also be used inside of the it or beforeEach
it('should override a version and test the new version is injected', function() {
// module() takes functions or strings (module aliases)
module(function($provide) {
$provide.value('version', 'overridden'); // override version here
});
inject(function(version) {
expect(version).toEqual('overridden');
});
});
});
```
Usage
-----
`angular.mock.inject(fns);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| fns | `...Function` | any number of functions which will be injected using the injector. |
angularjs
Improve this Doc View Source angular.mock.module
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(angular.mock.module)%3A%20describe%20your%20change...#L3065) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L3065) angular.mock.module
==================================================================================================================================================================================================================================================================================================
1. function in module [ngMock](../../ngmock)
Overview
--------
*NOTE*: This function is also published on window for easy access.
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
This function registers a module configuration code. It collects the configuration information which will be used when the injector is created by [inject](angular.mock.inject).
See [inject](angular.mock.inject) for usage example
Usage
-----
`angular.mock.module(fns);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| fns | `string``function()``Object` | any number of modules which are represented as string aliases or as anonymous module initialization functions. The modules are used to configure the injector. The 'ng' and 'ngMock' modules are automatically loaded. If an object literal is passed each key-value pair will be registered on the module via [$provide](../../auto/service/%24provide).value, the key being the string name (or token) to associate with the value on the injector. |
angularjs
Improve this Doc View Source angular.mock.module.sharedInjector
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(angular.mock.module.sharedInjector)%3A%20describe%20your%20change...#L3123) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L3123) angular.mock.module.sharedInjector
================================================================================================================================================================================================================================================================================================================================
1. function in module [ngMock](../../ngmock)
Overview
--------
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
This function ensures a single injector will be used for all tests in a given describe context. This contrasts with the default behaviour where a new injector is created per test case.
Use sharedInjector when you want to take advantage of Jasmine's `beforeAll()`, or mocha's `before()` methods. Call `module.sharedInjector()` before you setup any other hooks that will create (i.e call `module()`) or use (i.e call `inject()`) the injector.
You cannot call `sharedInjector()` from within a context already using `sharedInjector()`.
Typically beforeAll is used to make many assertions about a single operation. This can cut down test run-time as the test setup doesn't need to be re-run, and enabling focussed tests each with a single assertion.
```
describe("Deep Thought", function() {
module.sharedInjector();
beforeAll(module("UltimateQuestion"));
beforeAll(inject(function(DeepThought) {
expect(DeepThought.answer).toBeUndefined();
DeepThought.generateAnswer();
}));
it("has calculated the answer correctly", inject(function(DeepThought) {
// Because of sharedInjector, we have access to the instance of the DeepThought service
// that was provided to the beforeAll() hook. Therefore we can test the generated answer
expect(DeepThought.answer).toBe(42);
}));
it("has calculated the answer within the expected time", inject(function(DeepThought) {
expect(DeepThought.runTimeMillennia).toBeLessThan(8000);
}));
it("has double checked the answer", inject(function(DeepThought) {
expect(DeepThought.absolutelySureItIsTheRightAnswer).toBe(true);
}));
});
```
angularjs
Improve this Doc View Source angular.mock.dump
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(angular.mock.dump)%3A%20describe%20your%20change...#L1059) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L1059) angular.mock.dump
==============================================================================================================================================================================================================================================================================================
1. function in module [ngMock](../../ngmock)
Overview
--------
*NOTE*: This is not an injectable instance, just a globally available function.
Method for serializing common AngularJS objects (scope, elements, etc..) into strings. It is useful for logging objects to the console when debugging.
Usage
-----
`angular.mock.dump(object);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| object | `*` | any object to turn into string. |
### Returns
| | |
| --- | --- |
| `string` | a serialized string of the argument |
angularjs
Improve this Doc View Source browserTrigger
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/browserTrigger.js?message=docs(browserTrigger)%3A%20describe%20your%20change...#L4) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/browserTrigger.js#L4) browserTrigger
====================================================================================================================================================================================================================================================================================
1. function in module [ngMock](../../ngmock)
Overview
--------
This is a global (window) function that is only available when the [`ngMock`](../../ngmock) module is included.
It can be used to trigger a native browser event on an element, which is useful for unit testing.
Usage
-----
`browserTrigger(element, [eventType], [eventData]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| element | `Object` | Either a wrapped jQuery/jqLite node or a DOMElement |
| eventType *(optional)* | `string` | Optional event type. If none is specified, the function tries to determine the right event type for the element, e.g. `change` for `input[text]`. |
| eventData *(optional)* | `Object` | An optional object which contains additional event data that is used when creating the event:* `bubbles`: [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles). Not applicable to all events.
* `cancelable`: [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable). Not applicable to all events.
* `charcode`: [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode) for keyboard events (keydown, keypress, and keyup).
* `data`: [data](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/data) for [CompositionEvents](https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent).
* `elapsedTime`: the elapsedTime for [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent) and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
* `keycode`: [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode) for keyboard events (keydown, keypress, and keyup).
* `keys`: an array of possible modifier keys (ctrl, alt, shift, meta) for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and keyboard events (keydown, keypress, and keyup).
* `relatedTarget`: the [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget) for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
* `which`: [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which) for keyboard events (keydown, keypress, and keyup).
* `x`: x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
* `y`: y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
|
angularjs
Improve this Doc View Source $rootScope.Scope
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24rootScope.Scope)%3A%20describe%20your%20change...#L2958) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L2958) $rootScope.Scope
==============================================================================================================================================================================================================================================================================================
1. type in module [ngMock](../../ngmock)
Overview
--------
[Scope](../../ng/type/%24rootscope.scope) type decorated with helper methods useful for testing. These methods are automatically available on any [Scope](../../ng/type/%24rootscope.scope) instance when `ngMock` module is loaded.
In addition to all the regular `Scope` methods, the following helper methods are available:
Methods
-------
* ### $countChildScopes();
Counts all the direct and indirect child scopes of the current scope.
The current scope is excluded from the count. The count includes all isolate child scopes.
#### Method's `this`
$rootScope.Scope
#### Returns
| | |
| --- | --- |
| `number` | Total number of child scopes. |
* ### $countWatchers();
Counts all the watchers of direct and indirect child scopes of the current scope.
The watchers of the current scope are included in the count and so are all the watchers of isolate child scopes.
#### Method's `this`
$rootScope.Scope
#### Returns
| | |
| --- | --- |
| `number` | Total number of watchers. |
angularjs
Improve this Doc View Source angular.mock.TzDate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(angular.mock.TzDate)%3A%20describe%20your%20change...#L723) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L723) angular.mock.TzDate
================================================================================================================================================================================================================================================================================================
1. type in module [ngMock](../../ngmock)
Overview
--------
*NOTE*: this is not an injectable instance, just a globally available mock class of `Date`.
Mock of the Date type which has its timezone specified via constructor arg.
The main purpose is to create Date-like instances with timezone fixed to the specified timezone offset, so that we can test code that depends on local timezone settings without dependency on the time zone settings of the machine where the code is running.
Usage
-----
`angular.mock.TzDate(offset, timestamp);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| offset | `number` | Offset of the *desired* timezone in hours (fractions will be honored) |
| timestamp | `number``string` | Timestamp representing the desired time in *UTC* |
Example
-------
!!!! WARNING !!!!! This is not a complete Date object so only methods that were implemented can be called safely. To make matters worse, TzDate instances inherit stuff from Date via a prototype.
We do our best to intercept calls to "unimplemented" methods, but since the list of methods is incomplete we might be missing some non-standard methods. This can result in errors like: "Date.prototype.foo called on incompatible Object".
```
var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
newYearInBratislava.getTimezoneOffset() => -60;
newYearInBratislava.getFullYear() => 2010;
newYearInBratislava.getMonth() => 0;
newYearInBratislava.getDate() => 1;
newYearInBratislava.getHours() => 0;
newYearInBratislava.getMinutes() => 0;
newYearInBratislava.getSeconds() => 0;
```
angularjs
Improve this Doc View Source angular.mock
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(angular.mock)%3A%20describe%20your%20change...#L5) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L5) angular.mock
==============================================================================================================================================================================================================================================================================
1. object in module [ngMock](../../ngmock)
Overview
--------
Namespace from 'angular-mocks.js' which contains testing related code.
angularjs
Improve this Doc View Source $log
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24log)%3A%20describe%20your%20change...#L415) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L415) $log
====================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
Mock implementation of [`$log`](../../ng/service/%24log) that gathers all logged messages in arrays (one array per logging level). These arrays are exposed as `logs` property of each of the level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`.
Methods
-------
* ### reset();
Reset all of the logging arrays to empty.
* ### assertEmpty();
Assert that all of the logging methods have no logged messages. If any messages are present, an exception is thrown.
Properties
----------
* ### log.logs
| | |
| --- | --- |
| | Array of messages logged using [`log()`](../../ng/service/%24log#log.html). |
* ### info.logs
| | |
| --- | --- |
| | Array of messages logged using [`info()`](../../ng/service/%24log#info.html). |
* ### warn.logs
| | |
| --- | --- |
| | Array of messages logged using [`warn()`](../../ng/service/%24log#warn.html). |
* ### error.logs
| | |
| --- | --- |
| | Array of messages logged using [`error()`](../../ng/service/%24log#error.html). |
* ### debug.logs
| | |
| --- | --- |
| | Array of messages logged using [`debug()`](../../ng/service/%24log#debug.html). |
| programming_docs |
angularjs
Improve this Doc View Source $verifyNoPendingTasks
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24verifyNoPendingTasks)%3A%20describe%20your%20change...#L282) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L282) $verifyNoPendingTasks
======================================================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
Verifies that there are no pending tasks that need to be flushed. It throws an error if there are still pending tasks.
You can check for a specific type of tasks only, by specifying a `taskType`.
Available task types:
* `$timeout`: Pending timeouts (via [`$timeout`](%24timeout)).
* `$http`: Pending HTTP requests (via [`$http`](../../ng/service/%24http)).
* `$route`: In-progress route transitions (via [`$route`](../../ngroute/service/%24route)).
* `$applyAsync`: Pending tasks scheduled via [$applyAsync](../../ng/type/%24rootscope.scope#%24applyAsync.html).
* `$evalAsync`: Pending tasks scheduled via [$evalAsync](../../ng/type/%24rootscope.scope#%24evalAsync.html). These include tasks scheduled via `$evalAsync()` indirectly (such as [`$q`](../../ng/service/%24q) promises).
Periodic tasks scheduled via [`$interval`](%24interval) use a different queue and are not taken into account by `$verifyNoPendingTasks()`. There is currently no way to verify that there are no pending [`$interval`](%24interval) tasks. Usage
-----
`$verifyNoPendingTasks([taskType]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| taskType *(optional)* | `string` | The type of tasks to check for. |
angularjs
Improve this Doc View Source $animate
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24animate)%3A%20describe%20your%20change...#L889) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L889) $animate
============================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
Mock implementation of the [`$animate`](../../ng/service/%24animate) service. Exposes two additional methods for testing animations.
You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))`
Methods
-------
* ### closeAndFlush();
This method will close all pending animations (both [Javascript](../../nganimate#javascript-based-animations.html) and [CSS](../../nganimate/service/%24animatecss)) and it will also flush any remaining animation frames and/or callbacks.
* ### flush();
This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see [`closeAndFlush()`](%24animate#closeAndFlush.html) for that).
angularjs
Improve this Doc View Source $exceptionHandler
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24exceptionHandler)%3A%20describe%20your%20change...#L329) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L329) $exceptionHandler
==============================================================================================================================================================================================================================================================================================
1. [$exceptionHandlerProvider](../provider/%24exceptionhandlerprovider)
2. service in module [ngMock](../../ngmock)
Overview
--------
Mock implementation of [`$exceptionHandler`](../../ng/service/%24exceptionhandler) that rethrows or logs errors passed to it. See [$exceptionHandlerProvider](../provider/%24exceptionhandlerprovider) for configuration information.
```
describe('$exceptionHandlerProvider', function() {
it('should capture log messages and exceptions', function() {
module(function($exceptionHandlerProvider) {
$exceptionHandlerProvider.mode('log');
});
inject(function($log, $exceptionHandler, $timeout) {
$timeout(function() { $log.log(1); });
$timeout(function() { $log.log(2); throw 'banana peel'; });
$timeout(function() { $log.log(3); });
expect($exceptionHandler.errors).toEqual([]);
expect($log.assertEmpty());
$timeout.flush();
expect($exceptionHandler.errors).toEqual(['banana peel']);
expect($log.log.logs).toEqual([[1], [2], [3]]);
});
});
});
```
angularjs
Improve this Doc View Source $flushPendingTasks
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24flushPendingTasks)%3A%20describe%20your%20change...#L243) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L243) $flushPendingTasks
================================================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
Flushes all currently pending tasks and executes the corresponding callbacks.
Optionally, you can also pass a `delay` argument to only flush tasks that are scheduled to be executed within `delay` milliseconds. Currently, `delay` only applies to timeouts, since all other tasks have a delay of 0 (i.e. they are scheduled to be executed as soon as possible, but still asynchronously).
If no delay is specified, it uses a delay such that all currently pending tasks are flushed.
The types of tasks that are flushed include:
* Pending timeouts (via [`$timeout`](%24timeout)).
* Pending tasks scheduled via [$applyAsync](../../ng/type/%24rootscope.scope#%24applyAsync.html).
* Pending tasks scheduled via [$evalAsync](../../ng/type/%24rootscope.scope#%24evalAsync.html). These include tasks scheduled via `$evalAsync()` indirectly (such as [`$q`](../../ng/service/%24q) promises).
Periodic tasks scheduled via [`$interval`](%24interval) use a different queue and are not flushed by `$flushPendingTasks()`. Use [$interval.flush(millis)](%24interval#flush.html) instead. Usage
-----
`$flushPendingTasks([delay]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| delay *(optional)* | `number` | The number of milliseconds to flush. |
angularjs
Improve this Doc View Source $componentController
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24componentController)%3A%20describe%20your%20change...#L2508) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L2508) $componentController
======================================================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
A service that can be used to create instances of component controllers. Useful for unit-testing.
Be aware that the controller will be instantiated and attached to the scope as specified in the component definition object. If you do not provide a `$scope` object in the `locals` param then the helper will create a new isolated scope as a child of `$rootScope`.
If you are using `$element` or `$attrs` in the controller, make sure to provide them as `locals`. The `$element` must be a jqLite-wrapped DOM element, and `$attrs` should be an object that has all properties / functions that you are using in the controller. If this is getting too complex, you should compile the component instead and access the component's controller via the [`controller`](../../ng/function/angular.element#methods.html) function.
See also the section on [unit-testing component controllers](../../../guide/component#unit-testing-component-controllers.html) in the guide.
Usage
-----
`$componentController(componentName, locals, [bindings], [ident]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| componentName | `string` | the name of the component whose controller we want to instantiate |
| locals | `Object` | Injection locals for Controller. |
| bindings *(optional)* | `Object` | Properties to add to the controller before invoking the constructor. This is used to simulate the `bindToController` feature and simplify certain kinds of tests. |
| ident *(optional)* | `string` | Override the property name to use when attaching the controller to the scope. |
### Returns
| | |
| --- | --- |
| `Object` | Instance of requested controller. |
angularjs
Improve this Doc View Source $controller
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24controller)%3A%20describe%20your%20change...#L2430) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L2430) $controller
====================================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
A decorator for [`$controller`](../../ng/service/%24controller) with additional `bindings` parameter, useful when testing controllers of directives that use [`bindToController`](../../ng/service/%24compile#-bindtocontroller-.html).
```
// Directive definition ...
myMod.directive('myDirective', {
controller: 'MyDirectiveController',
bindToController: {
name: '@'
}
});
// Controller definition ...
myMod.controller('MyDirectiveController', ['$log', function($log) {
this.log = function() {
$log.info(this.name);
};
}]);
// In a test ...
describe('myDirectiveController', function() {
describe('log()', function() {
it('should write the bound name to the log', inject(function($controller, $log) {
var ctrl = $controller('MyDirectiveController', { /* no locals */ }, { name: 'Clark Kent' });
ctrl.log();
expect(ctrl.name).toEqual('Clark Kent');
expect($log.info.logs).toEqual(['Clark Kent']);
}));
});
});
```
Usage
-----
`$controller(constructor, locals, [bindings]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| constructor | `function()``string` | If called with a function then it's considered to be the controller constructor function. Otherwise it's considered to be a string which is used to retrieve the controller constructor using the following steps:* check if a controller with given name is registered via `$controllerProvider`
* check if evaluating the string on the current scope returns a constructor The string can use the `controller as property` syntax, where the controller instance is published as the specified property on the `scope`; the `scope` must be injected into `locals` param for this to work correctly.
|
| locals | `Object` | Injection locals for Controller. |
| bindings *(optional)* | `Object` | Properties to add to the controller instance. This is used to simulate the `bindToController` feature and simplify certain kinds of tests. |
### Returns
| | |
| --- | --- |
| `Object` | Instance of given controller. |
angularjs
Improve this Doc View Source $httpBackend
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24httpBackend)%3A%20describe%20your%20change...#L1126) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L1126) $httpBackend
======================================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
Fake HTTP backend implementation suitable for unit testing applications that use the [$http service](../../ng/service/%24http).
**Note**: For fake HTTP backend implementation suitable for end-to-end testing or backend-less development please see [e2e $httpBackend mock](../../ngmocke2e/service/%24httpbackend). During unit testing, we want our unit tests to run quickly and have no external dependencies so we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or [JSONP](http://en.wikipedia.org/wiki/JSONP) requests to a real server. All we really need is to verify whether a certain request has been sent or not, or alternatively just let the application make requests, respond with pre-trained responses and assert that the end result is what we expect it to be.
This mock implementation can be used to respond with static or dynamic responses via the `expect` and `when` apis and their shortcuts (`expectGET`, `whenPOST`, etc).
When an AngularJS application needs some data from a server, it calls the $http service, which sends the request to a real server using $httpBackend service. With dependency injection, it is easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify the requests and respond with some testing data without sending a request to a real server.
There are two ways to specify what test data should be returned as http responses by the mock backend when the code under test makes http requests:
* `$httpBackend.expect` - specifies a request expectation
* `$httpBackend.when` - specifies a backend definition
Request Expectations vs Backend Definitions
-------------------------------------------
Request expectations provide a way to make assertions about requests made by the application and to define responses for those requests. The test will fail if the expected requests are not made or they are made in the wrong order.
Backend definitions allow you to define a fake backend for your application which doesn't assert if a particular request was made or not, it just returns a trained response if a request is made. The test will pass whether or not the request gets made during testing.
| | Request expectations | Backend definitions |
| --- | --- | --- |
| Syntax | .expect(...).respond(...) | .when(...).respond(...) |
| Typical usage | strict unit tests | loose (black-box) unit testing |
| Fulfills multiple requests | NO | YES |
| Order of requests matters | YES | NO |
| Request required | YES | NO |
| Response required | optional (see below) | YES |
In cases where both backend definitions and request expectations are specified during unit testing, the request expectations are evaluated first.
If a request expectation has no response specified, the algorithm will search your backend definitions for an appropriate response.
If a request didn't match any expectation or if the expectation doesn't have the response defined, the backend definitions are evaluated in sequential order to see if any of them match the request. The response from the first matched definition is returned.
Flushing HTTP requests
----------------------
The $httpBackend used in production always responds to requests asynchronously. If we preserved this behavior in unit testing, we'd have to create async unit tests, which are hard to write, to follow and to maintain. But neither can the testing mock respond synchronously; that would change the execution of the code under test. For this reason, the mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending requests. This preserves the async api of the backend, while allowing the test to execute synchronously.
Unit testing with mock $httpBackend
-----------------------------------
The following code shows how to setup and use the mock backend when unit testing a controller. First we create the controller under test:
```
// The module code
angular
.module('MyApp', [])
.controller('MyController', MyController);
// The controller code
function MyController($scope, $http) {
var authToken;
$http.get('/auth.py').then(function(response) {
authToken = response.headers('A-Token');
$scope.user = response.data;
}).catch(function() {
$scope.status = 'Failed...';
});
$scope.saveMessage = function(message) {
var headers = { 'Authorization': authToken };
$scope.status = 'Saving...';
$http.post('/add-msg.py', message, { headers: headers } ).then(function(response) {
$scope.status = '';
}).catch(function() {
$scope.status = 'Failed...';
});
};
}
```
Now we setup the mock backend and create the test specs:
```
// testing controller
describe('MyController', function() {
var $httpBackend, $rootScope, createController, authRequestHandler;
// Set up the module
beforeEach(module('MyApp'));
beforeEach(inject(function($injector) {
// Set up the mock http service responses
$httpBackend = $injector.get('$httpBackend');
// backend definition common for all tests
authRequestHandler = $httpBackend.when('GET', '/auth.py')
.respond({userId: 'userX'}, {'A-Token': 'xxx'});
// Get hold of a scope (i.e. the root scope)
$rootScope = $injector.get('$rootScope');
// The $controller service is used to create instances of controllers
var $controller = $injector.get('$controller');
createController = function() {
return $controller('MyController', {'$scope' : $rootScope });
};
}));
afterEach(function() {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('should fetch authentication token', function() {
$httpBackend.expectGET('/auth.py');
var controller = createController();
$httpBackend.flush();
});
it('should fail authentication', function() {
// Notice how you can change the response even after it was set
authRequestHandler.respond(401, '');
$httpBackend.expectGET('/auth.py');
var controller = createController();
$httpBackend.flush();
expect($rootScope.status).toBe('Failed...');
});
it('should send msg to server', function() {
var controller = createController();
$httpBackend.flush();
// now you don’t care about the authentication, but
// the controller will still send the request and
// $httpBackend will respond without you having to
// specify the expectation and response for this request
$httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, '');
$rootScope.saveMessage('message content');
expect($rootScope.status).toBe('Saving...');
$httpBackend.flush();
expect($rootScope.status).toBe('');
});
it('should send auth header', function() {
var controller = createController();
$httpBackend.flush();
$httpBackend.expectPOST('/add-msg.py', undefined, function(headers) {
// check if the header was sent, if it wasn't the expectation won't
// match the request and the test will fail
return headers['Authorization'] === 'xxx';
}).respond(201, '');
$rootScope.saveMessage('whatever');
$httpBackend.flush();
});
});
```
Dynamic responses
-----------------
You define a response to a request by chaining a call to `respond()` onto a definition or expectation. If you provide a **callback** as the first parameter to `respond(callback)` then you can dynamically generate a response based on the properties of the request.
The `callback` function should be of the form `function(method, url, data, headers, params)`.
### Query parameters
By default, query parameters on request URLs are parsed into the `params` object. So a request URL of `/list?q=searchstr&orderby=-name` would set `params` to be `{q: 'searchstr', orderby: '-name'}`.
### Regex parameter matching
If an expectation or definition uses a **regex** to match the URL, you can provide an array of **keys** via a `params` argument. The index of each **key** in the array will match the index of a **group** in the **regex**.
The `params` object in the **callback** will now have properties with these keys, which hold the value of the corresponding **group** in the **regex**.
This also applies to the `when` and `expect` shortcut methods.
```
$httpBackend.expect('GET', /\/user\/(.+)/, undefined, undefined, ['id'])
.respond(function(method, url, data, headers, params) {
// for requested url of '/user/1234' params is {id: '1234'}
});
$httpBackend.whenPATCH(/\/user\/(.+)\/article\/(.+)/, undefined, undefined, ['user', 'article'])
.respond(function(method, url, data, headers, params) {
// for url of '/user/1234/article/567' params is {user: '1234', article: '567'}
});
```
Matching route requests
-----------------------
For extra convenience, `whenRoute` and `expectRoute` shortcuts are available. These methods offer colon delimited matching of the url path, ignoring the query string and trailing slashes. This allows declarations similar to how application routes are configured with `$routeProvider`. Because these methods convert the definition url to regex, declaration order is important. Combined with query parameter parsing, the following is possible:
```
$httpBackend.whenRoute('GET', '/users/:id')
.respond(function(method, url, data, headers, params) {
return [200, MockUserList[Number(params.id)]];
});
$httpBackend.whenRoute('GET', '/users')
.respond(function(method, url, data, headers, params) {
var userList = angular.copy(MockUserList),
defaultSort = 'lastName',
count, pages, isPrevious, isNext;
// paged api response '/v1/users?page=2'
params.page = Number(params.page) || 1;
// query for last names '/v1/users?q=Archer'
if (params.q) {
userList = $filter('filter')({lastName: params.q});
}
pages = Math.ceil(userList.length / pagingLength);
isPrevious = params.page > 1;
isNext = params.page < pages;
return [200, {
count: userList.length,
previous: isPrevious,
next: isNext,
// sort field -> '/v1/users?sortBy=firstName'
results: $filter('orderBy')(userList, params.sortBy || defaultSort)
.splice((params.page - 1) * pagingLength, pagingLength)
}];
});
```
Methods
-------
* ### when(method, url, [data], [headers], [keys]);
Creates a new backend definition.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method. |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled.
+ respond –
```
{function([status,] data[, headers, statusText])
| function(function(method, url, data, headers, params)}
```
– The respond method takes a set of static data to be returned or a function that can return an array containing response status (number), response data (Array|Object|string), response headers (Object), HTTP status text (string), and XMLHttpRequest status (string: `complete`, `error`, `timeout` or `abort`). The respond method returns the `requestHandler` object for possible overrides. |
* ### matchLatestDefinitionEnabled([value]);
This method can be used to change which mocked responses `$httpBackend` returns, when defining them with [$httpBackend.when()](%24httpbackend#when.html) (and shortcut methods). By default, `$httpBackend` returns the first definition that matches. When setting `$http.matchLatestDefinitionEnabled(true)`, it will use the last response that matches, i.e. the one that was added last.
```
hb.when('GET', '/url1').respond(200, 'content', {});
hb.when('GET', '/url1').respond(201, 'another', {});
hb('GET', '/url1'); // receives "content"
$http.matchLatestDefinitionEnabled(true)
hb('GET', '/url1'); // receives "another"
hb.when('GET', '/url1').respond(201, 'onemore', {});
hb('GET', '/url1'); // receives "onemore"
```
This is useful if a you have a default response that is overriden inside specific tests.
Note that different from config methods on providers, `matchLatestDefinitionEnabled()` can be changed even when the application is already running.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| value *(optional)* | `Boolean` | value to set, either `true` or `false`. Default is `false`. If omitted, it will return the current value. |
#### Returns
| | |
| --- | --- |
| `$httpBackend``Boolean` | self when used as a setter, and the current value when used as a getter |
* ### whenGET(url, [headers], [keys]);
Creates a new backend definition for GET requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### whenHEAD(url, [headers], [keys]);
Creates a new backend definition for HEAD requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### whenDELETE(url, [headers], [keys]);
Creates a new backend definition for DELETE requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### whenPOST(url, [data], [headers], [keys]);
Creates a new backend definition for POST requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### whenPUT(url, [data], [headers], [keys]);
Creates a new backend definition for PUT requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)` | HTTP request body or function that receives data string and returns true if the data is as expected. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### whenJSONP(url, [keys]);
Creates a new backend definition for JSONP requests. For more info see `when()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### whenRoute(method, url);
Creates a new backend definition that compares only with the requested route.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method. |
| url | `string` | HTTP url string that supports colon param matching. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. See [`when`](%24httpbackend#when.html) for more info. |
* ### expect(method, url, [data], [headers], [keys]);
Creates a new request expectation.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method. |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current definition. |
| data *(optional)* | `string``RegExp``function(string)``Object` | HTTP request body or function that receives data string and returns true if the data is as expected, or Object if request body is in JSON format. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled.
+ respond –
```
{function([status,] data[, headers, statusText])
| function(function(method, url, data, headers, params)}
```
– The respond method takes a set of static data to be returned or a function that can return an array containing response status (number), response data (Array|Object|string), response headers (Object), HTTP status text (string), and XMLHttpRequest status (string: `complete`, `error`, `timeout` or `abort`). The respond method returns the `requestHandler` object for possible overrides. |
* ### expectGET(url, [headers], [keys]);
Creates a new request expectation for GET requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current expectation. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. See #expect for more info. |
* ### expectHEAD(url, [headers], [keys]);
Creates a new request expectation for HEAD requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current expectation. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### expectDELETE(url, [headers], [keys]);
Creates a new request expectation for DELETE requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current expectation. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### expectPOST(url, [data], [headers], [keys]);
Creates a new request expectation for POST requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current expectation. |
| data *(optional)* | `string``RegExp``function(string)``Object` | HTTP request body or function that receives data string and returns true if the data is as expected, or Object if request body is in JSON format. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### expectPUT(url, [data], [headers], [keys]);
Creates a new request expectation for PUT requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current expectation. |
| data *(optional)* | `string``RegExp``function(string)``Object` | HTTP request body or function that receives data string and returns true if the data is as expected, or Object if request body is in JSON format. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### expectPATCH(url, [data], [headers], [keys]);
Creates a new request expectation for PATCH requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives a url and returns true if the url matches the current expectation. |
| data *(optional)* | `string``RegExp``function(string)``Object` | HTTP request body or function that receives data string and returns true if the data is as expected, or Object if request body is in JSON format. |
| headers *(optional)* | `Object``function(Object)` | HTTP headers or function that receives http header object and returns true if the headers match the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### expectJSONP(url, [keys]);
Creates a new request expectation for JSONP requests. For more info see `expect()`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| url | `string``RegExp``function(string)=` | HTTP url or function that receives an url and returns true if the url matches the current expectation. |
| keys *(optional)* | `Array` | Array of keys to assign to regex matches in request url described above. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. |
* ### expectRoute(method, url);
Creates a new request expectation that compares only with the requested route.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| method | `string` | HTTP method. |
| url | `string` | HTTP url string that supports colon param matching. |
#### Returns
| | |
| --- | --- |
| `requestHandler` | Returns an object with `respond` method that controls how a matched request is handled. You can save this object for later use and invoke `respond` again in order to change how a matched request is handled. See [`expect`](%24httpbackend#expect.html) for more info. |
* ### flush([count], [skip]);
Flushes pending requests using the trained responses. Requests are flushed in the order they were made, but it is also possible to skip one or more requests (for example to have them flushed later). This is useful for simulating scenarios where responses arrive from the server in any order.
If there are no pending requests to flush when the method is called, an exception is thrown (as this is typically a sign of programming error).
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| count *(optional)* | `number` | Number of responses to flush. If undefined/null, all pending requests (starting after `skip`) will be flushed. |
| skip *(optional)* | `number` | Number of pending requests to skip. For example, a value of `5` would skip the first 5 pending requests and start flushing from the 6th onwards. *(default: 0)* |
* ### verifyNoOutstandingExpectation();
Verifies that all of the requests defined via the `expect` api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
Typically, you would call this method following each test case that asserts requests using an "afterEach" clause.
```
afterEach($httpBackend.verifyNoOutstandingExpectation);
```
* ### verifyNoOutstandingRequest();
Verifies that there are no outstanding requests that need to be flushed.
Typically, you would call this method following each test case that asserts requests using an "afterEach" clause.
```
afterEach($httpBackend.verifyNoOutstandingRequest);
```
* ### resetExpectations();
Resets all request expectations, but preserves all backend definitions. Typically, you would call resetExpectations during a multiple-phase test when you want to reuse the same instance of $httpBackend mock.
| programming_docs |
angularjs
Improve this Doc View Source $interval
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24interval)%3A%20describe%20your%20change...#L566) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L566) $interval
==============================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
Mock implementation of the $interval service.
Use [`$interval.flush(millis)`](%24interval#flush.html) to move forward by `millis` milliseconds and trigger any functions scheduled to run in that time.
Usage
-----
`$interval(fn, delay, [count], [invokeApply], [Pass]);`
### Arguments
| Param | Type | Details |
| --- | --- | --- |
| fn | `function()` | A function that should be called repeatedly. |
| delay | `number` | Number of milliseconds between each function call. |
| count *(optional)* | `number` | Number of times to repeat. If not set, or 0, will repeat indefinitely. *(default: 0)* |
| invokeApply *(optional)* | `boolean` | If set to `false` skips model dirty checking, otherwise will invoke `fn` within the [$apply](../../ng/type/%24rootscope.scope#%24apply.html) block. *(default: true)* |
| Pass *(optional)* | `*` | additional parameters to the executed function. |
### Returns
| | |
| --- | --- |
| `promise` | A promise which will be notified on each iteration. |
Methods
-------
* ### cancel(promise);
Cancels a task associated with the `promise`.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| promise | `promise` | A promise from calling the `$interval` function. |
#### Returns
| | |
| --- | --- |
| `boolean` | Returns `true` if the task was successfully cancelled. |
* ### flush(millis);
Runs interval tasks scheduled to be run in the next `millis` milliseconds.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| millis | `number` | maximum timeout amount to flush up until. |
#### Returns
| | |
| --- | --- |
| `number` | The amount of time moved forward. |
angularjs
Improve this Doc View Source $timeout
[Improve this Doc](https://github.com/angular/angular.js/edit/v1.8.x/src/ngMock/angular-mocks.js?message=docs(%24timeout)%3A%20describe%20your%20change...#L2294) [View Source](https://github.com/angular/angular.js/tree/v1.8.2/src/ngMock/angular-mocks.js#L2294) $timeout
==============================================================================================================================================================================================================================================================================
1. service in module [ngMock](../../ngmock)
Overview
--------
This service is just a simple decorator for [$timeout](../../ng/service/%24timeout) service that adds a "flush" and "verifyNoPendingTasks" methods.
Methods
-------
* ### flush([delay]);
Flushes the queue of pending tasks.
*This method is essentially an alias of [`$flushPendingTasks`](%24flushpendingtasks).*
For historical reasons, this method will also flush non-`$timeout` pending tasks, such as [`$q`](../../ng/service/%24q) promises and tasks scheduled via [$applyAsync](../../ng/type/%24rootscope.scope#%24applyAsync.html) and [$evalAsync](../../ng/type/%24rootscope.scope#%24evalAsync.html).
**Deprecated:** (since 1.7.3) This method flushes all types of tasks (not only timeouts), which is unintuitive. It is recommended to use [`$flushPendingTasks`](%24flushpendingtasks) instead.
#### Parameters
| Param | Type | Details |
| --- | --- | --- |
| delay *(optional)* | `number` | maximum timeout amount to flush up until |
* ### verifyNoPendingTasks();
Verifies that there are no pending tasks that need to be flushed. It throws an error if there are still pending tasks.
*This method is essentially an alias of [`$verifyNoPendingTasks`](%24verifynopendingtasks) (called with no arguments).*
For historical reasons, this method will also verify non-`$timeout` pending tasks, such as pending [`$http`](../../ng/service/%24http) requests, in-progress [`$route`](../../ngroute/service/%24route) transitions, unresolved [`$q`](../../ng/service/%24q) promises and tasks scheduled via [$applyAsync](../../ng/type/%24rootscope.scope#%24applyAsync.html) and [$evalAsync](../../ng/type/%24rootscope.scope#%24evalAsync.html).
It is recommended to use [`$verifyNoPendingTasks`](%24verifynopendingtasks) instead, which additionally supports verifying a specific type of tasks. For example, you can verify there are no pending timeouts with `$verifyNoPendingTasks('$timeout')`.
**Deprecated:** (since 1.7.3) This method takes all types of tasks (not only timeouts) into account, which is unintuitive. It is recommended to use [`$verifyNoPendingTasks`](%24verifynopendingtasks) instead, which additionally allows checking for timeouts only (with `$verifyNoPendingTasks('$timeout')`).
mariadb MariaDB Server Documentation MariaDB Server Documentation
=============================
Documentation on using MariaDB Server.
A PDF version of the documentation is available for download at <https://mariadb.org/download/>.
| Title | Description |
| --- | --- |
### [Using MariaDB Server](using-mariadb-server/index)
| Title | Description |
| --- | --- |
| [SQL Statements & Structure](sql-statements-structure/index) | SQL statements, structure, and rules. |
| [Built-in Functions](built-in-functions/index) | Functions and procedures in MariaDB. |
| [Clients & Utilities](clients-utilities/index) | Client and utility programs for MariaDB. |
### [MariaDB Administration](mariadb-administration/index)
| Title | Description |
| --- | --- |
| [Getting, Installing, and Upgrading MariaDB](getting-installing-and-upgrading-mariadb/index) | Getting, installing, and upgrading MariaDB Server and related software. |
| [User & Server Security](user-server-security/index) | Creating users, granting privileges, and encryption. |
| [Backing Up and Restoring Databases](backing-up-and-restoring-databases/index) | Tools and methods for backing up and restoring databases. |
| [Server Monitoring & Logs](server-monitoring-logs/index) | Monitoring MariaDB Server and enabling and using logs. |
| [Partitioning Tables](partitioning-tables/index) | Splitting huge tables into multiple table files. |
| [MariaDB Audit Plugin](mariadb-audit-plugin/index) | Logging user activity with the MariaDB Audit Plugin. |
| [Variables and Modes](variables-and-modes/index) | Server variables and SQL modes. |
| [Copying Tables Between Different MariaDB Databases and MariaDB Servers](copying-tables-between-different-mariadb-databases-and-mariadb-servers/index) | Copy table files. |
### [High Availability & Performance Tuning](replication-cluster-multi-master/index)
| Title | Description |
| --- | --- |
| [MariaDB Replication](standard-replication/index) | Documentation on standard primary and replica replication. |
| [MariaDB Galera Cluster](galera-cluster/index) | MariaDB Galera Cluster is a virtually synchronous multi-master cluster. |
| [Optimization and Tuning](optimization-and-tuning/index) | Using indexes, writing better queries and adjusting variables for better performance. |
| [Multi Master in maria db](multi-master-in-maria-db/index) | Can we configure Multi Master in Maria Db. I have testing three node A, B, ... |
| [Multi master replication and deadlock detection in Galera with Mariadbs](multi-master-replication-and-deadlock-detection-in-galera-with-mariadbs/index) | Hi, We have multi master Galera replication setup where three master maria... |
### [Columns, Storage Engines, and Plugins](columns-storage-engines-and-plugins/index)
| Title | Description |
| --- | --- |
| [Data Types](data-types/index) | Data types for columns in MariaDB tables. |
| [Character Sets and Collations](character-sets/index) | Setting character set and collation for a language. |
| [Storage Engines](storage-engines/index) | Various storage engines available for MariaDB. |
| [Plugins](plugins/index) | Documentation on MariaDB Server plugins. |
### [Programming & Customizing MariaDB](programming-customizing-mariadb/index)
| Title | Description |
| --- | --- |
| [Programmatic & Compound Statements](programmatic-compound-statements/index) | Compound SQL statements for stored routines and in general. |
| [Stored Routines](stored-routines/index) | Stored procedures and functions. |
| [Triggers & Events](triggers-events/index) | Creating triggers and scheduled events within MariaDB. |
| [Views](views/index) | Stored queries for generating a virtual table. |
| [User-Defined Functions](user-defined-functions/index) | Extending MariaDB with custom functions. |
| [assertion](assertion/index) | how to create assertion in mariadb? |
### Other MariaDB Server Documentation Articles
| Title | Description |
| --- | --- |
| [MariaDB Platform X3](mariadb-platform-x3/index) | MariaDB Platform X3 integrates MariaDB Server, MariaDB ColumnStore, and Mar... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema Performance Schema
===================
The MariaDB Performance Schema is a feature for monitoring the performance of your MariaDB server.
| Title | Description |
| --- | --- |
| [Performance Schema Tables](../performance-schema-tables/index) | Tables making up the MariaDB Performance Schema. |
| [Performance Schema Overview](../performance-schema-overview/index) | Quick overview of the Performance Schema. |
| [Performance Schema Status Variables](../performance-schema-status-variables/index) | Performance Schema status variables. |
| [Performance Schema System Variables](../performance-schema-system-variables/index) | Performance Schema system variables. |
| [Performance Schema Digests](../performance-schema-digests/index) | Normalized statements with data values removed |
| [PERFORMANCE\_SCHEMA Storage Engine](../performance_schema-storage-engine/index) | PERFORMANCE\_SCHEMA storage engine, a mechanism for implementing the feature. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SHOW RELAYLOG EVENTS SHOW RELAYLOG EVENTS
====================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
Syntax
------
```
SHOW RELAYLOG ['connection_name'] EVENTS
[IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]
[ FOR CHANNEL 'channel_name']
```
Description
-----------
On [replicas](../standard-replication/index), this command shows the events in the [relay log](../relay-log/index). If `'log_name'` is not specified, the first relay log is shown.
Syntax for the `LIMIT` clause is the same as for [SELECT ... LIMIT](../select/index#limit).
Using the `LIMIT` clause is highly recommended because the `SHOW RELAYLOG EVENTS` command returns the complete contents of the relay log, which can be quite large.
This command does not return events related to setting user and system variables. If you need those, use [mariadb-binlog/mysqlbinlog](../mysqlbinlog/index).
On the primary, this command does nothing.
Requires the [REPLICA MONITOR](../grant/index#replica-monitor) privilege (>= [MariaDB 10.5.9](https://mariadb.com/kb/en/mariadb-1059-release-notes/)), the [REPLICATION SLAVE ADMIN](../grant/index#replication-slave-admin) privilege (>= [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)) or the [REPLICATION SLAVE](../grant/index#replication-slave) privilege (<= [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)).
#### connection\_name
If there is only one nameless primary, or the default primary (as specified by the [default\_master\_connection](../replication-and-binary-log-server-system-variables/index#default_master_connection) system variable) is intended, `connection_name` can be omitted. If provided, the `SHOW RELAYLOG` statement will apply to the specified primary. `connection_name` is case-insensitive.
**MariaDB starting with [10.7.0](https://mariadb.com/kb/en/mariadb-1070-release-notes/)**The `FOR CHANNEL` keyword was added for MySQL compatibility. This is identical as using the channel\_name directly after `SHOW RELAYLOG`.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ANALYZE TABLE ANALYZE TABLE
=============
Syntax
------
```
ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...]
[PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])]
[INDEXES ([index_name [,index_name ...]])]]
```
Description
-----------
`ANALYZE TABLE` analyzes and stores the key distribution for a table ([index statistics](../index-statistics/index)). This statement works with [MyISAM](../myisam/index), [Aria](../aria/index) and [InnoDB](../innodb/index) tables. During the analysis, InnoDB will allow reads/writes, and MyISAM/Aria reads/inserts. For MyISAM tables, this statement is equivalent to using [myisamchk --analyze](../myisamchk/index).
For more information on how the analysis works within InnoDB, see [InnoDB Limitations](../innodb-limitations/index#table-analysis).
MariaDB uses the stored key distribution to decide the order in which tables should be joined when you perform a join on something other than a constant. In addition, key distributions can be used when deciding which indexes to use for a specific table within a query.
This statement requires [SELECT and INSERT privileges](../grant/index) for the table.
By default, ANALYZE TABLE statements are written to the [binary log](../binary-log/index) and will be [replicated](../replication/index). The `NO_WRITE_TO_BINLOG` keyword (`LOCAL` is an alias) will ensure the statement is not written to the binary log.
From [MariaDB 10.3.19](https://mariadb.com/kb/en/mariadb-10319-release-notes/), `ANALYZE TABLE` statements are not logged to the binary log if [read\_only](../server-system-variables/index#read_only) is set. See also [Read-Only Replicas](../read-only-replicas/index).
`ANALYZE TABLE` is also supported for partitioned tables. You can use `[ALTER TABLE](../alter-table/index) ... ANALYZE PARTITION` to analyze one or more partitions.
The [Aria](../aria/index) storage engine supports [progress reporting](../progress-reporting/index) for the `ANALYZE TABLE` statement.
Engine-Independent Statistics
-----------------------------
`ANALYZE TABLE` supports [engine-independent statistics](../engine-independent-table-statistics/index). See [Engine-Independent Table Statistics: Collecting Statistics with the ANALYZE TABLE Statement](../engine-independent-table-statistics/index#collecting-statistics-with-the-analyze-table-statement) for more information.
See Also
--------
* [Index Statistics](../index-statistics/index)
* [InnoDB Persistent Statistics](../innodb-persistent-statistics/index)
* [Progress Reporting](../progress-reporting/index)
* [Engine-independent Statistics](../engine-independent-table-statistics/index)
* [Histogram-based Statistics](../histogram-based-statistics/index)
* [ANALYZE Statement](../analyze-statement/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema INNODB_CMP_PER_INDEX and INNODB_CMP_PER_INDEX_RESET Tables Information Schema INNODB\_CMP\_PER\_INDEX and INNODB\_CMP\_PER\_INDEX\_RESET Tables
====================================================================================
The `INNODB_CMP_PER_INDEX` and `INNODB_CMP_PER_INDEX_RESET` tables contain status information on compression operations related to [compressed XtraDB/InnoDB tables](../innodb-storage-formats/index#compressed), grouped by individual indexes. These tables are only populated if the [innodb\_cmp\_per\_index\_enabled](../innodb-system-variables/index#innodb_cmp_per_index_enabled) system variable is set to `ON`.
The [PROCESS](../grant/index#global-privileges) privilege is required to query this table.
These tables contains the following columns:
| Column Name | Description |
| --- | --- |
| `DATABASE_NAME` | Database containing the index. |
| `TABLE_NAME` | Table containing the index. |
| `INDEX_NAME` | Other values are totals which refer to this index's compression. |
| `COMPRESS_OPS` | How many times a page of `INDEX_NAME` has been compressed. This happens when a new page is created because the compression log runs out of space. This value includes both successful operations and *compression failures*. |
| `COMPRESS_OPS_OK` | How many times a page of `INDEX_NAME` has been successfully compressed. This value should be as close as possible to `COMPRESS_OPS`. If it is notably lower, either avoid compressing some tables, or increase the KEY\_BLOCK\_SIZE for some compressed tables. |
| `COMPRESS_TIME` | Time (in seconds) spent to compress pages of the size `PAGE_SIZE`. This value includes time spent in *compression failures*. |
| `UNCOMPRESS_OPS` | How many times a page of `INDEX_NAME` has been uncompressed. This happens when an uncompressed version of a page is created in the buffer pool, or when a *compression failure* occurs. |
| `UNCOMPRESS_TIME` | Time (in seconds) spent to uncompress pages of `INDEX_NAME`. |
These tables can be used to measure the effectiveness of XtraDB/InnoDB compression, per table or per index. The values in these tables show which tables perform better with index compression, and which tables cause too many *compression failures* or perform too many compression/uncompression operations. When compression performs badly for a table, this might mean that you should change its `KEY_BLOCK_SIZE`, or that the table should not be compressed.
`INNODB_CMP_PER_INDEX` and `INNODB_CMP_PER_INDEX_RESET` have the same columns and always contain the same values, but when `INNODB_CMP_PER_INDEX_RESET` is queried, both the tables are cleared. `INNODB_CMP_PER_INDEX_RESET` can be used, for example, if a script periodically logs the performances of compression in the last period of time. `INNODB_CMP_PER_INDEX` can be used to see the cumulated statistics.
See Also
--------
Other tables that can be used to monitor XtraDB/InnoDB compressed tables:
* [INNODB\_CMP and INNODB\_CMP\_RESET](../information_schemainnodb_cmp-and-innodb_cmp_reset-tables/index)
* [INNODB\_CMPMEM and INNODB\_CMPMEM\_RESET](../information_schemainnodb_cmpmem-and-innodb_cmpmem_reset-tables/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb SELECT WITH ROLLUP SELECT WITH ROLLUP
==================
Syntax
------
See [SELECT](../select/index) for the full syntax.
Description
-----------
The `WITH ROLLUP` modifier adds extra rows to the resultset that represent super-aggregate summaries. The super-aggregated column is represented by a `NULL` value. Multiple aggregates over different columns will be added if there are multiple `GROUP BY` columns.
The [LIMIT](../limit/index) clause can be used at the same time, and is applied after the `WITH ROLLUP` rows have been added.
`WITH ROLLUP` cannot be used with [ORDER BY](../order-by/index). Some sorting is still possible by using `ASC` or `DESC` clauses with the `GROUP BY` column, although the super-aggregate rows will always be added last.
Examples
--------
These examples use the following sample table
```
CREATE TABLE booksales (
country VARCHAR(35), genre ENUM('fiction','non-fiction'), year YEAR, sales INT);
INSERT INTO booksales VALUES
('Senegal','fiction',2014,12234), ('Senegal','fiction',2015,15647),
('Senegal','non-fiction',2014,64980), ('Senegal','non-fiction',2015,78901),
('Paraguay','fiction',2014,87970), ('Paraguay','fiction',2015,76940),
('Paraguay','non-fiction',2014,8760), ('Paraguay','non-fiction',2015,9030);
```
The addition of the `WITH ROLLUP` modifier in this example adds an extra row that aggregates both years:
```
SELECT year, SUM(sales) FROM booksales GROUP BY year;
+------+------------+
| year | SUM(sales) |
+------+------------+
| 2014 | 173944 |
| 2015 | 180518 |
+------+------------+
2 rows in set (0.08 sec)
SELECT year, SUM(sales) FROM booksales GROUP BY year WITH ROLLUP;
+------+------------+
| year | SUM(sales) |
+------+------------+
| 2014 | 173944 |
| 2015 | 180518 |
| NULL | 354462 |
+------+------------+
```
In the following example, each time the genre, the year or the country change, another super-aggregate row is added:
```
SELECT country, year, genre, SUM(sales)
FROM booksales GROUP BY country, year, genre;
+----------+------+-------------+------------+
| country | year | genre | SUM(sales) |
+----------+------+-------------+------------+
| Paraguay | 2014 | fiction | 87970 |
| Paraguay | 2014 | non-fiction | 8760 |
| Paraguay | 2015 | fiction | 76940 |
| Paraguay | 2015 | non-fiction | 9030 |
| Senegal | 2014 | fiction | 12234 |
| Senegal | 2014 | non-fiction | 64980 |
| Senegal | 2015 | fiction | 15647 |
| Senegal | 2015 | non-fiction | 78901 |
+----------+------+-------------+------------+
SELECT country, year, genre, SUM(sales)
FROM booksales GROUP BY country, year, genre WITH ROLLUP;
+----------+------+-------------+------------+
| country | year | genre | SUM(sales) |
+----------+------+-------------+------------+
| Paraguay | 2014 | fiction | 87970 |
| Paraguay | 2014 | non-fiction | 8760 |
| Paraguay | 2014 | NULL | 96730 |
| Paraguay | 2015 | fiction | 76940 |
| Paraguay | 2015 | non-fiction | 9030 |
| Paraguay | 2015 | NULL | 85970 |
| Paraguay | NULL | NULL | 182700 |
| Senegal | 2014 | fiction | 12234 |
| Senegal | 2014 | non-fiction | 64980 |
| Senegal | 2014 | NULL | 77214 |
| Senegal | 2015 | fiction | 15647 |
| Senegal | 2015 | non-fiction | 78901 |
| Senegal | 2015 | NULL | 94548 |
| Senegal | NULL | NULL | 171762 |
| NULL | NULL | NULL | 354462 |
+----------+------+-------------+------------+
```
The LIMIT clause, applied after WITH ROLLUP:
```
SELECT country, year, genre, SUM(sales)
FROM booksales GROUP BY country, year, genre WITH ROLLUP LIMIT 4;
+----------+------+-------------+------------+
| country | year | genre | SUM(sales) |
+----------+------+-------------+------------+
| Paraguay | 2014 | fiction | 87970 |
| Paraguay | 2014 | non-fiction | 8760 |
| Paraguay | 2014 | NULL | 96730 |
| Paraguay | 2015 | fiction | 76940 |
+----------+------+-------------+------------+
```
Sorting by year descending:
```
SELECT country, year, genre, SUM(sales)
FROM booksales GROUP BY country, year DESC, genre WITH ROLLUP;
+----------+------+-------------+------------+
| country | year | genre | SUM(sales) |
+----------+------+-------------+------------+
| Paraguay | 2015 | fiction | 76940 |
| Paraguay | 2015 | non-fiction | 9030 |
| Paraguay | 2015 | NULL | 85970 |
| Paraguay | 2014 | fiction | 87970 |
| Paraguay | 2014 | non-fiction | 8760 |
| Paraguay | 2014 | NULL | 96730 |
| Paraguay | NULL | NULL | 182700 |
| Senegal | 2015 | fiction | 15647 |
| Senegal | 2015 | non-fiction | 78901 |
| Senegal | 2015 | NULL | 94548 |
| Senegal | 2014 | fiction | 12234 |
| Senegal | 2014 | non-fiction | 64980 |
| Senegal | 2014 | NULL | 77214 |
| Senegal | NULL | NULL | 171762 |
| NULL | NULL | NULL | 354462 |
+----------+------+-------------+------------+
```
See Also
--------
* [SELECT](../select/index)
* [Joins and Subqueries](../joins-subqueries/index)
* [LIMIT](../limit/index)
* [ORDER BY](../order-by/index)
* [GROUP BY](../group-by/index)
* [Common Table Expressions](../common-table-expressions/index)
* [SELECT INTO OUTFILE](../select-into-outfile/index)
* [SELECT INTO DUMPFILE](../select-into-dumpfile/index)
* [FOR UPDATE](../for-update/index)
* [LOCK IN SHARE MODE](../lock-in-share-mode/index)
* [Optimizer Hints](../optimizer-hints/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MASTER_GTID_WAIT MASTER\_GTID\_WAIT
==================
Syntax
------
```
MASTER_GTID_WAIT(gtid-list[, timeout)
```
Description
-----------
This function takes a string containing a comma-separated list of [global transaction id's](../global-transaction-id/index) (similar to the value of, for example, [gtid\_binlog\_pos](../global-transaction-id/index#gtid_binlog_pos)). It waits until the value of [gtid\_slave\_pos](../global-transaction-id/index#gtid_slave_pos) has the same or higher seq\_no within all replication domains specified in the gtid-list; in other words, it waits until the slave has reached the specified GTID position.
An optional second argument gives a timeout in seconds. If the timeout expires before the specified GTID position is reached, then the function returns -1. Passing NULL or a negative number for the timeout means no timeout, and the function will wait indefinitely.
If the wait completes without a timeout, 0 is returned. Passing NULL for the gtid-list makes the function return NULL immediately, without waiting.
The gtid-list may be the empty string, in which case MASTER\_GTID\_WAIT() returns immediately. If the gtid-list contains fewer domains than [gtid\_slave\_pos](../global-transaction-id/index#gtid_slave_pos), then only those domains are waited upon. If gtid-list contains a domain that is not present in @@gtid\_slave\_pos, then MASTER\_GTID\_WAIT() will wait until an event containing such domain\_id arrives on the slave (or until timed out or killed).
MASTER\_GTID\_WAIT() can be useful to ensure that a slave has caught up to a master. Simply take the value of [gtid\_binlog\_pos](../global-transaction-id/index#gtid_binlog_pos) on the master, and use it in a MASTER\_GTID\_WAIT() call on the slave; when the call completes, the slave will have caught up with that master position.
MASTER\_GTID\_WAIT() can also be used in client applications together with the [last\_gtid](../global-transaction-id/index#last_gtid) session variable. This is useful in a read-scaleout [replication](../replication/index) setup, where the application writes to a single master but divides the reads out to a number of slaves to distribute the load. In such a setup, there is a risk that an application could first do an update on the master, and then a bit later do a read on a slave, and if the slave is not fast enough, the data read from the slave might not include the update just made, possibly confusing the application and/or the end-user. One way to avoid this is to request the value of [last\_gtid](../global-transaction-id/index#last_gtid) on the master just after the update. Then before doing the read on the slave, do a MASTER\_GTID\_WAIT() on the value obtained from the master; this will ensure that the read is not performed until the slave has replicated sufficiently far for the update to have become visible.
Note that MASTER\_GTID\_WAIT() can be used even if the slave is configured not to use GTID for connections ([CHANGE MASTER TO master\_use\_gtid=no](../change-master-to/index#master_use_gtid)). This is because from MariaDB 10, GTIDs are always logged on the master server, and always recorded on the slave servers.
Differences to MASTER\_POS\_WAIT()
----------------------------------
* MASTER\_GTID\_WAIT() is global; it waits for any master connection to reach the specified GTID position. [MASTER\_POS\_WAIT()](../master_pos_wait/index) works only against a specific connection. This also means that while MASTER\_POS\_WAIT() aborts if its master connection is terminated with [STOP SLAVE](../stop-slave/index) or due to an error, MASTER\_GTID\_WAIT() continues to wait while slaves are stopped.
* MASTER\_GTID\_WAIT() can take its timeout as a floating-point value, so a timeout in fractional seconds is supported, eg. MASTER\_GTID\_WAIT("0-1-100", 0.5). (The minimum wait is one microsecond, 0.000001 seconds).
* MASTER\_GTID\_WAIT() allows one to specify a timeout of zero in order to do a non-blocking check to see if the slaves have progressed to a specific GTID position (MASTER\_POS\_WAIT() takes a zero timeout as meaning an infinite wait). To do an infinite MASTER\_GTID\_WAIT(), specify a negative timeout, or omit the timeout argument.
* MASTER\_GTID\_WAIT() does not return the number of events executed since the wait started, nor does it return NULL if a slave thread is stopped. It always returns either 0 for successful wait completed, or -1 for timeout reached (or NULL if the specified gtid-pos is NULL).
Since MASTER\_GTID\_WAIT() looks only at the seq\_no part of the GTIDs, not the server\_id, care is needed if a slave becomes diverged from another server so that two different GTIDs with the same seq\_no (in the same domain) arrive at the same server. This situation is in any case best avoided; setting [gtid\_strict\_mode](../global-transaction-id/index#gtid_strict_mode) is recommended, as this will prevent any such out-of-order sequence numbers from ever being replicated on a slave.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysqlbinlog Options mysqlbinlog Options
===================
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-binlog` is a symlink to `mysqlbinlog`.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mariadb-binlog` is the name of the tool, with `mysqlbinlog` a symlink .
[mysqlbinlog](../mysqlbinlog/index) is a utility included with MariaDB for processing [binary log](../binary-log/index) and [relay log](../relay-log/index) files.
Options
-------
The following options are supported by [mysqlbinlog](../mysqlbinlog/index). They can be specified on the command line or in option files:
| Option | default value | Description | Introduced
|
| --- | --- | --- | --- |
| `-?`, `--help` | | Display a help statement. | |
| `--base64-output=name` (>= [MariaDB 10.6.1](https://mariadb.com/kb/en/mariadb-1061-release-notes/), [MariaDB 10.5.11](https://mariadb.com/kb/en/mariadb-10511-release-notes/)) | `auto` | Determine when the output statements should be base64-encoded BINLOG statements. Options (case-insensitive) include `auto`, `unspec`, `never` and `decode-rows`. `never` neither prints base64 encodings nor verbose event data, and will exit on error if a [row-based event](../binary-log-formats/index) is found. This option is useful for binlogs that are entirely statement based. `decode-rows` decodes row events into commented SQL statements if the `--verbose` option is also given. It can enhance the debugging experience with large binary log files, as the raw data will be omitted. Unlike *never*, *mysqlbinlog* will not exit with an error if a row event is found. `auto` (synonymous with *unspec*) outputs base64 encoded entries for [row-based](../binary-log-formats/index) and format description events; it should be used when ROW-format events are processed for re-executing on the MariaDB server. This behavior is presumed, such that `auto` is the default value when no option specification is provided. The other option values are intended only for debugging or testing purposes because they may produce output that does not include all events in executable form. | |
| `--base64-output[=name]` (<= [MariaDB 10.6.0](https://mariadb.com/kb/en/mariadb-1060-release-notes/), [MariaDB 10.5.10](https://mariadb.com/kb/en/mariadb-10510-release-notes/)) | *(No default Value)* | Determine when the output statements should be base64-encoded BINLOG statements. Options (case-insensitive) include `auto`, `unspec`, `always` (deprecated), `never` and `decode-rows`. `never` disables it and works only for binlogs without [row-based events](../binary-log-formats/index); `decode-rows` decodes row events into commented SQL statements if the `--verbose` option is also given; Unlike *never*, *mysqlbinlog* does not exit with an error if a row event is found `auto` or `unspec`, the default, prints base64 only when necessary (i.e., for [row-based events](../binary-log-formats/index) and format description events), and is the only safe behavior if you intend to use the output of mysqlbinlog to re-execute binary log file contents. The other option values are intended only for debugging or testing purposes because they may produce output that does not include all events in executable form.; `always` prints base64 whenever possible, and is for debugging only and should not be used in a production system. If this option is not given, the default is `auto`; if it is given with no argument, `always` is used. | |
| `--binlog-row-event-max-size=val` | 4294967040 (4GB) | The maximum size in bytes of a row-based [binary log](../binary-log/index) event. Should be a multiple of 256. Minimum 256, maximum 18446744073709547520. | |
| `--character-sets-dir=name` | *(No default value)* | Directory where the [character sets](../data-types-character-sets-and-collations/index) are. | |
| `-d`, `--database=name` | *(No default value)* | Output entries from the binary log (local log only) that occur while *name* has been selected as the default database by [USE](../use/index). Only one database can be specified. The effects depend on whether the [statement-based or row-based logging format](../binary-log-formats/index) is in use. For statement-based logging, the server will only log statements where the default database is *name*. The default database is set with the [USE](../use/index) statement. For row-based logging, the server will log any updates to any tables in the named database, irrespective of the current database. Ignored in `--raw` mode. | |
| `-# [options]`, `--debug[=options]` | `d:t:o,/tmp/mysqlbinlog.trace` | In a debug build, write a debugging log. A typical debug options string is `d:t:o,file_name`. | |
| `--debug-check` | FALSE | Print some debug info at exit.. | |
| `--debug-info` | FALSE | Print some debug info and memory and CPU info at exit. | |
| `--default-auth=name` | | Default authentication client-side plugin to use. | |
| `--defaults-extra-file=name` | | Read the file *name*, which can be the full path, or the path relative to the current directory, after the global files are read. | |
| `--defaults-file=name` | | Only read default options from the given file name, which can be the full path, or the path relative to the current directory. | |
| `--defaults-group-suffix=str` | | Also read groups with a suffix of *str*. For example, since *mysqlbinlog* normally reads the [client] and [mysqlbinlog] groups, `--defaults-group-suffix=x` would cause it to also read the groups [mysqlbinlog\_x] and [client\_x]. | |
| `-D`, `--disable-log-bin` | FALSE | Disable binary log. This is useful, if you enabled `--to-last-log` and are sending the output to the same MariaDB server. This way you could avoid an endless loop. You would also like to use it when restoring after a crash to avoid duplication of the statements you already have. NOTE: you will need a SUPER privilege to use this option. | |
| `--do-domain-ids=name` | *(No default value)* | A list of positive integers, separated by commas, that form a whitelist of domain ids. Any log event with a [GTID](../gtid/index) that originates from a domain id specified in this list is displayed. Cannot be used with `--ignore-domain-ids`. When used with `--ignore-server-ids` or `--do-server-ids`, the result is the intersection between the two datasets | [MariaDB 10.9.0](https://mariadb.com/kb/en/mariadb-1090-release-notes/) |
| `--do-server-ids=name` | *(No default value)* | A list of positive integers, separated by commas, that form a whitelist of server ids. Any log event originating from a server id specified in this list is displayed. Cannot be used with `--ignore-server-ids`. When used with `--ignore-domain-ids` or `do-domain-ids`, the result is the intersection between the two datasets. Alias for `--server-id`. | [MariaDB 10.9.0](https://mariadb.com/kb/en/mariadb-1090-release-notes/) |
| `-B`, `--flashback` | FALSE | Support [flashback](../flashback/index) mode. | [MariaDB 10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/) |
| `-F`, `--force-if-open` | TRUE | Force if binlog was not closed properly. Defaults to ON; use `--skip-force-if-open` to disable. | |
| `-f`, `--force-read` | FALSE | If *mysqlbinlog* reads a binary log event that it does not recognize, it prints a warning, ignores the event, and continues. Without this option, mysqlbinlog stops if it reads such an event. | |
| `--gtid-strict-mode` | TRUE | Process binlog according to gtid-strict-mode specification. The start, stop positions are verified to satisfy start < stop comparison condition. Sequence numbers of any [gtid](../gtid/index) domain must comprise monotically growing sequence, Defaults to on; use `--skip-gtid-strict-mode` to disable. | [MariaDB 10.8.0](https://mariadb.com/kb/en/mariadb-1080-release-notes/) |
| `-H`, `--hexdump` | FALSE | Augment output with hexadecimal and ASCII event dump. | |
| `-h`, `--host=name` | *(No default value)* | Get the binlog from the MariaDB server on the given host. | |
| `--ignore-domain-ids=name` | *(No default value)* | A list of positive integers, separated by commas, that form a blacklist of domain ids. Any log event with a [GTID](../gtid/index) that originates from a domain id specified in this list is hidden. Cannot be used with `--do-domain-ids`. When used with `--ignore-server-ids` or `--do-server-ids`, the result is the intersection between the two datasets. | [MariaDB 10.9.0](https://mariadb.com/kb/en/mariadb-1090-release-notes/) |
| `--ignore-server-ids=name` | *(No default value)* | A list of positive integers, separated by commas, that form a blacklist of server ids. Any log event originating from a server id specified in this list is hidden. Cannot be used with `--do-server-ids`. When used with `--ignore-domain-ids` or `--do-domain-ids`, the result is the intersection between the two datasets. | [MariaDB 10.9.0](https://mariadb.com/kb/en/mariadb-1090-release-notes/) |
| `-l path`, `--local-load=path` | *(No default value)* | Prepare local temporary files for [LOAD DATA INFILE](../load-data-infile/index) in the specified directory. The temporary files are not automatically removed. | |
| `--no-defaults` | | Don't read default options from any option file | |
| `-o value`, `--offset=value` | 0 | Skip the first *value* entries in the log. | |
| `--open_files_limit=#` | 64 | Reserve file descriptors for usage by *mysqlbinlog*. | |
| `-p[passwd]`, `--password[=passwd]` | *(No default value)* | Password to connect to the remote server. The password can be omitted allow it be entered from the prompt, or an option file can be used to avoid the security risk of passing a password on the commandline. | |
| `--plugin-dir=dir_name`, | | Directory for client-side plugins. | |
| `-P num`, `--port=num` | 0 | Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL\_TCP\_PORT, /etc/services, built-in default (3306). | |
| `--position=#` | 4 | Removed in [MariaDB 5.5](../what-is-mariadb-55/index). Use `--start-position` instead. | |
| `--print-defaults` | | Print the program argument list from all option files and exit. | |
| `--print-row-count` | TRUE | Print row counts for each row events. (Defaults to on; use `--skip-print-row-count` to disable.) | [MariaDB 10.3](../what-is-mariadb-103/index) |
| `--print-row-event-positions` | TRUE | Print row event positions. Defaults to on; use `--skip-print-row-event-positions` to disable.) | [MariaDB 10.3](../what-is-mariadb-103/index) |
| `print-table-metadata` | | Print metadata stored in Table\_map\_log\_event. | [MariaDB 10.5.0](https://mariadb.com/kb/en/mariadb-1050-release-notes/) |
| `--protocol=name` | *(No default value)* | The protocol of the connection (tcp,socket,pipe,memory). | |
| `--raw` | | Requires -R. Output raw binlog data instead of SQL statements. Output files named after server logs. | [MariaDB 10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/) |
| `-R`, `--read-from-remote-server` | FALSE | Read binary logs from a remote MariaDB server rather than reading a local log file. Any connection parameter options are ignored unless this option is given as well. These options are `--host`, `--password`, `--port`, `--protocol`, `--socket`, and `--user`. This option requires that the remote server be running. It works only for binary log files on the remote server, not relay log files. | |
| `-r name`, `--result-file=name` | *(No default value)* | Direct output to a given file. With --raw this is a prefix for the file names. | |
| `--rewrite-db=name` | *(No default value)* | Updates to a database with a different name than the original. Example: `rewrite-db='from->to'` For events that are binlogged as statements, rewriting the database constitutes changing a statement's default database from `db1` to `db2`. There is no statement analysis or rewrite of any kind, that is, if one specifies "`db1.tbl`" in the statement explicitly, that occurrence won't be changed to "`db2.tbl`". Row-based events are rewritten correctly to use the new database name. Filtering (e.g. with `--database=name` ) happens *after* the database rewrites have been performed. If you use this option on the command line and "`>`" has a special meaning to your command interpreter, quote the value (e.g. `--rewrite-db="oldname->newname"`). | |
| `--server-id=idnum` | 0 | Extract only binlog entries created by the server having the given id. From [MariaDB 10.9.0](https://mariadb.com/kb/en/mariadb-1090-release-notes/), alias for --do-server-ids. | |
| `--set-charset=character_set` | *(No default value)* | Add '`SET NAMES character_set`' to the output to specify the [character set](../data-types-character-sets-and-collations/index) to be used for processing log files. | |
| `--shared-memory-base-name=name` | MYSQL | Shared-memory name to use for Windows connections using shared memory to a local server (started with the `--shared-memory` option). Case-sensitive. | |
| `-s`, `--short-form` | FALSE | Just show regular queries: no extra info and no row-based events. This is for testing only, and should not be used in production systems. If you want to suppress base64-output, consider using `--base64-output=never` instead. | |
| `--skip-annotate-row-events` | | Skip all [Annotate\_rows](../annotate_rows_log_event/index) events in the mysqlbinlog output (by default, mysqlbinlog prints Annotate\_rows events, if the binary log does contain them). | |
| `-S`, `--socket=name` | *(No default value)* | For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use. | |
| `--ssl` | `FALSE` | Enables [TLS](../data-in-transit-encryption/index). TLS is also enabled even without setting this option when certain other TLS options are set. Starting with [MariaDB 10.2](../what-is-mariadb-102/index), the `--ssl` option will not enable [verifying the server certificate](../secure-connections-overview/index#server-certificate-verification) by default. In order to verify the server certificate, the user must specify the `--ssl-verify-server-cert` option. | |
| `--ssl-ca=name` | | Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for [TLS](../data-in-transit-encryption/index). This option requires that you use the absolute path, not a relative path. See [Secure Connections Overview: Certificate Authorities (CAs)](../secure-connections-overview/index#certificate-authorities-cas) for more information. This option implies the `--ssl` option. | |
| `--ssl-capath=name` | | Defines a path to a directory that contains one or more PEM files that should each contain one X509 certificate for a trusted Certificate Authority (CA) to use for [TLS](../data-in-transit-encryption/index). This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the `[openssl rehash](https://www.openssl.org/docs/man1.1.1/man1/rehash.html)` command. See [Secure Connections Overview: Certificate Authorities (CAs)](../secure-connections-overview/index#certificate-authorities-cas) for more information. This option is only supported if the client was built with OpenSSL or yaSSL. If the client was built with GnuTLS or Schannel, then this option is not supported. See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms. This option implies the `--ssl` option. | |
| `--ssl-cert=name` | | Defines a path to the X509 certificate file to use for [TLS](../data-in-transit-encryption/index). This option requires that you use the absolute path, not a relative path. This option implies the `--ssl` option. | |
| `--ssl-cipher=name` | | List of permitted ciphers or cipher suites to use for [TLS](../data-in-transit-encryption/index). This option implies the `--ssl` option. | |
| `--ssl-crl=name` | | Defines a path to a PEM file that should contain one or more revoked X509 certificates to use for [TLS](../data-in-transit-encryption/index). This option requires that you use the absolute path, not a relative path. See [Secure Connections Overview: Certificate Revocation Lists (CRLs)](../secure-connections-overview/index#certificate-revocation-lists-crls) for more information. This option is only supported if the client was built with OpenSSL or Schannel. If the client was built with yaSSL or GnuTLS, then this option is not supported. See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms. | |
| `--ssl-crlpath=name` | | Defines a path to a directory that contains one or more PEM files that should each contain one revoked X509 certificate to use for [TLS](../data-in-transit-encryption/index). This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the `[openssl rehash](https://www.openssl.org/docs/man1.1.1/man1/rehash.html)` command. See [Secure Connections Overview: Certificate Revocation Lists (CRLs)](../secure-connections-overview/index#certificate-revocation-lists-crls) for more information. This option is only supported if the client was built with OpenSSL. If the client was built with yaSSL, GnuTLS, or Schannel, then this option is not supported. See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms. | |
| `--ssl-key=name` | | Defines a path to a private key file to use for [TLS](../data-in-transit-encryption/index). This option requires that you use the absolute path, not a relative path. This option implies the `--ssl` option. | |
| `--ssl-verify-server-cert` | `FALSE` | Enables [server certificate verification](../secure-connections-overview/index#server-certificate-verification). This option is disabled by default. | |
| `--start-datetime=datetime` | *(No default value)* | Start reading the binlog at first event having a datetime equal to or later than the argument; the argument must be a date and time in the local time zone, in any format accepted by the MariaDB server for [DATETIME](../datetime/index) and [TIMESTAMP](../timestamp/index) types, for example: 2014-12-25 11:25:56 (you should probably use quotes for your shell to set it properly). This option is useful for point-in-time recovery. | |
| `-j pos`, `--start-position=pos` | 4 | Start reading the binlog at this position. Type can either be a positive integer or, from [MariaDB 10.8.0](https://mariadb.com/kb/en/mariadb-1080-release-notes/), a [GTID](../gtid/index) list. When using a positive integer, the value only applies to the first binlog passed on the command line. In GTID mode, multiple GTIDs can be passed as a comma separated list, where each must have a unique domain id. The list represents the gtid binlog state that the client (another "replica" server) is aware of. Therefore, each GTID is exclusive; only events after a given sequence number will be printed to allow users to receive events after their current state. | |
| `--stop-datetime=name` | *(No default value)* | Stop reading the binlog at first event having a datetime equal or posterior to the argument; the argument must be a date and time in the local time zone, in any format accepted by the MariaDB server for DATETIME and TIMESTAMP types, for example: 2014-12-25 11:25:56 (you should probably use quotes for your shell to set it properly). Ignored in `--raw` mode. | |
| `--stop-never` | | Wait for more data from the server instead of stopping at the end of the last log. Implies `--to-last-log`. | [MariaDB 10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/) |
| `--stop-never-slave-server-id` | | The slave [server\_id](../replication-and-binary-log-server-system-variables/index#server_id) used for `--read-from-remote-server` `--stop-never`. | [MariaDB 10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/) |
| `--stop-position=pos` | 18446744073709551615 | Stop reading the binlog at this position. Type can either be a positive integer or, from [MariaDB 10.8](../what-is-mariadb-108/index), a [GTID](../gtid/index) list. When using a positive integer, the value only applies to the last binlog passed on the command line. In GTID mode, multiple GTIDs can be passed as a comma separated list, where each must have a unique domain id. Each GTID is inclusive; only events up to the given sequence numbers are printed. Ignored in `--raw` mode. | |
| `-T`, `--table` | | List entries for just this table (local log only). | [MariaDB 10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/) |
| `--tls-version=name` | TLSv1.1,TLSv1.2,TLSv1.3 | This option accepts a comma-separated list of TLS protocol versions. A TLS protocol version will only be enabled if it is present in this list. All other TLS protocol versions will not be permitted. See [Secure Connections Overview: TLS Protocol Versions](../secure-connections-overview/index#tls-protocol-versions) for more information. | [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/) |
| `-t`, `--to-last-log` | FALSE | Requires `-R` or `--read-from-remote-server` . Will not stop at the end of the requested binlog but rather continue printing until the end of the last binlog of the MariaDB server. If you send the output to the same MariaDB server, that may lead to an endless loop. | |
| `-u`, `--user=username` | *(No default value)* | Connect to the remote server as username. | |
| `-v`, `--verbose` | | Reconstruct SQL statements out of row events. -v -v adds comments on column data types | |
| `-V`, `--version` | | Print version and exit. | |
| `--verify-binlog-checksum` | | Verify [binlog event checksums](../binlog-event-checksums/index) when reading a binlog file. | |
Option Files
------------
In addition to reading options from the command-line, `mysqlbinlog` can also read options from [option files](../configuring-mariadb-with-option-files/index). If an unknown option is provided to `mysqlbinlog` in an option file, then it is ignored.
The following options relate to how MariaDB command-line tools handles option files. They must be given as the first argument on the command-line:
| Option | Description |
| --- | --- |
| `--print-defaults` | Print the program argument list and exit. |
| `--no-defaults` | Don't read default options from any option file. |
| `--defaults-file=#` | Only read default options from the given file #. |
| `--defaults-extra-file=#` | Read this file after the global files are read. |
| `--defaults-group-suffix=#` | In addition to the default option groups, also read option groups with this suffix. |
In [MariaDB 10.2](../what-is-mariadb-102/index) and later, `mysqlbinlog` is linked with [MariaDB Connector/C](../about-mariadb-connector-c/index). However, MariaDB Connector/C does not yet handle the parsing of option files for this client. That is still performed by the server option file parsing code. See [MDEV-19035](https://jira.mariadb.org/browse/MDEV-19035) for more information.
### Option Groups
`mysqlbinlog` reads options from the following [option groups](../configuring-mariadb-with-option-files/index#option-groups) from [option files](../configuring-mariadb-with-option-files/index):
| Group | Description |
| --- | --- |
| `[mysqlbinlog]` | Options read by `mysqlbinlog`, which includes both MariaDB Server and MySQL Server. |
| `[mariadb-binlog]` | Options read by `mysqlbinlog`. Available starting with [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/). |
| `[client]` | Options read by all MariaDB and MySQL [client programs](../clients-utilities/index), which includes both MariaDB and MySQL clients. For example, `mysqldump`. |
| `[client-server]` | Options read by all MariaDB [client programs](../clients-utilities/index) and the MariaDB Server. This is useful for options like socket and port, which is common between the server and the clients. |
| `[client-mariadb]` | Options read by all MariaDB [client programs](../clients-utilities/index). |
In [MariaDB 10.2](../what-is-mariadb-102/index) and later, `mysqlbinlog` is linked with [MariaDB Connector/C](../about-mariadb-connector-c/index). However, MariaDB Connector/C does not yet handle the parsing of option files for this client. That is still performed by the server option file parsing code. See [MDEV-19035](https://jira.mariadb.org/browse/MDEV-19035) for more information.
See Also
--------
* [Using mysqlbinlog](../using-mysqlbinlog/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb CONNECT Table Types - OEM: Implemented in an External LIB CONNECT Table Types - OEM: Implemented in an External LIB
=========================================================
Although CONNECT provides a rich set of table types, specific applications may need to access data organized in a way that is not handled by its existing foreign data wrappers (FDW). To handle these cases, CONNECT features an interface that enables developers to implement in C++ the required table wrapper and use it as if it were part of the standard CONNECT table type list. CONNECT can use these additional handlers providing the corresponding external module (dll or shared lib) be available.
To create such a table on an existing handler, use a Create Table statement as shown below.
```
create table xtab (column definitions)
engine=CONNECT table_type=OEM module='libname'
subtype='MYTYPE' [standard table options]
Option_list='Myopt=foo';
```
The option module gives the name of the DLL or shared library implementing the OEM wrapper for the table type. This library must be located in the plugin directory like all other plugins or UDF’s.
This library must export a function *GetMYTYPE*. The option subtype enables CONNECT to have the name of the exported function and to use the new table type. Other options are interpreted by the OEM type and can also be specified within the *option\_list* option.
Column definitions can be unspecified only if the external wrapper is able to return this information. For this it must export a function ColMYTYPE returning these definitions in a format acceptable by the CONNECT discovery function.
Which and how options must be specified and the way columns must be defined may vary depending on the OEM type used and should be documented by the OEM type implementer(s).
An OEM Table Example
--------------------
The OEM table REST described in [Adding the REST Feature as a Library Called by an OEM Table](../connect-adding-the-rest-feature-as-a-library-called-by-an-oem-table/index) permits using REST-like tables with MariaDB binary distributions containing but not enabling the [REST table type](../connect-files-retrieved-using-rest-queries/index)
Of course, the mongo (dll or so) exporting the GetREST and colREST functions must be available in the plugin directory for all this to work.
### Some Currently Available OEM Table Modules and Subtypes
| Module | Subtype | Description |
| --- | --- | --- |
| libhello | HELLO | A sample OEM wrapper displaying a one line table saying “Hello world” |
| mongo | MONGO | Enables using tables based on MongoDB collections. |
| Tabfic | FIC | Handles files having the Windev HyperFile format. |
| Tabofx | OFC | Handles Open Financial Connectivity files. |
| Tabofx | QIF | Handles Quicken Interchange Format files. |
| Cirpack | CRPK | Handles CDR's from Cirpack UTP's. |
| Tabplg | PLG | Access tables from the PlugDB DBMS. |
How to implement an OEM handler is out of the scope of this document.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing correct libraries for PAM and readline Installing correct libraries for PAM and readline
=================================================
Some additional/alternative libraries needs to be installed to handle readline and PAM correctly.
The newer libreadline is GPLv3 and so not compatible with the MariaDB/MySQL GPLv2 license. The PAM libraries are needed for the PAM plugin.
On the Centos and RHEL -build VMs, install the pam-devel package:
```
sudo yum install pam-devel
```
On all the Debian/Ubuntu -build virtual machines, install libpam0g-dev:
```
sudo apt-get install libpam0g-dev
```
On debian6/maverick/natty, install libreadline5-dev (replacing any libreadline6-dev already there):
```
sudo apt-get install libreadline5-dev
```
On oneiric (and any newer, eg. Debian 7 or Ubuntu 12.04), the package is called libreadline-gplv2-dev:
```
sudo apt-get install libreadline-gplv2-dev
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Query Optimizations Query Optimizations
====================
Different query optimizations and how you can use and tune them to get better performance.
| Title | Description |
| --- | --- |
| [Index Hints: How to Force Query Plans](../index-hints-how-to-force-query-plans/index) | Using hints to get the optimizer to use another query plan. |
| [Subquery Optimizations](../subquery-optimizations/index) | Articles about subquery optimizations in MariaDB. |
| [Optimization Strategies](../optimization-strategies/index) | Various optimization strategies used by the query optimizer. |
| [Optimizations for Derived Tables](../optimizations-for-derived-tables/index) | Optimizations for derived tables, or subqueries in the FROM clause |
| [Table Elimination](../table-elimination/index) | Resolving queries without accessing some of the tables the query refers to |
| [Statistics for Optimizing Queries](../statistics-for-optimizing-queries/index) | Different statistics provided by MariaDB to help you optimize your queries |
| [MIN/MAX optimization](../minmax-optimization/index) | How MIN and MAX are optimized |
| [Filesort with Small LIMIT Optimization](../filesort-with-small-limit-optimization/index) | MariaDB 10's filesort with small LIMIT optimization |
| [LIMIT ROWS EXAMINED](../limit-rows-examined/index) | Means to terminate execution of SELECTs that examine too many rows. |
| [Block-Based Join Algorithms](../block-based-join-algorithms/index) | Algorithms that employ a join buffer for the first join before starting to look in the second. |
| [index\_merge sort\_intersection](../index_merge-sort_intersection/index) | Operation to allow the use of index\_merge in a broader number of cases. |
| [MariaDB 5.3 Optimizer Debugging](../mariadb-53-optimizer-debugging/index) | MariaDB 5.3's optimizer debugging patch |
| [optimizer\_switch](../optimizer-switch/index) | Server variable for enabling specific optimizations. |
| [Extended Keys](../extended-keys/index) | Optimization using InnoDB key components to generate more efficient execution plans. |
| [How to Quickly Insert Data Into MariaDB](../how-to-quickly-insert-data-into-mariadb/index) | Techniques for inserting data quickly into MariaDB. |
| [Index Condition Pushdown](../index-condition-pushdown/index) | Index Condition Pushdown optimization. |
| [Query Limits and Timeouts](../query-limits-and-timeouts/index) | Different methods MariaDB provides to limit/timeout a query. |
| [Aborting Statements that Exceed a Certain Time to Execute](../aborting-statements/index) | Aborting statements that take longer than a certain time to execute. |
| [Partition Pruning and Selection](../partition-pruning-and-selection/index) | Partition pruning is when the optimizer knows which partitions are relevant for the query. |
| [Big DELETEs](../big-deletes/index) | How to DELETE lots of rows from a large table |
| [Data Sampling: Techniques for Efficiently Finding a Random Row](../data-sampling-techniques-for-efficiently-finding-a-random-row/index) | Fetching random rows from a table (beyond ORDER BY RAND()) |
| [Data Warehousing High Speed Ingestion](../data-warehousing-high-speed-ingestion/index) | Ingesting lots of data and performance is bottlenecked in the INSERT area. What to do? |
| [Data Warehousing Summary Tables](../data-warehousing-summary-tables/index) | Creation and maintenance of summary tables |
| [Data Warehousing Techniques](../data-warehousing-techniques/index) | Improving performance for data-warehouse-like tables |
| [Equality propagation optimization](../equality-propagation-optimization/index) | Basic idea Consider a query with a WHERE clause: WHERE col1=col2 AND ... t... |
| [FORCE INDEX](../force-index/index) | Similar to USE INDEX, but tells the optimizer to regard a table scan as very expensive. |
| [Groupwise Max in MariaDB](../groupwise-max-in-mariadb/index) | Finding the largest row for each group. |
| [GUID/UUID Performance](../guiduuid-performance/index) | GUID/UUID performance (type 1 only). |
| [IGNORE INDEX](../ignore-index/index) | Tell the optimizer to not consider a particular index. |
| [not\_null\_range\_scan Optimization](../not_null_range_scan-optimization/index) | Enables constructing range scans from NOT NULL conditions inferred from the WHERE clause. |
| [Optimizing for "Latest News"-style Queries](../optimizing-for-latest-news-style-queries/index) | Optimizing the schema and code for "Latest News"-style queries |
| [Pagination Optimization](../pagination-optimization/index) | Pagination, not with OFFSET, LIMIT |
| [Pivoting in MariaDB](../pivoting-in-mariadb/index) | Pivoting data so a linear list of values with two keys becomes a spreadsheet-like array. |
| [Rollup Unique User Counts](../rollup-unique-user-counts/index) | Technique for counting unique users |
| [Rowid Filtering Optimization](../rowid-filtering-optimization/index) | Rowid filtering is an optimization available from MariaDB 10.4. |
| [USE INDEX](../use-index/index) | Find rows in the table using only one of the named indexes. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MULTIPOINT MULTIPOINT
==========
Syntax
------
```
MultiPoint(pt1,pt2,...)
```
Description
-----------
Constructs a [WKB](../wkb/index) MultiPoint value using WKB [Point](../point/index) arguments. If any argument is not a WKB Point, the return value is `NULL`.
Examples
--------
```
SET @g = ST_GEOMFROMTEXT('MultiPoint( 1 1, 2 2, 5 3, 7 2, 9 3, 8 4, 6 6, 6 9, 4 9, 1 5 )');
CREATE TABLE gis_multi_point (g MULTIPOINT);
INSERT INTO gis_multi_point VALUES
(MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MINUTE MINUTE
======
Syntax
------
```
MINUTE(time)
```
Description
-----------
Returns the minute for *time*, in the range 0 to 59.
Examples
--------
```
SELECT MINUTE('2013-08-03 11:04:03');
+-------------------------------+
| MINUTE('2013-08-03 11:04:03') |
+-------------------------------+
| 4 |
+-------------------------------+
SELECT MINUTE ('23:12:50');
+---------------------+
| MINUTE ('23:12:50') |
+---------------------+
| 12 |
+---------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SHOW WARNINGS SHOW WARNINGS
=============
Syntax
------
```
SHOW WARNINGS [LIMIT [offset,] row_count]
SHOW ERRORS [LIMIT row_count OFFSET offset]
SHOW COUNT(*) WARNINGS
```
Description
-----------
`SHOW WARNINGS` shows the error, warning, and note messages that resulted from the last statement that generated messages in the current session. It shows nothing if the last statement used a table and generated no messages. (That is, a statement that uses a table but generates no messages clears the message list.) Statements that do not use tables and do not generate messages have no effect on the message list.
A note is different to a warning in that it only appears if the `[sql\_notes](../server-system-variables/index#sql_notes)` variable is set to 1 (the default), and is not converted to an error if `[strict mode](../sql_mode/index)` is enabled.
A related statement, `[SHOW ERRORS](../show-errors/index)`, shows only the errors.
The `SHOW COUNT(*) WARNINGS` statement displays the total number of errors, warnings, and notes. You can also retrieve this number from the [warning\_count](../server-system-variables/index#warning_count) variable:
```
SHOW COUNT(*) WARNINGS;
SELECT @@warning_count;
```
The value of `[warning\_count](../server-system-variables/index#warning_count)` might be greater than the number of messages displayed by `SHOW WARNINGS` if the `[max\_error\_count](../server-system-variables/index#max_error_count)` system variable is set so low that not all messages are stored.
The `LIMIT` clause has the same syntax as for the `[SELECT statement](../select/index)`.
`SHOW WARNINGS` can be used after `[EXPLAIN EXTENDED](../explain/index)` to see how a query is internally rewritten by MariaDB.
If the `[sql\_notes](../server-system-variables/index#sql_notes)` server variable is set to 1, Notes are included in the output of `SHOW WARNINGS`; if it is set to 0, this statement will not show (or count) Notes.
The results of `SHOW WARNINGS` and `SHOW COUNT(*) WARNINGS` are directly sent to the client. If you need to access those information in a stored program, you can use the `[GET DIAGNOSTICS](../get-diagnostics/index)` statement instead.
For a list of MariaDB error codes, see [MariaDB Error Codes](../mariadb-error-codes/index).
The `[mysql](../mysql-command-line-client/index)` client also has a number of options related to warnings. The `\W` command will show warnings after every statement, while `\w` will disable this. Starting the client with the `--show-warnings` option will show warnings after every statement.
[MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/) implements a stored routine error stack trace. `SHOW WARNINGS` can also be used to show more information. See the example below.
Examples
--------
```
SELECT 1/0;
+------+
| 1/0 |
+------+
| NULL |
+------+
SHOW COUNT(*) WARNINGS;
+-------------------------+
| @@session.warning_count |
+-------------------------+
| 1 |
+-------------------------+
SHOW WARNINGS;
+---------+------+---------------+
| Level | Code | Message |
+---------+------+---------------+
| Warning | 1365 | Division by 0 |
+---------+------+---------------+
```
### Stack Trace
From [MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/), displaying a stack trace:
```
DELIMITER $$
CREATE OR REPLACE PROCEDURE p1()
BEGIN
DECLARE c CURSOR FOR SELECT * FROM not_existing;
OPEN c;
CLOSE c;
END;
$$
CREATE OR REPLACE PROCEDURE p2()
BEGIN
CALL p1;
END;
$$
DELIMITER ;
CALL p2;
ERROR 1146 (42S02): Table 'test.not_existing' doesn't exist
SHOW WARNINGS;
+-------+------+-----------------------------------------+
| Level | Code | Message |
+-------+------+-----------------------------------------+
| Error | 1146 | Table 'test.not_existing' doesn't exist |
| Note | 4091 | At line 6 in test.p1 |
| Note | 4091 | At line 4 in test.p2 |
+-------+------+-----------------------------------------+
```
`SHOW WARNINGS` displays a stack trace, showing where the error actually happened:
* Line 4 in test.p1 is the OPEN command which actually raised the error
* Line 3 in test.p2 is the CALL statement, calling p1 from p2.
See Also
--------
* [SHOW ERRORS](../show-errors/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB Audit Plugin - Installation MariaDB Audit Plugin - Installation
===================================
The `server_audit` plugin logs the server's activity. For each client session, it records who connected to the server (i.e., user name and host), what queries were executed, and which tables were accessed and server variables that were changed. This information is stored in a rotating log file or it may be sent to the local syslogd.
Locating the Plugin
-------------------
The `server_audit` plugin's shared library is included in MariaDB packages as the `server_audit.so` or `server_audit.dll` shared library on systems where it can be built.
The plugin must be located in the plugin directory, the directory containing all plugin libraries for MariaDB. The path to this directory is configured by the `[plugin\_dir](../server-system-variables/index#plugin_dir)` system variable. To see the value of this variable and thereby determine the file path of the plugin library, execute the following SQL statement:
```
SHOW GLOBAL VARIABLES LIKE 'plugin_dir';
+---------------+--------------------------+
| Variable_name | Value |
+---------------+--------------------------+
| plugin_dir | /usr/lib64/mysql/plugin/ |
+---------------+--------------------------+
```
Check the directory returned at the filesystem level to make sure that you have a copy of the plugin library, `server_audit.so` or `server_audit.dll`, depending on your system. It's included in recent installations of MariaDB. If you do not have it, you should upgrade MariaDB.
Installing the Plugin
---------------------
Although the plugin's shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.
The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing `[INSTALL SONAME](../install-soname/index)` or `[INSTALL PLUGIN](../install-plugin/index)`. For example:
```
INSTALL SONAME 'server_audit';
```
The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options. This can be specified as a command-line argument to `[mysqld](../mysqld-options/index)` or it can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
plugin_load_add = server_audit
```
Uninstalling the Plugin
-----------------------
You can uninstall the plugin dynamically by executing `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)`. For example:
```
UNINSTALL SONAME 'server_audit';
```
If you installed the plugin by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index), then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
Prohibiting Uninstallation
--------------------------
The `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)` statements may be used to uninstall plugins. For the `server_audit` plugin, you might want to disable this capability. To prevent the plugin from being uninstalled, you could set the the `[server\_audit](../mariadb-audit-plugin-system-variables/index#server_audit)` option to `FORCE_PLUS_PERMANENT` in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) after the plugin is loaded once:
```
[mariadb]
...
plugin_load_add = server_audit
server_audit=FORCE_PLUS_PERMANENT
```
Once you've added the option to the server's option file and restarted the server, the plugin can't be uninstalled. If someone tries to uninstall the audit plugin, then an error message will be returned. Below is an example of the error message:
```
UNINSTALL PLUGIN server_audit;
ERROR 1702 (HY000):
Plugin 'server_audit' is force_plus_permanent and can not be unloaded
```
For more information on `FORCE_PLUS_PERMANENT` and other option values for the `[server\_audit](../mariadb-audit-plugin-system-variables/index#-server-audit)` option, see [Plugin Overview: Configuring Plugin Activation at Server Startup](../plugin-overview/index#configuring-plugin-activation-at-server-startup) for more information.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb BIT_LENGTH BIT\_LENGTH
===========
Syntax
------
```
BIT_LENGTH(str)
```
Description
-----------
Returns the length of the given string argument in bits. If the argument is not a string, it will be converted to string. If the argument is `NULL`, it returns `NULL`.
Examples
--------
```
SELECT BIT_LENGTH('text');
+--------------------+
| BIT_LENGTH('text') |
+--------------------+
| 32 |
+--------------------+
```
```
SELECT BIT_LENGTH('');
+----------------+
| BIT_LENGTH('') |
+----------------+
| 0 |
+----------------+
```
Compatibility
-------------
PostgreSQL and Sybase support BIT\_LENGTH().
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CURRENT_DATE CURRENT\_DATE
=============
Syntax
------
```
CURRENT_DATE, CURRENT_DATE()
```
Description
-----------
`CURRENT_DATE` and `CURRENT_DATE()` are synonyms for [CURDATE()](../curdate/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb INSERT ON DUPLICATE KEY UPDATE INSERT ON DUPLICATE KEY UPDATE
==============================
Syntax
------
```
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name [PARTITION (partition_list)] [(col,...)]
{VALUES | VALUE} ({expr | DEFAULT},...),(...),...
[ ON DUPLICATE KEY UPDATE
col=expr
[, col=expr] ... ]
```
Or:
```
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name [PARTITION (partition_list)]
SET col={expr | DEFAULT}, ...
[ ON DUPLICATE KEY UPDATE
col=expr
[, col=expr] ... ]
```
Or:
```
INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name [PARTITION (partition_list)] [(col,...)]
SELECT ...
[ ON DUPLICATE KEY UPDATE
col=expr
[, col=expr] ... ]
```
Description
-----------
INSERT ... ON DUPLICATE KEY UPDATE is a MariaDB/MySQL extension to the [INSERT](../insert/index) statement that, if it finds a duplicate unique or primary key, will instead perform an [UPDATE](../update/index).
The row/s affected value is reported as 1 if a row is inserted, and 2 if a row is updated, unless the API's `CLIENT_FOUND_ROWS` flag is set.
If more than one unique index is matched, only the first is updated. It is not recommended to use this statement on tables with more than one unique index.
If the table has an [AUTO\_INCREMENT](../auto_increment/index) primary key and the statement inserts or updates a row, the [LAST\_INSERT\_ID()](../last_insert_id/index) function returns its AUTO\_INCREMENT value.
The [VALUES()](../values/index) function can only be used in a `ON DUPLICATE KEY UPDATE` clause and has no meaning in any other context. It returns the column values from the `INSERT` portion of the statement. This function is particularly useful for multi-rows inserts.
The [IGNORE](../ignore/index) and [DELAYED](../insert-delayed/index) options are ignored when you use `ON DUPLICATE KEY UPDATE`.
See [Partition Pruning and Selection](../partition-pruning-and-selection/index) for details on the PARTITION clause.
This statement activates INSERT and UPDATE triggers. See [Trigger Overview](../trigger-overview/index) for details.
See also a similar statement, [REPLACE](../replace/index).
Examples
--------
```
CREATE TABLE ins_duplicate (id INT PRIMARY KEY, animal VARCHAR(30));
INSERT INTO ins_duplicate VALUES (1,'Aardvark'), (2,'Cheetah'), (3,'Zebra');
```
If there is no existing key, the statement runs as a regular INSERT:
```
INSERT INTO ins_duplicate VALUES (4,'Gorilla')
ON DUPLICATE KEY UPDATE animal='Gorilla';
Query OK, 1 row affected (0.07 sec)
```
```
SELECT * FROM ins_duplicate;
+----+----------+
| id | animal |
+----+----------+
| 1 | Aardvark |
| 2 | Cheetah |
| 3 | Zebra |
| 4 | Gorilla |
+----+----------+
```
A regular INSERT with a primary key value of 1 will fail, due to the existing key:
```
INSERT INTO ins_duplicate VALUES (1,'Antelope');
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
```
However, we can use an INSERT ON DUPLICATE KEY UPDATE instead:
```
INSERT INTO ins_duplicate VALUES (1,'Antelope')
ON DUPLICATE KEY UPDATE animal='Antelope';
Query OK, 2 rows affected (0.09 sec)
```
Note that there are two rows reported as affected, but this refers only to the UPDATE.
```
SELECT * FROM ins_duplicate;
+----+----------+
| id | animal |
+----+----------+
| 1 | Antelope |
| 2 | Cheetah |
| 3 | Zebra |
| 4 | Gorilla |
+----+----------+
```
Adding a second unique column:
```
ALTER TABLE ins_duplicate ADD id2 INT;
UPDATE ins_duplicate SET id2=id+10;
ALTER TABLE ins_duplicate ADD UNIQUE KEY(id2);
```
Where two rows match the unique keys match, only the first is updated. This can be unsafe and is not recommended unless you are certain what you are doing.
```
INSERT INTO ins_duplicate VALUES (2,'Lion',13)
ON DUPLICATE KEY UPDATE animal='Lion';
Query OK, 2 rows affected (0.004 sec)
SELECT * FROM ins_duplicate;
+----+----------+------+
| id | animal | id2 |
+----+----------+------+
| 1 | Antelope | 11 |
| 2 | Lion | 12 |
| 3 | Zebra | 13 |
| 4 | Gorilla | 14 |
+----+----------+------+
```
Although the third row with an id of 3 has an id2 of 13, which also matched, it was not updated.
Changing id to an auto\_increment field. If a new row is added, the auto\_increment is moved forward. If the row is updated, it remains the same.
```
ALTER TABLE `ins_duplicate` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
ALTER TABLE ins_duplicate DROP id2;
SELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='ins_duplicate';
+----------------+
| Auto_increment |
+----------------+
| 5 |
+----------------+
INSERT INTO ins_duplicate VALUES (2,'Leopard')
ON DUPLICATE KEY UPDATE animal='Leopard';
Query OK, 2 rows affected (0.00 sec)
SELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='ins_duplicate';
+----------------+
| Auto_increment |
+----------------+
| 5 |
+----------------+
INSERT INTO ins_duplicate VALUES (5,'Wild Dog')
ON DUPLICATE KEY UPDATE animal='Wild Dog';
Query OK, 1 row affected (0.09 sec)
SELECT * FROM ins_duplicate;
+----+----------+
| id | animal |
+----+----------+
| 1 | Antelope |
| 2 | Leopard |
| 3 | Zebra |
| 4 | Gorilla |
| 5 | Wild Dog |
+----+----------+
SELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='ins_duplicate';
+----------------+
| Auto_increment |
+----------------+
| 6 |
+----------------+
```
Refering to column values from the INSERT portion of the statement:
```
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)
ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);
```
See the [VALUES()](../values/index) function for more.
See Also
--------
* [INSERT](../insert/index)
* [INSERT DELAYED](../insert-delayed/index)
* [INSERT SELECT](../insert-select/index)
* [HIGH\_PRIORITY and LOW\_PRIORITY](../high_priority-and-low_priority/index)
* [Concurrent Inserts](../concurrent-inserts/index)
* [INSERT - Default & Duplicate Values](../insert-default-duplicate-values/index)
* [INSERT IGNORE](../insert-ignore/index)
* [VALUES()](../values/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Connecting to MariaDB Connecting to MariaDB
=====================
This article covers connecting to MariaDB and the basic connection parameters. If you are completely new to MariaDB, take a look at [A MariaDB Primer](../a-mariadb-primer/index) first.
In order to connect to the MariaDB server, the client software must provide the correct connection parameters. The client software will most often be the [mysql client](../mysql-client/index), used for entering statements from the command line, but the same concepts apply to any client, such as a [graphical clients](../graphical-and-enhanced-clients/index), a client to run backups such as [mysqldump](../mysqldump/index), etc. The rest of this article assumes that the mysql command line client is used.
If a connection parameter is not provided, it will revert to a default value.
For example, to connect to MariaDB using only default values with the mysql client, enter the following from the command line:
```
mysql
```
In this case, the following defaults apply:
* The host name is `localhost`.
* The user name is either your Unix login name, or `ODBC` on Windows.
* No password is sent.
* The client will connect to the server, but not any particular database on the server.
These defaults can be overridden by specifying a particular parameter to use. For example:
```
mysql -h 166.78.144.191 -u username -ppassword database_name
```
In this case:
* `-h` specifies a host. Instead of using `localhost`, the IP `166.78.144.191` is used.
* `-u` specifies a use name, in this case `username`
* `-p` specifies a password, `password`. Note that for passwords, unlike the other parameters, there cannot be a space between the the option (`-p`) and the value (`password`). It is also not secure to use a password in this way, as other users on the system can see it as part of the command that has been run. If you include the `-p` option, but leave out the password, you will be prompted for it, which is more secure.
* The database name is provided as the first argument after all the options, in this case `database_name`.
Connection Parameters
---------------------
### host
```
--host=name
-h name
```
Connect to the MariaDB server on the given host. The default host is `localhost`. By default, MariaDB does not permit remote logins - see [Configuring MariaDB for Remote Client Access](../configuring-mariadb-for-remote-client-access/index).
### password
```
--password[=passwd]
-p[passwd]
```
The password of the MariaDB account. It is generally not secure to enter the password on the command line, as other users on the system can see it as part of the command that has been run. If you include the `-p` or `--password` option, but leave out the password, you will be prompted for it, which is more secure.
### pipe
```
--pipe
-W
```
On Windows systems that have been started with the `--enable-named-pipe` option, use this option to connect to the server using a named pipe.
### port
```
--port=num
-P num
```
The TCP/IP port number to use for the connection. The default is `3306`.
### protocol
```
--protocol=name
```
Specifies the protocol to be used for the connection for the connection. It can be one of `TCP`, `SOCKET`, `PIPE` or `MEMORY` (case-insensitive). Usually you would not want to change this from the default. For example on Unix, a Unix socket file (`SOCKET`) is the default protocol, and usually results in the quickest connection.
* `TCP`: A TCP/IP connection to a server (either local or remote). Available on all operating systems.
* `SOCKET`: A Unix socket file connection, available to the local server on Unix systems only.
* `PIPE`. A named-pipe connection (either local or remote). Available on Windows only.
* `MEMORY`. Shared-memory connection to the local server on Windows systems only.
### shared-memory-base-name
```
--shared-memory-base-name=name
```
Only available on Windows systems in which the server has been started with the `--shared-memory` option, this specifies the shared-memory name to use for connecting to a local server. The value is case-sensitive, and defaults to `MYSQL`.
### socket
```
--socket=name
-S name
```
For connections to localhost, either the Unix socket file to use (default `/tmp/mysql.sock`), or, on Windows where the server has been started with the `--enable-named-pipe` option, the name (case-insensitive) of the named pipe to use (default `MySQL`).
### TLS Options
A brief listing is provided below. See [Secure Connections Overview](../secure-connections-overview/index) and [TLS System Variables](../tls-system-variables/index) for more detail.
#### ssl
```
--ssl
```
Enable TLS for connection (automatically enabled with other TLS flags). Disable with '`--skip-ssl`'
#### ssl-ca
```
--ssl-ca=name
```
CA file in PEM format (check OpenSSL docs, implies `--ssl`).
#### ssl-capath
```
--ssl-capath=name
```
| |
| --- |
| CA directory (check OpenSSL docs, implies `--ssl`). |
#### ssl-cert
```
--ssl-cert=name
```
X509 cert in PEM format (implies `--ssl`).
#### ssl-cipher
```
--ssl-cipher=name
```
TLS cipher to use (implies `--ssl`).
#### ssl-key
```
--ssl-key=name
```
X509 key in PEM format (implies `--ssl`).
#### ssl-crl
```
--ssl-crl=name
```
Certificate revocation list (implies `--ssl`).
#### ssl-crlpath
```
--ssl-crlpath=name
```
Certificate revocation list path (implies `--ssl`).
#### ssl-verify-server-cert
```
--ssl-verify-server-cert
```
Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default.
### user
```
--user=name
-u name
```
The MariaDB user name to use when connecting to the server.The default is either your Unix login name, or `ODBC` on Windows. See the [GRANT](../grant/index) command for details on creating MariaDB user accounts.
Option Files
------------
It's also possible to use option files (or configuration files) to set these options. Most clients read option files. Usually, starting a client with the `--help` option will display which files it looks for as well as which option groups it recognizes.
See Also
--------
* [A MariaDB Primer](../a-mariadb-primer/index)
* [mysql client](../mysql-client/index)
* [Clients and Utilities](../clients-and-utilities/index)
* [Configuring MariaDB for Remote Client Access](../configuring-mariadb-for-remote-client-access/index)
* [--skip-grant-tables](../mysqld-options/index#-skip-grant-tables) allows you to start MariaDB without `GRANT`. This is useful if you lost your root password.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Semi-join Materialization Strategy Semi-join Materialization Strategy
==================================
Semi-join Materialization is a special kind of subquery materialization used for [Semi-join subqueries](../semi-join-subquery-optimizations/index). It actually includes two strategies:
* Materialization/lookup
* Materialization/scan
The idea
--------
Consider a query that finds countries in Europe which have big cities:
```
select * from Country
where Country.code IN (select City.Country
from City
where City.Population > 7*1000*1000)
and Country.continent='Europe'
```
The subquery is uncorrelated, that is, we can run it independently of the upper query. The idea of semi-join materialization is to do just that, and fill a temporary table with possible values of the City.country field of big cities, and then do a join with countries in Europe:
The join can be done in two directions:
1. From the materialized table to countries in Europe
2. From countries in Europe to the materialized table
The first way involves doing a full scan on the materialized table, so we call it "Materialization-scan".
If you run a join from Countries to the materialized table, the cheapest way to find a match in the materialized table is to make a lookup on its primary key (it has one: we used it to remove duplicates). Because of that, we call the strategy "Materialization-lookup".
Semi-join materialization in action
-----------------------------------
### Materialization-Scan
If we chose to look for cities with a population greater than 7 million, the optimizer will use Materialization-Scan and `EXPLAIN` will show this:
```
MariaDB [world]> explain select * from Country where Country.code IN
(select City.Country from City where City.Population > 7*1000*1000);
+----+--------------+-------------+--------+--------------------+------------+---------+--------------------+------+-----------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------+-------------+--------+--------------------+------------+---------+--------------------+------+-----------------------+
| 1 | PRIMARY | <subquery2> | ALL | distinct_key | NULL | NULL | NULL | 15 | |
| 1 | PRIMARY | Country | eq_ref | PRIMARY | PRIMARY | 3 | world.City.Country | 1 | |
| 2 | MATERIALIZED | City | range | Population,Country | Population | 4 | NULL | 15 | Using index condition |
+----+--------------+-------------+--------+--------------------+------------+---------+--------------------+------+-----------------------+
3 rows in set (0.01 sec)
```
Here, you can see:
* There are still two `SELECT`s (look for columns with `id=1` and `id=2`)
* The second select (with `id=2`) has `select_type=MATERIALIZED`. This means it will be executed and its results will be stored in a temporary table with a unique key over all columns. The unique key is there to prevent the table from containing any duplicate records.
* The first select received the table name `<subquery2>`. This is the table that we got as a result of the materialization of the select with `id=2`.
The optimizer chose to do a full scan over the materialized table, so this is an example of a use of the Materialization-Scan strategy.
As for execution costs, we're going to read 15 rows from table City, write 15 rows to materialized table, read them back (the optimizer assumes there won't be any duplicates), and then do 15 eq\_ref accesses to table Country. In total, we'll do 45 reads and 15 writes.
By comparison, if you run the `EXPLAIN` in MySQL, you'll get this:
```
MySQL [world]> explain select * from Country where Country.code IN
(select City.Country from City where City.Population > 7*1000*1000);
+----+--------------------+---------+-------+--------------------+------------+---------+------+------+------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+---------+-------+--------------------+------------+---------+------+------+------------------------------------+
| 1 | PRIMARY | Country | ALL | NULL | NULL | NULL | NULL | 239 | Using where |
| 2 | DEPENDENT SUBQUERY | City | range | Population,Country | Population | 4 | NULL | 15 | Using index condition; Using where |
+----+--------------------+---------+-------+--------------------+------------+---------+------+------+------------------------------------+
```
...which is a plan to do `(239 + 239*15) = 3824` table reads.
### Materialization-Lookup
Let's modify the query slightly and look for countries which have cities with a population over one millon (instead of seven):
```
MariaDB [world]> explain select * from Country where Country.code IN
(select City.Country from City where City.Population > 1*1000*1000) ;
+----+--------------+-------------+--------+--------------------+--------------+---------+------+------+-----------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------+-------------+--------+--------------------+--------------+---------+------+------+-----------------------+
| 1 | PRIMARY | Country | ALL | PRIMARY | NULL | NULL | NULL | 239 | |
| 1 | PRIMARY | <subquery2> | eq_ref | distinct_key | distinct_key | 3 | func | 1 | |
| 2 | MATERIALIZED | City | range | Population,Country | Population | 4 | NULL | 238 | Using index condition |
+----+--------------+-------------+--------+--------------------+--------------+---------+------+------+-----------------------+
3 rows in set (0.00 sec)
```
The `EXPLAIN` output is similar to the one which used Materialization-scan, except that:
* the `<subquery2>` table is accessed with the `eq_ref` access method
* the access uses an index named `distinct_key`
This means that the optimizer is planning to do index lookups into the materialized table. In other words, we're going to use the Materialization-lookup strategy.
In MySQL (or with `optimizer_switch='semijoin=off,materialization=off'`), one will get this `EXPLAIN`:
```
MySQL [world]> explain select * from Country where Country.code IN
(select City.Country from City where City.Population > 1*1000*1000) ;
+----+--------------------+---------+----------------+--------------------+---------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+---------+----------------+--------------------+---------+---------+------+------+-------------+
| 1 | PRIMARY | Country | ALL | NULL | NULL | NULL | NULL | 239 | Using where |
| 2 | DEPENDENT SUBQUERY | City | index_subquery | Population,Country | Country | 3 | func | 18 | Using where |
+----+--------------------+---------+----------------+--------------------+---------+---------+------+------+-------------+
```
One can see that both plans will do a full scan on the `Country` table. For the second step, MariaDB will fill the materialized table (238 rows read from table City and written to the temporary table) and then do a unique key lookup for each record in table `Country`, which works out to 238 unique key lookups. In total, the second step will cost `(239+238) = 477` reads and `238` temp.table writes.
MySQL's plan for the second step is to read 18 rows using an index on `City.Country` for each record it receives for table `Country`. This works out to a cost of `(18*239) = 4302` reads. Had there been fewer subquery invocations, this plan would have been better than the one with Materialization. By the way, MariaDB has an option to use such a query plan, too (see [FirstMatch Strategy](../firstmatch-strategy/index)), but it did not choose it.
Subqueries with grouping
------------------------
MariaDB is able to use Semi-join materialization strategy when the subquery has grouping (other semi-join strategies are not applicable in this case).
This allows for efficient execution of queries that search for the best/last element in a certain group.
For example, let's find cities that have the biggest population on their continent:
```
explain
select * from City
where City.Population in (select max(City.Population) from City, Country
where City.Country=Country.Code
group by Continent)
+------+--------------+-------------+------+---------------+------------+---------+----------------------------------+------+-----------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+--------------+-------------+------+---------------+------------+---------+----------------------------------+------+-----------------+
| 1 | PRIMARY | <subquery2> | ALL | distinct_key | NULL | NULL | NULL | 239 | |
| 1 | PRIMARY | City | ref | Population | Population | 4 | <subquery2>.max(City.Population) | 1 | |
| 2 | MATERIALIZED | Country | ALL | PRIMARY | NULL | NULL | NULL | 239 | Using temporary |
| 2 | MATERIALIZED | City | ref | Country | Country | 3 | world.Country.Code | 18 | |
+------+--------------+-------------+------+---------------+------------+---------+----------------------------------+------+-----------------+
4 rows in set (0.00 sec)
```
the cities are:
```
+------+-------------------+---------+------------+
| ID | Name | Country | Population |
+------+-------------------+---------+------------+
| 1024 | Mumbai (Bombay) | IND | 10500000 |
| 3580 | Moscow | RUS | 8389200 |
| 2454 | Macao | MAC | 437500 |
| 608 | Cairo | EGY | 6789479 |
| 2515 | Ciudad de México | MEX | 8591309 |
| 206 | São Paulo | BRA | 9968485 |
| 130 | Sydney | AUS | 3276207 |
+------+-------------------+---------+------------+
```
Factsheet
---------
Semi-join materialization
* Can be used for uncorrelated IN-subqueries. The subselect may use grouping and/or aggregate functions.
* Is shown in `EXPLAIN` as `type=MATERIALIZED` for the subquery, and a line with `table=<subqueryN>` in the parent subquery.
* Is enabled when one has both `materialization=on` and `semijoin=on` in the [optimizer\_switch](../server-system-variables/index#optimizer_switch) variable.
* The `materialization=on|off` flag is shared with [Non-semijoin materialization](../non-semi-join-subquery-optimizations/index#materialization-for-non-correlated-in-subqueries).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb BENCHMARK BENCHMARK
=========
Syntax
------
```
BENCHMARK(count,expr)
```
Description
-----------
The BENCHMARK() function executes the expression `expr` repeatedly `count` times. It may be used to time how quickly MariaDB processes the expression. The result value is always 0. The intended use is from within the [mysql client](../mysql-command-line-client/index), which reports query execution times.
Examples
--------
```
SELECT BENCHMARK(1000000,ENCODE('hello','goodbye'));
+----------------------------------------------+
| BENCHMARK(1000000,ENCODE('hello','goodbye')) |
+----------------------------------------------+
| 0 |
+----------------------------------------------+
1 row in set (0.21 sec)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_GeometryCollectionFromWKB ST\_GeometryCollectionFromWKB
=============================
A synonym for [ST\_GeomCollFromWKB](../st_geomcollfromwkb/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing TokuDB Installing TokuDB
=================
TokuDB has been deprecated by its upstream maintainer. It is disabled from [MariaDB 10.5](../what-is-mariadb-105/index) and has been been removed in [MariaDB 10.6](../what-is-mariadb-106/index) - [MDEV-19780](https://jira.mariadb.org/browse/MDEV-19780). We recommend [MyRocks](../myrocks/index) as a long-term migration path.
Note that ha\_tokudb is not included in binaries built with the "old" glibc. Binaries built with glibc 2.14+ do include it.
TokuDB is available on the following distributions:
| Distribution | Introduced |
| --- | --- |
| CentOS 6 64-bit and newer | [MariaDB 5.5.36](https://mariadb.com/kb/en/mariadb-5536-release-notes/) and [MariaDB 10.0.9](https://mariadb.com/kb/en/mariadb-1009-release-notes/) |
| Debian 7 "wheezy"64-bit and newer | [MariaDB 5.5.33](https://mariadb.com/kb/en/mariadb-5533-release-notes/) and [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/) |
| Fedora 19 64-bit and newer | [MariaDB 5.5.33](https://mariadb.com/kb/en/mariadb-5533-release-notes/) and [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/) |
| openSUSE 13.1 64-bit and newer | [MariaDB 5.5.41](https://mariadb.com/kb/en/mariadb-5541-release-notes/) and [MariaDB 10.0.15](https://mariadb.com/kb/en/mariadb-10015-release-notes/) |
| Red Hat 6 64-bit and newer | [MariaDB 5.5.36](https://mariadb.com/kb/en/mariadb-5536-release-notes/) and [MariaDB 10.0.9](https://mariadb.com/kb/en/mariadb-1009-release-notes/) |
| Ubuntu 12.10 "quantal" 64-bit and newer | [MariaDB 5.5.33](https://mariadb.com/kb/en/mariadb-5533-release-notes/) and [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/) |
**Note:** The TokuDB version that comes from MariaDB.org differs slightly from the TokuDB version from [Tokutek](http://www.tokutek.com). Please read the [TokuDB Differences](../tokudb-differences/index) article before using TokuDB!
The following sections detail how to install and enable TokuDB.
Installing TokuDB
-----------------
Until MariaDB versions 5.5.39 and 10.0.13, before upgrading TokuDB, the server needed to be cleanly shut down. If the server was not cleanly shut down, TokuDB would fail to start. Since 5.5.40 and 10.0.14, this has no longer been necessary. See [MDEV-6173](https://jira.mariadb.org/browse/MDEV-6173).
TokuDB has been included with MariaDB since [MariaDB 5.5.34](https://mariadb.com/kb/en/mariadb-5534-release-notes/) and [MariaDB 10.0.6](https://mariadb.com/kb/en/mariadb-1006-release-notes/) and does not require separate installation. Proceed straight to [Check for Transparent HugePage Support on Linux](#check-for-transparent-hugepage-support-on-linux). For older versions, see the distro-specific instructions below.
### Installing TokuDB on Fedora, RedHat, & CentOS
In [MariaDB 5.5.33](https://mariadb.com/kb/en/mariadb-5533-release-notes/), [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/), and starting from [MariaDB 10.2.5](https://mariadb.com/kb/en/mariadb-1025-release-notes/) TokuDB is in a separate RPM package called `MariaDB-tokudb-engine` and is installed as follows:
```
sudo yum install MariaDB-tokudb-engine
```
### Installing TokuDB on Ubuntu & Debian
On Ubuntu, TokuDB is available on the 64-bit versions of Ubuntu 12.10 and newer. On Debian, TokuDB is available on the 64-bit versions of Debian 7 "Wheezy" and newer.
The package is installed as follows:
```
sudo apt-get install mariadb-plugin-tokudb
```
In some earlier versions, from [MariaDB 5.5.33](https://mariadb.com/kb/en/mariadb-5533-release-notes/) and [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/), TokuDB is in a separate package called `mariadb-tokudb-engine-x.x`, where `x.x` is the MariaDB series (`5.5` or `10.0`). The package is installed, for example on `5.5`, as follows:
```
sudo apt-get install mariadb-tokudb-engine-5.5
```
libjemalloc
-----------
TokuDB requires the libjemalloc library (currently version 3.3.0 or greater).
libjemalloc should automatically be installed when using a package manager, and is loaded by restarting MariaDB.
It can be enabled, if not already done, by adding the following to the my.cnf configuration file:
```
[mysqld_safe]
malloc-lib= /path/to/jemalloc
```
If you don't do the above, you will get an error similar to the following one in your error file
```
2018-11-19 18:46:26 0 [ERROR] mysqld: Can't open shared library '/home/my/maria-10.3/mysql-test/var/plugins/ha_tokudb.so' (errno: 2, /usr/lib64/libjemalloc.so.2: cannot allocate memory in static TLS block)
```
Check for Transparent HugePage Support on Linux
-----------------------------------------------
Transparent hugepages is a feature in newer linux kernel versions that causes problems for the memory usage tracking calculations in TokuKV and can lead to memory overcommit. If you have this feature enabled, TokuKV will not start, and you should turn it off.
You can check the status of Transparent Hugepages as follows:
```
cat /sys/kernel/mm/transparent_hugepage/enabled
```
If the path does not exist, Transparent Hugepages are not enabled and you may continue.
Alternatively, the following will be returned:
```
always madvise [never]
```
indicating Transparent Hugepages are not enabled and you may continue. If the following is returned:
```
[always] madvise never
```
Transparent Hugepages are enabled, and you will need to disable them.
To disable them, pass "transparent\_hugepage=never" to the kernel in your bootloader (grub, lilo, etc.). For example, for SUSE, add `transparent_hugepage=never` to Optional Kernel Command Line Parameter at the end, such as after "showopts", and press OK. The setting will take effect on the next reboot.
You can also disable with:
```
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
```
On Centos or RedHat you can do:
Add line `GRUB_CMDLINE_LINUX_DEFAULT="transparent_hugepage=never"` to file /etc/default/grub
Update grub (boot loader):
```
grub2-mkconfig -o /boot/grub2/grub.cfg "$@"
```
For more information, see <http://unix.stackexchange.com/questions/99154/disable-transparent-hugepages>
Enabling TokuDB
---------------
Attempting to enable TokuDB while Linux Transparent HugePages are enabled will fail with an error such as:
```
ERROR 1123 (HY000): Can't initialize function 'TokuDB'; Plugin initialization function failed
```
See the section above; [Check for Transparent HugePage Support on Linux](#check-for-transparent-hugepage-support-on-linux).
The [binary log also needs to be enabled](../activating-the-binary-log/index) before attempting to enable TokuDB. Strictly speaking, the XA code requires two XA-capable storage engines, and this is checked at startup. In practice, this requires InnoDB and the binary log to be active. If it isn't, the following warning will be returned and XA features will be disabled:
```
Cannot enable tc-log at run-time. XA features of TokuDB are disabled
```
MariaDB's default `my.cnf` files come with a section for TokuDB. To enable TokuDB just remove the '#' comment markers from the options in the TokuDB section.
A typical TokuDB section looks like the following:
```
# See https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/
# for instructions how to enable TokuDB
#
# See https://mariadb.com/kb/en/tokudb-differences/ for differences
# between TokuDB in MariaDB and TokuDB from http://www.tokutek.com/
plugin-load=ha_tokudb
```
By default, the `plugin-load` option is commented out. Simply un-comment it as in the example above.
Don't forget to also enable jemalloc in the config file.
```
[mysqld_safe]
malloc-lib= /path/to/jemalloc
```
With these changes done, you can restart MariaDB to activate TokuDB.
### Enabling TokuDB on Fedora
Instead of putting the TokuDB section in the main `my.cnf` file, it is placed in a separate file located at: `/etc/my.cnf.d/tokudb.cnf`
### Enabling TokuDB on Ubuntu & Debian
Instead of putting the TokuDB section in the main `my.cnf` file, it is placed in a separate file located at: `/etc/mysql/conf.d/tokudb.cnf`
### Enabling TokuDB Manually From the mysql Command Line
Generally, it is recommended to use one of the above methods to enable the TokuDB storage engine, but it is also possible to enable it manually as with other plugins. To do so, launch the mysql command-line client and connect to MariaDB as a user with the `SUPER` privilege and execute the following command:
```
INSTALL SONAME 'ha_tokudb';
```
TokuDB will be installed until someone executes [UNINSTALL SONAME](../uninstall-soname/index).
### Temporarily Enabling TokuDB When Starting MariaDB
If you just want to test TokuDB, you can start the `mysqld` server with TokuDB with the following command:
```
mysqld --plugin-load=ha_tokudb --plugin-dir=/usr/local/mysql/lib/mysql/plugin
```
See Also
--------
* [Differences between TokuDB from Tokutek.com and the TokuDB version in MariaDB from MariaDB.org](../tokudb-differences/index).
* [TokuDB System and Status Variables](../tokudb-system-and-status-variables/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema events_transactions_summary_by_account_by_event_name Table Performance Schema events\_transactions\_summary\_by\_account\_by\_event\_name Table
====================================================================================
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**The events\_transactions\_summary\_by\_account\_by\_event\_name table was introduced in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/).
The `events_transactions_summary_by_account_by_event_name` table contains information on transaction events aggregated by account and event name.
The table contains the following columns:
| Column | Type | Description |
| --- | --- | --- |
| USER | char(32) | User for which summary is generated. |
| HOST | char(60) | Host for which summary is generated. |
| EVENT\_NAME | varchar(128) | Event name for which summary is generated. |
| COUNT\_STAR | bigint(20) unsigned | The number of summarized events. This value includes all events, whether timed or nontimed. |
| SUM\_TIMER\_WAIT | bigint(20) unsigned | The total wait time of the summarized timed events. This value is calculated only for timed events because nontimed events have a wait time of NULL. The same is true for the other xxx\_TIMER\_WAIT values. |
| MIN\_TIMER\_WAIT | bigint(20) unsigned | The minimum wait time of the summarized timed events. |
| AVG\_TIMER\_WAIT | bigint(20) unsigned | The average wait time of the summarized timed events. |
| MAX\_TIMER\_WAIT | bigint(20) unsigned | The maximum wait time of the summarized timed events. |
| COUNT\_READ\_WRITE | bigint(20) unsigned | The total number of only READ/WRITE transaction events. |
| SUM\_TIMER\_READ\_WRITE | bigint(20) unsigned | The total wait time of only READ/WRITE transaction events. |
| MIN\_TIMER\_READ\_WRITE | bigint(20) unsigned | The minimum wait time of only READ/WRITE transaction events. |
| AVG\_TIMER\_READ\_WRITE | bigint(20) unsigned | The average wait time of only READ/WRITE transaction events. |
| MAX\_TIMER\_READ\_WRITE | bigint(20) unsigned | The maximum wait time of only READ/WRITE transaction events. |
| COUNT\_READ\_ONLY | bigint(20) unsigned | The total number of only READ ONLY transaction events. |
| SUM\_TIMER\_READ\_ONLY | bigint(20) unsigned | The total wait time of only READ ONLY transaction events. |
| MIN\_TIMER\_READ\_ONLY | bigint(20) unsigned | The minimum wait time of only READ ONLY transaction events. |
| AVG\_TIMER\_READ\_ONLY | bigint(20) unsigned | The average wait time of only READ ONLY transaction events. |
| MAX\_TIMER\_READ\_ONLY | bigint(20) unsigned | The maximum wait time of only READ ONLY transaction events. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Non-blocking API Reference Non-blocking API Reference
==========================
Here is a list of all functions in the non-blocking client API and their parameters. Apart from operating in a non-blocking way, they all work exactly the same as their blocking counterparts, so their exact semantics can be obtained from the documentation of the normal client API.
The API also contains the following three functions which are used to get the socket `fd` and `timeout` values when waiting for events to occur:
```
my_socket mysql_get_socket(const MYSQL *mysql)
```
Return the descriptor of the socket used for the connection.
```
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql)
```
This should only be called when a `_start()` or `_cont()` function returns a value with the `MYSQL_WAIT_TIMEOUT` flag set. In this case, it returns the value, in seconds, after which a timeout has occured and the application should call the appropriate `_cont()` function passing `MYSQL_WAIT_TIMEOUT` as the event that occured.
This is used to handle connection and read timeouts.
```
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql)
```
This function is available starting from [MariaDB 5.5.28](https://mariadb.com/kb/en/mariadb-5528-release-notes/) and [MariaDB 10.0.0](https://mariadb.com/kb/en/mariadb-1000-release-notes/).
Like mysql\_get\_timeout\_value(), this should only be called when a \_start() or \_cont() function returns a value with the MYSQL\_WAIT\_TIMEOUT flag set. In this case, it returns the value, in millisecondsseconds, after which a timeout has occured and the application should call the appropriate \_cont() function passing MYSQL\_WAIT\_TIMEOUT as the event that occured.
The difference to mysql\_get\_timeout\_value() is that this provides millisecond resolution for timeouts, rather than just whole seconds. In [MariaDB 10.0](../what-is-mariadb-100/index), internal timeouts can now be in milliseconds, while in 5.5 and below it was only whole seconds.
This milliseconds version is provided also in [MariaDB 5.5](../what-is-mariadb-55/index) (from 5.5.28 onwards) to make it easier for applications to work with either library version. However, in 5.5 it always returns a multiple of 1000 milliseconds.
[At the end](#client-api-functions-which-never-block) is a list of all functions from the normal API which can be used safely in a non-blocking program, since they never need to block.
```
int mysql_real_connect_start(MYSQL **ret, MYSQL *mysql, const char *host,
const char *user, const char *passwd, const char *db,
unsigned int port, const char *unix_socket,
unsigned long client_flags)
```
```
int mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql, int ready_status)
```
`mysql_real_connect_start()` initiates a non-blocking connection request to a server.
When `mysql_real_connect_start()` or `mysql_real_connect_cont()` returns zero, a copy of the passed '`mysql`' argument is stored in `*ret`.
```
int mysql_real_query_start(int *ret, MYSQL *mysql, const char *stmt_str,
unsigned long length)
int mysql_real_query_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_fetch_row_start(MYSQL_ROW *ret, MYSQL_RES *result)
int mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result, int ready_status)
```
Initiate fetch of another row from a `SELECT` query.
If the `MYSQL_RES` was obtained from `mysql_use_result()`, then this function allows stream processing, where initial rows are returned to the application while the server is still sending subsequent rows. When no more data is available on the socket, `mysql_fetch_row_start()` or `mysql_fetch_row_cont()` will return `MYSQL_WAIT_READ` (or possibly `MYSQL_WAIT_WRITE` if using TLS and TLS re-negotiation is needed; also `MYSQL_WAIT_TIMEOUT` may be set if read timeout is enabled). When data becomes available, more rows can be fetched with `mysql_fetch_row_cont()`.
If the `MYSQL_RES` was obtained from `mysql_store_result()` / `mysql_store_result_start()` / `mysql_store_result_cont()`, then this function cannot block — `mysql_fetch_row_start()` will always return 0 (and if desired, `plain mysql_fetch_row()` may be used instead with equivalent effect).
```
int mysql_set_character_set_start(int *ret, MYSQL *mysql, const char *csname)
int mysql_set_character_set_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
mysql_select_db_start(int *ret, MYSQL *mysql, const char *db)
int mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_send_query_start(int *ret, MYSQL *mysql, const char *q, unsigned long length)
int mysql_send_query_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql)
int mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
```
```
int mysql_free_result_start(MYSQL_RES *result)
int mysql_free_result_cont(MYSQL_RES *result, int ready_status)
```
This function can need to wait if not all rows were fetched before it was called (then it needs to consume any pending rows sent from the server so they do not interfere with any subsequent queries sent).
If all rows were already fetched, then this function will not need to wait. `mysql_free_result_start()` will return zero (or if so desired, plain `mysql_free_result()` may be used instead).
Note that `mysql_free_result()` returns no value, so there is no extra '`ret`' parameter for `mysql_free_result_start()` or `mysql_free_result_cont()`.
```
int mysql_close_start(MYSQL *sock)
int mysql_close_cont(MYSQL *sock, int ready_status)
```
`mysql_close()` sends a `COM_QUIT` request to the server, though it does not wait for any reply.
Thus teoretically it can block (if the socket buffer is full), though in practise it is probably unlikely to occur frequently.
The non-blocking version of `mysql_close()` is provided for completeness; for many applications using the normal `mysql_close()` is probably sufficient (and may be simpler).
Note that `mysql_close()` returns no value, so there is no extra '`ret`' parameter for `mysql_close_start()` or `mysql_close_cont()`.
```
int mysql_change_user_start(my_bool *ret, MYSQL *mysql, const char *user, const
char *passwd, const char *db)
int mysql_change_user_cont(my_bool *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_query_start(int *ret, MYSQL *mysql, const char *q)
int mysql_query_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_shutdown_start(int *ret, MYSQL *mysql, enum mysql_enum_shutdown_level
shutdown_level)
int mysql_shutdown_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_dump_debug_info_start(int *ret, MYSQL *mysql)
int mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_refresh_start(int *ret, MYSQL *mysql, unsigned int refresh_options)
int mysql_refresh_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_kill_start(int *ret, MYSQL *mysql, unsigned long pid)
int mysql_kill_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_set_server_option_start(int *ret, MYSQL *mysql,
enum enum_mysql_set_option option)
int mysql_set_server_option_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_ping_start(int *ret, MYSQL *mysql)
int mysql_ping_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_stat_start(const char **ret, MYSQL *mysql)
int mysql_stat_cont(const char **ret, MYSQL *mysql, int ready_status)
```
```
int mysql_list_dbs_start(MYSQL_RES **ret, MYSQL *mysql, const char *wild)
int mysql_list_dbs_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
```
```
int mysql_list_tables_start(MYSQL_RES **ret, MYSQL *mysql, const char *wild)
int mysql_list_tables_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
```
```
int mysql_list_processes_start(MYSQL_RES **ret, MYSQL *mysql)
int mysql_list_processes_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
```
```
int mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, const char *table,
const char *wild)
int mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status)
```
```
int mysql_read_query_result_start(my_bool *ret, MYSQL *mysql)
int mysql_read_query_result_cont(my_bool *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt, const char *query,
unsigned long length)
int mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt)
int mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt)
int mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt)
int mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt)
int mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT *stmt)
int mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt)
int mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt,
unsigned int param_number,
const char *data, unsigned long length)
int mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt, int ready_status)
```
```
int mysql_commit_start(my_bool *ret, MYSQL *mysql)
int mysql_commit_cont(my_bool *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_rollback_start(my_bool *ret, MYSQL *mysql)
int mysql_rollback_cont(my_bool *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_autocommit_start(my_bool *ret, MYSQL *mysql, my_bool auto_mode)
int mysql_autocommit_cont(my_bool *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_next_result_start(int *ret, MYSQL *mysql)
int mysql_next_result_cont(int *ret, MYSQL *mysql, int ready_status)
```
```
int mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt)
int mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int ready_status)
```
Client API functions which never block
--------------------------------------
The following client API functions never need to do I/O and thus can never block. Therefore, they can be used as normal in programs using non-blocking operations; no need to call any special `_start()` variant. (Even if a `_start()` variant was available, it would always return zero, so no `_cont()` call would ever be needed).
* [mysql\_num\_rows()](../mysql_num_rows/index)
* [mysql\_num\_fields()](../mysql_num_fields/index)
* mysql\_eof()
* [mysql\_fetch\_field\_direct()](../mysql_fetch_field_direct/index)
* [mysql\_fetch\_fields()](../mysql_fetch_fields/index)
* [mysql\_row\_tell](../mysql_row_tell/index)
* [mysql\_field\_tell()](../mysql_field_tell/index)
* [mysql\_field\_count()](../mysql_field_count/index)
* [mysql\_affected\_rows()](../mysql_affected_rows/index)
* [mysql\_insert\_id()](../mysql_insert_id/index)
* [mysql\_errno()](../mysql_errno/index)
* [mysql\_error()](../mysql_error/index)
* [mysql\_sqlstate()](../mysql_sqlstate/index)
* [mysql\_warning\_count()](../mysql_warning_count/index)
* [mysql\_info()](../mysql_info/index)
* [mysql\_thread\_id()](../mysql_thread_id/index)
* [mysql\_character\_set\_name()](../mysql_character_set_name/index)
* [mysql\_init()](../mysql_init/index)
* [mysql\_ssl\_set()](../mysql_ssl_set/index)
* [mysql\_get\_ssl\_cipher()](../mysql_get_ssl_cipher/index)
* [mysql\_use\_result()](../mysql_use_result/index)
* [mysql\_get\_character\_set\_info()](../mysql_get_character_set_info/index)
* mysql\_set\_local\_infile\_handler()
* mysql\_set\_local\_infile\_default()
* [mysql\_get\_server\_info()](../mysql_get_server_info/index)
* mysql\_get\_server\_name()
* [mysql\_get\_client\_info()](../mysql_get_client_info/index)
* [mysql\_get\_client\_version()](../mysql_get_client_version/index)
* [mysql\_get\_host\_info()](../mysql_get_host_info/index)
* [mysql\_get\_server\_version()](../mysql_get_server_version/index)
* [mysql\_get\_proto\_info()](../mysql_get_proto_info/index)
* [mysql\_options()](../mysql_options/index)
* [mysql\_data\_seek()](../mysql_data_seek/index)
* [mysql\_row\_seek()](../mysql_row_seek/index)
* [mysql\_field\_seek()](../mysql_field_seek/index)
* [mysql\_fetch\_lengths()](../mysql_fetch_lengths/index)
* [mysql\_fetch\_field()](../mysql_fetch_field/index)
* [mysql\_escape\_string()](../mysql_escape_string/index)
* [mysql\_hex\_string()](../mysql_hex_string/index)
* [mysql\_real\_escape\_string()](../mysql_real_escape_string/index)
* [mysql\_debug()](../mysql_debug/index)
* myodbc\_remove\_escape()
* mysql\_thread\_safe()
* mysql\_embedded()
* mariadb\_connection()
* [mysql\_stmt\_init()](../mysql_stmt_init/index)
* [mysql\_stmt\_fetch\_column()](../mysql_stmt_fetch_column/index)
* [mysql\_stmt\_param\_count()](../mysql_stmt_param_count/index)
* [mysql\_stmt\_attr\_set()](../mysql_stmt_attr_set/index)
* [mysql\_stmt\_attr\_get()](../mysql_stmt_attr_get/index)
* [mysql\_stmt\_bind\_param()](../mysql_stmt_bind_param/index)
* [mysql\_stmt\_bind\_result()](../mysql_stmt_bind_result/index)
* [mysql\_stmt\_result\_metadata()](../mysql_stmt_result_metadata/index)
* [mysql\_stmt\_param\_metadata()](../mysql_stmt_param_metadata/index)
* [mysql\_stmt\_errno()](../mysql_stmt_errno/index)
* [mysql\_stmt\_error()](../mysql_stmt_error/index)
* [mysql\_stmt\_sqlstate()](../mysql_stmt_sqlstate/index)
* [mysql\_stmt\_row\_seek()](../mysql_stmt_row_seek/index)
* [mysql\_stmt\_row\_tell()](../mysql_stmt_row_tell/index)
* [mysql\_stmt\_data\_seek()](../mysql_stmt_data_seek/index)
* [mysql\_stmt\_num\_rows()](../mysql_stmt_num_rows/index)
* [mysql\_stmt\_affected\_rows()](../mysql_stmt_affected_rows/index)
* [mysql\_stmt\_insert\_id()](../mysql_stmt_insert_id/index)
* [mysql\_stmt\_field\_count()](../mysql_stmt_field_count/index)
* [mysql\_more\_results()](../mysql_more_results/index)
* mysql\_get\_socket()
* mysql\_get\_timeout\_value
* mysql\_get\_timeout\_value\_ms
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Plans for 10.3 Plans for 10.3
==============
No new features will be added to [MariaDB 10.3](../what-is-mariadb-103/index). If you wish to contribute new features to the latest development release, see [Plans for MariaDB 10.5](../plans-for-mariadb-105/index).
"[What is MariaDB 10.3](../what-is-mariadb-103/index)" shows all features implemented for 10.3.
[MariaDB 10.3](../what-is-mariadb-103/index)
--------------------------------------------
The following features were discussed at the 2016 MariaDB Developer's Meeting for consideration in [MariaDB 10.3](../what-is-mariadb-103/index). See [Thoughts on MariaDB Server 10.3 from MariaDB Developers Meeting in Amsterdam, part 1](https://mariadb.org/thoughts-mariadb-server-10-3-mariadb-developers-meeting-amsterdam-part-1/).
* Hidden Columns
* Long unique constraints
* SQL based CREATE AGGREGATE FUNCTION
* Now it looks like one step ahead has been made with the implementation of a Pluggable Data Type API. It still exists in a separate branch, but it is now planned for inclusion in MariaDB Server 10.3. On top of the API the idea is to build User Defined Types according to the SQL Standard.
* Better support for CJK (Chinese, Japanese, and Korean) languages. The idea is to include the ngram full-text parser and MeCab full-text parser plugins. Also the GB 18030 standard for Chinese charsets is on the radar for 10.3.
* On the storage engine side MyRocks will be included in 10.2, which will open MyRocks to a wider audience. It’s obvious that it will need work during 10.3 timeframe to grow in maturity. Another interesting storage engine discussed during the last few years is Spider, an engine that provides a sharding solution for databases. Although Spider already exists in MariaDB Server, there is a set of patches that needs to be incorporated on the server side to improve functionality and performance. These patches can be found in [MDEV-7698](https://jira.mariadb.org/browse/MDEV-7698).
### InnoDB
* In MySQL 8.0 there are a couple of interesting new features for InnoDB that are interesting for MariaDB as well. The timelines of 10.3 and 8.0 will partially determine whether these will be in 10.3.
* InnoDB deadlock detect
* The new information schema table.
* Lock wait policy
* Persistent autoincrement
### Compatibility
* Support for SEQUENCE
* Addition of a PL/SQL parser
* Support for INTERSECT
* Support for EXCEPT
### JIRA
We manage our development plans in JIRA, so the definitive list will be there. [This search](https://jira.mariadb.org/issues/?jql=project+%3D+MDEV+AND+issuetype+%3D+Task+AND+fixVersion+in+%2810.3.0%2C+10.3%29+ORDER+BY+priority+DESC) shows what we **currently** plan for 10.3. It shows all tasks with the **Fix-Version** being 10.3. Not all these tasks will really end up in 10.3, but tasks with the "red" priorities have a much higher chance of being done in time for 10.3. Practically, you can think of these tasks as "features that **will** be in 10.3". Tasks with the "green" priorities probably won't be in 10.3. Think of them as "bonus features that would be **nice to have** in 10.3".
See Also
--------
* [Current tasks for 10.3](https://jira.mariadb.org/issues/?jql=project%20%3D%20MDEV%20AND%20issuetype%20%3D%20Task%20AND%20fixVersion%20in%20(10.3.0%2C%2010.3)%20ORDER%20BY%20priority%20DESC)
* [10.3 Features/fixes by vote](https://jira.mariadb.org/issues/?jql=project%20%3D%20MDEV%20AND%20fixVersion%20%3D%2010.3%20ORDER%20BY%20votes%20DESC)
* [What is MariaDB 10.3?](../what-is-mariadb-103/index)
* [What is MariaDB 10.2?](../what-is-mariadb-102/index)
* [What is MariaDB 10.1?](../what-is-mariadb-101/index)
* [What is MariaDB 10.0?](../what-is-mariadb-100/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb 10.1.22 Pre-release Upgrade Tests 10.1.22 Pre-release Upgrade Tests
=================================
Upgrade from 10.0
-----------------
### Tested revision
dbd1d7ea8e96a2b4cff89ec889494700d634b3a3
### Test date
2017-03-07 13:42:18
### Summary (PASS)
All tests passed
### Details
| # | type | pagesize | OLD version | encrypted | compressed | | NEW version | encrypted | compressed | readonly | result | notes |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | crash | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 2 | crash | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 3 | crash | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 4 | crash | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 5 | crash | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 6 | crash | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 7 | crash | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 8 | crash | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 9 | crash | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 10 | crash | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 11 | crash | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 12 | crash | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 13 | crash | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 14 | crash | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 15 | crash | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 16 | crash | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 17 | crash | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 18 | crash | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 19 | crash | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 20 | crash | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 21 | crash | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 22 | crash | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 23 | crash | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 24 | crash | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 25 | crash | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 26 | crash | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 27 | crash | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 28 | crash | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 29 | crash | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 30 | crash | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 31 | crash | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 32 | crash | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 33 | crash | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 34 | crash | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 35 | crash | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 36 | crash | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 37 | crash | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 38 | crash | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 39 | crash | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 40 | crash | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 41 | crash | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 42 | crash | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 43 | crash | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 44 | crash | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 45 | crash | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 46 | crash | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 47 | crash | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 48 | crash | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 49 | normal | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 50 | normal | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 51 | normal | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 52 | normal | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 53 | normal | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 54 | normal | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 55 | normal | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 56 | normal | 4 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 57 | normal | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 58 | normal | 16 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 59 | normal | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 60 | normal | 8 | 10.0.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 61 | normal | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 62 | normal | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 63 | normal | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 64 | normal | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 65 | normal | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 66 | normal | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 67 | normal | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 68 | normal | 16 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 69 | normal | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 70 | normal | 4 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 71 | normal | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 72 | normal | 8 | 10.0.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 73 | normal | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 74 | normal | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 75 | normal | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 76 | normal | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 77 | normal | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 78 | normal | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 79 | normal | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 80 | normal | 4 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 81 | normal | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 82 | normal | 16 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 83 | normal | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 84 | normal | 8 | 10.0.29 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 85 | normal | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 86 | normal | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 87 | normal | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 88 | normal | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 89 | normal | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 90 | normal | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 91 | normal | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 92 | normal | 4 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 93 | normal | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 94 | normal | 16 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 95 | normal | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 96 | normal | 8 | 10.0.29 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
Upgrade from 10.1
-----------------
### Tested revision
adc91387e3add6d9c850b7c2a44760deaceb3638
### Test date
2017-03-05 18:09:10
### Summary (FAIL)
34 failures out of 1280 combinations, all associated with [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) (crash-upgrade from 10.1.10 with encryption enabled)
### Details
| # | type | pagesize | OLD version | encrypted | compressed | | NEW version | encrypted | compressed | readonly | result | notes |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 2 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 3 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 4 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 5 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 6 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 7 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 8 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 9 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 10 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 11 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 12 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 13 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 14 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 15 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 16 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 17 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 18 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 19 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 20 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 21 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 22 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 23 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 24 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 25 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 26 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 27 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 28 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 29 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 30 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 31 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 32 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 33 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 34 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 35 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 36 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 37 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 38 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 39 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 40 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 41 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 42 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 43 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 44 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 45 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 46 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 47 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 48 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 49 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 50 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 51 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 52 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 53 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 54 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 55 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 56 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 57 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 58 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 59 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 60 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 61 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 62 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 63 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 64 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 65 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 66 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 67 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 68 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 69 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 70 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 71 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 72 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 73 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 74 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 75 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 76 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 77 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 78 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 79 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 80 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 81 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 82 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 83 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 84 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 85 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 86 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 87 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 88 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 89 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 90 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 91 | crash | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 92 | crash | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 93 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 94 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 95 | crash | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 96 | crash | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 97 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 98 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 99 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 100 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 101 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 102 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 103 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 104 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 105 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 106 | crash | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 107 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 108 | crash | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 109 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 110 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 111 | crash | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 112 | crash | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 113 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 114 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 115 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 116 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 117 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 118 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 119 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 120 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 121 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 122 | crash | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 123 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 124 | crash | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 125 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 126 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 127 | crash | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 128 | crash | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 129 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 130 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 131 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 132 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 133 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 134 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 135 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 136 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 137 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 138 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 139 | crash | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 140 | crash | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 141 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 142 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 143 | crash | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 144 | crash | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 145 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 146 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 147 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 148 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 149 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 150 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 151 | crash | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 152 | crash | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 153 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 154 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 155 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 156 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 157 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 158 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 159 | crash | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 160 | crash | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 161 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 162 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 163 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 164 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 165 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 166 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 167 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 168 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 169 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 170 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 171 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 172 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 173 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 174 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 175 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 176 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 177 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 178 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 179 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 180 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 181 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 182 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 183 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 184 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 185 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 186 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 187 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 188 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 189 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 190 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 191 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 192 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 193 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 194 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 195 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 196 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 197 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 198 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 199 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 200 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 201 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 202 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 203 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 204 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 205 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 206 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 207 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 208 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 209 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 210 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 211 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 212 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 213 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 214 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 215 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 216 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 217 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 218 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 219 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 220 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 221 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 222 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 223 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 224 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 225 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 226 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 227 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 228 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 229 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 230 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 231 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 232 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 233 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 234 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 235 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 236 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 237 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 238 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 239 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 240 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 241 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 242 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 243 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 244 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 245 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 246 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 247 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 248 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 249 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 250 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 251 | crash | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 252 | crash | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 253 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 254 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 255 | crash | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 256 | crash | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 257 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 258 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 259 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 260 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 261 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 262 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 263 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 264 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 265 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 266 | crash | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 267 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 268 | crash | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 269 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 270 | crash | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 271 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 272 | crash | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 273 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 274 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 275 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 276 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 277 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 278 | crash | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 279 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 280 | crash | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 281 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 282 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 283 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 284 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 285 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 286 | crash | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 287 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 288 | crash | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 289 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 290 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 291 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 292 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 293 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 294 | crash | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 295 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 296 | crash | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 297 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 298 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 299 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 300 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 301 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 302 | crash | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 303 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 304 | crash | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 305 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 306 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 307 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 308 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 309 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 310 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 311 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 312 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 313 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 314 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 315 | crash | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 316 | crash | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 317 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 318 | crash | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 319 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 320 | crash | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 321 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 322 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 323 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 324 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 325 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 326 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 327 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 328 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 329 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 330 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 331 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 332 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 333 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 334 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 335 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 336 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 337 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 338 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 339 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 340 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 341 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 342 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 343 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 344 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 345 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 346 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 347 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 348 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 349 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 350 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 351 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 352 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 353 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 354 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 355 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 356 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 357 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 358 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 359 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 360 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 361 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 362 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 363 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 364 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 365 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 366 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 367 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 368 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 369 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 370 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 371 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 372 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 373 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 374 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 375 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 376 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 377 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 378 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 379 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 380 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 381 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 382 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 383 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 384 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 385 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 386 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 387 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 388 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 389 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 390 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 391 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 392 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 393 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 394 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 395 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 396 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 397 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 398 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 399 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 400 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 401 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 402 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 403 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 404 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 405 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 406 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 407 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 408 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 409 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 410 | crash | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 411 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 412 | crash | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 413 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 414 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 415 | crash | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 416 | crash | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 417 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 418 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 419 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 420 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 421 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 422 | crash | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 423 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 424 | crash | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 425 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 426 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 427 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 428 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 429 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 430 | crash | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 431 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 432 | crash | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 433 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 434 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 435 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 436 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 437 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 438 | crash | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 439 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 440 | crash | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 441 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 442 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 443 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 444 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 445 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 446 | crash | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 447 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 448 | crash | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 449 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 450 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 451 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 452 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 453 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 454 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | **FAIL** | [MDEV-9422](https://jira.mariadb.org/browse/MDEV-9422) |
| 455 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 456 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 457 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 458 | crash | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 459 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 460 | crash | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 461 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 462 | crash | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 463 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 464 | crash | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 465 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 466 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 467 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 468 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 469 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 470 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 471 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 472 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 473 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 474 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 475 | crash | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 476 | crash | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 477 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 478 | crash | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 479 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 480 | crash | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 481 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 482 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 483 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 484 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 485 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 486 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 487 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 488 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 489 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 490 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 491 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 492 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 493 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 494 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 495 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 496 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 497 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 498 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 499 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 500 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 501 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 502 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 503 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 504 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 505 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 506 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 507 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 508 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 509 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 510 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 511 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 512 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 513 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 514 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 515 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 516 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 517 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 518 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 519 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 520 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 521 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 522 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 523 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 524 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 525 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 526 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 527 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 528 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 529 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 530 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 531 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 532 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 533 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 534 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 535 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 536 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 537 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 538 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 539 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 540 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 541 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 542 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 543 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 544 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 545 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 546 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 547 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 548 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 549 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 550 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 551 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 552 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 553 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 554 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 555 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 556 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 557 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 558 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 559 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 560 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 561 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 562 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 563 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 564 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 565 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 566 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 567 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 568 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 569 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 570 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 571 | crash | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 572 | crash | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 573 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 574 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 575 | crash | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 576 | crash | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 577 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 578 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 579 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 580 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 581 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 582 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 583 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 584 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 585 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 586 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 587 | crash | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 588 | crash | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 589 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 590 | crash | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 591 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 592 | crash | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 593 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 594 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 595 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 596 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 597 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 598 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 599 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 600 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 601 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 602 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 603 | crash | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 604 | crash | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 605 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 606 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 607 | crash | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 608 | crash | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 609 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 610 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 611 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 612 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 613 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 614 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 615 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 616 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 617 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 618 | crash | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 619 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 620 | crash | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 621 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 622 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 623 | crash | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 624 | crash | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 625 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 626 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 627 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 628 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 629 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 630 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 631 | crash | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 632 | crash | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 633 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 634 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 635 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 636 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 637 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 638 | crash | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 639 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 640 | crash | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 641 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 642 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 643 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 644 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 645 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 646 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 647 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 648 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 649 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 650 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 651 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 652 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 653 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 654 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 655 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 656 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 657 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 658 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 659 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 660 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 661 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 662 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 663 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 664 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 665 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 666 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 667 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 668 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 669 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 670 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 671 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 672 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 673 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 674 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 675 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 676 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 677 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 678 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 679 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 680 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 681 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 682 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 683 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 684 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 685 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 686 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 687 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 688 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 689 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 690 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 691 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 692 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 693 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 694 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 695 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 696 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 697 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 698 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 699 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 700 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 701 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 702 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 703 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 704 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 705 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 706 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 707 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 708 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 709 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 710 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 711 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 712 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 713 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 714 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 715 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 716 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 717 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 718 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 719 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 720 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 721 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 722 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 723 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 724 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 725 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 726 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 727 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 728 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 729 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 730 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 731 | normal | 64 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 732 | normal | 64 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 733 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 734 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 735 | normal | 64 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 736 | normal | 64 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 737 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 738 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 739 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 740 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 741 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 742 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 743 | normal | 4 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 744 | normal | 4 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 745 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 746 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 747 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 748 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 749 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 750 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 751 | normal | 4 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 752 | normal | 4 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 753 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 754 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 755 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 756 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 757 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 758 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 759 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 760 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 761 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 762 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 763 | normal | 8 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 764 | normal | 8 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 765 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 766 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 767 | normal | 8 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 768 | normal | 8 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 769 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 770 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 771 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 772 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 773 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 774 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 775 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 776 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 777 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 778 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 779 | normal | 16 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 780 | normal | 16 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 781 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 782 | normal | 16 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 783 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 784 | normal | 16 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 785 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 786 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 787 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 788 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 789 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 790 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 791 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 792 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 793 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 794 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 795 | normal | 32 | 10.1.10 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 796 | normal | 32 | 10.1.10 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 797 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 798 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 799 | normal | 32 | 10.1.10 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 800 | normal | 32 | 10.1.10 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 801 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 802 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 803 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 804 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 805 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 806 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 807 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 808 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 809 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 810 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 811 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 812 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 813 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 814 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 815 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 816 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 817 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 818 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 819 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 820 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 821 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 822 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 823 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 824 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 825 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 826 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 827 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 828 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 829 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 830 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 831 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 832 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 833 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 834 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 835 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 836 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 837 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 838 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 839 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 840 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 841 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 842 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 843 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 844 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 845 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 846 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 847 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 848 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 849 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 850 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 851 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 852 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 853 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 854 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 855 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 856 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 857 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 858 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 859 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 860 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 861 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 862 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 863 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 864 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 865 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 866 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 867 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 868 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 869 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 870 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 871 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 872 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 873 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 874 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 875 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 876 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 877 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 878 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 879 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 880 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 881 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 882 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 883 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 884 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 885 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 886 | normal | 8 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 887 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 888 | normal | 8 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 889 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 890 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 891 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 892 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 893 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 894 | normal | 8 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 895 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 896 | normal | 8 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 897 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 898 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 899 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 900 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 901 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 902 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 903 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 904 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 905 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 906 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 907 | normal | 32 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 908 | normal | 32 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 909 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 910 | normal | 32 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 911 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 912 | normal | 32 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 913 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 914 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 915 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 916 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 917 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 918 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 919 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 920 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 921 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 922 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 923 | normal | 64 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 924 | normal | 64 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 925 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 926 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 927 | normal | 64 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 928 | normal | 64 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 929 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 930 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 931 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 932 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 933 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 934 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 935 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 936 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 937 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 938 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 939 | normal | 16 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 940 | normal | 16 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 941 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 942 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 943 | normal | 16 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 944 | normal | 16 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 945 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 946 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 947 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 948 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 949 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 950 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 951 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 952 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 953 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 954 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 955 | normal | 4 | 10.1.10 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 956 | normal | 4 | 10.1.10 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 957 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 958 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 959 | normal | 4 | 10.1.10 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 960 | normal | 4 | 10.1.10 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 961 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 962 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 963 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 964 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 965 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 966 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 967 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 968 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 969 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 970 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 971 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 972 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 973 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 974 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 975 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 976 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 977 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 978 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 979 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 980 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 981 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 982 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 983 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 984 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 985 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 986 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 987 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 988 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 989 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 990 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 991 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 992 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 993 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 994 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 995 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 996 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 997 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 998 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 999 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1000 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1001 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1002 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1003 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1004 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1005 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1006 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1007 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1008 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1009 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1010 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1011 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1012 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1013 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1014 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1015 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1016 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1017 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1018 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1019 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1020 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1021 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1022 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1023 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1024 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1025 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1026 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1027 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1028 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1029 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1030 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1031 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1032 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1033 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1034 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1035 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1036 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1037 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1038 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1039 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1040 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1041 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1042 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1043 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1044 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1045 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1046 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1047 | normal | 64 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1048 | normal | 64 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1049 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1050 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1051 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1052 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1053 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1054 | normal | 64 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1055 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1056 | normal | 64 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1057 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1058 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1059 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1060 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1061 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1062 | normal | 32 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1063 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1064 | normal | 32 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1065 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1066 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1067 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1068 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1069 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1070 | normal | 32 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1071 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1072 | normal | 32 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1073 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1074 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1075 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1076 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1077 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1078 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1079 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1080 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1081 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1082 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1083 | normal | 8 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1084 | normal | 8 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1085 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1086 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1087 | normal | 8 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1088 | normal | 8 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1089 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1090 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1091 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1092 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1093 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1094 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1095 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1096 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1097 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1098 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1099 | normal | 4 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1100 | normal | 4 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1101 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1102 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1103 | normal | 4 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1104 | normal | 4 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1105 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1106 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1107 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1108 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1109 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1110 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1111 | normal | 16 | 10.1.20 (InnoDB plugin) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1112 | normal | 16 | 10.1.20 (InnoDB plugin) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1113 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1114 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1115 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1116 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1117 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1118 | normal | 16 | 10.1.20 (InnoDB plugin) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1119 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1120 | normal | 16 | 10.1.20 (InnoDB plugin) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1121 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1122 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1123 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1124 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1125 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1126 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1127 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1128 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1129 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1130 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1131 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1132 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1133 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1134 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1135 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1136 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1137 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1138 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1139 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1140 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1141 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1142 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1143 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1144 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1145 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1146 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1147 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1148 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1149 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1150 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1151 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1152 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1153 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1154 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1155 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1156 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1157 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1158 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1159 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1160 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1161 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1162 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1163 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1164 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1165 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1166 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1167 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1168 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1169 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1170 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1171 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1172 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1173 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1174 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1175 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1176 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1177 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1178 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1179 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1180 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1181 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1182 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1183 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1184 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1185 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1186 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1187 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1188 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1189 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1190 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1191 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | zlib | - | OK | |
| 1192 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | zlib | - | OK | |
| 1193 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1194 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1195 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1196 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1197 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1198 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1199 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 1200 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 1201 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1202 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1203 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1204 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1205 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1206 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1207 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1208 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1209 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1210 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1211 | normal | 8 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1212 | normal | 8 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1213 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1214 | normal | 8 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1215 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1216 | normal | 8 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1217 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1218 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1219 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1220 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1221 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1222 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1223 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1224 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1225 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1226 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1227 | normal | 32 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1228 | normal | 32 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1229 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1230 | normal | 32 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1231 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1232 | normal | 32 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1233 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1234 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1235 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1236 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1237 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1238 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1239 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1240 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1241 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1242 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1243 | normal | 4 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1244 | normal | 4 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1245 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1246 | normal | 4 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1247 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1248 | normal | 4 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1249 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1250 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1251 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1252 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1253 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1254 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1255 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1256 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1257 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1258 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1259 | normal | 16 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1260 | normal | 16 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1261 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1262 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1263 | normal | 16 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1264 | normal | 16 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1265 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1266 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1267 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1268 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1269 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1270 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1271 | normal | 64 | 10.1.20 (inbuilt) | - | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1272 | normal | 64 | 10.1.20 (inbuilt) | on | zlib | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1273 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1274 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 1275 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1276 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 1277 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1278 | normal | 64 | 10.1.20 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
| 1279 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | - | zlib | - | OK | |
| 1280 | normal | 64 | 10.1.20 (inbuilt) | on | - | => | 10.1.22 (inbuilt) | on | zlib | - | OK | |
Upgrade from MySQL 5.6
----------------------
### Tested revision
dbd1d7ea8e96a2b4cff89ec889494700d634b3a3
### Test date
2017-03-07 18:37:29
### Summary (PASS)
All tests passed
### Details
| # | type | pagesize | OLD version | encrypted | compressed | | NEW version | encrypted | compressed | readonly | result | notes |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | crash | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 2 | crash | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 3 | crash | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 4 | crash | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 5 | crash | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 6 | crash | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 7 | crash | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 8 | crash | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 9 | crash | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 10 | crash | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 11 | crash | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 12 | crash | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 13 | normal | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 14 | normal | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 15 | normal | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 16 | normal | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 17 | normal | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | - | - | - | OK | |
| 18 | normal | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (InnoDB plugin) | on | - | - | OK | |
| 19 | normal | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 20 | normal | 8 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 21 | normal | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 22 | normal | 4 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
| 23 | normal | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | - | - | - | OK | |
| 24 | normal | 16 | 5.6.35 (inbuilt) | - | - | => | 10.1.22 (inbuilt) | on | - | - | OK | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb DES_ENCRYPT DES\_ENCRYPT
============
DES\_ENCRYPT has been deprecated from [MariaDB 10.10.0](https://mariadb.com/kb/en/mariadb-10100-release-notes/), and will be removed in a future release.
Syntax
------
```
DES_ENCRYPT(str[,{key_num|key_str}])
```
Description
-----------
Encrypts the string with the given key using the Triple-DES algorithm.
This function works only if MariaDB has been configured with [TLS support](../secure-connections-overview/index).
The encryption key to use is chosen based on the second argument to `DES_ENCRYPT()`, if one was given. With no argument, the first key from the DES key file is used. With a *`key_num`* argument, the given key number (0-9) from the DES key file is used. With a *`key_str`* argument, the given key string is used to encrypt *`str`*.
The key file can be specified with the `--des-key-file` server option.
The return string is a binary string where the first character is `CHAR(128 | key_num)`. If an error occurs, `DES_ENCRYPT()` returns `NULL`.
The 128 is added to make it easier to recognize an encrypted key. If you use a string key, *`key_num`* is 127.
The string length for the result is given by this formula:
```
new_len = orig_len + (8 - (orig_len % 8)) + 1
```
Each line in the DES key file has the following format:
```
key_num des_key_str
```
Each *`key_num`* value must be a number in the range from 0 to 9. Lines in the file may be in any order. *`des_key_str`* is the string that is used to encrypt the message. There should be at least one space between the number and the key. The first key is the default key that is used if you do not specify any key argument to `DES_ENCRYPT()`.
You can tell MariaDB to read new key values from the key file with the FLUSH DES\_KEY\_FILE statement. This requires the RELOAD privilege.
One benefit of having a set of default keys is that it gives applications a way to check for the existence of encrypted column values, without giving the end user the right to decrypt those values.
Examples
--------
```
SELECT customer_address FROM customer_table
WHERE crypted_credit_card = DES_ENCRYPT('credit_card_number');
```
See Also
--------
* [DES\_DECRYPT()](../des_decrypt/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InnoDB Online DDL InnoDB Online DDL
==================
| Title | Description |
| --- | --- |
| [InnoDB Online DDL Overview](../innodb-online-ddl-overview/index) | All about online DDL operations with InnoDB. |
| [InnoDB Online DDL Operations with the INPLACE Alter Algorithm](../innodb-online-ddl-operations-with-the-inplace-alter-algorithm/index) | These DDL operations can be done in-place with InnoDB. |
| [InnoDB Online DDL Operations with the NOCOPY Alter Algorithm](../innodb-online-ddl-operations-with-the-nocopy-alter-algorithm/index) | These DDL operations can be done without copying the table with InnoDB. |
| [InnoDB Online DDL Operations with the INSTANT Alter Algorithm](../innodb-online-ddl-operations-with-the-instant-alter-algorithm/index) | These DDL operations can be done instantly with InnoDB. |
| [Instant ADD COLUMN for InnoDB](../instant-add-column-for-innodb/index) | Instantly add a new column to a table |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb EXPORT_SET EXPORT\_SET
===========
Syntax
------
```
EXPORT_SET(bits, on, off[, separator[, number_of_bits]])
```
Description
-----------
Takes a minimum of three arguments. Returns a string where each bit in the given `bits` argument is returned, with the string values given for `on` and `off`.
Bits are examined from right to left, (from low-order to high-order bits). Strings are added to the result from left to right, separated by a separator string (defaults as '`,`'). You can optionally limit the number of bits the `EXPORT_SET()` function examines using the `number_of_bits` option.
If any of the arguments are set as `NULL`, the function returns `NULL`.
Examples
--------
```
SELECT EXPORT_SET(5,'Y','N',',',4);
+-----------------------------+
| EXPORT_SET(5,'Y','N',',',4) |
+-----------------------------+
| Y,N,Y,N |
+-----------------------------+
SELECT EXPORT_SET(6,'1','0',',',10);
+------------------------------+
| EXPORT_SET(6,'1','0',',',10) |
+------------------------------+
| 0,1,1,0,0,0,0,0,0,0 |
+------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb RIGHT RIGHT
=====
Syntax
------
```
RIGHT(str,len)
```
Description
-----------
Returns the rightmost *`len`* characters from the string *`str`*, or NULL if any argument is NULL.
Examples
--------
```
SELECT RIGHT('MariaDB', 2);
+---------------------+
| RIGHT('MariaDB', 2) |
+---------------------+
| DB |
+---------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_WITHIN ST\_WITHIN
==========
Syntax
------
```
ST_WITHIN(g1,g2)
```
Description
-----------
Returns `1` or `0` to indicate whether geometry *`g1`* is spatially within geometry *`g2`*.
This tests the opposite relationship as `[ST\_CONTAINS()](../st_contains/index)`.
ST\_WITHIN() uses object shapes, while [WITHIN()](../within/index), based on the original MySQL implementation, uses object bounding rectangles.
Examples
--------
```
SET @g1 = ST_GEOMFROMTEXT('POINT(174 149)');
SET @g2 = ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))');
SELECT ST_WITHIN(@g1,@g2);
+--------------------+
| ST_WITHIN(@g1,@g2) |
+--------------------+
| 1 |
+--------------------+
SET @g1 = ST_GEOMFROMTEXT('POINT(176 151)');
SELECT ST_WITHIN(@g1,@g2);
+--------------------+
| ST_WITHIN(@g1,@g2) |
+--------------------+
| 0 |
+--------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CHECKSUM TABLE CHECKSUM TABLE
==============
Syntax
------
```
CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]
```
Description
-----------
`CHECKSUM TABLE` reports a table checksum. This is very useful if you want to know if two tables are the same (for example on a master and slave).
With `QUICK`, the live table checksum is reported if it is available, or `NULL` otherwise. This is very fast. A live checksum is enabled by specifying the `CHECKSUM=1` table option when you [create the table](../create-table/index); currently, this is supported only for [Aria](../aria/index) and [MyISAM](../myisam/index) tables.
With `EXTENDED`, the entire table is read row by row and the checksum is calculated. This can be very slow for large tables.
If neither `QUICK` nor `EXTENDED` is specified, MariaDB returns a live checksum if the table storage engine supports it and scans the table otherwise.
`CHECKSUM TABLE` requires the [SELECT privilege](../grant/index#table-privileges) for the table.
For a nonexistent table, `CHECKSUM TABLE` returns `NULL` and generates a warning.
The table row format affects the checksum value. If the row format changes, the checksum will change. This means that when a table created with a MariaDB/MySQL version is upgraded to another version, the checksum value will probably change.
Two identical tables should always match to the same checksum value; however, also for non-identical tables there is a very slight chance that they will return the same value as the hashing algorithm is not completely collision-free.
Differences Between MariaDB and MySQL
-------------------------------------
`CHECKSUM TABLE` may give a different result as MariaDB doesn't ignore `NULL`s in the columns as MySQL 5.1 does (Later MySQL versions should calculate checksums the same way as MariaDB). You can get the 'old style' checksum in MariaDB by starting mysqld with the `--old` option. Note however that that the MyISAM and Aria storage engines in MariaDB are using the new checksum internally, so if you are using `--old`, the `CHECKSUM` command will be slower as it needs to calculate the checksum row by row. Starting from MariaDB Server 10.9, `--old` is deprecated and will be removed in a future release. Set `--old-mode` or `OLD_MODE` to `COMPAT_5_1_CHECKSUM` to get 'old style' checksum.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Existing Ansible Modules and Roles for MariaDB Existing Ansible Modules and Roles for MariaDB
==============================================
This page contains links to Ansible modules and roles that can be used to automate MariaDB deployment and configuration. The list is not meant to be exhaustive. Use it as a starting point, but then please do your own research.
Modules
-------
At the time time of writing, there are no MariaDB-specific modules in Ansible Galaxy. MySQL modules can be used. Trying to use MySQL-specific features may result in errors or unexpected behavior. However, the same applies when trying to use a feature not supported by the MySQL version in use.
Currently, the [MySQL collection](https://galaxy.ansible.com/community/mysql?extIdCarryOver=true&sc_cid=701f2000001OH7YAAW) in Ansible Galaxy contains at least the following modules:
* **[mysql\_db](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_db_module.html)**: manages MySQL databases.
* **[mysql\_info](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_info_module.html)**: gathers information about a MySQL server.
* **[mysql\_query](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_query_module.html)**: runs SQL queries against MySQL.
* **[mysql\_replication](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_replication_module.html)**: configures and operates asynchronous replication.
* **[mysql\_user](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_user_module.html)**: creates, modifies and deletes MySQL users.
* **[mysql\_variables](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_variables_module.html)**: manages MySQL configuration.
Note that some modules only exist as shortcuts, and it is possible to use mysql\_query instead. However, it is important to notice that mysql\_query is not idempotent. Ansible does not understand MySQL queries, therefore it cannot check whether a query needs to be run or not.
To install this collection locally:
```
ansible-galaxy collection install community.mysql
```
MariaDB Corporation maintains a [ColumnStore playbook](https://github.com/mariadb-corporation/columnstore-ansible) on GitHub.
### Other Useful Modules
Let's see some other modules that are useful to manage MariaDB servers.
#### shell and command
Modules like [shell](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html#ansible-collections-ansible-builtin-command-module) and [command](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html#ansible-collections-ansible-builtin-command-module) allow one to run system commands.
To deploy on Windows, [win\_shell](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_shell_module.html#ansible-collections-ansible-windows-win-shell-module) and [win\_command](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_command_module.html#ansible-collections-ansible-windows-win-command-module) can be used.
Among other things, it is possible to use one of these modules to run MariaDB queries:
```
- name: Make the server read-only
# become root to log into MariaDB with UNIX_SOCKET plugin
become: yes
shell: $( which mysql ) -e "SET GLOBAL read_only = 1;"
```
The main disadvantage with these modules is that they are not idempotent, because they're meant to run arbitrary system commands that Ansible can't understand. They are still useful in a variety of cases:
* To run queries, because mysql\_query is also not idempotent.
* In cases when other modules do not allow us to use the exact arguments we need to use, we can achieve our goals by writing shell commands ourselves.
* To run custom scripts that implement non-trivial logic. Implementing complex logic in Ansible tasks is possible, but it can be tricky and inefficient.
* To call [command-line tools](../clients-utilities/index). There may be specific roles for some of the most common tools, but most of the times using them is an unnecessary complication.
#### copy and template
An important part of configuration management is copying [configuration files](../configuring-mariadb-with-option-files/index) to remote servers.
The [copy module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html) allows us to copy files to target hosts. This is convenient for static files that we want to copy exactly as they are. An example task:
```
- name: Copy my.cnf
copy:
src: ./files/my.cnf.1
dest: /etc/mysql/my.cnf
```
As you can see, the local name and the name on remote host don't need to match. This is convenient, because it makes it easy to use different configuration files with different servers. By default, files to copy are located in a `files` subdirectory in the role.
However, typically the content of a configuration file should vary based on the target host, the group and various variables. To do this, we can use the [template](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html) module, which compiles and copies templates written in [Jinja](https://jinja.palletsprojects.com/en/2.11.x/).
A simple template task:
```
- name: Compile and copy my.cnf
copy:
src: ./templates/my.cnf.j2
dest: /etc/mysql/my.cnf
```
Again, the local and the remote names don't have to match. By default, Jinja templates are located in a `templates` subdirectory in the role, and by convention they have the `.j2` extension. This is because Ansible uses Jinja version 2 for templating, at the time writing.
A simple template example:
```
## WARNING: DO NOT EDIT THIS FILE MANUALLY !!
## IF YOU DO, THIS FILE WILL BE OVERWRITTEN BY ANSIBLE
[mysqld]
innodb_buffer_pool_size = {{ innodb_buffer_pool_size }}
{% if use_connect sameas true %}
connect_work_size = {{ connect_work_size }}
{% endif %}
```
#### Other Common Modules
The following modules are also often used for database servers:
* [package](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html), [apt](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html) or [yum](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/yum_module.html). Package is package manager-agnostic. Use them to install, uninstall and upgrade packages.
* [user](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html), useful to create the system user and group that run MariaDB binary.
* [file](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html) can be used to make sure that MariaDB directories (like the data directory) exist and have proper permissions. It can also be used to upload static files.
* [template](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html) allows to create configuration files (like my.cnf) more dynamically, using the [Jinja](https://jinja.palletsprojects.com/en/3.0.x/) template language.
* [service](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html) is useful after installing MariaDB as a service, to start it, restart it or stop it.
Roles
-----
Specific roles exist for MariaDB in Ansible Galaxy. Using them for MariaDB is generally preferable, to be sure to avoid [incompatibilities](../mariadb-vs-mysql-compatibility/index) and to probably be able to use some MariaDB specific [features](../mariadb-vs-mysql-features/index). However, using MySQL or Percona Server roles is also possible. This probably makes sense for users who also administer MySQL and Percona Server instances.
To find roles that suits you, check [Ansible Galaxy search page](https://galaxy.ansible.com/search?deprecated=false&keywords=&order_by=-relevance). Most roles are also available on GitHub.
You can also search roles using the [ansible-galaxy](https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html) tool:
```
ansible-galaxy search mariadb
```
See Also
--------
* [MariaDB Deployment and Management with Ansible](https://youtu.be/CV8-56Fgjc0) (video)
---
Content initially contributed by [Vettabase Ltd](https://vettabase.com/).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb About MyRocks for MariaDB About MyRocks for MariaDB
=========================
About MyRocks for MariaDB
=========================
MyRocks is an open source storage engine that was originally developed by Facebook.
MyRocks has been extended by the MariaDB engineering team to be a pluggable storage engine that you use in your MariaDB solutions. It works seamlessly with MariaDB features. This openness in the storage layer allows you to use the right storage engine to optimize your usage requirements, which provides optimum performance. Community contributions are one of MariaDB’s greatest advantages over other databases. Under the lead of our developer Sergey Petrunia, MyRocks in MariaDB is occasionally being merged with upstream MyRocks from Facebook.
See more at: <https://mariadb.com/resources/blog/facebook-myrocks-mariadb#sthash.ZlEr7kNq.dpuf>
MyRocks, typically, gives greater performance for web scale type applications. It can be an ideal storage engine solution when you have workloads that require greater compression and IO efficiency. It uses a Log Structured Merge (LSM) architecture, which has advantages over B-Tree algorithms, to provide efficient data ingestion, like read-free replication slaves, or fast bulk data loading. MyRocks distinguishing features include:
* compaction filter
* merge operator
* backup
* column families
* bulk loading
* persistent cache
For more MyRocks features see: <https://github.com/facebook/rocksdb/wiki/Features-Not-in-LevelDB>
Benefits
--------
On production workloads, MyRocks was tested to prove that it provides:
#### Greater Space Efficiency
* 2x more compression
MyRocks has 2x better compression compared to compressed InnoDB, 3-4x better compression compared to uncompressed InnoDB, meaning you use less space.
#### Greater Writing Efficiency
* 2x lower write rates to storage
MyRocks has a 10x less write amplification compared to InnoDB, giving you better endurance of flash storage and improving overall throughput.
#### Faster Data Loading
* faster database loads
MyRocks writes data directly onto the bottommost level, which avoids all compaction overheads when you enable faster data loading for a session.
#### Faster Replication
* No random reads for updating secondary keys, except for unique indexes. The Read-Free Replication option does away with random reads when updating primary keys, regardless of uniqueness, with a row-based binary logging format.
<http://myrocks.io> <https://mariadb.com/resources/blog/facebook-myrocks-mariadb>
Requirements and Limitations
----------------------------
* MyRocks is included from [MariaDB 10.2.5](https://mariadb.com/kb/en/mariadb-1025-release-notes/).
* MyRocks is available in the MariaDB Server packages for Linux and Windows.
* Maria DB optimistic parallel replication may not be supported.
* MyRocks is not available for 32-bit platforms
* [Galera Cluster](../galera/index) is tightly integrated into InnoDB storage engine (it also supports Percona's XtraDB which is a modified version of InnoDB). Galera Cluster does not work with any other storage engines, including MyRocks (or TokuDB for example).
MyRocks builds are available on platforms that support a sufficiently modern compiler, for example:
* Ubuntu Trusty, Xenial, (amd64 and ppc64el)
* Ubuntu Yakkety (amd64)
* Debian Jessie, stable (amd64, ppc64el)
* Debian Stretch, Sid (testing and unstable) (amd64)
* CentOS/RHEL 7 (amd64)
* Centos/RHEL 7.3 (amd64)
* Fedora 24 and 25 (amd64)
* OpenSUSE 42 (amd64)
* Windows 64 (zip and MSI)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Performance Schema Digests Performance Schema Digests
==========================
The Performance Schema digest is a normalized form of a statement, with the specific data values removed. It allows statistics to be gathered for similar kinds of statements.
For example:
```
SELECT * FROM customer WHERE age < 20
SELECT * FROM customer WHERE age < 30
```
With the data values removed, both of these statements normalize to:
```
SELECT * FROM customer WHERE age < ?
```
which is the digest text. The digest text is then MD5 hashed, resulting in a digest. For example:
```
DIGEST_TEXT: SELECT * FROM `performance_schema` . `users`
DIGEST: 0f70cec4015f2a346df4ac0e9475d9f1
```
By contrast, the following two statements would not have the same digest as, while the data values are the same, they call upon different tables.
```
SELECT * FROM customer1 WHERE age < 20
SELECT * FROM customer2 WHERE age < 20
```
The digest text is limited to 1024 bytes. Queries exceeding this limit are truncated with '...', meaning that long queries that would otherwise have different digests may share the same digest.
Digest information is used in a number of performance scheme tables. These include
* [events\_statements\_current](../performance-schema-events_statements_current-table/index)
* [events\_statements\_history](../performance-schema-events_statements_history-table/index)
* [events\_statements\_history\_long](../performance-schema-events_statements_history_long-table/index)
* [events\_statements\_summary\_by\_digest](../performance-schema-events_statements_summary_by_digest-table/index) (a summary table by schema and digest)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb UUID_SHORT UUID\_SHORT
===========
Syntax
------
```
UUID_SHORT()
```
Description
-----------
Returns a "short" universally unique identifier as a 64-bit unsigned integer (rather than a string-form 128-bit identifier as returned by the [UUID()](../uuid/index) function).
The value of `UUID_SHORT()` is guaranteed to be unique if the following conditions hold:
* The server\_id of the current host is unique among your set of master and slave servers
* `server_id` is between 0 and 255
* You don't set back your system time for your server between mysqld restarts
* You do not invoke `UUID_SHORT()` on average more than 16 million times per second between mysqld restarts
The UUID\_SHORT() return value is constructed this way:
```
(server_id & 255) << 56
+ (server_startup_time_in_seconds << 24)
+ incremented_variable++;
```
Statements using the UUID\_SHORT() function are not [safe for statement-based replication](../unsafe-statements-for-replication/index).
Examples
--------
```
SELECT UUID_SHORT();
+-------------------+
| UUID_SHORT() |
+-------------------+
| 21517162376069120 |
+-------------------+
```
```
create table t1 (a bigint unsigned default(uuid_short()) primary key);
insert into t1 values(),();
select * from t1;
+-------------------+
| a |
+-------------------+
| 98113699159474176 |
| 98113699159474177 |
+-------------------+
```
See Also
--------
* [UUID()](../uuid/index) ; Return full (128 bit) Universally Unique Identifier
* [AUTO\_INCREMENT](../auto_increment/index)
* [Sequences](../sequences/index) - an alternative to auto\_increment available from [MariaDB 10.3](../what-is-mariadb-103/index)
* [SYS\_GUID](../sys_guid/index) - UUID without the `-` character for Oracle compatibility
* [UUID data type](../uuid-data-type/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema OPTIMIZER_TRACE Table Information Schema OPTIMIZER\_TRACE Table
=========================================
**MariaDB starting with [10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/)**[Optimizer Trace](../optimizer-trace/index) was introduced in [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/).
Description
-----------
The [Information Schema](../information_schema/index) `OPTIMIZER_TRACE` table contains [Optimizer Trace](../optimizer-trace/index) information.
It contains the following columns:
| Column | Description |
| --- | --- |
| `QUERY` | Displays the query that was asked to be traced. |
| `TRACE` | A JSON document displaying the stats we collected when the query was run. |
| `MISSING_BYTES_BEYOND_MAX_MEM_SIZE` | For huge trace, where the trace is truncated due to the optimizer\_trace\_max\_mem\_size limit being reached, displays the bytes that are missing in the trace |
| `INSUFFICENT_PRIVILEGES` | Set to 1 if the user running the trace does not have the privileges to see the trace. |
Structure:
```
SHOW CREATE TABLE INFORMATION_SCHEMA.OPTIMIZER_TRACE \G
*************************** 1. row ***************************
Table: OPTIMIZER_TRACE
Create Table: CREATE TEMPORARY TABLE `OPTIMIZER_TRACE` (
`QUERY` longtext NOT NULL DEFAULT '',
`TRACE` longtext NOT NULL DEFAULT '',
`MISSING_BYTES_BEYOND_MAX_MEM_SIZE` int(20) NOT NULL DEFAULT 0,
`INSUFFICIENT_PRIVILEGES` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=0
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Incremental Backup and Restore with Mariabackup Incremental Backup and Restore with Mariabackup
===============================================
When using Mariabackup, you have the option of performing a full or incremental backup. Full backups create a complete copy in an empty directory while incremental backups update a previous backup with new data. This page documents incremental backups.
InnoDB pages contain log sequence numbers, or LSN's. Whenever you modify a row on any InnoDB table on the database, the storage engine increments this number. When performing an incremental backup, Mariabackup checks the most recent LSN for the backup against the LSN's contained in the database. It then updates any of the backup files that have fallen behind.
Backing up the Database Server
------------------------------
In order to take an incremental backup, you first need to take a [full backup](../full-backup-and-restore-with-mariabackup/index). In order to back up the database, you need to run Mariabackup with the `[--backup](../mariabackup-options/index#-backup)` option to tell it to perform a backup and with the `[--target-dir](../mariabackup-options/index#-target-dir)` option to tell it where to place the backup files. When taking a full backup, the target directory must be empty or it must not exist.
To take a backup, run the following command:
```
$ mariabackup --backup \
--target-dir=/var/mariadb/backup/ \
--user=mariabackup --password=mypassword
```
This backs up all databases into the target directory `/var/mariadb/backup`. If you look in that directory at the `[xtrabackup\_checkpoints](../files-created-by-mariabackup/index#xtrabackup_checkpoints)` file, you can see the LSN data provided by InnoDB.
For example:
```
backup_type = full-backuped
from_lsn = 0
to_lsn = 1635102
last_lsn = 1635102
recover_binlog_info = 0
```
Backing up the Incremental Changes
----------------------------------
Once you have created a full backup on your system, you can also back up the incremental changes as often as you would like.
In order to perform an incremental backup, you need to run Mariabackup with the `[--backup](../mariabackup-options/index#-backup)` option to tell it to perform a backup and with the `[--target-dir](../mariabackup-options/index#-target-dir)` option to tell it where to place the incremental changes. The target directory must be empty. You also need to run it with the `[--incremental-basedir](../mariabackup-options/index#-incremental-basedir)` option to tell it the path to the full backup taken above. For example:
```
$ mariabackup --backup \
--target-dir=/var/mariadb/inc1/ \
--incremental-basedir=/var/mariadb/backup/ \
--user=mariabackup --password=mypassword
```
This command creates a series of delta files that store the incremental changes in `/var/mariadb/inc1`. You can find a similar `[xtrabackup\_checkpoints](../files-created-by-mariabackup/index#xtrabackup_checkpoints)` file in this directory, with the updated LSN values.
For example:
```
backup_type = incremental
from_lsn = 1635102
to_lsn = 1635114
last_lsn = 1635114
recover_binlog_info = 0
```
To perform additional incremental backups, you can then use the target directory of the previous incremental backup as the incremental base directory of the next incremental backup. For example:
```
$ mariabackup --backup \
--target-dir=/var/mariadb/inc2/ \
--incremental-basedir=/var/mariadb/inc1/ \
--user=mariabackup --password=mypassword
```
Combining with `--stream` output
--------------------------------
When using `[--stream](../mariabackup-options/index#-stream)`, e.g for [compression or encryption using external tools](../using-encryption-and-compression-tools-with-mariabackup/index), the `[xtrabackup\_checkpoints](../files-created-by-mariabackup/index#xtrabackup_checkpoints)` file containing the information where to continue from on the next incremental backup will also be part of the compressed/encrypted backup file, and so not directly accessible by default.
A directory containing an extra copy of the file can be created using the `[--extra-lsndir=...](../mariabackup-options/index#-extra-lsndir)` option though, and this directory can then be passed to the next incremental backup `[--incremental-basedir=...](../mariabackup-options/index#-incremental-basedir)`, for example:
```
# initial full backup
$ mariabackup --backup --stream=mbstream \
--user=mariabackup --password=mypassword \
--extra-lsndir=backup_base | gzip > backup_base.gz
# incremental backup
$ mariabackup --backup --stream=mbstream \
--incremental-basedir=backup_base \
--user=mariabackup --password=mypassword \
--extra-lsndir=backup_inc1 | gzip > backup-inc1.gz
```
Preparing the Backup
--------------------
Following the above steps, you have three backups in `/var/mariadb`: The first is a full backup, the others are increments on this first backup. In order to restore a backup to the database, you first need to apply the incremental backups to the base full backup. This is done using the `[--prepare](../mariabackup-options/index#-prepare)` command option. In [MariaDB 10.1](../what-is-mariadb-101/index), you would also have to use the the `[--apply-log-only](../mariabackup-options/index#-apply-log-only)` option.
**MariaDB starting with [10.2](../what-is-mariadb-102/index)**In [MariaDB 10.2](../what-is-mariadb-102/index) and later, perform the following process:
First, prepare the base backup:
```
$ mariabackup --prepare \
--target-dir=/var/mariadb/backup
```
Running this command brings the base full backup, that is, `/var/mariadb/backup`, into sync with the changes contained in the [InnoDB redo log](../innodb-redo-log/index) collected while the backup was taken.
Then, apply the incremental changes to the base full backup:
```
$ mariabackup --prepare \
--target-dir=/var/mariadb/backup \
--incremental-dir=/var/mariadb/inc1
```
Running this command brings the base full backup, that is, `/var/mariadb/backup`, into sync with the changes contained in the first incremental backup.
For each remaining incremental backup, repeat the last step to bring the base full backup into sync with the changes contained in that incremental backup.
**MariaDB until [10.1](../what-is-mariadb-101/index)**In [MariaDB 10.1](../what-is-mariadb-101/index), perform the following process:
First, prepare the base backup:
```
$ mariabackup --prepare --apply-log-only \
--target-dir=/var/mariadb/backup
```
Running this command brings the base full backup, that is, `/var/mariadb/backup`, into sync with the changes contained in the [InnoDB redo log](../innodb-redo-log/index) collected while the backup was taken.
Then, apply the incremental changes to the base full backup:
```
$ mariabackup --prepare --apply-log-only \
--target-dir=/var/mariadb/backup \
--incremental-dir=/var/mariadb/inc1
```
Running this command brings the base full backup, that is, `/var/mariadb/backup`, into sync with the changes contained in the first incremental backup.
For each remaining incremental backup, repeat the last step to bring the base full backup into sync with the changes contained in that incremental backup.
Restoring the Backup
--------------------
Once you've applied all incremental backups to the base, you can restore the backup using either the `[--copy-back](../mariabackup-options/index#-copy-back)` or the `[--move-back](../mariabackup-options/index#-move-back)` options. The `[--copy-back](../mariabackup-options/index#-copy-back)` option allows you to keep the original backup files. The `[--move-back](../mariabackup-options/index#-move-back)` option actually moves the backup files to the `[datadir](../server-system-variables/index#datadir)`, so the original backup files are lost.
* First, [stop the MariaDB Server process](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
* Then, ensure that the `[datadir](../server-system-variables/index#datadir)` is empty.
* Then, run Mariabackup with one of the options mentioned above:
```
$ mariabackup --copy-back \
--target-dir=/var/mariadb/backup/
```
* Then, you may need to fix the file permissions.
When Mariabackup restores a database, it preserves the file and directory privileges of the backup. However, it writes the files to disk as the user and group restoring the database. As such, after restoring a backup, you may need to adjust the owner of the data directory to match the user and group for the MariaDB Server, typically `mysql` for both. For example, to recursively change ownership of the files to the `mysql` user and group, you could execute:
```
$ chown -R mysql:mysql /var/lib/mysql/
```
* Finally, [start the MariaDB Server process](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Overview of MariaDB Logs Overview of MariaDB Logs
========================
There are many variables in MariaDB that you can use to define what to log and when to log.
This article will give you an overview of the different logs and how to enable/disable logging to these.
Note that storage engines can have their logs too: for example, InnoDB keeps an [Undo Log](../undo-log/index) and a Redo Log which are used for rollback and crash recovery. However, this page only lists MariaDB server logs.
### [The error log](../error-log/index)
* Always enabled
* Usually a file in the data directory, but some distributions may move this to other locations.
* All critical errors are logged here.
* One can get warnings to be logged by setting [log\_warnings](../server-system-variables/index#log_warnings).
* With the [mysqld\_safe](../mysqld_safe/index) `--syslog` option one can duplicate the messages to the system's syslog.
### [General query log](../general-query-log/index)
* Enabled with [--general-log](../server-system-variables/index#general_log)
* Logs all queries to a [file or table](../server-system-variables/index#log_output).
* Useful for debugging or auditing queries.
* The super user can disable logging to it for a connection by setting [SQL\_LOG\_OFF](../server-system-variables/index#sql_log_off) to 1.
### [Slow Query log](../slow-query-log/index)
* Enabled by starting mysqld with [--slow-query-log](../server-system-variables/index#slow_query_log)
* Logs all queries to a [file or table](../server-system-variables/index#log_output).
* Useful to find queries that causes performance problems.
* Logs all queries that takes more than [long\_query\_time](../server-system-variables/index#long_query_time) to run.
* One can decide what to log with the options [--log-slow-admin-statements](../server-system-variables/index#log_slow_admin_statements), [--log-slow-slave-statements](../server-system-variables/index#log_slow_slave_statements), [log\_slow\_filter](../server-system-variables/index#log_slow_filter) or [log\_slow\_rate\_limit](../server-system-variables/index#log_slow_rate_limit).
* One can change what is logged by setting [log\_slow\_verbosity](../server-system-variables/index#log_slow_verbosity).
* One can disable it globally by setting [global.slow\_query\_log](../server-system-variables/index#slow_query_log) to 0
* In 10.1 one can disable it for a connection by setting [local.slow\_query\_log](../server-system-variables/index#slow_query_log) to 0.
### [The binary log](../overview-of-the-binary-log/index)
* Enabled by starting mysqld with [--log-bin](../replication-and-binary-log-server-system-variables/index#log_bin)
* Used on machines that are, or may become, replication masters.
* Required for point-in-time recovery.
* Binary log files are mainly used by replication and can also be used with [mysqlbinlog](../mysqlbinlog/index) to apply on a backup to get the database up to date.
* One can decide what to log with [--binlog-ignore-db=database\_name](../mysqld-options/index#-binlog-ignore-db) or [--binlog-do-db=database\_name](../mysqld-options/index#-binlog-do-db).
* The super user can disable logging for a connection by [setting SQL\_LOG\_BIN](../set-sql_log_bin/index) to 0. However while this is 0, no changes done in this connection will be replicated to the slaves!
* For examples, see [Using and Maintaining the Binary Log](../using-and-maintaining-the-binary-log/index).
### Examples
If you know that your next query will be slow and you don't want to log it in the slow query log, do:
```
SET LOCAL SLOW_QUERY_LOG=0;
```
If you are a super user running a log batch job that you don't want to have logged (for example mysqldump), do:
```
SET LOCAL SQL_LOG_OFF=1, LOCAL SLOW_QUERY_LOG=0;
```
[mysqldump](../mysqldump/index) since [MariaDB 10.1](../what-is-mariadb-101/index) will add this automatically to your dump file if you run it with the `--skip-log-queries` option.
See also
--------
* [MariaDB audit plugin](../server_audit-mariadb-audit-plugin/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb State Snapshot Transfers (SSTs) in Galera Cluster State Snapshot Transfers (SSTs) in Galera Cluster
==================================================
| Title | Description |
| --- | --- |
| [Introduction to State Snapshot Transfers (SSTs)](../introduction-to-state-snapshot-transfers-ssts/index) | In an SST, the cluster provisions nodes by transferring a full data copy from one node to another. |
| [mariabackup SST Method](../mariabackup-sst-method/index) | The mariabackup SST method uses the Mariabackup utility for performing SSTs. |
| [Manual SST of Galera Cluster Node With Mariabackup](../manual-sst-of-galera-cluster-node-with-mariabackup/index) | It can be helpful to perform a "manual SST" with Mariabackup when Galera's normal SSTs fail. |
| [xtrabackup-v2 SST Method](../xtrabackup-v2-sst-method/index) | The xtrabackup-v2 SST method uses the Percona XtraBackup utility for performing SSTs. |
| [Manual SST of Galera Cluster Node With Percona XtraBackup](../manual-sst-of-galera-cluster-node-with-percona-xtrabackup/index) | It can be helpful to perform a "manual SST" with Xtrabackup when Galera's normal SSTs fail. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb SHOW WSREP_STATUS SHOW WSREP\_STATUS
==================
`SHOW WSREP_STATUS` is part of the `[WSREP\_INFO](../wsrep_info-plugin/index)` plugin.
Syntax
------
```
SHOW WSREP_STATUS
```
Description
-----------
The `SHOW WSREP_STATUS` statement returns [Galera](../galera/index) node and cluster status information. It returns the same information as found in the `[information\_schema.WSREP\_STATUS](../information-schema-wsrep_status-table/index)` table. Only users with the `[SUPER](../grant/index)` privilege can access this information.
Examples
--------
```
SHOW WSREP_STATUS;
+------------+-------------+----------------+--------------+
| Node_Index | Node_Status | Cluster_Status | Cluster_Size |
+------------+-------------+----------------+--------------+
| 0 | Synced | Primary | 3 |
+------------+-------------+----------------+--------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ENVELOPE ENVELOPE
========
A synonym for [ST\_ENVELOPE](../st_envelope/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb JSON_REPLACE JSON\_REPLACE
=============
**MariaDB starting with [10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/)**JSON functions were added in [MariaDB 10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/).
Syntax
------
```
JSON_REPLACE(json_doc, path, val[, path, val] ...)
```
Description
-----------
Replaces existing values in a JSON document, returning the result, or NULL if any of the arguments are NULL.
An error will occur if the JSON document is invalid, the path is invalid or if the path contains a `*` or `**` wildcard.
Paths and values are evaluated from left to right, with the result from the earlier evaluation being used as the value for the next.
JSON\_REPLACE can only update data, while [JSON\_INSERT](../json_insert/index) can only insert. [JSON\_SET](../json_set/index) can update or insert data.
Examples
--------
```
SELECT JSON_REPLACE('{ "A": 1, "B": [2, 3]}', '$.B[1]', 4);
+-----------------------------------------------------+
| JSON_REPLACE('{ "A": 1, "B": [2, 3]}', '$.B[1]', 4) |
+-----------------------------------------------------+
| { "A": 1, "B": [2, 4]} |
+-----------------------------------------------------+
```
See Also
--------
* [JSON video tutorial](https://www.youtube.com/watch?v=sLE7jPETp8g) covering JSON\_REPLACE.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Upgrading MariaDB ColumnStore from 1.0.3 to 1.0.4 Upgrading MariaDB ColumnStore from 1.0.3 to 1.0.4
=================================================
MariaDB ColumnStore software upgrade 1.0.3 to 1.0.4
---------------------------------------------------
Note: Columnstore.xml modifications you manually made are not automatically carried forward on an upgrade. These modifications will need to be incorporated back into .XML once the upgrade has occurred.
The previous configuration file will be saved as /usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave.
### Choosing the type of upgrade
#### Root User Installs
#### Upgrading MariaDB ColumnStore using RPMs
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.0.4-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.** Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
`tar -zxf mariadb-columnstore-1.0.4-1-centos#.x86_64.rpm.tar.gz`
* Upgrade the RPMs. The MariaDB ColumnStore software will be installed in /usr/local/.
```
rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
rpm -ivh mariadb-columnstore-*1.0.4*rpm
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
For RPM Upgrade, the previous configuration file will be saved as:
/usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory -mariadb-columnstore-release#.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
`mcsadmin shutdownsystem y`
* Run pre-uninstall script
`/usr/local/mariadb/columnstore/bin/pre-uninstall`
* Unpack the tarball, in the /usr/local/ directory.
`tar -zxvf -mariadb-columnstore-release#.x86_64.bin.tar.gz`
* Run post-install scripts
`/usr/local/mariadb/columnstore/bin/post-install`
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
`/usr/local/mariadb/columnstore/bin/postConfigure -u`
### Upgrading MariaDB ColumnStore using the DEB package
A DEB upgrade would be done on a system that supports DEBs like Debian or Ubuntu systems.
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory
```
mariadb-columnstore-release#.amd64.deb.tar.gz
```
(DEB 64-BIT) to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate DEBs.
```
tar -zxf mariadb-columnstore-release#.amd64.deb.tar.gz
```
* Remove, purge and install all MariaDB ColumnStore debs
```
cd /root/
dpkg -r mariadb-columnstore*deb
dpkg -P mariadb-columnstore*deb
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
/usr/local/mariadb/columnstore/bin/postConfigure -u
```
#### Non-Root User Installs
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /home/'non-root-user" directory
mariadb-columnstore-release#.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
`mcsadmin shutdownsystem y`
* Run pre-uninstall script
`$HOME/mariadb/columnstore/bin/pre-uninstall -i /home/guest/mariadb/columnstore`
* Unpack the tarball, which will generate the $HOME/ directory.
`tar -zxvf -mariadb-columnstore-release#.x86_64.bin.tar.gz`
* Run post-install scripts
1. $HOME/mariadb/columnstore/bin/post-install -i /home/guest/mariadb/columnstore
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
`$HOME/mariadb/columnstore/bin/postConfigure -u -i /home/guest/mariadb/columnstore`
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Storage Snapshots and BACKUP STAGE Commands Storage Snapshots and BACKUP STAGE Commands
===========================================
**MariaDB starting with [10.4.1](https://mariadb.com/kb/en/mariadb-1041-release-notes/)**The `BACKUP STAGE` commands were introduced in [MariaDB 10.4.1](https://mariadb.com/kb/en/mariadb-1041-release-notes/).
The [BACKUP STAGE](../backup-stage/index) commands are a set of commands to make it possible to make an efficient external backup tool. These commands could even be used by tools that perform backups by taking a snapshot of a file system, SAN, or some other kind of storage device.
Generic Backup Process with Storage Snapshots
---------------------------------------------
A tool that backs up MariaDB by taking a snapshot of a file system, SAN, or some other kind of storage device could use each `BACKUP STAGE` command in the following way:
* First, execute the following:
```
BACKUP STAGE START
BACKUP STAGE BLOCK_COMMIT
```
* Then, take the snapshot.
* Then, execute the following:
```
BACKUP STAGE END
```
The above ensures that all non-transactional tables are properly flushed to disk before the snapshot is done. Using `BACKUP STAGE` commands is also more efficient than using the [FLUSH TABLES WITH READ LOCK](../flush/index) command as the above set of commands will not block or be blocked by write operations to transactional tables.
Note that when the backup is completed, one should delete all files with the "#sql" prefix, as these are files used by concurrent running `ALTER TABLE`. Note that InnoDB will on server restart automatically delete any tables with the "#sql" prefix.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema INNODB_SYS_FOREIGN_COLS Table Information Schema INNODB\_SYS\_FOREIGN\_COLS Table
===================================================
The [Information Schema](../information_schema/index) `INNODB_SYS_FOREIGN_COLS` table contains information about InnoDB [foreign key](../foreign-keys/index) columns.
The `PROCESS` [privilege](../grant/index) is required to view the table.
It has the following columns:
| Column | Description |
| --- | --- |
| `ID` | Foreign key index associated with this column, matching the [INNODB\_SYS\_FOREIGN.ID](../information-schema-innodb_sys_foreign-table/index) field. |
| `FOR_COL_NAME` | Child column name. |
| `REF_COL_NAME` | Parent column name. |
| `POS` | Ordinal position of the column in the table, starting from 0. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Segmented Key Cache Segmented Key Cache
===================
About Segmented Key Cache
-------------------------
A segmented key cache is a collection of structures for regular [MyISAM](../myisam/index) key caches called key cache segments. Segmented key caches mitigate one of the major problems of the simple key cache: thread contention for key cache lock (mutex). With regular key caches, every call of a key cache interface function must acquire this lock. So threads compete for this lock even in the case when they have acquired shared locks for the file and the pages they want to read from are in the key cache buffers.
When working with a segmented key cache any key cache interface function that needs only one page has to acquire the key cache lock only for the segment the page is assigned to. This makes the chances for threads not having to compete for the same key cache lock better.
Any page from a file can be placed into a buffer of only one segment. The number of the segment is calculated from the file number and the position of the page in the file, and it's always the same for the page. Pages are evenly distributed among segments.
The idea and the original code of the segmented key cache was provided by Fredrik Nylander from Stardoll.com. The code was extensively reworked, improved, and eventually merged into MariaDB by Igor Babaev from Monty Program (now MariaDB Corporation).
You can find some benchmark results comparing various settings on the [Segmented Key Cache Performance](../segmented-key-cache-performance/index) page.
Segmented Key Cache Syntax
--------------------------
New global variable: [key\_cache\_segments](../myisam-system-variables/index#key_cache_segments). This variable sets the number of segments in a key cache. Valid values for this variable are whole numbers between `0` and `64`. If the number of segments is set to a number greater than `64` the number of segments will be truncated to 64 and a warning will be issued.
A value of `0` means the key cache is a regular (i.e. non-segmented) key cache. This is the default. If `key_cache_segments` is `1` (or higher) then the new key cache segmentation code is used. In practice there is no practical use of a single-segment segmented key cache except for testing purposes, and setting `key_cache_segments = 1` should be slower than any other option and should not be used in production.
Other global variables used when working with regular key caches also apply to segmented key caches: [key\_buffer\_size](../myisam-system-variables/index#key_buffer_size), [key\_cache\_age\_threshold](../myisam-system-variables/index#key_cache_age_threshold), [key\_cache\_block\_size](../myisam-system-variables/index#key_cache_block_size), and [key\_cache\_division\_limit](../myisam-system-variables/index#key_cache_division_limit).
Segmented Key Cache Statistics
------------------------------
Statistics about the key cache can be found by looking at the [KEY\_CACHES](../information-schema-key_caches-table/index) table in the [INFORMATION\_SCHEMA](../information_schema/index) database. Columns in this table are:
| Column Name | Description |
| --- | --- |
| `KEY_CACHE_NAME` | The name of the key cache |
| `SEGMENTS` | total number of segments (set to `NULL` for regular key caches) |
| `SEGMENT_NUMBER` | segment number (set to `NULL` for any regular key caches and for rows containing aggregation statistics for segmented key caches) |
| `FULL_SIZE` | memory for cache buffers/auxiliary structures |
| `BLOCK_SIZE` | size of the blocks |
| `USED_BLOCKS` | number of currently used blocks |
| `UNUSED_BLOCKS` | number of currently unused blocks |
| `DIRTY_BLOCKS` | number of currently dirty blocks |
| `READ_REQUESTS` | number of read requests |
| `READS` | number of actual reads from files into buffers |
| `WRITE_REQUESTS` | number of write requests |
| `WRITES` | number of actual writes from buffers into files |
See Also
--------
* [Segmented Key Cache Performance](../segmented-key-cache-performance/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Row-based Replication With No Primary Key Row-based Replication With No Primary Key
=========================================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
MariaDB improves on row-based [replication](../standard-replication/index) (see [binary log formats](../binary-log-formats/index)) of tables which have no primary key but do have some other index. This is based in part on the original Percona patch "row\_based\_replication\_without\_primary\_key.patch", with some additional fixes and enhancements.
When row-based replication is used with [UPDATE](../update/index) or [DELETE](../delete/index), the slave needs to locate each replicated row based on the value in columns. If the table contains at least one index, an index lookup will be used (otherwise a table scan is needed for each row, which is extremely inefficient for all but the smallest table and generally to be avoided).
In MariaDB, the slave will try to choose a good index among any available:
* The primary key is used, if there is one.
* Else, the first unique index without NULL-able columns is used, if there is one.
* Else, a choice is made among any normal indexes on the table (e.g. a [FULLTEXT](../full-text-indexes/index) index is not considered).
The choice of which of several non-unique indexes to use is based on the cardinality of indexes; the one that is most selective (has the smallest average number of rows per distinct tuple of column values) is preferred. Note that for this choice to be effective, for most storage engines (like MyISAM, InnoDB) it is necessary to make sure [ANALYZE TABLE](../analyze-table/index) has been run on the slave, otherwise statistics about index cardinality will not be available. In the absence of index cardinality, the first unique index will be chosen, if any, else the first non-unique index.
Prior to [MariaDB 5.3](../what-is-mariadb-53/index), the slave would always choose the first index without considering cardinality. The slave could even choose an unusable index (like FULLTEXT) if no other index was available ([MySQL Bug #58997](http://bugs.mysql.com/bug.php?id=58997)), causing row-based replication to break in this case; this was also fixed in [MariaDB 5.3](../what-is-mariadb-53/index).
See Also
--------
* [What is MariaDB 5.3](../what-is-mariadb-53/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb IsRing IsRing
======
A synonym for [ST\_IsRing](../st_isring/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Full-Text Index Stopwords Full-Text Index Stopwords
=========================
Stopwords are used to provide a list of commonly-used words that can be ignored for the purposes of [Full-text-indexes](../full-text-indexes/index).
Full-text indexes built in [MyISAM](../myisam/index) and [InnoDB](../innodb/index) have different stopword lists by default.
MyISAM Stopwords
----------------
For full-text indexes on MyISAM tables, by default, the list is built from the file `storage/myisam/ft_static.c`, and searched using the server's character set and collation. The [ft\_stopword\_file](../server-system-variables/index#ft_stopword_file) system variable allows the default list to be overridden with words from another file, or for stopwords to be ignored altogether.
If the stopword list is changed, any existing full-text indexes need to be rebuilt
The following table shows the default list of stopwords, although you should always treat `storage/myisam/ft_static.c` as the definitive list. See the [Fulltext Index Overview](../fulltext-index-overview/index) for more details, and [Full-text-indexes](../full-text-indexes/index) for related articles.
| | | | |
| --- | --- | --- | --- |
| a's | able | about | above |
| according | accordingly | across | actually |
| after | afterwards | again | against |
| ain't | all | allow | allows |
| almost | alone | along | already |
| also | although | always | am |
| among | amongst | an | and |
| another | any | anybody | anyhow |
| anyone | anything | anyway | anyways |
| anywhere | apart | appear | appreciate |
| appropriate | are | aren't | around |
| as | aside | ask | asking |
| associated | at | available | away |
| awfully | be | became | because |
| become | becomes | becoming | been |
| before | beforehand | behind | being |
| believe | below | beside | besides |
| best | better | between | beyond |
| both | brief | but | by |
| c'mon | c's | came | can |
| can't | cannot | cant | cause |
| causes | certain | certainly | changes |
| clearly | co | com | come |
| comes | concerning | consequently | consider |
| considering | contain | containing | contains |
| corresponding | could | couldn't | course |
| currently | definitely | described | despite |
| did | didn't | different | do |
| does | doesn't | doing | don't |
| done | down | downwards | during |
| each | edu | eg | eight |
| either | else | elsewhere | enough |
| entirely | especially | et | etc |
| even | ever | every | everybody |
| everyone | everything | everywhere | ex |
| exactly | example | except | far |
| few | fifth | first | five |
| followed | following | follows | for |
| former | formerly | forth | four |
| from | further | furthermore | get |
| gets | getting | given | gives |
| go | goes | going | gone |
| got | gotten | greetings | had |
| hadn't | happens | hardly | has |
| hasn't | have | haven't | having |
| he | he's | hello | help |
| hence | her | here | here's |
| hereafter | hereby | herein | hereupon |
| hers | herself | hi | him |
| himself | his | hither | hopefully |
| how | howbeit | however | i'd |
| i'll | i'm | i've | ie |
| if | ignored | immediate | in |
| inasmuch | inc | indeed | indicate |
| indicated | indicates | inner | insofar |
| instead | into | inward | is |
| isn't | it | it'd | it'll |
| it's | its | itself | just |
| keep | keeps | kept | know |
| knows | known | last | lately |
| later | latter | latterly | least |
| less | lest | let | let's |
| like | liked | likely | little |
| look | looking | looks | ltd |
| mainly | many | may | maybe |
| me | mean | meanwhile | merely |
| might | more | moreover | most |
| mostly | much | must | my |
| myself | name | namely | nd |
| near | nearly | necessary | need |
| needs | neither | never | nevertheless |
| new | next | nine | no |
| nobody | non | none | noone |
| nor | normally | not | nothing |
| novel | now | nowhere | obviously |
| of | off | often | oh |
| ok | okay | old | on |
| once | one | ones | only |
| onto | or | other | others |
| otherwise | ought | our | ours |
| ourselves | out | outside | over |
| overall | own | particular | particularly |
| per | perhaps | placed | please |
| plus | possible | presumably | probably |
| provides | que | quite | qv |
| rather | rd | re | really |
| reasonably | regarding | regardless | regards |
| relatively | respectively | right | said |
| same | saw | say | saying |
| says | second | secondly | see |
| seeing | seem | seemed | seeming |
| seems | seen | self | selves |
| sensible | sent | serious | seriously |
| seven | several | shall | she |
| should | shouldn't | since | six |
| so | some | somebody | somehow |
| someone | something | sometime | sometimes |
| somewhat | somewhere | soon | sorry |
| specified | specify | specifying | still |
| sub | such | sup | sure |
| t's | take | taken | tell |
| tends | th | than | thank |
| thanks | thanx | that | that's |
| thats | the | their | theirs |
| them | themselves | then | thence |
| there | there's | thereafter | thereby |
| therefore | therein | theres | thereupon |
| these | they | they'd | they'll |
| they're | they've | think | third |
| this | thorough | thoroughly | those |
| though | three | through | throughout |
| thru | thus | to | together |
| too | took | toward | towards |
| tried | tries | truly | try |
| trying | twice | two | un |
| under | unfortunately | unless | unlikely |
| until | unto | up | upon |
| us | use | used | useful |
| uses | using | usually | value |
| various | very | via | viz |
| vs | want | wants | was |
| wasn't | way | we | we'd |
| we'll | we're | we've | welcome |
| well | went | were | weren't |
| what | what's | whatever | when |
| whence | whenever | where | where's |
| whereafter | whereas | whereby | wherein |
| whereupon | wherever | whether | which |
| while | whither | who | who's |
| whoever | whole | whom | whose |
| why | will | willing | wish |
| with | within | without | won't |
| wonder | would | wouldn't | yes |
| yet | you | you'd | you'll |
| you're | you've | your | yours |
| yourself | yourselves | zero | |
InnoDB Stopwords
----------------
Stopwords on full-text indexes are only enabled if the [innodb\_ft\_enable\_stopword](../xtradbinnodb-server-system-variables/index#innodb_ft_enable_stopword) system variable is set (by default it is) at the time the index was created.
The stopword list is determined as follows:
* If the [innodb\_ft\_user\_stopword\_table](../xtradbinnodb-server-system-variables/index#innodb_ft_user_stopword_table) system variable is set, that table is used as a stopword list.
* If `innodb_ft_user_stopword_table` is not set, the table set by [innodb\_ft\_server\_stopword\_table](../xtradbinnodb-server-system-variables/index#innodb_ft_server_stopword_table) is used.
* If neither variable is set, the built-in list is used, which can be viewed by querying the [INNODB\_FT\_DEFAULT\_STOPWORD table](../information-schema-innodb_ft_default_stopword-table/index) in the [Information Schema](../information_schema/index).
In the first two cases, the specified table must exist at the time the system variable is set and the full-text index created. It must be an InnoDB table with a single column, a [VARCHAR](../varchar/index) named VALUE.
The default InnoDB stopword list differs from the default MyISAM list, being much shorter, and contains the following words:
| | | | |
| --- | --- | --- | --- |
| a | about | an | are |
| as | at | be | by |
| com | de | en | for |
| from | how | i | in |
| is | it | la | of |
| on | or | that | the |
| this | to | was | what |
| when | where | who | will |
| with | und | the | www |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb MariaDB Galera Cluster MariaDB Galera Cluster
=======================
MariaDB Galera Cluster is a [virtually synchronous](../about-galera-replication/index) multi-master cluster that runs on Linux only. It has been a standard part of the server since [MariaDB 10.1](../what-is-mariadb-101/index).
| Title | Description |
| --- | --- |
| [What is MariaDB Galera Cluster?](../what-is-mariadb-galera-cluster/index) | Basic information on MariaDB Galera Cluster. |
| [About Galera Replication](../about-galera-replication/index) | About Galera replication. |
| [Galera Use Cases](../galera-use-cases/index) | Common use cases for Galera replication. |
| [MariaDB Galera Cluster - Known Limitations](../mariadb-galera-cluster-known-limitations/index) | Describing the known limitations of MariaDB Galera Cluster. |
| [Tips on Converting to Galera](../tips-on-converting-to-galera/index) | Best/required practices when using Galera for High-availability |
| [Getting Started with MariaDB Galera Cluster](../getting-started-with-mariadb-galera-cluster/index) | Synchronous multi-master cluster for Linux supporting XtraDB/InnoDB storage engines. |
| [Configuring MariaDB Galera Cluster](../configuring-mariadb-galera-cluster/index) | Details on how to configure MariaDB Galera Cluster. |
| [State Snapshot Transfers (SSTs) in Galera Cluster](../state-snapshot-transfers-ssts-in-galera-cluster/index) | In an SST, the cluster provisions nodes by transferring a full data copy from one node to another. |
| [Galera Cluster Status Variables](../galera-cluster-status-variables/index) | Galera Cluster Status Variables |
| [Galera Cluster System Variables](../galera-cluster-system-variables/index) | Listing and description of Galera Cluster system variables. |
| [Building the Galera wsrep Package on Ubuntu and Debian](../building-the-galera-wsrep-package-on-ubuntu-and-debian/index) | Short how-to on building the galera package on Debian |
| [Building the Galera wsrep Package on Fedora](../building-the-galera-wsrep-package-on-fedora/index) | Short how-to on building the galera package on Fedora |
| [Installing Galera from Source](../installing-galera-from-source/index) | Building Galera from source. |
| [Galera Test Repositories](../galera-test-repositories/index) | To facilitate development and QA, we have created some test repos for the Galera wsrep provider. |
| [wsrep\_provider\_options](../wsrep_provider_options/index) | Galera options set with the wsrep\_provider\_options variable. |
| [Galera Cluster Address](../galera-cluster-address/index) | Galera URLs |
| [Galera Load Balancer](../galera-load-balancer/index) | A load balancer specifically designed for Galera Cluster |
| [MariaDB Galera Cluster Releases](../mariadb-galera-cluster-releases/index) | Galera Cluster release notes and changelogs. |
| [Upgrading Galera Cluster](../upgrading-galera-cluster/index) | Upgrading MariaDB Galera Cluster. |
| [Using MariaDB Replication with MariaDB Galera Cluster](../using-mariadb-replication-with-mariadb-galera-cluster/index) | Information on using MariaDB replication with MariaDB Galera Cluster. |
| [Securing Communications in Galera Cluster](../securing-communications-in-galera-cluster/index) | Enabling TLS encryption in transit for Galera Cluster. |
| [Installing MariaDB Galera on IBM Cloud](../installing-mariadb-galera-on-ibm-cloud/index) | Get MariaDB Galera on IBM Cloud You should have an IBM Cloud account, oth... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing MariaDB Windows ZIP Packages Installing MariaDB Windows ZIP Packages
=======================================
Users need to run [mysql\_install\_db.exe](../mysql_install_dbexe/index), without parameters to create a data directory, e.g
```
C:\zip_unpack\directory> bin\mysqld_install_db.exe
```
Then you can start server like this
```
C:\zip_unpack\directory> bin\mysqld.exe --console
```
For very old distributions (10.3 and earlier), a prebuilt data directory is already provided.
If you like to customize the server instance (data directory, install as service etc), please refer to [mysql\_install\_db.exe documentation](../mysql_install_dbexe/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb FIND_IN_SET FIND\_IN\_SET
=============
Syntax
------
```
FIND_IN_SET(pattern, strlist)
```
Description
-----------
Returns the index position where the given pattern occurs in a string list. The first argument is the pattern you want to search for. The second argument is a string containing comma-separated variables. If the second argument is of the `[SET](../set-data-type/index)` data-type, the function is optimized to use bit arithmetic.
If the pattern does not occur in the string list or if the string list is an empty string, the function returns `0`. If either argument is `NULL`, the function returns `NULL`. The function does not return the correct result if the pattern contains a comma ("`,`") character.
Examples
--------
```
SELECT FIND_IN_SET('b','a,b,c,d') AS "Found Results";
+---------------+
| Found Results |
+---------------+
| 2 |
+---------------+
```
See Also
--------
* [ELT()](../elt/index) function. Returns the N'th element from a set of strings.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb PREVIOUS VALUE FOR sequence_name PREVIOUS VALUE FOR sequence\_name
=================================
**MariaDB starting with [10.3](../what-is-mariadb-103/index)**SEQUENCEs were introduced in [MariaDB 10.3](../what-is-mariadb-103/index).
Syntax
------
```
PREVIOUS VALUE FOR sequence_name
```
or
```
LASTVAL(sequence_name)
```
or in Oracle mode ([SQL\_MODE=ORACLE](../sql-mode/index))
```
sequence_name.currval
```
`PREVIOUS VALUE FOR` is IBM DB2 syntax while `LASTVAL()` is PostgreSQL syntax.
Description
-----------
Get last value in the current connection generated from a sequence.
* If the sequence has not yet been used by the connection, `PREVIOUS VALUE FOR` returns `NULL` (the same thing applies with a new connection which doesn't see a last value for an existing sequence).
* If a `SEQUENCE` has been dropped and re-created then it's treated as a new `SEQUENCE` and `PREVIOUS VALUE FOR` will return `NULL`.
* `[FLUSH TABLES](../flush/index)` has no effect on `PREVIOUS VALUE FOR`.
* Previous values for all used sequences are stored per connection until connection ends.
* `PREVIOUS VALUE FOR` requires the [SELECT privilege](../grant/index).
Example
-------
```
CREATE SEQUENCE s START WITH 100 INCREMENT BY 10;
SELECT PREVIOUS VALUE FOR s;
+----------------------+
| PREVIOUS VALUE FOR s |
+----------------------+
| NULL |
+----------------------+
# The function works for sequences only, if the table is used an error is generated
SELECT PREVIOUS VALUE FOR t;
ERROR 4089 (42S02): 'test.t' is not a SEQUENCE
# Call the NEXT VALUE FOR s:
SELECT NEXT VALUE FOR s;
+------------------+
| NEXT VALUE FOR s |
+------------------+
| 100 |
+------------------+
SELECT PREVIOUS VALUE FOR s;
+----------------------+
| PREVIOUS VALUE FOR s |
+----------------------+
| 100 |
+----------------------+
```
Now try to start the new connection and check that the last value is still NULL, before updating the value in the new connection after the output of the new connection gets current value (110 in the example below). Note that first connection cannot see this change and the result of last value still remains the same (100 in the example above).
```
$ .mysql -uroot test -e"SELECT PREVIOUS VALUE FOR s; SELECT NEXT VALUE FOR s; SELECT PREVIOUS VALUE FOR s;"
+----------------------+
| PREVIOUS VALUE FOR s |
+----------------------+
| NULL |
+----------------------+
+------------------+
| NEXT VALUE FOR s |
+------------------+
| 110 |
+------------------+
+----------------------+
| PREVIOUS VALUE FOR s |
+----------------------+
| 110 |
+----------------------+
```
See Also
--------
* [Sequence Overview](../sequence-overview/index)
* [CREATE SEQUENCE](../create-sequence/index)
* [ALTER SEQUENCE](../alter-sequence/index)
* [NEXT VALUE FOR](../next-value-for-sequence_name/index)
* [SETVAL()](../setval/index). Set next value for the sequence.
* [AUTO\_INCREMENT](../auto_increment/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SecuRich SecuRich
========
SecuRich has not been updated since 2011.
SecuRich is a library of [stored procedures](../stored-procedures/index) that adds security features to MariaDB and MySQL. It is maintained by Darren Cassar, and can be downloaded from [securich.com](http://www.securich.com/).
Its main purpose is to emulate [roles](../roles/index), but this feature has been supported in the server since [MariaDB 10.0](../what-is-mariadb-100/index). However other interesting features are available via SecuRich, such as the ability to block a user, clone a user or set a password that will expire (also supported since [MariaDB 10.4](../what-is-mariadb-104/index) - see [User Password Expiry](../user-password-expiry/index)).
To use SecuRich features, its stored procedures should be used instead of the usual security-related SQL statements. For example, drop\_user() should be used instead of [DROP USER](../drop-user/index). However, if a combination of SecuRich procedure and normal SQL statements is used, SecuRich can reconcile its tables with the system tables.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Spider Status Variables Spider Status Variables
=======================
The following status variables are associated with the [Spider storage engine](../spider/index). See [Server Status Variables](../server-status-variables/index) for a complete list of status variables that can be viewed with [SHOW STATUS](../show-status/index).
See also the [Full list of MariaDB options, system and status variables](../full-list-of-mariadb-options-system-and-status-variables/index).
#### `Spider_direct_aggregate`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Spider_direct_delete`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
* **Introduced:** [MariaDB 10.3.3](https://mariadb.com/kb/en/mariadb-1033-release-notes/)
---
#### `Spider_direct_order_limit`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Spider_direct_update`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
* **Introduced:** [MariaDB 10.3.3](https://mariadb.com/kb/en/mariadb-1033-release-notes/)
---
#### `Spider_mon_table_cache_version`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Spider_mon_table_cache_version_req`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Spider_parallel_search`
* **Description:**
* **Scope:** Global, Session
* **Data Type:** `numeric`
* **Introduced:** [MariaDB 10.3.3](https://mariadb.com/kb/en/mariadb-1033-release-notes/)
---
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb HANDLER HANDLER
========
The `HANDLER` statements give you direct access to reading rows from the storage engine. This is much faster than normal access through [SELECT](../select/index) as there is less parsing involved and no optimizer involved.
You can use [prepared statements](../prepared-statements/index) for `HANDLER READ`, which should give you a speed comparable to [HandlerSocket](../handlersocket/index). Also see Yoshinori Matsunobu's blog post [Using MySQL as a NoSQL - A story for exceeding 750,000 qps on a commodity server](http://yoshinorimatsunobu.blogspot.com/2010/10/using-mysql-as-nosql-story-for.html).
| Title | Description |
| --- | --- |
| [HANDLER Commands](../handler-commands/index) | Direct access to table storage engine interfaces for key lookups and key or table scans. |
| [HANDLER for MEMORY Tables](../handler-for-memory-tables/index) | Using HANDLER commands efficiently with MEMORY/HEAP tables |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mroonga_command mroonga\_command
================
Syntax
------
```
mroonga_command (command)
```
Description
-----------
`mroonga_command` is a [user-defined function](../user-defined-functions/index) (UDF) included with the [Mroonga storage engine](../mroonga/index). It passes a command to Groonga for execution. See [Creating Mroonga User-Defined Functions](../creating-mroonga-user-defined-functions/index) for details on creating this UDF if required.
* `command` - string, required parameter specifying the command to pass that will be executed by Groonga. See [the Groonga reference](http://groonga.org/docs/reference/command.html) for a list of commands.
Returns the result of the Groonga command.
Example
-------
```
SELECT mroonga_command('status');
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| mroonga_command('status') |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {"alloc_count":593,"starttime":1512022368,"start_time":1512022368,"uptime":13510,"version":"7.0.7","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":3} |
```
See Also
--------
* [Creating Mroonga User-Defined Functions](../creating-mroonga-user-defined-functions/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb POWER POWER
=====
Syntax
------
```
POWER(X,Y)
```
Description
-----------
This is a synonym for [POW()](../pow/index), which returns the value of X raised to the power of Y.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb How to Use procmon to Trace mysqld.exe Filesystem Access How to Use procmon to Trace mysqld.exe Filesystem Access
========================================================
This article provides a walkthrough on using the Process Monitor on Windows, tracing file system access by mysqld.exe during the "install plugin" call.
Download
--------
Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, registry and process/thread activity. It is a part of sysinternals suite developed by Mark Russinovich and Bryce Cogswell. Process Monitor can be directly downloaded from <http://download.sysinternals.com/files/ProcessMonitor.zip> . More description can be found at [https:*technet.microsoft.com/en-us/library/bb896645.aspx*](procmon%27s_microsoft_tecnet_page)
Installation
------------
There is no installation necessary; the single executable can be used after unpacking. I suggest putting procmon into some directory in the PATH [environment variable](../mariadb-environment-variables/index).
Example of taking a mysqld.exe trace
------------------------------------
The purpose of the following exercise is to learn how to use procmon to trace mysqld.exe calls to the filesystem.
We assume that mysqld.exe is already started.
1. Start procmon.exe . Dialog will pop up that offers to set filter. Use this dialog to set filter to "Process name" "is" "mysqld.exe", as shown in the screenshot below.
Click on "Add" button to mysqld.exe to include it in the filter, "Apply" and "OK".
2. Capture events (Menu File=>Capture Events (Ctrl+E)
3. Start mysql command line client and connect to the server.
Execute
```
mysql> install plugin blackhole soname 'ha_blackhole.dll';
Query OK, 0 rows affected (0.03 sec)
```
4. Saving the trace
Back to Process Monitor Windows, you should see the filesystem events initiated by the "INSTALL PLUGIN" operation

To save it, choose File/Save.
(Advanced) Seeing stack traces corresponding to events
------------------------------------------------------
It is also possible to see stacktraces corresponding to the events. For this to work , symbols support needs to be configured. This needs to be only done once.
1. Install Debugging Tools for Windows (google on how to do that).
2. Switch to Process Monitor's menu Options => Configure symbols.
3. Add dbghelp.dll from your installation of Debugging Tools into "dbghelp.dll path" input field . On my system it is
C:\Program Files\Debugging Tools for Windows (x64)\dbghelp.dll
4. In "symbol path" input field, add
srv\*C:\symbols\*[http://msdl.microsoft.com/download/symbols;<path\to\your\installation\bin](#)>
(substitute last last path element with real path to your installation)
This is how it looks on my machine:
Once symbols are configured, you'll get a stack trace corresponding to a filesystem event by simply doubleclicking on the line corresponding to the event. This is what I see after clicking on the first event of my tracing session (corresponds to opening my.ini file)
It is also possible to save the the whole trace with callstacks as text (File/Save, choose XML, include callstack + resolve callstack).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb INET_NTOA INET\_NTOA
==========
Syntax
------
```
INET_NTOA(expr)
```
Description
-----------
Given a numeric IPv4 network address in network byte order (4 or 8 byte), returns the dotted-quad representation of the address as a string.
Examples
--------
```
SELECT INET_NTOA(3232235777);
+-----------------------+
| INET_NTOA(3232235777) |
+-----------------------+
| 192.168.1.1 |
+-----------------------+
```
192.168.1.1 corresponds to 3232235777 since 192 x 2563 + 168 x 256 2 + 1 x 256 + 1 = 3232235777
See Also
--------
* [INET6\_NTOA()](../inet6_ntoa/index)
* [INET\_ATON()](../inet_aton/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb User & Server Security User & Server Security
=======================
| Title | Description |
| --- | --- |
| [Securing MariaDB](../securing-mariadb/index) | Securing your MariaDB installation |
| [User Account Management](../user-account-management/index) | Administering user accounts in MariaDB |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Using CONNECT - Exporting Data From MariaDB Using CONNECT - Exporting Data From MariaDB
===========================================
Exporting data from MariaDB is obviously possible with CONNECT in particular for all formats not supported by the `[SELECT INTO OUTFILE](../select-into-outfile/index)` statement. Let us consider the query:
```
select plugin_name handler, plugin_version version, plugin_author
author, plugin_description description, plugin_maturity maturity
from information_schema.plugins where plugin_type = 'STORAGE ENGINE';
```
Supposing you want to get the result of this query into a file handlers.htm in XML/HTML format, allowing displaying it on an Internet browser, this is how you can do it:
Just create the CONNECT table that will be used to make the file:
```
create table handout
engine=CONNECT table_type=XML file_name='handout.htm' header=yes
option_list='name=TABLE,coltype=HTML,attribute=border=1;cellpadding=5
,headattr=bgcolor=yellow'
select plugin_name handler, plugin_version version, plugin_author
author, plugin_description description, plugin_maturity maturity
from information_schema.plugins where plugin_type = 'STORAGE ENGINE';
```
Here the column definition is not given and will come from the Select statement following the Create. The CONNECT options are the same we have seen previously. This will do both actions, creating the matching *handlers* CONNECT table and 'filling' it with the query result.
**Note 1:** This could not be done in only one statement if the table type had required using explicit CONNECT column options. In this case, firstly create the table, and then populate it with an Insert statement.
**Note 2:** The source “plugins” table column “description” is a long text column, data type not supported for CONNECT tables. It has been silently internally replaced by varchar(256).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_INTERSECTION ST\_INTERSECTION
================
Syntax
------
```
ST_INTERSECTION(g1,g2)
```
Description
-----------
Returns a geometry that is the intersection, or shared portion, of geometry *`g1`* and geometry *`g2`*.
Examples
--------
```
SET @g1 = ST_GEOMFROMTEXT('POINT(2 1)');
SET @g2 = ST_GEOMFROMTEXT('LINESTRING(2 1, 0 2)');
SELECT ASTEXT(ST_INTERSECTION(@g1,@g2));
+----------------------------------+
| ASTEXT(ST_INTERSECTION(@g1,@g2)) |
+----------------------------------+
| POINT(2 1) |
+----------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Out Parameters in PREPARE Out Parameters in PREPARE
=========================
**MariaDB [10.1.1](https://mariadb.com/kb/en/mariadb-1011-release-notes/)**Out parameters in PREPARE were only available in [MariaDB 10.1.1](https://mariadb.com/kb/en/mariadb-1011-release-notes/)
One can use question mark placeholders for out-parameters in the [PREPARE](../prepare-statement/index) statement. Only [SELECT … INTO](../select/index#into) can be used this way:
```
prepare test from "select id into ? from t1 where val=?";
execute test using @out, @in;
```
This is particularly convenient when used with [compound statements](../using-compound-statements-outside-of-stored-programs/index):
```
PREPARE stmt FROM "BEGIN NOT ATOMIC
DECLARE v_res INT;
SELECT COUNT(*) INTO v_res FROM t1;
SELECT 'Hello World', v_res INTO ?,?;
END"|
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Subquery Limitations Subquery Limitations
====================
There are a number of limitations regarding [subqueries](../subqueries/index), which are discussed below.
The following tables and data will be used in the examples that follow:
```
CREATE TABLE staff(name VARCHAR(10),age TINYINT);
CREATE TABLE customer(name VARCHAR(10),age TINYINT);
```
```
INSERT INTO staff VALUES
('Bilhah',37), ('Valerius',61), ('Maia',25);
INSERT INTO customer VALUES
('Thanasis',48), ('Valerius',61), ('Brion',51);
```
### ORDER BY and LIMIT
To use [ORDER BY](../order-by/index) or limit [LIMIT](../limit/index) in [subqueries](../subqueries/index) both must be used.. For example:
```
SELECT * FROM staff WHERE name IN (SELECT name FROM customer ORDER BY name);
+----------+------+
| name | age |
+----------+------+
| Valerius | 61 |
+----------+------+
```
is valid, but
```
SELECT * FROM staff WHERE name IN (SELECT NAME FROM customer ORDER BY name LIMIT 1);
ERROR 1235 (42000): This version of MariaDB doesn't
yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
```
is not.
### Modifying and Selecting from the Same Table
It's not possible to both modify and select from the same table in a subquery. For example:
```
DELETE FROM staff WHERE name = (SELECT name FROM staff WHERE age=61);
ERROR 1093 (HY000): Table 'staff' is specified twice, both
as a target for 'DELETE' and as a separate source for data
```
### Row Comparison Operations
There is only partial support for row comparison operations. The expression in
```
expr op {ALL|ANY|SOME} subquery,
```
must be scalar and the subquery can only return a single column.
However, because of the way `IN` is implemented (it is rewritten as a sequence of `=` comparisons and `AND`), the expression in
```
expression [NOT] IN subquery
```
is permitted to be an n-tuple and the subquery can return rows of n-tuples.
For example:
```
SELECT * FROM staff WHERE (name,age) NOT IN (
SELECT name,age FROM customer WHERE age >=51]
);
+--------+------+
| name | age |
+--------+------+
| Bilhah | 37 |
| Maia | 25 |
+--------+------+
```
is permitted, but
```
SELECT * FROM staff WHERE (name,age) = ALL (
SELECT name,age FROM customer WHERE age >=51
);
ERROR 1241 (21000): Operand should contain 1 column(s)
```
is not.
### Correlated Subqueries
Subqueries in the FROM clause cannot be correlated subqueries. They cannot be evaluated for each row of the outer query since they are evaluated to produce a result set during when the query is executed.
### Stored Functions
A subquery can refer to a [stored function](../stored-functions/index) which modifies data. This is an extension to the SQL standard, but can result in indeterminate outcomes. For example, take:
```
SELECT ... WHERE x IN (SELECT f() ...);
```
where *f()* inserts rows. The function *f()* could be executed a different number of times depending on how the optimizer chooses to handle the query.
This sort of construct is therefore not safe to use in replication that is not [row-based](../binary-log-formats/index), as there could be different results on the master and the slave.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.5 GA MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.5 GA
=========================================================
MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.5 GA
---------------------------------------------------------
### Changes in 1.2.1 and later
#### libjemalloc dependency
ColumnStore 1.2.3 onward requires libjemalloc to be installed. For Ubuntu & Debian based distributions this is installed using the package "libjemalloc1" in the standard repositories.
For CentOS the package is in RedHat's EPEL repository:
This does require either root user access or SUDO setup to install:
```
sudo yum -y install epel-release
sudo yum install -y jemalloc
```
#### Non-distributed is the default distribution mode in postConfigure
The default distribution mode has changed from 'distributed' to 'non-distributed'. During an upgrade, however, the default is to use the distribution mode used in the original installation. The options '-d' and '-n' can always be used to override the default.
#### Non-root user sudo setup
Root-level permissions are no longer required to install or upgrade ColumnStore for most types of installations. Installations requiring some level of sudo access, and the instructions, are listed here: [https://mariadb.com/kb/en/library/preparing-for-columnstore-installation-121/#update-sudo-configuration-if-needed-by-root-user](../library/preparing-for-columnstore-installation-121/index#update-sudo-configuration-if-needed-by-root-user)
#### Running the mysql\_upgrade script
As part of the upgrade process to 1.2.5, the user is might be required to run the mysql\_upgrade script on all of the following nodes.
1. If the system was upgraded to 1.1.x to 1.2.x. And now it being upgrade to 1.2.5, the mysql\_upgrade script will need to be run. 2. If the system was initially installed with 1.2.x and now its being upgraded to 1.2.5, the mysql\_upgrade script doesnt need to be run. So this section can be skipped.
* All User Modules on a system configured with separate User and Performance Modules
* All Performance Modules on a system configured with separate User and Performance Modules and Local Query Feature is enabled
* All Performance Modules on a system configured with combined User and Performance Modules
mysql\_upgrade should be run once the upgrade has been completed.
This is an example of how it run on a root user install:
```
/usr/local/mariadb/columnstore/mysql/bin/mysql_upgrade --defaults-file=/usr/local/mariadb/columnstore/mysql/my.cnf --force
```
This is an example of how it run on a non-root user install, assuming ColumnStore is installed under the user's home directory:
```
$HOME/mariadb/columnstore/mysql/bin/mysql_upgrade --defaults-file=$HOME/mariadb/columnstore/mysql/my.cnf --force
```
In addition you should run the upgrade stored procedure below for a major version upgrade.
#### Executing the upgrade stored procedure
1. If the system was upgraded to 1.1.x to 1.2.x. And now it being upgrade to 1.2.5, the upgrade stored procedure will need to be run. 2. If the system was initially installed with 1.2.x and now its being upgraded to 1.2.5, the upgrade stored procedure doesnt need to be run. So this section can be skipped.
This updates the MariaDB FRM files by altering every ColumnStore table with a blank table comment. This will not affect options set using table comments but will erase any table comment the user has manually set.
You only need to execute this as part of a major version upgrade. It is executed using the following query which should be executed by a user which has access to alter every ColumnStore table:
```
call columnstore_info.columnstore_upgrade();
```
### Upgrading from 1.2.4 to a later version
Version 1.2.4 had a bug which caused bad metadata to be stored with dictionary columns. After an upgrade from 1.2.4 tables with dictionary columns (CHAR > 8 bytes, VARCHAR > 7, TEXT & BLOB) tables should be recreated and data cloned. This could be done using CREATE TABLE ... LIKE and using INSERT...SELECT.
### Setup
In this section, we will refer to the directory ColumnStore is installed in as <CSROOT>. If you installed the RPM or DEB package, then your <CSROOT> will be /usr/local. If you installed it from the tarball, <CSROOT> will be where you unpacked it.
#### Columnstore.xml / my.cnf
Configuration changes made manually are not automatically carried forward during the upgrade. These modifications will need to be made again manually after the upgrade is complete.
After the upgrade process the configuration files will be saved at:
* <CSROOT>/mariadb/columnstore/etc/Columnstore.xml.rpmsave
* <CSROOT>/mariadb/columnstore/mysql/my.cnf.rpmsave
#### MariaDB root user database password
If you have specified a root user database password (which is good practice), then you must configure a .my.cnf file with user credentials for the upgrade process to use. Create a .my.cnf file in the user home directory, which is /root for root install and /home/'user' for non-root install. Set 600 as the file permissions with the following content (updating PASSWORD as appropriate):
```
[mysqladmin]
user = root
password = PASSWORD
```
### Choosing the type of upgrade
Note, softlinks may cause a problem during the upgrade if you use the RPM or DEB packages. If you have linked a directory above /usr/local/mariadb/columnstore, the softlinks will be deleted and the upgrade will fail. In that case you will need to upgrade using the binary tarball instead. If you have only linked the data directories (ie /usr/local/MariaDB/columnstore/data\*), the RPM/DEB package upgrade will work.
#### Root User Installs
##### Upgrading MariaDB ColumnStore using the tarball of RPMs (distributed mode)
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.2.5-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.**
**Shutdown the MariaDB ColumnStore system:**
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
```
# tar -zxf mariadb-columnstore-1.2.5-1-centos#.x86_64.rpm.tar.gz
```
* Uninstall the old packages, then install the new packages. The MariaDB ColumnStore software will be installed in /usr/local/.
```
# rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
# rpm -ivh mariadb-columnstore-*1.2.5*rpm
```
* Run postConfigure using the upgrade option
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
* Run the mysql\_upgrade script on the nodes documented above for a root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/index#running-the-mysql_upgrade-script)
##### Upgrading MariaDB ColumnStore using RPM Package Repositories (non-distributed mode)
The system can be upgraded when it was previously installed from the Package Repositories. This will need to be run on each module in the system.
Additional information can be found in this document on how to setup and install using the 'yum' package repo command:
[https://mariadb.com/kb/en/library/installing-mariadb-ax-from-the-package-repositories](../library/installing-mariadb-ax-from-the-package-repositories)
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Shutdown the MariaDB ColumnStore system:**
```
# mcsadmin shutdownsystem y
```
* Uninstall MariaDB ColumnStore Packages
```
# yum remove mariadb-columnstore*
```
* Install MariaDB ColumnStore Packages
```
# yum --enablerepo=mariadb-columnstore clean metadata
# yum install mariadb-columnstore*
```
NOTE: On all modules except for PM1, start the columnstore service
```
# /usr/local/mariadb/columnstore/bin/columnstore start
```
* Run postConfigure using the upgrade and non-distributed options
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u -n
```
* Run the mysql\_upgrade script on the nodes documented above for a root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/index#running-the-mysql_upgrade-script)
##### Upgrading MariaDB ColumnStore using the binary tarball (distributed mode)
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory mariadb-columnstore-1.2.5-1.x86\_64.bin.tar.gz
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# /usr/local/mariadb/columnstore/bin/pre-uninstall
```
* Unpack the tarball in the /usr/local/ directory.
```
# tar -zxvf mariadb-columnstore-1.2.5-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# /usr/local/mariadb/columnstore/bin/post-install
```
* Run postConfigure using the upgrade option
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
* Run the mysql\_upgrade script on the nodes documented above for a root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/index#running-the-mysql_upgrade-script)
##### Upgrading MariaDB ColumnStore using the DEB tarball (distributed mode)
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory mariadb-columnstore-1.2.5-1.amd64.deb.tar.gz
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which contains DEBs.
```
# tar -zxf mariadb-columnstore-1.2.5-1.amd64.deb.tar.gz
```
* Remove and install all MariaDB ColumnStore debs
```
# cd /root/
# dpkg -r $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg --install mariadb-columnstore-*1.2.5-1*deb
```
* Run postConfigure using the upgrade option
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
* Run the mysql\_upgrade script on the nodes documented above for a root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/index#running-the-mysql_upgrade-script)
##### Upgrading MariaDB ColumnStore using DEB Package Repositories (non-distributed mode)
The system can be upgraded when it was previously installed from the Package Repositories. This will need to be run on each module in the system
Additional information can be found in this document on how to setup and install using the 'apt-get' package repo command:
[https://mariadb.com/kb/en/library/installing-mariadb-ax-from-the-package-repositories](../library/installing-mariadb-ax-from-the-package-repositories)
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Shutdown the MariaDB ColumnStore system:**
```
# mcsadmin shutdownsystem y
```
* Uninstall MariaDB ColumnStore Packages
```
# apt-get remove mariadb-columnstore*
```
* Install MariaDB ColumnStore Packages
```
# apt-get update
# sudo apt-get install mariadb-columnstore*
```
NOTE: On all modules except for PM1, start the columnstore service
```
# /usr/local/mariadb/columnstore/bin/columnstore start
```
* Run postConfigure using the upgrade and non-distributed options
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u -n
```
* Run the mysql\_upgrade script on the nodes documented above for a root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-124-ga/index#running-the-mysql_upgrade-script)
#### Non-Root User Installs
##### Upgrade MariaDB ColumnStore from the binary tarball (non-distributed mode)
The upgrade instructions:
* Download the binary tarball to the current installation location on all nodes. See <https://downloads.mariadb.com/ColumnStore/>
* Shutdown the MariaDB ColumnStore system from PM1:
```
$ mcsadmin shutdownsystem y
```
* On all nodes, run pre-install, specifying where ColumnStore is installed
```
$ <CSROOT>/mariadb/columnstore/bin/pre-install --installdir=<CSROOT>/mariadb/columnstore
```
* On all nodes, untar the new files in the same location as the old ones
```
$ tar zxf columnstore-1.2.5-1.x86_64.bin.tar.gz
```
* On all nodes, run post-install, specifying where ColumnStore is installed
```
$ <CSROOT>/mariadb/columnstore/bin/post-install --installdir=<CSROOT>/mariadb/columnstore
```
* On all nodes except for PM1, start the columnstore service
```
$ <CSROOT>/mariadb/columnstore/bin/columnstore start
```
* On PM1 only, run postConfigure, specifying the upgrade, non-distributed installation mode, and the location of the installation
```
$ <CSROOT>/mariadb/columnstore/bin/postConfigure -u -n -i <CSROOT>/mariadb/columnstore
```
* Run the mysql\_upgrade script on the nodes documented above for a non-root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-125-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-125-ga/index#running-the-mysql_upgrade-script)
##### Upgrade MariaDB ColumnStore from the binary tarball (distributed mode)
Upgrade MariaDB ColumnStore as user USER on the server designated as PM1:
* Download the package into the user's home directory mariadb-columnstore-1.2.5-1.x86\_64.bin.tar.gz
* Shutdown the MariaDB ColumnStore system:
```
$ mcsadmin shutdownsystem y
```
* Run the pre-uninstall script
```
$ <CSROOT>/mariadb/columnstore/bin/pre-uninstall --installdir=<CSROOT>/mariadb/columnstore
```
* Unpack the tarball in the same place as the original installation
```
$ tar -zxvf mariadb-columnstore-1.2.5-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
$ <CSROOT>/mariadb/columnstore/bin/post-install --installdir=<CSROOT>/mariadb/columnstore
```
* Run postConfigure using the upgrade option
```
$ <CSROOT>/mariadb/columnstore/bin/postConfigure -u -i <CSROOT>/mariadb/columnstore
```
* Run the mysql\_upgrade script on the nodes documented above for a non-root user install
[https://mariadb.com/kb/en/library/mariadb-columnstore-software-upgrade-117-ga-to-125-ga/#running-the-mysql\_upgrade-script](../library/mariadb-columnstore-software-upgrade-117-ga-to-125-ga/index#running-the-mysql_upgrade-script)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Performance Schema events_transactions_summary_global_by_event_name Table Performance Schema events\_transactions\_summary\_global\_by\_event\_name Table
===============================================================================
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**The events\_transactions\_summary\_global\_by\_event\_name table was introduced in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/).
The `events_transactions_summary_global_by_event_name` table contains information on transaction events aggregated by event name.
The table contains the following columns:
```
+----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------------+------+-----+---------+-------+
| EVENT_NAME | varchar(128) | NO | | NULL | |
| COUNT_STAR | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_WAIT | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_WRITE | bigint(20) unsigned | NO | | NULL | |
| COUNT_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| SUM_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MIN_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| AVG_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
| MAX_TIMER_READ_ONLY | bigint(20) unsigned | NO | | NULL | |
+----------------------+---------------------+------+-----+---------+-------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Replication Commands Replication Commands
=====================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
A list of replication-related commands. See [replication](../replication/index) for more replication-related information.
| Title | Description |
| --- | --- |
| [CHANGE MASTER TO](../change-master-to/index) | Set or change replica parameters for connecting to the primary. |
| [START SLAVE](../start-replica/index) | Start replica threads. |
| [STOP SLAVE](../stop-replica/index) | Stop replica threads. |
| [RESET REPLICA/SLAVE](../reset-replica/index) | Forget replica connection information and start a new relay log file. |
| [SET GLOBAL SQL\_SLAVE\_SKIP\_COUNTER](../set-global-sql_slave_skip_counter/index) | Skips a number of events from the primary. |
| [SHOW RELAYLOG EVENTS](../show-relaylog-events/index) | Show events in the relay log. |
| [SHOW SLAVE STATUS](../show-replica-status/index) | Show status for one or all primaries. |
| [SHOW MASTER STATUS](../show-binlog-status/index) | Status information about the binary log. |
| [SHOW SLAVE HOSTS](../show-replica-hosts/index) | Display replicas currently registered with the primary. |
| [RESET MASTER](../reset-master/index) | Delete binary log files. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb IS NULL IS NULL
=======
Syntax
------
```
IS NULL
```
Description
-----------
Tests whether a value is NULL. See also [NULL Values in MariaDB](../null-values-in-mariadb/index).
Examples
--------
```
SELECT 1 IS NULL, 0 IS NULL, NULL IS NULL;
+-----------+-----------+--------------+
| 1 IS NULL | 0 IS NULL | NULL IS NULL |
+-----------+-----------+--------------+
| 0 | 0 | 1 |
+-----------+-----------+--------------+
```
Compatibility
-------------
Some `ODBC` applications use the syntax `auto_increment_field IS NOT NULL` to find the latest row that was inserted with an autogenerated key value. If your applications need this, you can set the [sql\_auto\_is\_null](../server-system-variables/index#sql_auto_is_null) variable to 1.
```
SET @@sql_auto_is_null=1;
CREATE TABLE t1 (auto_increment_column INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 WHERE auto_increment_column IS NULL;
+-----------------------+
| auto_increment_column |
+-----------------------+
| 1 |
+-----------------------+
```
See also
--------
* [NULL values](../null-values/index)
* [IS NOT NULL operator](../is-not-null/index)
* [COALESCE function](../coalesce/index)
* [IFNULL function](../ifnull/index)
* [NULLIF function](../nullif/index)
* [CONNECT data types](../connect-data-types/index#null-handling)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb DAYOFYEAR DAYOFYEAR
=========
Syntax
------
```
DAYOFYEAR(date)
```
Description
-----------
Returns the day of the year for date, in the range 1 to 366.
Examples
--------
```
SELECT DAYOFYEAR('2018-02-16');
+-------------------------+
| DAYOFYEAR('2018-02-16') |
+-------------------------+
| 47 |
+-------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb View Algorithms View Algorithms
===============
Description
-----------
The [CREATE VIEW](../create-view/index) statement accepts an optional ALGORITHM clause, an extension to standard SQL for [Views](../views/index).
It can contain one of three values: MERGE, TEMPTABLE or UNDEFINED, and affects how MariaDB will process the view.
With MERGE, the view definition and the related portion of the statement referring to the view are merged. If TEMPTABLE is selected, the view results are stored in a temporary table.
MERGE is usually more efficient, and a view can only be updated with this algorithm. TEMPTABLE can be useful in certain situations, as locks on the underlying tables can be released before the statement is finished processing.
If it's UNDEFINED (or the ALGORITHM clause is not used), MariaDB will choose what it thinks is the best algorithm. An algorithm can also be UNDEFINED if its defined as MERGE, but the view requires a temporary table.
Views with definition ALGORITHM=MERGE or ALGORITHM=TEMPTABLE got accidentally swapped between MariaDB and MySQL. When upgrading, you have to re-create views created with either of these definitions (see [MDEV-6916](https://jira.mariadb.org/browse/MDEV-6916)).
MERGE Limitations
-----------------
A view cannot be of type ALGORITHM=MERGE if it uses any of the following:
* [HAVING](../select/index)
* [LIMIT](../select/index#limit)
* [GROUP BY](../select/index#group-by)
* [DISTINCT](../select/index#distinct)
* [UNION](../union/index)
* [UNION ALL](../union/index)
* An aggregate function, such as [MAX()](../max/index), [MIN()](../min/index), [SUM()](../sum/index) or [COUNT()](../count/index)
* subquery in the SELECT list
* if it has no underlying table because it refers only to literal values
MERGE Examples
--------------
### Example 1
Here's an example of how MariaDB handles a view with a MERGE algorithm. Take a view defined as follows:
```
CREATE ALGORITHM = MERGE VIEW view_name (view_field1, view_field2) AS
SELECT field1, field2 FROM table_name WHERE field3 > '2013-06-01';
```
Now, if we run a query on this view, as follows:
```
SELECT * FROM view_name;
```
to execute the view `view_name` becomes the underlying table, `table_name`, the `*` becomes the fields `view_field1` and `view_field2`, corresponding to `field1` and `field2` and the WHERE clause, `WHERE field3 > 100` is added, so the actual query executed is:
```
SELECT field1, field2 FROM table_name WHERE field3 > '2013-06-01'
```
### Example 2
Given the same view as above, if we run the query:
```
SELECT * FROM view_name WHERE view_field < 8000;
```
everything occurs as it does in the previous example, but `view_field < 8000` takes the corresponding field name and becomes `field1 < 8000`, connected with `AND` to the `field3 > '2013-06-01'` part of the query.
So the resulting query is:
```
SELECT field1, field2 FROM table_name WHERE (field3 > '2013-06-01') AND (field1 < 8000);
```
When connecting with `AND`, parentheses are added to make sure the correct precedence is used.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Using MariaDB ColumnStore Using MariaDB ColumnStore
==========================
| Title | Description |
| --- | --- |
| [MariaDB ColumnStore with Spark](../mariadb-columnstore-with-spark/index) | Introduction Apache Spark (http://spark.apache.org/) is a popular open sou... |
| [R Statistical Programming Using MariaDB as the Background Database](../r-statistical-programming-using-mariadb-as-the-background-database/index) | R Statistical Programming using MariaDB as the background database. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb NAME_CONST NAME\_CONST
===========
Syntax
------
```
NAME_CONST(name,value)
```
Description
-----------
Returns the given value. When used to produce a result set column, `NAME_CONST()` causes the column to have the given name. The arguments should be constants.
This function is used internally when replicating stored procedures. It makes little sense to use it explicitly in SQL statements, and it was not supposed to be used like that.
```
SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
| 14 |
+--------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Binlog Event Checksums Binlog Event Checksums
======================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
MariaDB includes a feature to include a checksum in [binary log](../binary-log/index) events.
Checksums are enabled with the [binlog\_checksum option](../replication-and-binary-log-server-system-variables/index#binlog_checksum). Until [MariaDB 10.2.1](https://mariadb.com/kb/en/mariadb-1021-release-notes/), this was disabled by default. From [MariaDB 10.2.1](https://mariadb.com/kb/en/mariadb-1021-release-notes/), the option is set to `CRC32`.
The variable can be changed dynamically without restarting the server. Setting the variable in any way (even to the existing value) forces a rotation of the [binary log](../binary-log/index) (the intention is to avoid having a single binlog where some events are checksummed and others are not).
When checksums are enabled, replication slaves will check events received over the network for checksum errors, and will stop with an error if a corrupt event is detected.
In addition, the server can be configured to verify checksums in two other places.
One is when reading events from the binlog on the master, for example when sending events to a slave or for something like SHOW BINLOG EVENTS. This is controlled by option master\_verify\_checksum, and is thus used to detect file system corruption of the binlog files.
The other is when the slave SQL thread reads events from the [relay log](../relay-log/index). This is controlled by the slave\_sql\_verify\_checksum option, and is used to detect file system corruption of slave relay log files.
`master_verify_checksum`
* **Description:** Verify binlog checksums when reading events from the binlog on the master.
* **Commandline:** `--master_verify_checksum=[0|1]`
* **Scope:** Global
* **Access Type:** Can be changed dynamically
* **Data Type:** `bool`
* **Default Value:** `OFF (0)`
`slave_sql_verify_checksum`
* **Description:** Verify binlog checksums when the slave SQL thread reads events from the relay log.
* **Commandline:** `--slave_sql_verify_checksum=[0|1]`
* **Scope:** Global
* **Access Type:** Can be changed dynamically
* **Data Type:** `bool`
* **Default Value:** `ON (1)`
The [mysqlbinlog](../mysqlbinlog/index) client program by default does not verify checksums when reading a binlog file, however it can be instructed to do so with the option verify-binlog-checksum:
* **Variable Name:** `verify-binlog-checksum`
* **Data Type:** `bool`
* **Default Value:** `OFF`
See Also
--------
* [Binlog Event Checksum Interoperability](../binlog-event-checksum-interoperability/index)
* [What is MariaDB 5.3](../what-is-mariadb-53/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Buildbot Database Schema Buildbot Database Schema
========================
This page describes the database schema used by Buildbot to save results from test runs.
The idea is to be able to use this data from outside of Buildbot for things like additional web pages presenting test results, or search/data mining facilities for searching for test failures.
Accessing the database
----------------------
The plan is to make remote database connections available to community members. For this, we need to set up a slave host replicating the master Buildbot database (which would in any case be good to isolate the running Buildbot from possibly high load from queries).
However, for now the database access is only available locally on the machine (hasky) running the buildbot master.
Schema
------
The most current information about the schema used is available in the file `buildbot/process/mtrlogobserver.py` in the Buildbot sources. As the code evolves and more kinds of information is made available in the database, the schema might be extended, but the schema description in the source code should always be up-to-date.
### The `test_run` table
This table has one row for every test run that Buildbot does. Thus, each row corresponds to one cell in the [<http://askmonty.org/buildbot/waterfall> Waterfall display]. The format of the table is as follows:
```
CREATE TABLE test_run(
id INT PRIMARY KEY AUTO_INCREMENT,
branch VARCHAR(100),
revision VARCHAR(32) NOT NULL,
platform VARCHAR(100) NOT NULL,
dt TIMESTAMP NOT NULL,
bbnum INT NOT NULL,
typ VARCHAR(32) NOT NULL,
info VARCHAR(255),
KEY (branch, revision),
KEY (dt),
KEY (platform, bbnum)
) ENGINE=innodb
```
* **id:** Primary key, just an auto\_increment id.
* **branch:** This is the name of the bzr branch of the test run.
* **revision:** The Bzr revision number tested.
* **platform:** The name of the builder that ran the test.
* **dt:** Date when the buildbot run was started.
* **bbnum:** The Buildbot '''build number''' which together with `platform` uniquely identifies a build within Buildbot.
* **typ:** Concise abbreviation describing the kind of test. For example `pr` for --ps-protocol with row based replication, or `nm` for normal run with mixed-mode replication.
* **info:** Short textual description of the kind of test run.
### The `test_failure` table
This table has one row for every test failure encountered:
```
CREATE TABLE test_failure(
test_run_id INT NOT NULL,
test_name VARCHAR(100) NOT NULL,
test_variant VARCHAR(16) NOT NULL,
info_text VARCHAR(255),
failure_text TEXT,
PRIMARY KEY (test_run_id, test_name, test_variant)
) ENGINE=innodb
```
* **test\_run\_id:** This identifies the test run in which the test failure occured (eg. it is a foreign key to `id` in table `test_run`).
* **test\_name:** The name of the test that failed, eg. `main.information_schema`.
* **test\_variant:** Some tests are run multiple times in different variants. Ie. many replication tests are run under both statement-based, mixed-mode, and row-based replication. The variant will be 'stmt', 'mix', or 'row' accordingly. For tests that do not have multiple variants, the value will be the empty string (ie. not a **NULL** value).
* **info\_text:** This is a short description that mysql-test-run.pl sometimes gives for some kinds of test failures (for example "timeout").
* **failure\_text:** This is the entire output from mysql-test-run.pl concerning this test failure. It usually contains the diff against the result file, a stacktrace for a crash, etc. This is useful to run `LIKE` queries against when searching for test failures similar to one being investigated.
### The `test_warnings` table
This table holds information about test problems that were detected after a test case ran, during server restart (typically by finding an error or warning message in the server error log files). A typical example of this is a memory leak or a crash during server shutdown.
Such a failure can not be attributed to a specific test case, as it could be caused by any of the tests run against the server since last restart, or could even be a general problem not caused by any test case. Instead, for each occurence, this table provides a list of names of the tests that were run by the server prior to detecting the error or warning.
```
CREATE TABLE test_warnings(
test_run_id INT NOT NULL,
list_id INT NOT NULL,
list_idx INT NOT NULL,
test_name VARCHAR(100) NOT NULL,
PRIMARY KEY (test_run_id, list_id, list_idx)
) ENGINE=innodb
```
* **test\_run\_id:** Identifies the corresponding row in table <code>test\_run</code>.
* **list\_id:** This is a counter for occurences of warnings within each test run (ie. it starts over from 0 again for each different value of <code>test\_run\_id</code>).
* **list\_idx:** This is a counter for each test name (ie. it starts over from 0 again for each different value of <code>test\_run\_id</code> ''and'' <code>list\_id</code>).
* **test\_name:** The name of the test run by the server prior to seeing the warning.
Sample queries
--------------
Show all platforms that failed for a particular revision of a particular branch:
```
select platform
from test_run r
where branch = 'mysql-6.0-testing2'
and revision = '2819'
and (exists (select * from test_failure f where f.test_run_id = r.id)
or exists (select * from test_warnings w where w.test_run_id = r.id));
```
Find failures similar to a given failure being investigated:
```
select branch, revision, platform, test_name, test_variant, failure_text
from test_failure f
inner join test_run r on (f.test_run_id = r.id)
where failure_text LIKE "%--protocol=TCP' failed%";
```
Check which branches a specific kind of failure has occured in:
```
select branch, count(*)
from test_failure f
inner join test_run r on (f.test_run_id = r.id)
where failure_text LIKE "%--protocol=TCP' failed%"
group by branch;
```
Find all test runs where a given test was run against a server that later had warnings in the error log, and also count the number of occurences of this event in each run:
```
select branch, revision, platform, count(*)
from test_warnings w
inner join test_run r on (w.test_run_id = r.id)
where test_name = 'rpl.rpl_plugin_load'
group by r.id;
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Altering Tables in MariaDB Altering Tables in MariaDB
==========================
Despite a MariaDB developer's best planning, occasionally one needs to change the structure or other aspects of tables. This is not very difficult, but some developers are unfamiliar with the syntax for the functions used in MariaDB to accomplish this. And some changes can be very frustrating. In this article we'll explore the ways to alter tables in MariaDB and we'll give some precautions about related potential data problems.
#### Before Beginning
For the examples in this article, we will refer to a database called `db1` containing a table called `clients`. The `clients` table is for keeping track of client names and addresses. To start off, we'll enter a [DESCRIBE](../describe/index) statement to see what the table looks like:
```
DESCRIBE clients;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| cust_id | int(11) | | PRI | 0 | |
| name | varchar(25) | YES | | NULL | |
| address | varchar(25) | YES | | NULL | |
| city | varchar(25) | YES | | NULL | |
| state | char(2) | YES | | NULL | |
| zip | varchar(10) | YES | | NULL | |
| client_type | varchar(4) | YES | | NULL | |
+-------------+-------------+------+-----+---------+-------+
```
This is a very simple table that will hold very little information. However, it's sufficient for the examples here in which we will change several of its columns. Before doing any structural changes to a table in MariaDB, especially if it contains data, one should make a backup of the table to be changed. There are a few ways to do this, but some choices may not be permitted by your web hosting company. Even if your database is on your own server, though, the [mysqldump](../mysqldump/index) utility is typically the best tool for making and restoring backups in MariaDB, and it's generally permitted by web hosting companies. To backup the clients table with [mysqldump](../mysqldump/index), we will enter the following from the command-line:
```
mysqldump --user='username' --password='password' --add-locks db1 clients > clients.sql
```
As you can see, the username and password are given on the first line. On the next line, the `--add-locks` option is used to lock the table before backing up and to unlock automatically it when the backup is finished. There are many other options in [mysqldump](../mysqldump/index) that could be used, but for our purposes this one is all that's necessary. Incidentally, this statement can be entered in one line from the shell (i.e., not from the `mysql` client), or it can be entered on multiple lines as shown here by using the back-slash (i.e., `/`) to let the shell know that more is to follow. On the third line above, the database name is given, followed by the table name. The redirect (i.e., `>`) tells the shell to send the results of the dump to a text file called `clients.sql` in the current directory. A directory path could be put in front of the file name to create the file elsewhere. If the table should need to be restored, the following can be run from the shell:
```
mysql --user='username' --password='password' db1 < clients.sql
```
Notice that this line does not use the `mysqldump` utility. It uses the `mysql` client from the outside, so to speak. When the dump file (`clients.sql`) is read into the database, it will delete the `clients` table and it's data in MariaDB before restoring the backup copy with its data. So be sure that users haven't added data in the interim. In the examples in this article, we are assuming that there isn't any data in the tables yet.
#### Basic Addition and More
In order to add a column to an existing MariaDB table, one would use the [ALTER TABLE](../alter-table/index) statement. To demonstrate, suppose that it has been decided that there should be a column for the client's account status (i.e., active or inactive). To make this change, the following is entered:
```
ALTER TABLE clients
ADD COLUMN status CHAR(2);
```
This will add the column `status` to the end with a fixed width of two characters (i.e., *AC* for active and *IA* for inactive). In looking over the table again, it's decided that another field for client apartment numbers or the like needs to be added. That data could be stored in the address column, but it would better for it to be in a separate column. An [ALTER TABLE](../alter-table/index) statement could be entered like above, but it will look tidier if the new column is located right after the address column. To do this, we'll use the `AFTER` option:
```
ALTER TABLE clients
ADD COLUMN address2 varchar(25)
AFTER address;
```
By the way, to add a column to the first position, you would replace the last line of the SQL statement above to read like this:
```
...
FIRST;
```
Before moving on, let's take a look at the table's structure so far:
```
DESCRIBE clients;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| cust_id | int(11) | | PRI | 0 | |
| name | varchar(25) | YES | | NULL | |
| address | varchar(25) | YES | | NULL | |
| address2 | varchar(25) | YES | | NULL | |
| city | varchar(25) | YES | | NULL | |
| state | char(2) | YES | | NULL | |
| zip | varchar(10) | YES | | NULL | |
| client_type | varchar(4) | YES | | NULL | |
| status | char(2) | YES | | NULL | |
+-------------+-------------+------+-----+---------+-------+
```
#### Changing One's Mind
After looking over the above table display, it's decided that it might be better if the status column has the choices of 'AC' and 'IA' enumerated. To make this change, we'll enter the following SQL statement:
```
ALTER TABLE clients
CHANGE status status enum('AC','IA');
```
Notice that the column name status is specified twice. Although the column name isn't being changed, it still must be respecified. To change the column name (from `status` to `active`), while leaving the enumerated list the same, we specify the new column name in the second position:
```
ALTER TABLE clients
CHANGE status active ENUM('AC','IA');
```
Here we have the current column name and then the new column name, along with the data type specifications (i.e., `ENUM`), even though the result is only a name change. With the `CHANGE` clause everything must be stated, even items that are not to be changed.
In checking the table structure again, more changes are decided on: The column address is to be renamed to address1 and changed to forty characters wide. Also, the enumeration of active is to have 'yes' and 'no' choices. The problem with changing enumerations is that data can be clobbered in the change if one isn't careful. We've glossed over this possibility before because we are assuming that clients is empty. Let's take a look at how the modifications suggested could be made with the table containing data:
```
ALTER TABLE clients
CHANGE address address1 varchar(40),
MODIFY active enum('yes','no','AC','IA');
UPDATE clients
SET active = 'yes'
WHERE active = 'AC';
UPDATE clients
SET active = 'no'
WHERE active = 'IA';
ALTER TABLE clients
MODIFY active enum('yes','no');
```
The first SQL statement above changes address and modifies active in preparation for the transition. Notice the use of a `MODIFY` clause. It works the same as `CHANGE`, but it is only used for changing data types and not column names. Therefore, the column name isn't respecified. Notice also that there is a comma after the CHANGE clause. You can string several `CHANGE` and `MODIFY` clauses together with comma separators. We've enumerated both the new choices and the old ones to be able to migrate the data. The two [UPDATE](../update/index) statements are designed to adjust the data accordingly and the last [ALTER TABLE](../alter-table/index) statement is to remove the old enumerated choices for the status column.
In talking to the boss, we find out that the `client_type` column isn't going to be used. So we enter the following in MariaDB:
```
ALTER TABLE clients
DROP client_type;
```
This deletes `client_type` and its data, but not the whole table, obviously. Nevertheless, it is a permanent and non-reversible action; there won't be a confirmation request when using the mysql client. This is how it is with all MariaDB DROP statements and clauses. So be sure that you want to delete an element and its data before using a `DROP.` As mentioned earlier, be sure that you have a backup of your tables before doing any structured changes.
#### The Default
You may have noticed that the results of the [DESCRIBE](../describe/index) statements shown before have a heading called 'Default' and just about all of the fields have a default value of NULL. This means that there are no default values and a null value is allowed and will be used if a value isn't specified when a row is created. To be able to specify a default value other than NULL, an [ALTER TABLE](../alter-table/index) statement can be entered with a `SET` clause. Suppose we're located in Louisiana and we want a default value of 'LA' for state since that's where our clients are usually located. We would enter the following to set the default:
```
ALTER TABLE clients
ALTER state SET DEFAULT 'LA';
```
Notice that the second line starts with `ALTER` and not `CHANGE`. If we change our mind about having a default value for state, we would enter the following to reset it back to NULL (or whatever the initial default value would be based on the data type):
```
ALTER TABLE clients
ALTER state DROP DEFAULT;
```
This particular `DROP` doesn't delete data, by the way.
#### Indexes
One of the most irritating tasks in making changes to a table for newcomers is dealing with indexes. If they try to rename a column that is indexed by only using an [ALTER TABLE](../alter-table/index) statement like we used earlier, they will get a frustrating and confusing error message:
```
ALTER TABLE clients
CHANGE cust_id client_id INT
PRIMARY KEY;
ERROR 1068: Multiple primary key defined
```
If they're typing this column change from memory, they will wear themselves out trying different deviations thinking that they remembered the syntax wrong. What most newcomers to MariaDB don't seem to realize is that the index is separate from the indexed column. To illustrate, let's take a look at the index for clients by using the [SHOW INDEX](../show-index/index) statement:
```
SHOW INDEX FROM clientsG;
*************************** 1. row ***************************
Table: clients
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: cust_id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Comment:
1 row in set (0.00 sec)
```
The text above shows that behind the scenes there is an index associated with `cust_id`. The column `cust_id` is not the index. Incidentally, the G at the end of the [SHOW INDEX](../show-index/index) statement is to display the results in portrait instead of landscape format. Before the name of an indexed column can be changed, the index related to it must be eliminated. The index is not automatically changed or deleted. Therefore, in the example above, MariaDB thinks that the developer is trying to create another primary key index. So, a `DROP` clause for the index must be entered first and then a `CHANGE` for the column name can be made along with the establishing of a new index:
```
ALTER TABLE clients
DROP PRIMARY KEY,
CHANGE cust_id
client_id INT PRIMARY KEY;
```
The order of these clauses is necessary. The index must be dropped before the column can be renamed. The syntax here is for a `PRIMARY KEY`. There are other types of indexes, of course. To change a column that has an index type other than a `PRIMARY KEY`. Assuming for a moment that `cust_id` has a `UNIQUE` index, this is what we would enter to change its name:
```
ALTER TABLE clients
DROP UNIQUE cust_id
CHANGE cust_id
client_id INT UNIQUE;
```
Although the index type can be changed easily, MariaDB won't permit you to do so when there are duplicate rows of data and when going from an index that allows duplicates (e.g., `INDEX`) to one that doesn't (e.g., `UNIQUE`). If you actually do want to eliminate the duplicates, though, you can add the `IGNORE` flag to force the duplicates to be deleted:
```
ALTER IGNORE TABLE clients
DROP INDEX cust_id
CHANGE cust_id
client_id INT UNIQUE;
```
In this example, we're not only changing the indexed column's name, but we're also changing the index type from `INDEX` to `UNIQUE`. And, again, the `IGNORE` flag tells MariaDB to ignore any records with duplicate values for `cust_id`.
#### Renaming & Shifting Tables
The previous sections covered how to make changes to columns in a table. Sometimes you may want to rename a table. To change the name of the `clients` table to client\_addresses we enter this:
```
RENAME TABLE clients
TO client_addresses;
```
The RENAME TABLE statement will also allows a table to be moved to another database just by adding the receiving database's name in front of the new table name, separated by a dot. Of course, you can move a table without renaming it. To move the newly named `client_addresses` table to the database db2, we enter this:
```
RENAME TABLE client_addresses
TO db2.client_addresses;
```
Finally, with tables that contain data (excluding [InnoDB](../innodb/index) tables), occasionally it's desirable to resort the data within the table. Although the [ORDER BY](../select/index#order-by) clause in a [SELECT](../select/index) statement can do this on the fly as needed, sometimes developers want to do this somewhat permanently to the data within the table based on a particular column or columns. It can be done by entering the following:
```
ALTER TABLE client_addresses
ORDER BY city, name;
```
Notice that we're sorting by the city first and then by the client's name. Now when the developer enters a [SELECT](../select/index) statement without an [ORDER BY](../select/index#order-by) clause, the results are already ordered by the default of city and then name, at least until more data is added to the table.
This is not applicable to [InnoDB](../innodb/index) tables, the default, which are ordered according to the clustered index, unless the primary key is defined on the specific columns.
#### Summation
Good planning is certainly important in developing a MariaDB database. However, as you can see, MariaDB is malleable enough that it can be reshaped without much trouble. Just be sure to make a backup before restructuring a table and be sure to check your work and the data when you're finished. With all of this in mind, you should feel comfortable in creating tables since they don't have to be perfect from the beginning.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mariadb-check mariadb-check
=============
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-check` is a symlink to `mysqlcheck`, the tool for checking, repairing, analyzing and optimizing tables.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mariadb-check` is the name of the tool, with `mysqlcheck` a symlink .
See [mysqlcheck](../mysqlcheck/index) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb DROP INDEX DROP INDEX
==========
Syntax
------
```
DROP INDEX [IF EXISTS] index_name ON tbl_name
[WAIT n |NOWAIT]
```
Description
-----------
`DROP INDEX` drops the [index](../optimization-and-indexes/index) named `index_name` from the table `tbl_name`. This statement is mapped to an `ALTER TABLE` statement to drop the index.
If another connection is using the table, a [metadata lock](../metadata-locking/index) is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.
See `[ALTER TABLE](../alter-table/index)`.
Another shortcut, `[CREATE INDEX](../create-index/index)`, allows the creation of an index.
To remove the primary key, ``PRIMARY`` must be specified as index\_name. Note that [the quotes](../identifier-qualifiers/index) are necessary, because `PRIMARY` is a keyword.
Privileges
----------
Executing the `DROP INDEX` statement requires the `[INDEX](../grant/index#table-privileges)` privilege for the table or the database.
Online DDL
----------
Online DDL is used by default with InnoDB, when the drop index operation supports it.
See [InnoDB Online DDL Overview](../innodb-online-ddl-overview/index) for more information on online DDL with [InnoDB](../innodb/index).
`DROP INDEX IF EXISTS ...`
--------------------------
If the `IF EXISTS` clause is used, then MariaDB will return a warning instead of an error if the index does not exist.
`WAIT/NOWAIT`
-------------
**MariaDB starting with [10.3.0](https://mariadb.com/kb/en/mariadb-1030-release-notes/)**Set the lock wait timeout. See [WAIT and NOWAIT](../wait-and-nowait/index).
Progress Reporting
------------------
MariaDB provides progress reporting for `DROP INDEX` statement for clients that support the new progress reporting protocol. For example, if you were using the `[mysql](../mysql-command-line-client/index)` client, then the progress report might look like this::
See Also
--------
* [Getting Started with Indexes](../getting-started-with-indexes/index)
* [CREATE INDEX](../create-index/index)
* [ALTER TABLE](../alter-table/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SQLSTATE SQLSTATE
========
SQLSTATE is a code which identifies SQL error conditions. It composed by five characters, which can be numbers or uppercase ASCII letters. An SQLSTATE value consists of a class (first two characters) and a subclass (last three characters).
There are three important standard classes. They all indicate in which logical group of errors the condition falls. They match to a particular keyword which can be used with [DECLARE HANDLER](../declare-handler/index). Also, the SQLSTATE class determines the default value for the MYSQL\_ERRNO and MESSAGE\_TEXT condition properties.
* '00' means 'success'. It can not be set in any way, and can only be read via the API.
* '01' contains all warnings, and matches to the SQLWARNING keyword. The default MYSQL\_ERRNO is 1642 and default MESSAGE\_TEXT is 'Unhandled user-defined warning condition'.
* '02' is the NOT FOUND class. The default MYSQL\_ERRNO is 1643 and default MESSAGE\_TEXT is 'Unhandled user-defined not found condition'.
* All other classes match the SQLEXCEPTION keyword. The default MYSQL\_ERRNO is 1644 and default MESSAGE\_TEXT is 'Unhandled user-defined exception condition'.
The subclass, if it is set, indicates a particular condition, or a particular group of conditions within the class. However the '000' sequence means 'no subclass'.
For example, if you try to [SELECT](../select/index) from a table which does not exist, a 1109 error is produced, with a '42S02' SQLSTATE. '42' is the class and 'S02' is the subclass. This value matches to the SQLEXCEPTION keyword. When FETCH is called for a [cursor](../programmatic-and-compound-statements-cursors/index) which has already reached the end, a 1329 error is produced, with a '02000' SQLSTATE. The class is '02' and there is no subclass (because '000' means 'no subclass'). It can be handled by a NOT FOUND handlers.
The standard SQL specification says that classes beginning with 0, 1, 2, 3, 4, A, B, C, D, E, F and G are reserved for standard-defined classes, while other classes are vendor-specific. It also says that, when the class is standard-defined, subclasses starting with those characters (except for '000') are standard-defined subclasses, while other subclasses are vendor-defined. However, MariaDB and MySQL do not strictly obey this rule.
To read the SQLSTATE of a particular condition which is in the [diagnostics area](../diagnostics-area/index), the [GET DIAGNOSTICS](../get-diagnostics/index) statement can be used: the property is called RETURNED\_SQLSTATE. For user-defined conditions ([SIGNAL](../signal/index) and [RESIGNAL](../resignal/index) statements), a SQLSTATE value must be set via the SQLSTATE clause. However, [SHOW WARNINGS](../show-warnings/index) and [SHOW ERRORS](../show-errors/index) do not display the SQLSTATE.
For user-defined conditions, MariaDB and MySQL recommend the '45000' SQLSTATE class.
'HY000' is called the "general error": it is the class used for builtin conditions which do not have a specific SQLSTATE class.
A partial list of error codes and matching SQLSTATE values can be found in the page [MariaDB Error Codes](../mariadb-error-codes/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Data-at-Rest Encryption Data-at-Rest Encryption
========================
MariaDB supports the use of data-at-rest encryption for tables and tablespaces. For a minor performance overhead of 3-5%, this makes it almost impossible for someone with access to the host system or who steals a hard drive to read the original data.
| Title | Description |
| --- | --- |
| [Data-at-Rest Encryption Overview](../data-at-rest-encryption-overview/index) | Having data encrypted will make it hard for someone to steal your data. |
| [Why Encrypt MariaDB Data?](../why-encrypt-mariadb-data/index) | When to use encryption for MariaDB data. |
| [Key Management and Encryption Plugins](../key-management-and-encryption-plugins/index) | MariaDB uses plugins to handle key management and encryption of data. |
| [Encrypting Binary Logs](../encrypting-binary-logs/index) | Data-at-rest encryption for binary logs and relay logs. |
| [Aria Encryption](../aria-encryption/index) | Configuration and use of data-at-rest encryption with the Aria storage engine. |
| [InnoDB Encryption](../innodb-encryption/index) | Articles on using data-at-rest encryption with the InnoDB storage engine. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Why Encrypt MariaDB Data? Why Encrypt MariaDB Data?
=========================
**MariaDB starting with [10.1](../what-is-mariadb-101/index)**Encryption of tables and tablespaces was added in [MariaDB 10.1](../what-is-mariadb-101/index)
Nearly everyone owns data of immense value: customer data, construction plans, recipes, product designs and other information. These data are stored in clear text on your storage media. Everyone with file system access is able to read and modify the data. If this data falls into the wrong hands (criminals or competitors) this may result in serious consequences.
With encryption you protect Data At Rest (see the [Wikipedia article](http://en.wikipedia.org/wiki/Data_at_Rest)). That way, the database files are protected against unauthorized access.
When Does Encryption Help to Protect Your Data?
-----------------------------------------------
Encryption helps in case of threats against the database files:
* An attacker gains access to the system and copies the database files to avoid the MariaDB authorization check.
* MariaDB is operated by a service provider who should not gain access to the sensitive data.
When is Encryption No Help?
---------------------------
Encryption provides no additional protection against threats caused by authorized database users. Specifically, SQL injections aren’t prevented.
What to Encrypt?
----------------
All data that is not supposed to fall into possible attackers hands should be encrypted. Especially information, subject to strict data protection regulations, is to be protected by encryption (e.g. in the healthcare sector: patient records). Additionally data being of interest for criminals should be protected. Data which should be encrypted are:
* Personal related information
* Customer details
* Financial and credit card data
* Public authorities data
* Construction plans and research and development results
How to Handle Key Management?
-----------------------------
There are currently three options for key management:
* [File Key Management Plugin](../file-key-management-encryption-plugin/index)
* [AWS Key Management Plugin](../aws-key-management-encryption-plugin/index)
* [eperi Gateway for Databases](../encryption-key-management/index#eperi-gateway-for-databases)
See [Encryption Key Management](../encryption-key-management/index) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Why Source RPMs (SRPMs) Aren't Packaged For Some Platforms Why Source RPMs (SRPMs) Aren't Packaged For Some Platforms
==========================================================
MariaDB source RPMs (SRPMs) are not packaged on all platforms for which MariaDB RPMs are packaged.
The reason is that MariaDB's build process relies heavily on `[cmake](https://cmake.org)` for a lot of things. In this specific case, MariaDB's build process relies on [CMake CPack Package Generators](https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators) to build RPMs. The specific package generator that it uses to build RPMs is called `[CPackRPM](https://cmake.org/cmake/help/v3.10/module/CPackRPM.html)`.
Support for source RPMs in `[CPackRPM](https://cmake.org/cmake/help/v3.10/module/CPackRPM.html)` became usable with MariaDB's build system starting from around [cmake 3.10](https://cmake.org/cmake/help/v3.10/release/3.10.html). This means that we do not produce source RPMs on platforms where the installed `[cmake](https://cmake.org)` version is older than that.
See also [Building MariaDB from a Source RPM](../building-mariadb-from-a-source-rpm/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore software upgrade 1.0.7 to 1.0.8 MariaDB ColumnStore software upgrade 1.0.7 to 1.0.8
===================================================
MariaDB ColumnStore software upgrade 1.0.7 to 1.0.8
---------------------------------------------------
Note: Columnstore.xml modifications you manually made are not automatically carried forward on an upgrade. These modifications will need to be incorporated back into .XML once the upgrade has occurred.
The previous configuration file will be saved as /usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave.
If you have specified a root database password (which is good practice), then you must configure a .my.cnf file with user credentials for the upgrade process to use. Create a .my.cnf file in the user home directory with 600 file permissions with the following content (updating PASSWORD as appropriate):
```
[mysqladmin]
user = root
password = PASSWORD
```
### Changes for 1.0.8
Additional package dependencies - snappy for rpms and libsnappy1 for debian
### Choosing the type of upgrade
#### Root User Installs
#### Upgrading MariaDB ColumnStore using RPMs
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.0.8-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.** Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
`tar -zxf mariadb-columnstore-1.0.8-1-centos#.x86_64.rpm.tar.gz`
* Upgrade the RPMs. The MariaDB ColumnStore software will be installed in /usr/local/.
```
rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
rpm -ivh mariadb-columnstore-*1.0.8*rpm
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml.rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
For RPM Upgrade, the previous configuration file will be saved as:
/usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory -mariadb-columnstore-1.0.8-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
`mcsadmin shutdownsystem y`
* Run pre-uninstall script
`/usr/local/mariadb/columnstore/bin/pre-uninstall`
* Unpack the tarball, in the /usr/local/ directory.
`tar -zxvf -mariadb-columnstore-1.0.8-1.x86_64.bin.tar.gz`
* Run post-install scripts
`/usr/local/mariadb/columnstore/bin/post-install`
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
`/usr/local/mariadb/columnstore/bin/postConfigure -u`
### Upgrading MariaDB ColumnStore using the DEB package
A DEB upgrade would be done on a system that supports DEBs like Debian or Ubuntu systems.
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory
```
mariadb-columnstore-1.0.8-1.amd64.deb.tar.gz
```
(DEB 64-BIT) to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate DEBs.
```
tar -zxf mariadb-columnstore-1.0.8-1.amd64.deb.tar.gz
```
* Remove, purge and install all MariaDB ColumnStore debs
```
cd /root/
dpkg -r mariadb-columnstore*deb
dpkg -P mariadb-columnstore*deb
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
/usr/local/mariadb/columnstore/bin/postConfigure -u
```
<</style>>
#### Non-Root User Installs
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /home/'non-root-user" directory
mariadb-columnstore-1.0.8-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
`mcsadmin shutdownsystem y`
* Run pre-uninstall script
`$HOME/mariadb/columnstore/bin/pre-uninstall -i /home/guest/mariadb/columnstore`
* Unpack the tarball, which will generate the $HOME/ directory.
`tar -zxvf -mariadb-columnstore-1.0.8-1.x86_64.bin.tar.gz`
* Run post-install scripts
1. $HOME/mariadb/columnstore/bin/post-install -i /home/guest/mariadb/columnstore
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
`$HOME/mariadb/columnstore/bin/postConfigure -u -i /home/guest/mariadb/columnstore`
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LineStringFromText LineStringFromText
==================
A synonym for [ST\_LineFromText](../st_linefromtext/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Configuring PAM Authentication and User Mapping with LDAP Authentication Configuring PAM Authentication and User Mapping with LDAP Authentication
========================================================================
In this article, we will walk through the configuration of PAM authentication using the `[pam](../authentication-plugin-pam/index)` authentication plugin and user and group mapping with the `[pam\_user\_map](../user-and-group-mapping-with-pam/index)` PAM module. The primary authentication will be handled by the `[pam\_ldap](https://linux.die.net/man/5/pam_ldap)` PAM module, which performs LDAP authentication. We will also set up an OpenLDAP server.
Hypothetical Requirements
-------------------------
In this walkthrough, we are going to assume the following hypothetical requirements:
* The LDAP user `foo` should be mapped to the MariaDB user `bar`. (`foo: bar`)
* Any LDAP user in the LDAP group `dba` should be mapped to the MariaDB user `dba`. (`@dba: dba`)
Setting up the OpenLDAP Server
------------------------------
Before we can use LDAP authentication, we first need to set up our OpenLDAP Server. This is usually done on a server that is completely separate from the database server.
### Installing the OpenLDAP Server and Client Components
On the server acting as the OpenLDAP Server, first, we need to install the OpenLDAP components.
On RHEL, CentOS, and other similar Linux distributions that use [RPM packages](../rpm/index), that would go like this:
```
sudo yum install openldap openldap-servers openldap-clients nss-pam-ldapd
```
### Configuring the OpenLDAP Server
Next, let's to configure the OpenLDAP Server. The easiest way to do that is to copy the template configuration file that is included with the installation. In many installations, that will be at `/usr/share/openldap-servers/DB_CONFIG.example`. For example:
```
sudo cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
sudo chown ldap. /var/lib/ldap/DB_CONFIG
```
#### Configuring the OpenLDAP Port
Sometimes it is useful to change the port used by OpenLDAP. For example, some cloud environments block well-known authentication services, so they block the default LDAP port.
On some systems, the port can be changed by setting `SLAPD_URLS` in `/etc/sysconfig/slapd`:
```
SLAPD_URLS="ldapi:/// ldap://0.0.0.0:3306/"
```
I used `3306` because that is the port that is usually used by `mysqld`, so I know that it is not blocked.
### Starting the OpenLDAP Server
Next, let's start the OpenLDAP Server and configure it to start on reboot. On `[systemd](../systemd/index)` systems, that would go like this:
```
sudo systemctl start slapd
sudo systemctl enable slapd
```
### Installing the Standard LDAP objectClasses
In order to use LDAP for authentication, we also need to install some standard `objectClasses`, such as `posixAccount` and `posixGroup`. In LDAP, things like `objectClasses` are defined in `[LDIF](https://www.digitalocean.com/community/tutorials/how-to-use-ldif-files-to-make-changes-to-an-openldap-system)` files. In many installations, these specific `objectClasses` are defined in `/etc/openldap/schema/nis.ldif`. `nis.ldif` also depends on `core.ldif` and `cosine.ldif`. However, `core.ldif` is usually installed by default.
We can install them with `[ldapmodify](http://www.openldap.org/software/man.cgi?query=ldapmodify&sektion=1&apropos=0&manpath=OpenLDAP+2.4-Release)`:
```
sudo ldapmodify -a -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
sudo ldapmodify -a -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif
```
### Creating the LDAP Directory Manager User
Next, let’s create a directory manager user. We can do this by using OpenLDAP's [olc](https://www.openldap.org/doc/admin24/slapdconf2.html) configuration system to change the `[olcRootDN](https://www.openldap.org/doc/admin24/slapdconf2.html#olcRootDN:%20%3CDN%3E)` directive to the DN of the directory manager user, which means that the user will be a privileged LDAP user that is not subject to access controls. We will also set the root password for the user by changing the `[olcRootPW](https://www.openldap.org/doc/admin24/slapdconf2.html#olcRootPW:%20%3Cpassword%3E)` directive.
We will also set the DN suffix for our backend LDAP database by changing the `[olcSuffix](https://www.openldap.org/doc/admin24/slapdconf2.html#olcSuffix:%20%3Cdn%20suffix%3E)` directive.
Let’s use the `[slappasswd](http://www.openldap.org/software/man.cgi?query=slappasswd&apropos=0&sektion=8&manpath=OpenLDAP+2.4-Release&format=html)` utility to generate a password hash from a clear-text password. Simply execute:
```
slappasswd
```
This utility should provide a password hash that looks kind of like this: `{SSHA}AwT4jrvmokeCkbDrFAnGvzzjCMb7bvEl`
OpenLDAP's [olc](https://www.openldap.org/doc/admin24/slapdconf2.html) configuration system also uses `[LDIF](https://www.digitalocean.com/community/tutorials/how-to-use-ldif-files-to-make-changes-to-an-openldap-system)` files. Now that we have the password hash, let’s create an `LDIF` file to create the directory manager user:
```
tee ~/setupDirectoryManager.ldif <<EOF
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to *
by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
by dn.base="cn=Manager,dc=support,dc=mariadb,dc=com" read
by * none
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=support,dc=mariadb,dc=com
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=Manager,dc=support,dc=mariadb,dc=com
dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}AwT4jrvmokeCkbDrFAnGvzzjCMb7bvEl
dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
by dn="cn=Manager,dc=support,dc=mariadb,dc=com" write
by anonymous auth
by self write
by * none
olcAccess: {1}to dn.base=""
by * read
olcAccess: {2}to *
by dn="cn=Manager,dc=support,dc=mariadb,dc=com" write
by * read
EOF
```
Note that I am using the `dc=support,dc=mariadb,dc=com` domain for my directory. You can change this to whatever is relevant to you.
Now let’s run the ldif file with `[ldapmodify](http://www.openldap.org/software/man.cgi?query=ldapmodify&sektion=1&apropos=0&manpath=OpenLDAP+2.4-Release)`:
```
sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f ~/setupDirectoryManager.ldif
```
We will use the new directory manager user to make changes to the LDAP directory after this step.
### Creating the Structure of the Directory
Next, let's create the structure of the directory by creating parts of our tree.
```
tee ~/setupDirectoryStructure.ldif <<EOF
dn: dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: dcObject
objectclass: organization
o: MariaDB Support Team
dc: support
dn: cn=Manager,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: organizationalRole
cn: Manager
description: Directory Manager
dn: ou=People,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: organizationalUnit
ou: People
dn: ou=Groups,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Groups
dn: ou=System Users,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: organizationalUnit
ou: System Users
EOF
```
Now let’s use our new directory manager user and run the `[LDIF](https://www.digitalocean.com/community/tutorials/how-to-use-ldif-files-to-make-changes-to-an-openldap-system)` file with `[ldapmodify](http://www.openldap.org/software/man.cgi?query=ldapmodify&sektion=1&apropos=0&manpath=OpenLDAP+2.4-Release)`:
```
ldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/setupDirectoryStructure.ldif
```
### Creating the LDAP Users and Groups
Let's go ahead and create the LDAP users and groups that we are using for this hypothetical scenario.
First, let's create the the `foo` user:
```
tee ~/createFooUser.ldif <<EOF
dn: uid=foo,ou=People,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: foo
uid: foo
uidNumber: 16859
gidNumber: 100
homeDirectory: /home/foo
loginShell: /bin/bash
gecos: foo
userPassword: {crypt}x
shadowLastChange: -1
shadowMax: -1
shadowWarning: 0
EOF
ldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createFooUser.ldif
```
Then let's create a couple users to go into the `dba` group:
```
tee ~/createDbaUsers.ldif <<EOF
dn: uid=gmontee,ou=People,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: gmontee
uid: gmontee
uidNumber: 16860
gidNumber: 100
homeDirectory: /home/gmontee
loginShell: /bin/bash
gecos: gmontee
userPassword: {crypt}x
shadowLastChange: -1
shadowMax: -1
shadowWarning: 0
dn: uid=bstillman,ou=People,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: bstillman
uid: bstillman
uidNumber: 16861
gidNumber: 100
homeDirectory: /home/bstillman
loginShell: /bin/bash
gecos: bstillman
userPassword: {crypt}x
shadowLastChange: -1
shadowMax: -1
shadowWarning: 0
EOF
ldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createDbaUsers.ldif
```
Note that each of these users needs a password, so we can set it for each user with `[ldappasswd](http://www.openldap.org/software/man.cgi?query=ldappasswd&apropos=0&sektion=1&manpath=OpenLDAP+2.4-Release&format=html)`:
```
ldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=foo,ou=People,dc=support,dc=mariadb,dc=com
ldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=gmontee,ou=People,dc=support,dc=mariadb,dc=com
ldappasswd -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -S uid=bstillman,ou=People,dc=support,dc=mariadb,dc=com
```
And then let's create our `dba` group
```
tee ~/createDbaGroup.ldif <<EOF
dn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: posixGroup
gidNumber: 678
EOF
ldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createDbaGroup.ldif
```
And then let's add our two users to it:
```
tee ~/addUsersToDbaGroup.ldif <<EOF
dn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com
changetype: modify
add: memberuid
memberuid: gmontee
dn: cn=dba,ou=Groups,dc=support,dc=mariadb,dc=com
changetype: modify
add: memberuid
memberuid: bstillman
EOF
ldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/addUsersToDbaGroup.ldif
```
We also need to create LDAP users with the same name as the `bar` and `dba` MariaDB users. See [here](../user-and-group-mapping-with-pam/index#pam-user-with-same-name-as-mapped-mariadb-user-must-exist) to read more about why. No one will be logging in as these users, so they do not need passwords. Instead of the `People` `organizationalUnit`, we will create them in the `System Users` `organizationalUnit`.
```
tee ~/createSystemUsers.ldif <<EOF
dn: uid=bar,ou=System Users,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: bar
uid: bar
uidNumber: 16862
gidNumber: 100
homeDirectory: /home/bar
loginShell: /bin/bash
gecos: bar
userPassword: {crypt}x
shadowLastChange: -1
shadowMax: -1
shadowWarning: 0
dn: uid=dba,ou=System Users,dc=support,dc=mariadb,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: dba
uid: dba
uidNumber: 16863
gidNumber: 100
homeDirectory: /home/dba
loginShell: /bin/bash
gecos: dba
userPassword: {crypt}x
shadowLastChange: -1
shadowMax: -1
shadowWarning: 0
EOF
ldapmodify -a -x -D cn=Manager,dc=support,dc=mariadb,dc=com -W -f ~/createSystemUsers.ldif
```
Setting up the MariaDB Server
-----------------------------
At this point, we can move onto setting up the MariaDB Server.
### Installing LDAP and PAM Libraries
First, we need to make sure that the LDAP and PAM libraries are installed.
On RHEL, CentOS, and other similar Linux distributions that use [RPM packages](../rpm/index), we need to install the following packages:
```
sudo yum install openldap-clients nss-pam-ldapd pam pam-devel
```
### Configuring LDAP
Next, let's configure LDAP on the system. We can use `[authconfig](https://linux.die.net/man/8/authconfig)` for this:
```
sudo authconfig --enableldap \
--enableldapauth \
--ldapserver="ldap://172.30.0.238:3306" \
--ldapbasedn="dc=support,dc=mariadb,dc=com" \
--enablemkhomedir \
--update
```
Be sure to replace `-–ldapserver` and `-–ldapbasedn` with values that are relevant for your environment.
### Installing the pam\_user\_map PAM Module
The following steps apply to MariaDB Server in versions 10.2.32.7, 10.3.23., 10.4.13.6, 10.5.2 and earlier. In later releases, the pam\_user\_map PAM module is now included in the base install.
Next, let's [install the pam\_user\_map PAM module](../user-and-group-mapping-with-pam/index#installing-the-pam_user_map-pam-module).
Before the module can be compiled from source, we may need to install some dependencies.
On RHEL, CentOS, and other similar Linux distributions that use [RPM packages](../rpm/index), we need to install `gcc` and `pam-devel`:
```
sudo yum install gcc pam-devel
```
On Debian, Ubuntu, and other similar Linux distributions that use [DEB packages](../installing-mariadb-deb-files/index), we need to install `gcc` and `libpam0g-dev`:
```
sudo apt-get install gcc libpam0g-dev
```
And then we can build and install the library with the following:
```
wget https://raw.githubusercontent.com/MariaDB/server/10.4/plugin/auth_pam/mapper/pam_user_map.c
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
sudo install --mode=0755 pam_user_map.so /lib64/security/
```
### Configuring the pam\_user\_map PAM Module
Next, let's [configure the pam\_user\_map PAM module](../user-and-group-mapping-with-pam/index#configuring-the-pam_user_map-pam-module) based on our hypothetical requirements.
The configuration file for the `pam_user_map` PAM module is `/etc/security/user_map.conf`. Based on our hypothetical requirements, ours would look like:
```
foo: bar
@dba:dba
```
### Installing the PAM Authentication Plugin
Next, let's [install the `pam` authentication plugin](../authentication-plugin-pam/index#installing-the-plugin).
Log into the MariaDB Server and execute the following:
```
INSTALL SONAME 'auth_pam';
```
### Configuring the PAM Service
Next, let's [configure the PAM service](../authentication-plugin-pam/index#configuring-the-pam-service). We will call our service `mariadb`, so our PAM service configuration file will be located at `/etc/pam.d/mariadb` on most systems.
#### Configuring PAM to Allow Only LDAP Authentication
Since we are only doing LDAP authentication with the `[pam\_ldap](https://linux.die.net/man/5/pam_ldap)` PAM module and group mapping with the `pam_user_map` PAM module, our configuration file would look like this:
```
auth required pam_ldap.so
auth required pam_user_map.so
account required pam_ldap.so
```
#### Configuring PAM to Allow LDAP and Local Unix Authentication
If we want to allow authentication from LDAP users **and** from local Unix users through `[pam\_unix](https://linux.die.net/man/8/pam_unix)`, while giving priority to the local users, then we could do this instead:
```
auth [success=1 new_authtok_reqd=1 default=ignore] pam_unix.so audit
auth required pam_ldap.so try_first_pass
auth required pam_user_map.so
account sufficient pam_unix.so audit
account required pam_ldap.so
```
##### Configuring the pam\_unix PAM Module
If you also want to allow authentication from local Unix users, the `pam_unix` PAM module adds [some additional configuration steps](../authentication-plugin-pam/index#configuring-the-pam-service) on a lot of systems. We basically have to give the user that runs `mysqld` access to `/etc/shadow`.
If the `mysql` user is running `mysqld`, then we can do that by executing the following:
```
sudo groupadd shadow
sudo usermod -a -G shadow mysql
sudo chown root:shadow /etc/shadow
sudo chmod g+r /etc/shadow
```
The [server needs to be restarted](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index) for this change to take affect.
Creating MariaDB Users
----------------------
Next, let's [create the MariaDB users](../authentication-plugin-pam/index#creating-users). Remember that our PAM service is called `mariadb`.
First, let's create the MariaDB user for the user mapping: `foo: bar`
That means that we need to create a `bar` user:
```
CREATE USER 'bar'@'%' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON *.* TO 'bar'@'%' ;
```
And then let's create the MariaDB user for the group mapping: `@dba: dba`
That means that we need to create a `dba` user:
```
CREATE USER 'dba'@'%' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON *.* TO 'dba'@'%' ;
```
And then to allow for the user and group mapping, we need to [create an anonymous user that authenticates with the `pam` authentication plugin](../user-and-group-mapping-with-pam/index#creating-users) that is also able to `PROXY` as the `bar` and `dba` users. Before we can create the proxy user, we might need to [clean up some defaults](../create-user/index#fixing-a-legacy-default-anonymous-account):
```
DELETE FROM mysql.db WHERE User='' AND Host='%';
FLUSH PRIVILEGES;
```
And then let's create the anonymous proxy user:
```
CREATE USER ''@'%' IDENTIFIED VIA pam USING 'mariadb';
GRANT PROXY ON 'bar'@'%' TO ''@'%';
GRANT PROXY ON 'dba'@'%' TO ''@'%';
```
Testing our Configuration
-------------------------
Next, let's test out our configuration by [verifying that mapping is occurring](../user-and-group-mapping-with-pam/index#verifying-that-mapping-is-occurring). We can verify this by logging in as each of our users and comparing the return value of `[USER()](../user/index)`, which is the original user name and the return value of `[CURRENT\_USER()](../current_user/index)`, which is the authenticated user name.
### Testing LDAP Authentication
First, let's test out our `foo` user:
```
$ mysql -u foo -h 172.30.0.198
[mariadb] Password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 134
Server version: 10.3.10-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SELECT USER(), CURRENT_USER();
+------------------------------------------------+----------------+
| USER() | CURRENT_USER() |
+------------------------------------------------+----------------+
| [email protected] | bar@% |
+------------------------------------------------+----------------+
1 row in set (0.000 sec)
```
We can verify that our `foo` LDAP user was properly mapped to the `bar` MariaDB user by looking at the return value of `[CURRENT\_USER()](../current_user/index)`.
Then let's test out our `gmontee` user in the `dba` group:
```
$ mysql -u gmontee -h 172.30.0.198
[mariadb] Password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 135
Server version: 10.3.10-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SELECT USER(), CURRENT_USER();
+----------------------------------------------------+----------------+
| USER() | CURRENT_USER() |
+----------------------------------------------------+----------------+
| [email protected] | dba@% |
+----------------------------------------------------+----------------+
1 row in set (0.000 sec)
```
And then let's test out our `bstillman` user in the `dba` group:
```
$ mysql -u bstillman -h 172.30.0.198
[mariadb] Password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 136
Server version: 10.3.10-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SELECT USER(), CURRENT_USER();
+------------------------------------------------------+----------------+
| USER() | CURRENT_USER() |
+------------------------------------------------------+----------------+
| [email protected] | dba@% |
+------------------------------------------------------+----------------+
1 row in set (0.000 sec)
```
We can verify that our `gmontee` and `bstillman` LDAP users in the `dba` LDAP group were properly mapped to the `dba` MariaDB user by looking at the return values of `[CURRENT\_USER()](../current_user/index)`.
### Testing Local Unix Authentication
If you chose the option that also allowed local Unix authentication, then let's test that out. Let's create a Unix user and give the user a password real quick:
```
sudo useradd alice
sudo passwd alice
```
And let's also map this user to `dba`:
```
@dba:dba
foo: bar
alice: dba
```
And we know that the existing anonymous user already has the `PROXY` privilege granted to the `dba` user, so this should just work without any other configuration. Let's test it out:
```
$ mysql -u alice -h 172.30.0.198
[mariadb] Password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 141
Server version: 10.3.10-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SELECT USER(), CURRENT_USER();
+--------------------------------------------------+----------------+
| USER() | CURRENT_USER() |
+--------------------------------------------------+----------------+
| [email protected] | dba@% |
+--------------------------------------------------+----------------+
1 row in set (0.000 sec)
```
We can verify that our `alice` Unix user was properly mapped to the `dba` MariaDB user by looking at the return values of `[CURRENT\_USER()](../current_user/index)`.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb LineFromText LineFromText
============
A synonym for [ST\_LineFromText](../st_linefromtext/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LOAD INDEX LOAD INDEX
==========
Syntax
------
```
LOAD INDEX INTO CACHE
tbl_index_list [, tbl_index_list] ...
tbl_index_list:
tbl_name
[[INDEX|KEY] (index_name[, index_name] ...)]
[IGNORE LEAVES]
```
Description
-----------
The `LOAD INDEX INTO CACHE` statement preloads a table index into the key cache to which it has been assigned by an explicit [`CACHE INDEX`](../cache-index/index) statement, or into the default key cache otherwise. `LOAD INDEX INTO CACHE` is used only for [MyISAM](../myisam/index) or [Aria](../aria/index) tables.
The `IGNORE LEAVES` modifier causes only blocks for the nonleaf nodes of the index to be preloaded.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_OVERLAPS ST\_OVERLAPS
============
Syntax
------
```
ST_OVERLAPS(g1,g2)
```
Description
-----------
Returns `1` or `0` to indicate whether geometry *`g1`* spatially overlaps geometry *`g2`*.
The term spatially overlaps is used if two geometries intersect and their intersection results in a geometry of the same dimension but not equal to either of the given geometries.
ST\_OVERLAPS() uses object shapes, while [OVERLAPS()](../overlaps/index), based on the original MySQL implementation, uses object bounding rectangles.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb RELEASE_LOCK RELEASE\_LOCK
=============
Syntax
------
```
RELEASE_LOCK(str)
```
Description
-----------
Releases the lock named by the string `str` that was obtained with [GET\_LOCK()](../get_lock/index). Returns 1 if the lock was released, 0 if the lock was not established by this thread (in which case the lock is not released), and `NULL` if the named lock did not exist. The lock does not exist if it was never obtained by a call to `GET_LOCK()` or if it has previously been released.
`str` is case insensitive. If `str` is an empty string or `NULL`, `RELEASE_LOCK()` returns `NULL` and does nothing.
Statements using the RELEASE\_LOCK() function are not [safe for replication](../unsafe-statements-for-replication/index).
The [DO statement](../do/index) is convenient to use with `RELEASE_LOCK()`.
Examples
--------
Connection1:
```
SELECT GET_LOCK('lock1',10);
+----------------------+
| GET_LOCK('lock1',10) |
+----------------------+
| 1 |
+----------------------+
```
Connection 2:
```
SELECT GET_LOCK('lock2',10);
+----------------------+
| GET_LOCK('lock2',10) |
+----------------------+
| 1 |
+----------------------+
```
Connection 1:
```
SELECT RELEASE_LOCK('lock1'), RELEASE_LOCK('lock2'), RELEASE_LOCK('lock3');
+-----------------------+-----------------------+-----------------------+
| RELEASE_LOCK('lock1') | RELEASE_LOCK('lock2') | RELEASE_LOCK('lock3') |
+-----------------------+-----------------------+-----------------------+
| 1 | 0 | NULL |
+-----------------------+-----------------------+-----------------------+
```
From [MariaDB 10.0.2](https://mariadb.com/kb/en/mariadb-1002-release-notes/), it is possible to hold the same lock recursively. This example is viewed using the [metadata\_lock\_info](../metadata-lock-info/index) plugin:
```
SELECT GET_LOCK('lock3',10);
+----------------------+
| GET_LOCK('lock3',10) |
+----------------------+
| 1 |
+----------------------+
SELECT GET_LOCK('lock3',10);
+----------------------+
| GET_LOCK('lock3',10) |
+----------------------+
| 1 |
+----------------------+
SELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;
+-----------+---------------------+---------------+-----------+--------------+------------+
| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA | TABLE_NAME |
+-----------+---------------------+---------------+-----------+--------------+------------+
| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |
+-----------+---------------------+---------------+-----------+--------------+------------+
SELECT RELEASE_LOCK('lock3');
+-----------------------+
| RELEASE_LOCK('lock3') |
+-----------------------+
| 1 |
+-----------------------+
SELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;
+-----------+---------------------+---------------+-----------+--------------+------------+
| THREAD_ID | LOCK_MODE | LOCK_DURATION | LOCK_TYPE | TABLE_SCHEMA | TABLE_NAME |
+-----------+---------------------+---------------+-----------+--------------+------------+
| 46 | MDL_SHARED_NO_WRITE | NULL | User lock | lock3 | |
+-----------+---------------------+---------------+-----------+--------------+------------+
SELECT RELEASE_LOCK('lock3');
+-----------------------+
| RELEASE_LOCK('lock3') |
+-----------------------+
| 1 |
+-----------------------+
SELECT * FROM INFORMATION_SCHEMA.METADATA_LOCK_INFO;
Empty set (0.000 sec)
```
See Also
--------
* [GET\_LOCK](../get_lock/index)
* [IS\_FREE\_LOCK](../is_free_lock/index)
* [IS\_USED\_LOCK](../is_used_lock/index)
* [RELEASE\_ALL\_LOCKS](../release_all_locks/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema FILES Table Information Schema FILES Table
==============================
The `FILES` tables is unused in MariaDB. See [MDEV-11426](https://jira.mariadb.org/browse/MDEV-11426).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing VM images for testing .deb upgrade between versions Installing VM images for testing .deb upgrade between versions
==============================================================
This step creates virtual machine images used to do an important additional upgrade test for .debs. Each virtual machine is pre-installed with an older version of MariaDB, and the test tries upgrading this version to the newly build one (to check that dependencies etc. work out correctly).
This step may not be easily possible to replicate exactly for new or updated images. For example, when we add a new platform/distro, we will not have the same old version of MariaDB available for installation on the new planform. Or if needing to re-create an image in the future, the original old .debs used before may no longer be available. However, this is not a big problem, as we can just use whatever version of MariaDB is available. In fact, while we cannot reasonably test every possible upgrade combination between MariaDB versions, it is still useful to test upgrades from different versions on different platforms, to increase coverage a bit.
The bulk of the images were installed with the following two loops, using packages from the OurDelta repository for [MariaDB 5.1.42](https://mariadb.com/kb/en/mariadb-5142-release-notes/), which was the one available from there at the time of installation.
```
for i in "vm-hardy-amd64-install qemu64 hardy" "vm-hardy-i386-install qemu32,-nx hardy" \
"vm-intrepid-amd64-install qemu64 intrepid" "vm-intrepid-i386-install qemu32,-nx intrepid" \
"vm-karmic-amd64-install qemu64 karmic" "vm-karmic-i386-install qemu32,-nx karmic" \
"vm-jaunty-amd64-install qemu64 jaunty" "vm-jaunty-i386-deb-install qemu32,-nx jaunty" \
"vm-debian5-amd64-install qemu64 lenny" "vm-debian5-i386-install qemu32,-nx lenny" ; do \
set $i; \
runvm -b $1.qcow2 -m 512 --smp=1 --port=2200 --user=buildbot --cpu=$2 $(echo $1 | sed -e 's/-install/-upgrade2/').qcow2 \
"wget -O- http://ourdelta.org/deb/ourdelta.gpg | sudo apt-key add -" \
"sudo sh -c \"echo 'deb http://mirror.ourdelta.org/deb $3 mariadb-ourdelta' > /etc/apt/sources.list.d/ourdelta.list\"" \
"sudo apt-get update || true" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server mariadb-test libmariadbclient-dev || true" \
'mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"' \
"sudo rm /etc/apt/sources.list.d/ourdelta.list" \
"sudo apt-get update || true" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y || true" ; \
done
```
```
for i in "vm-debian4-amd64-install qemu64 etch /kvm/debian-40r8-amd64-netinst.iso" "vm-debian4-i386-install qemu32,-nx etch /kvm/debian-40r8-i386-netinst.iso" ; do \
set $i; \
runvm -b $1.qcow2 -m 512 --smp=1 --port=2200 --user=buildbot --cpu=$2 --netdev=e1000 --kvm=-cdrom --kvm=$4 $(echo $1 | sed -e 's/-install/-upgrade2/').qcow2 \
"wget -O- http://ourdelta.org/deb/ourdelta.gpg | sudo apt-key add -" \
"sudo sh -c \"echo 'deb http://mirror.ourdelta.org/deb $3 mariadb-ourdelta' > /etc/apt/sources.list.d/ourdelta.list\"" \
"sudo apt-get update || true" \
"sudo sh -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server mariadb-test libmariadbclient-dev' || true" \
'mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"' \
"sudo rm /etc/apt/sources.list.d/ourdelta.list" \
"sudo apt-get update || true" \
"sudo sh -c 'DEBIAN_FRONTEND=noninteractive apt-get upgrade -y' || true" ; \
done
```
The Ubuntu 10.04 "lucid" images were installed manually (as no packages for lucid were available from OurDelta at the time of installation):
Create and boot 64-bit lucid upgrade image:
```
qemu-img create -b vm-lucid-amd64-install.qcow2 -f qcow2 vm-lucid-amd64-upgrade2.qcow2
kvm -m 512 -hda vm-lucid-amd64-upgrade2.qcow2 -redir 'tcp:2200::22' -boot c -smp 1 -cpu qemu64 -net nic,model=virtio -net user -nographic
```
Create directory inside the image:
```
mkdir buildbot
```
Copy in packages to be installed from outside:
```
scp -P 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r /archive/pack/mariadb-5.1-knielsen/build-277/kvm-deb-lucid-amd64/debs buildbot@localhost:buildbot/
```
Install the MariaDB packages, remove package dir, and upgrade to latest security fixes:
```
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server mariadb-test libmariadbclient-dev
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
rm -Rf buildbot
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
```
Now the same, but for 32-bit lucid:
```
qemu-img create -b vm-lucid-i386-install.qcow2 -f qcow2 vm-lucid-i386-upgrade2.qcow2
kvm -m 512 -hda vm-lucid-i386-upgrade2.qcow2 -redir 'tcp:2200::22' -boot c -smp 1 -cpu qemu32,-nx -net nic,model=virtio -net user -nographic
```
Create directory inside the image:
```
mkdir buildbot
```
Copy in packages to be installed from outside:
```
scp -P 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r /archive/pack/mariadb-5.1-knielsen/build-277/kvm-deb-lucid-x86/debs buildbot@localhost:buildbot/
```
Install the MariaDB packages, remove package dir, and upgrade to latest security fixes:
```
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server mariadb-test libmariadbclient-dev
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
rm -Rf buildbot
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
```
The Ubuntu 10.10 "maverick" images were likewise installed manually:
Create and boot 64-bit maverick upgrade image:
```
qemu-img create -b vm-maverick-amd64-install.qcow2 -f qcow2 vm-maverick-amd64-upgrade2.qcow2
kvm -m 512 -hda vm-maverick-amd64-upgrade2.qcow2 -redir 'tcp:2200::22' -boot c -smp 1 -cpu qemu64 -net nic,model=virtio -net user -nographic
ssh -p 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no buildbot@localhost mkdir buildbot
scp -P 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r /archive/pack/mariadb-5.1-knielsen/build-619/kvm-deb-maverick-amd64/debs buildbot@localhost:buildbot/
ssh -p 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no buildbot@localhost
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server mariadb-test libmariadbclient-dev
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
rm -Rf buildbot
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
```
Same for 32-bit maverick:
```
qemu-img create -b vm-maverick-i386-install.qcow2 -f qcow2 vm-maverick-i386-upgrade2.qcow2
kvm -m 512 -hda vm-maverick-i386-upgrade2.qcow2 -redir 'tcp:2200::22' -boot c -smp 1 -cpu qemu32,-nx -net nic,model=virtio -net user -nographic
ssh -p 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no buildbot@localhost mkdir buildbot
scp -P 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r /archive/pack/mariadb-5.1-knielsen/build-619/kvm-deb-maverick-x86/debs buildbot@localhost:buildbot/
ssh -p 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no buildbot@localhost
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server mariadb-test libmariadbclient-dev
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
rm -Rf buildbot
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
```
For Ubuntu 11.04 "natty", mariadb packages were installed from the repository for the previous version.
64-bit Ubuntu natty:
```
qemu-img create -b vm-natty-amd64-install.qcow2 -f qcow2 vm-natty-amd64-upgrade2.qcow2
kvm -m 512 -hda vm-natty-amd64-upgrade2.qcow2 -redir 'tcp:2200::22' -boot c -smp 1 -cpu qemu64 -net nic,model=virtio -net user -nographic
ssh -p 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no buildbot@localhost
sudo sh -c 'cat > /etc/apt/sources.list.d/tmp.list'
deb http://ftp.osuosl.org/pub/mariadb/repo/5.1/ubuntu maverick main
deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.1/ubuntu maverick main
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server mariadb-test libmariadbclient-dev
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
sudo rm /etc/apt/sources.list.d/tmp.list
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
```
32-bit Ubuntu natty:
```
qemu-img create -b vm-natty-i386-install.qcow2 -f qcow2 vm-natty-i386-upgrade2.qcow2
kvm -m 512 -hda vm-natty-i386-upgrade2.qcow2 -redir 'tcp:2200::22' -boot c -smp 1 -cpu qemu64 -net nic,model=virtio -net user -nographic
ssh -p 2200 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no buildbot@localhost
sudo sh -c 'cat > /etc/apt/sources.list.d/tmp.list'
deb http://ftp.osuosl.org/pub/mariadb/repo/5.1/ubuntu maverick main
deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.1/ubuntu maverick main
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server mariadb-test libmariadbclient-dev
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
sudo rm /etc/apt/sources.list.d/tmp.list
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
```
For Ubuntu 11.10 "oneiric". The steps performed are listed at: [Buildbot Setup for Virtual Machines - Ubuntu 11.10 "oneiric"](../buildbot-setup-for-virtual-machines-ubuntu-1110-oneiric/index) (in the VMs for Upgrade Testing section)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb wsrep_provider_options wsrep\_provider\_options
========================
wsrep\_provider\_options
------------------------
The following options can be set as part of the Galera [wsrep\_provider\_options](../galera-cluster-system-variables/index#wsrep_provider_options) variable. Dynamic options can be changed while the server is running.
Options need to be provided as a semicolon (;) separated list on a single line.
Note that before Galera 3, the `repl` tag was named `replicator`.
#### `base_dir`
* **Description:** Specifies the data directory
---
#### `base_host`
* **Description:** For internal use. Should not be manually set.
* **Default:** `127.0.0.1` (detected network address)
---
#### `base_port`
* **Description:** For internal use. Should not be manually set.
* **Default:** `4567`
---
#### `cert.log_conflicts`
* **Description:** Certification failure log details.
* **Dynamic:** Yes
* **Default:** `no`
---
#### `cert.optimistic_pa`
* **Description:** Controls parallel application of actions on the replica. If set, the full range of parallelization as determined by the certification algorithm is permitted. If not set, the parallel applying window will not exceed that seen on the primary, and applying will start no sooner than after all actions it has seen on the master are committed.
* **Dynamic:** Yes
* **Default:** `yes`
* **Introduced:** [MariaDB 10.3.12](https://mariadb.com/kb/en/mariadb-10312-release-notes/), [MariaDB 10.2.20](https://mariadb.com/kb/en/mariadb-10220-release-notes/), [MariaDB 10.1.38](https://mariadb.com/kb/en/mariadb-10138-release-notes/)
---
#### `debug`
* **Description:** Enable debugging.
* **Dynamic:** Yes
* **Default:** `no`
---
#### `evs.auto_evict`
* **Description:** Number of entries the node permits for a given delayed node before triggering the Auto Eviction protocol. An entry is added to a delayed list for each delayed response from a node. If set to `0`, the default, the Auto Eviction protocol is disabled for this node. See [Auto Eviction](https://galeracluster.com/library/documentation/auto-eviction.html) for more.
* **Dynamic:** No
* **Default:** `0`
---
#### `evs.causal_keepalive_period`
* **Description:** Used by the developers only, and not manually serviceable.
* **Dynamic:** No
* **Default:** The [evs.keepalive\_period](#evskeepalive_period).
---
#### `evs.debug_log_mask`
* **Description:** Controls EVS debug logging. Only effective when [wsrep\_debug](../galera-cluster-system-variables/index#wsrep_debug) is on.
* **Dynamic:** Yes
* **Default:** `0x1`
---
#### `evs.delay_margin`
* **Description:** Time that response times can be delayed before this node adds an entry to the delayed list. See [evs.auto\_evict](#evsauto_evict). Must be set to a higher value than the round-trip delay time between nodes.
* **Dynamic:** No
* **Default:** `PT1S`
---
#### `evs.delayed_keep_period`
* **Description:** Time that this node requires a previously delayed node to remain responsive before being removed from the delayed list. See [evs.auto\_evict](#evsauto_evict).
* **Dynamic:** No
* **Default:** `PT30S`
---
#### `evs.evict`
* **Description:** When set to the gcomm UUID of a node, that node is evicted from the cluster. When set to an empty string, the eviction list is cleared on the node where it is set. See [evs.auto\_evict](#evsauto_evict).
* **Dynamic:** No
* **Default:** Empty string
---
#### `evs.inactive_check_period`
* **Description:** Frequency of checks for peer inactivity (looking for nodes with delayed responses), after which nodes may be added to the delayed list, and later evicted.
* **Dynamic:** No
* **Default:** `PT0.5S`
---
#### `evs.inactive_timeout`
* **Description:** Time limit that a node can be inactive before being pronounced as dead.
* **Dynamic:** No
* **Default:** `PT15S`
---
#### `evs.info_log_mask`
* **Description:** Controls extra EVS info logging. Bits:
+ 0x1 – extra view change information
+ 0x2 – extra state change information
+ 0x4 – statistics
+ 0x8 – profiling (only available in builds with profiling enabled)
* **Dynamic:** No
* **Default:** `0`
---
#### `evs.install_timeout`
* **Description:** Timeout on waits for install message acknowledgments. Replaces evs.consensus\_timeout.
* **Dynamic:** Yes
* **Default:** `PT7.5S`
---
#### `evs.join_retrans_period`
* **Description:** Time period for how often retransmission of EVS join messages when forming cluster membership should occur.
* **Dynamic:** Yes
* **Default:** `PT1S`
---
#### `evs.keepalive_period`
* **Description:** How often keepalive signals should be transmitted when there's no other traffic.
* **Dynamic:** Yes
* **Default:** `PT1S`
---
#### `evs.max_install_timeouts`
* **Description:** Number of membership install rounds to attempt before timing out. The total rounds will be this value plus two.
* **Dynamic:** No
* **Default:** `3`
---
#### `evs.send_window`
* **Description:** Maximum number of packets that can be replicated at a time, Must be more than [evs.user\_send\_window](#evsuser_send_window), which applies to data packets only (double is recommended). In WAN environments can be set much higher than the default, for example `512`.
* **Dynamic:** Yes
* **Default:** `4`
---
#### `evs.stats_report_period`
* **Description:** Reporting period for EVS statistics.
* **Dynamic:** No
* **Default:** `PT1M`
---
#### `evs.suspect_timeout`
* **Description:** A node will be suspected to be dead after this period of inactivity. If all nodes agree, the node is dropped from the cluster before [evs.inactive\_timeout](#evsinactive_timeout) is reached.
* **Dynamic:** No
* **Default:** `PT5S`
---
#### `evs.use_aggregate`
* **Description:** If set to `true` (the default), small packets will be aggregated into one where possible.
* **Dynamic:** No
* **Default:** `true`
---
#### `evs.user_send_window`
* **Description:** Maximum number of data packets that can be replicated at a time. Must be smaller than [evs.send\_window](#evssend_window) (half is recommended). In WAN environments can be set much higher than the default, for example `512`.
* **Dynamic:** Yes
* **Default:** `2`
---
#### `evs.version`
* **Description:** EVS protocol version. Defaults to `0` for backward compatibility. Certain EVS features (e.g. auto eviction) require more recent versions.
* **Dynamic:** No
* **Default:** `0`
---
#### `evs.view_forget_timeout`
* **Description:** Time after which past views will be dropped from the view history.
* **Dynamic:** No
* **Default:** `P1D`
---
#### `gcache.dir`
* **Description:** Directory where GCache files are placed.
* **Dynamic:** No
* **Default:** The working directory
---
#### `gcache.keep_pages_size`
* **Description:** Total size of the page storage pages for caching. One page is always present if only page storage is enabled.
* **Dynamic:** No
* **Default:** `0`
---
#### `gcache.mem_size`
* **Description:** Maximum size of size of the malloc() store for setups that have spare RAM.
* **Dynamic:** No
* **Default:** `0`
---
#### `gcache.name`
* **Description:** Gcache ring buffer storage file name. By default placed in the working directory, changing to another location or partition can reduce disk IO.
* **Dynamic:** No
* **Default:** `./galera.cache` ---
#### `gcache.page_size`
* **Description:** Size of the page storage page files. These are prefixed by `gcache.page`. Can be set to as large as the disk can handle.
* **Dynamic:** No
* **Default:** `128M`
---
#### `gcache.recover`
* **Description:** Whether or not gcache recovery takes place when the node starts up. If it is possible to recover gcache, the node can then provide IST to other joining nodes, which assists when the whole cluster is restarted.
* **Dynamic:** No
* **Default:** `no`
* **Introduced:** [MariaDB 10.1.20](https://mariadb.com/kb/en/mariadb-10120-release-notes/), [MariaDB Galera 10.0.29](https://mariadb.com/kb/en/mariadb-galera-cluster-10029-release-notes/), [MariaDB Galera 5.5.54](https://mariadb.com/kb/en/mariadb-galera-cluster-5554-release-notes/)
---
#### `gcache.size`
* **Description:** Gcache ring buffer storage size (the space the node uses for caching write sets), preallocated on startup.
* **Dynamic:** No
* **Default:** `128M`
---
#### `gcomm.thread_prio`
* **Description:** Gcomm thread policy and priority (in the format `policy:priority`. Priority is an integer, while policy can be one of:
+ `fifo`: First-in, first-out scheduling. Always preempt other, batch or idle threads and can only be preempted by other `fifo` threads of a higher priority or blocked by an I/O request.
+ `rr`: Round-robin scheduling. Always preempt other, batch or idle threads. Runs for a fixed period of time after which the thread is stopped and moved to the end of the list, being replaced by another round-robin thread with the same priority. Otherwise runs until preempted by other `rr` threads of a higher priority or blocked by an I/O request.
+ `other`: Default scheduling on Linux. Threads run until preempted by a thread of a higher priority or a superior scheduling designation, or blocked by an I/O request.
* **Dynamic:** No
* **Default:** Empty string
---
#### `gcs.fc_debug`
* **Description:** If set to a value greater than zero (the default), debug statistics about SST flow control will be posted each time after the specified number of writesets.
* **Dynamic:** No
* **Default:** `0`
---
#### `gcs.fc_factor`
* **Description:**Fraction below [gcs.fc\_limit](#gcsfc_limit) which if the recv queue drops below, replication resumes.
* **Dynamic:** Yes
* **Default:** `1.0`
---
#### `gcs.fc_limit`
* **Description:** If the recv queue exceeds this many writesets, replication is paused. Can increase greatly in master-slave setups. Replication will resume again according to the [gcs.fc\_factor](#gcsfc_factor) setting.
* **Dynamic:** Yes
* **Default:** `16`
---
#### `gcs.fc_master_slave`
* **Description:** Whether to assume that the cluster only contains one master. Deprecated since Galera 4.10 ([MariaDB 10.8.1](https://mariadb.com/kb/en/mariadb-1081-release-notes/), [MariaDB 10.7.2](https://mariadb.com/kb/en/mariadb-1072-release-notes/), [MariaDB 10.6.6](https://mariadb.com/kb/en/mariadb-1066-release-notes/), [MariaDB 10.5.14](https://mariadb.com/kb/en/mariadb-10514-release-notes/), [MariaDB 10.4.22](https://mariadb.com/kb/en/mariadb-10422-release-notes/))
* **Dynamic:** No
* **Default:** `no`
#### `gcs.fc_single_primary`
* **Description:** Defines whether there is more than one source of replication. As the number of nodes in the cluster grows, the larger the calculated gcs.fc\_limit gets. At the same time, the number of writes from the nodes increases. When this parameter value is set to NO (multi-primary), the gcs.fc\_limit parameter is dynamically modified to give more margin for each node to be a bit further behind applying writes. The gcs.fc\_limit parameter is modified by the square root of the cluster size, that is, in a four-node cluster it is two times higher than the base value. This is done to compensate for the increasing replication rate noise.
* **Dynamic:** No
* **Default:** `no`
---
#### `gcs.max_packet_size`
* **Description:** Maximum packet size, after which writesets become fragmented.
* **Dynamic:** No
* **Default:** `64500`
---
#### `gcs.max_throttle`
* **Description:** How much we can throttle replication rate during state transfer (to avoid running out of memory). Set it to 0.0 if stopping replication is acceptable for the sake of completing state transfer.
* **Dynamic:** No
* **Default:** `0.25`
---
#### `gcs.recv_q_hard_limit`
* **Description:** Maximum size of the recv queue. If exceeded, the server aborts. Half of available RAM plus swap is a recommended size.
* **Dynamic:** No
* **Default:** LLONG\_MAX
---
#### `gcs.recv_q_soft_limit`
* **Description:** Fraction of [gcs.recv\_q\_hard\_limit](#gcsrecv_q_hard_limit) after which replication rate is throttled. The rate of throttling increases linearly from zero (the regular, varying rate of replication) at and below `csrecv_q_soft_limit` to one (full throttling) at [gcs.recv\_q\_hard\_limit](#gcsrecv_q_hard_limit)
* **Dynamic:** No
* **Default:** `0.25`
---
#### `gcs.sync_donor`
* **Description:** Whether or not the rest of the cluster should stay in sync with the donor. If set to `YES` (`NO` is default), if the donor is blocked by state transfer, the whole cluster is also blocked.
* **Dynamic:** No
* **Default:** `no`
---
#### `gmcast.listen_addr`
* **Description:** Address Galera listens for connections from other nodes. Can be used to override the default port to listen, which is obtained from the connection address.
* **Dynamic:** No
* **Default:** `tcp://0.0.0.0:4567`
---
#### `gmcast.mcast_addr`
* **Description:** Not set by default, but if set, UDP multicast will be used for replication. Must be identical on all nodes.For example, `gmcast.mcast_addr=239.192.0.11`
* **Dynamic:** No
* **Default:** None
---
#### `gmcast.mcast_ttl`
* **Description:** Multicast packet TTL (time to live) value.
* **Dynamic:** No
* **Default:** `1`
---
#### `gmcast.peer_timeout`
* **Description:** Connection timeout for initiating message relaying.
* **Dynamic:** No
* **Default:** `PT3S`
---
#### `gmcast.segment`
* **Description:** Defines the segment to which the node belongs. By default, all nodes are placed in the same segment (`0`). Usually, you would place all nodes in the same datacenter in the same segment. Galera protocol traffic is only redirected to one node in each segment, and then relayed to other nodes in that same segment, which saves cross-datacenter network traffic at the expense of some extra latency. State transfers are also, preferably but not exclusively, taken from the same segment. If there are no nodes available in the same segment, state transfer will be taken from a node in another segment.
* **Dynamic:** No
* **Default:** `0`
* **Range:** `0` to `255`
---
#### `gmcast.time_wait`
* **Description:** Waiting time before allowing a peer that was declared outside of the stable view to reconnect.
* **Dynamic:** No
* **Default:** `PT5S`
---
#### `gmcast.version`
* **Description:** Deprecated option. Gmcast version.
* **Dynamic:** No
* **Default:** `0`
---
#### `ist.recv_addr`
* **Description:** Address for listening for Incremental State Transfer.
* **Dynamic:** No
* **Default:** <address>:<port+1> from [wsrep\_node\_address](../galera-cluster-system-variables/index#wsrep_node_address)
---
#### `ist.recv_bind`
* **Description:**
* **Dynamic:** No
* **Default:** Empty string
* **Introduced:** [MariaDB 10.1.17](https://mariadb.com/kb/en/mariadb-10117-release-notes/), [MariaDB Galera 10.0.27](https://mariadb.com/kb/en/mariadb-galera-cluster-10027-release-notes/), [MariaDB Galera 5.5.51](https://mariadb.com/kb/en/mariadb-galera-cluster-5551-release-notes/)
---
#### `pc.announce_timeout`
* **Description:** Period of time for which cluster joining announcements are sent every 1/2 second.
* **Dynamic:** No
* **Default:** `PT3S`
---
#### `pc.checksum`
* **Description:** For debug purposes, by default `false` (`true` in earlier releases), indicates whether to checksum replicated messages on PC level. Safe to turn off.
* **Dynamic:** No
* **Default:** `false`
---
#### `pc.ignore_quorum`
* **Description:** Whether to ignore quorum calculations, for example when a master splits from several slaves, it will remain in operation if set to `true` (`false is default`). Use with care however, as in master-slave setups, slaves will not automatically reconnect to the master if set.
* **Dynamic:** Yes
* **Default:** `false`
---
#### `pc.ignore_sb`
* **Description:** Whether to permit updates to be processed even in the case of split brain (when a node is disconnected from its remaining peers). Safe in master-slave setups, but could lead to data inconsistency in a multi-master setup.
* **Dynamic:** Yes
* **Default:** `false`
---
#### `pc.linger`
* **Description:** Time that the PC protocol waits for EVS termination.
* **Dynamic:** No
* **Default:** `PT20S`
---
#### `pc.npvo`
* **Description:** If set to `true` (`false` is default), when there are primary component conficts, the most recent component will override the older.
* **Dynamic:** No
* **Default:** `false`
---
#### `pc.recovery`
* **Description:** If set to `true` (the default), the Primary Component state is stored on disk and in the case of a full cluster crash (e.g power outages), automatic recovery is then possible. Subsequent graceful full cluster restarts will require explicit bootstrapping for a new Primary Component.
* **Dynamic:** No
* **Default:** `true`
---
#### `pc.version`
* **Description:** Deprecated option. PC protocol version.
* **Dynamic:** No
* **Default:** `0`
---
#### `pc.wait_prim`
* **Description:** When set to `true`, the default, the node will wait for a primary component for the period of time specified by [pc.wait\_prim\_timeout](#pc.wait_prim_timeout). Used to bring up non-primary components and make them primary using [pc.bootstrap](#pcbootstrap.).
* **Dynamic:** No
* **Default:** `true`
---
#### `pc.wait_prim_timeout`
* **Description:** Ttime to wait for a primary component. See [pc.wait\_prim](#pcwait_prim).
* **Dynamic:** No
* **Default:** `PT30S`
---
#### `pc.weight`
* **Description:** Node weight, used for quorum calculation. See the Codership article [Weighted Quorum](https://galeracluster.com/library/documentation/weighted-quorum.html#weighted-quorum).
* **Dynamic:** Yes
* **Default:** `1`
---
#### `protonet.backend`
* **Description:** Transport backend to use. Only ASIO is supported currently.
* **Dynamic:** No
* **Default:** `asio`
---
#### `protonet.version`
* **Description:** Deprecated option. Protonet version.
* **Dynamic:** No
* **Default:** `0`
---
#### `repl.causal_read_timeout`
* **Description:** Timeout period for causal reads.
* **Dynamic:** Yes
* **Default:** `PT30S`
---
#### `repl.commit_order`
* **Description:** Whether or not out-of-order committing is permitted, and under what conditions. By default it is not permitted, but setting this can improve parallel performance.
+ `0` BYPASS: No commit order monitoring is done (useful for measuring the performance penalty).
+ `1` OOOC: Out-of-order committing is permitted for all transactions.
+ `2` LOCAL\_OOOC: Out-of-order committing is permitted for local transactions only.
+ `3` NO\_OOOC: Out-of-order committing is not permitted at all.
* **Dynamic:** No
* **Default:** `3`
---
#### `repl.key_format`
* **Description:** Format for key replication. Can be one of:
+ `FLAT8` - shorter key with a higher probability of false positives when matching
+ `FLAT16` - longer key with a lower probability of false positives when matching
+ `FLAT8A` - shorter key with a higher probability of false positives when matching, includes annotations for debug purposes
+ `FLAT16A` - longer key with a lower probability of false positives when matching, includes annotations for debug purposes
* **Dynamic:** Yes
* **Default:** `FLAT8`
---
#### `repl.max_ws_size`
* **Description:**
* **Dynamic:**
* **Default:** `2147483647`
---
#### `repl.proto_max`
* **Description:**
* **Dynamic:**
* **Default:** `9`
---
#### `socket.checksum`
* **Description:** Method used for generating checksum. Note: If Galera 25.2.x and 25.3.x are both being used in the cluster, MariaDB with Galera 25.3.x must be started with `wsrep_provider_options='socket.checksum=1'` in order to make it backward compatible with Galera v2. Galera wsrep providers other than 25.3.x or 25.2.x are not supported.
* **Dynamic:** No
* **Default:** `2`
---
#### `socket.recv_buf_size`
* **Description:** Size in bytes of the receive buffer used on the network sockets between nodes, passed on to the kernel via the SO\_RCVBUF socket option.
* **Dynamic:** No
* **Default:**
+ >= [MariaDB 10.3.23](https://mariadb.com/kb/en/mariadb-10323-release-notes/), [MariaDB 10.2.32](https://mariadb.com/kb/en/mariadb-10232-release-notes/), [MariaDB 10.1.45](https://mariadb.com/kb/en/mariadb-10145-release-notes/): Auto
+ < [MariaDB 10.3.22](https://mariadb.com/kb/en/mariadb-10322-release-notes/): [MariaDB 10.2.31](https://mariadb.com/kb/en/mariadb-10231-release-notes/), [MariaDB 10.1.44](https://mariadb.com/kb/en/mariadb-10144-release-notes/): `212992`
---
#### `socket.send_buf_size`
* **Description:** Size in bytes of the send buffer used on the network sockets between nodes, passed on to the kernel via the SO\_SNDBUF socket option.
* **Dynamic:** No
* **Default:**: Auto
* **Introduced:** [MariaDB 10.3.23](https://mariadb.com/kb/en/mariadb-10323-release-notes/), [MariaDB 10.2.32](https://mariadb.com/kb/en/mariadb-10232-release-notes/), [MariaDB 10.1.45](https://mariadb.com/kb/en/mariadb-10145-release-notes/)
---
#### `socket.ssl`
* **Description:** Explicitly enables TLS usage by the wsrep Provider.
* **Dynamic:** No
* **Default:** `NO`
---
#### `socket.ssl_ca`
* **Description:** Path to Certificate Authority (CA) file. Implicitly enables the `[socket.ssl](#socket.ssl)` option.
* **Dynamic:** No
---
#### `socket.ssl_cert`
* **Description:** Path to TLS certificate. Implicitly enables the `[socket.ssl](#socket.ssl)` option.
* **Dynamic:** No
---
#### `socket.ssl_cipher`
* **Description:** TLS cipher to use. Implicitly enables the `[socket.ssl](#socket.ssl)` option. Since [MariaDB 10.2.18](https://mariadb.com/kb/en/mariadb-10218-release-notes/) defaults to the value of the `[ssl\_cipher](../ssltls-system-variables/index#ssl_cipher)` system variable.
* **Dynamic:** No
* **Default:** system default, before [MariaDB 10.2.18](https://mariadb.com/kb/en/mariadb-10218-release-notes/) defaults to `AES128-SHA`.
---
#### `socket.ssl_compression`
* **Description:** Compression to use on TLS connections. Implicitly enables the `[socket.ssl](#socket.ssl)` option.
* **Dynamic:** No
---
#### `socket.ssl_key`
* **Description:** Path to TLS key file. Implicitly enables the `[socket.ssl](#socket.ssl)` option.
* **Dynamic:** No
---
#### `socket.ssl_password_file`
* **Description:** Path to password file to use in TLS connections. Implicitly enables the `[socket.ssl](#socket.ssl)` option.
* **Dynamic:** No
---
See Also
--------
* [Galera parameters documentation from Codership](https://galeracluster.com/library/documentation/galera-parameters.html)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb CHR CHR
===
**MariaDB starting with [10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/)**The `CHR()` function was introduced in [MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/) to provide Oracle compatibility
Syntax
------
```
CHR(N)
```
Description
-----------
`CHR()` interprets each argument N as an integer and returns a `[VARCHAR(1)](../varchar/index)` string consisting of the character given by the code values of the integer. The character set and collation of the string are set according to the values of the `[character\_set\_database](../server-system-variables/index#character_set_database)` and `[collation\_database](../server-system-variables/index#collation_database)` system variables.
`CHR()` is similar to the `[CHAR()](../char-function/index)` function, but only accepts a single argument.
`CHR()` is available in all [sql\_modes](../sql-mode/index).
Examples
--------
```
SELECT CHR(67);
+---------+
| CHR(67) |
+---------+
| C |
+---------+
SELECT CHR('67');
+-----------+
| CHR('67') |
+-----------+
| C |
+-----------+
SELECT CHR('C');
+----------+
| CHR('C') |
+----------+
| |
+----------+
1 row in set, 1 warning (0.000 sec)
SHOW WARNINGS;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'C' |
+---------+------+----------------------------------------+
```
See Also
--------
* [Character Sets and Collations](../data-types-character-sets-and-collations/index)
* [ASCII()](../ascii/index) - Return ASCII value of first character
* [ORD()](../ord/index) - Return value for character in single or multi-byte character sets
* [CHAR()](../char-function/index) - Similar function which accepts multiple integers
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LOAD_FILE LOAD\_FILE
==========
Syntax
------
```
LOAD_FILE(file_name)
```
Description
-----------
Reads the file and returns the file contents as a string. To use this function, the file must be located on the server host, you must specify the full path name to the file, and you must have the FILE privilege. The file must be readable by all and it must be less than the size, in bytes, of the [max\_allowed\_packet](../server-system-variables/index#max_allowed_packet) system variable. If the [secure\_file\_priv](../server-system-variables/index#secure_file_priv) system variable is set to a non-empty directory name, the file to be loaded must be located in that directory.
If the file does not exist or cannot be read because one of the preceding conditions is not satisfied, the function returns NULL.
Since [MariaDB 5.1](../what-is-mariadb-51/index), the [character\_set\_filesystem](../server-system-variables/index#character_set_filesystem) system variable has controlled interpretation of file names that are given as literal strings.
Statements using the LOAD\_FILE() function are not [safe for statement based replication](../unsafe-statements-for-replication/index). This is because the slave will execute the LOAD\_FILE() command itself. If the file doesn't exist on the slave, the function will return NULL.
Examples
--------
```
UPDATE t SET blob_col=LOAD_FILE('/tmp/picture') WHERE id=1;
```
See Also
--------
* [SELECT INTO DUMPFILE](../select-into-dumpfile/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb DECIMAL DECIMAL
=======
Syntax
------
```
DECIMAL[(M[,D])] [SIGNED | UNSIGNED | ZEROFILL]
```
Description
-----------
A packed "exact" fixed-point number. `M` is the total number of digits (the precision) and `D` is the number of digits after the decimal point (the scale).
* The decimal point and (for negative numbers) the "-" sign are not counted in `M`.
* If `D` is `0`, values have no decimal point or fractional part and on [INSERT](../insert/index) the value will be rounded to the nearest `DECIMAL`.
* The maximum number of digits (`M`) for `DECIMAL` is 65.
* The maximum number of supported decimals (`D`) is `30` before [MariadB 10.2.1](https://mariadb.com/kb/en/mariadb-1021-release-notes/) and `38` afterwards.
* If `D` is omitted, the default is `0`. If `M` is omitted, the default is `10`.
`UNSIGNED`, if specified, disallows negative values.
`ZEROFILL`, if specified, pads the number with zeros, up to the total number of digits specified by `M`.
All basic calculations (+, -, \*, /) with `DECIMAL` columns are done with a precision of 65 digits.
For more details on the attributes, see [Numeric Data Type Overview](../numeric-data-type-overview/index).
`DEC`, `NUMERIC` and `FIXED` are synonyms, as well as `NUMBER` in [Oracle mode from MariaDB 10.3](../sql_modeoracle-from-mariadb-103/index#synonyms-for-basic-sql-types).
Examples
--------
```
CREATE TABLE t1 (d DECIMAL UNSIGNED ZEROFILL);
INSERT INTO t1 VALUES (1),(2),(3),(4.0),(5.2),(5.7);
Query OK, 6 rows affected, 2 warnings (0.16 sec)
Records: 6 Duplicates: 0 Warnings: 2
Note (Code 1265): Data truncated for column 'd' at row 5
Note (Code 1265): Data truncated for column 'd' at row 6
SELECT * FROM t1;
+------------+
| d |
+------------+
| 0000000001 |
| 0000000002 |
| 0000000003 |
| 0000000004 |
| 0000000005 |
| 0000000006 |
+------------+
```
With [strict\_mode](../sql-mode/index#strict-mode) set, the default from [MariaDB 10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/):
```
INSERT INTO t1 VALUES (-7);
ERROR 1264 (22003): Out of range value for column 'd' at row 1
```
With [strict\_mode](../sql-mode/index#strict-mode) unset, the default until [MariaDB 10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/):
```
INSERT INTO t1 VALUES (-7);
Query OK, 1 row affected, 1 warning (0.02 sec)
Warning (Code 1264): Out of range value for column 'd' at row 1
SELECT * FROM t1;
+------------+
| d |
+------------+
| 0000000001 |
| 0000000002 |
| 0000000003 |
| 0000000004 |
| 0000000005 |
| 0000000006 |
| 0000000000 |
+------------+
```
See Also
--------
* [Numeric Data Type Overview](../numeric-data-type-overview/index)
* [Oracle mode from MariaDB 10.3](../sql_modeoracle-from-mariadb-103/index#synonyms-for-basic-sql-types)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MONTH MONTH
=====
Syntax
------
```
MONTH(date)
```
Description
-----------
Returns the month for `date` in the range 1 to 12 for January to December, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero month part.
Examples
--------
```
SELECT MONTH('2019-01-03');
+---------------------+
| MONTH('2019-01-03') |
+---------------------+
| 1 |
+---------------------+
SELECT MONTH('2019-00-03');
+---------------------+
| MONTH('2019-00-03') |
+---------------------+
| 0 |
+---------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Optimizer Trace Overview Optimizer Trace Overview
========================
**MariaDB starting with [10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/)**Optimizer Trace was introduced in [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/).
Usage
-----
This feature produces a trace as a JSON document for any [SELECT](../select/index)/[UPDATE](../update/index)/[DELETE](../delete/index) containing information about decisions taken by the optimizer during the optimization phase (choice of table access method, various costs, transformations, etc). This feature helps to explain why some decisions were taken by the optimizer and why some were rejected.
Associated System Variables
---------------------------
* [optimizer\_trace=’enabled=on/off’](../server-system-variables/index#optimizer_trace)
+ Default value is off
* [optimizer\_trace\_max\_mem\_size](../server-system-variables/index#optimizer_trace_max_mem_size)= value
+ Default value: 1048576
INFORMATION\_SCHEMA.OPTIMIZER\_TRACE
------------------------------------
Each connection stores a trace from the last executed statement. One can view the trace by reading the [Information Schema OPTIMIZER\_TRACE table](../information-schema-optimizer_trace-table/index).
Structure of the optimizer trace table:
```
SHOW CREATE TABLE INFORMATION_SCHEMA.OPTIMIZER_TRACE \G
*************************** 1. row ***************************
Table: OPTIMIZER_TRACE
Create Table: CREATE TEMPORARY TABLE `OPTIMIZER_TRACE` (
`QUERY` longtext NOT NULL DEFAULT '',
`TRACE` longtext NOT NULL DEFAULT '',
`MISSING_BYTES_BEYOND_MAX_MEM_SIZE` int(20) NOT NULL DEFAULT 0,
`INSUFFICIENT_PRIVILEGES` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=Aria DEFAULT CHARSET=utf8 PAGE_CHECKSUM=0
```
Optimizer Trace Contents
------------------------
See [Optimizer Trace Guide](../optimizer-trace-guide/index) for an overview of what one can find in the trace.
Traceable Queries
-----------------
These include [SELECT](../select/index), [UPDATE](../update/index), [DELETE](../delete/index) as well as their multi-table variants and all of the preceding prefixed by [EXPLAIN](../explain/index) and [ANALYZE](../analyze-statement/index).
Enabling Optimizer Trace
------------------------
To enable optimizer trace run:
```
SET optimizer_trace='enabled=on';
```
Memory Usage
------------
Each trace is stored as a string. It is extended (with realloc()) as the optimization progresses and appends data to it. The [optimizer\_trace\_max\_mem\_size](../server-system-variables/index#optimizer_trace_max_mem_size) variable sets a limit on the total amount of memory used by the current trace. If this limit is reached, the current trace isn't extended (so it will be incomplete), and the MISSING\_BYTES\_BEYOND\_MAX\_MEM\_SIZE column will show the number of bytes missing from this trace.
Privilege Checking
------------------
In complex scenarios where the query uses SQL SECURITY DEFINER views or stored routines, it may be that a user is denied from seeing the trace of its query because it lacks some extra privileges on those objects. In that case, the trace will be shown as empty and the INSUFFICIENT\_PRIVILEGES column will show "1".
Limitations
-----------
Currently, only one trace is stored. It is not possible to trace the sub-statements of a stored routine; only the statement at the top level is traced.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema CHANGED_PAGE_BITMAPS Table Information Schema CHANGED\_PAGE\_BITMAPS Table
===============================================
**MariaDB starting with [10.1.6](https://mariadb.com/kb/en/mariadb-1016-release-notes/)**The`CHANGED_PAGE_BITMAPS` table was added in [MariaDB 10.1.6](https://mariadb.com/kb/en/mariadb-1016-release-notes/).
The [Information Schema](../information_schema/index) `CHANGED_PAGE_BITMAPS` table is a dummy table added to [XtraDB](../xtradb/index) with reset\_table callback to allow `FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS` to be called from `innobackupex`. It contains only one column, *dummy*.
For more information, see [MDEV-7472](https://jira.mariadb.org/browse/MDEV-7472).
The `PROCESS` [privilege](../grant/index) is required to view the table.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb GeoJSON GeoJSON
========
GeoJSON is a format for encoding various geographic data structures.
| Title | Description |
| --- | --- |
| [ST\_AsGeoJSON](../geojson-st_asgeojson/index) | Returns the given geometry as a GeoJSON element. |
| [ST\_GeomFromGeoJSON](../st_geomfromgeojson/index) | Given a GeoJSON input, returns a geometry object |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Coordinated Universal Time Coordinated Universal Time
==========================
UTC stands for Coordinated Universal Time, and is the world standard for regulating time.
MariaDB stores values internally in UTC, converting them to the required time zone as required.
In general terms it is equivalent to Greenwich Mean Time (GMT), but UTC is used in technical contexts as it is precisely defined at the subsecond level.
[Time zones](../time-zones/index) are offset relative to UTC. For example, time in Tonga is UTC + 13, so 03h00 UTC will be 16h00 in Tonga.
See Also
--------
* [UTC\_DATE](../utc_date/index)
* [UTC\_TIME](../utc_time/index)
* [UTC\_TIMESTAMP](../utc_timestamp/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InnoDB File Format InnoDB File Format
==================
Prior to [MariaDB 10.3](../what-is-mariadb-103/index), the [InnoDB](../innodb/index) storage engine supports two different file formats.
Setting a Table's File Format
-----------------------------
In [MariaDB 10.2](../what-is-mariadb-102/index) and before, the default file format for InnoDB tables can be chosen by setting the [innodb\_file\_format](../innodb-system-variables/index#innodb_file_format).
In [MariaDB 10.2.1](https://mariadb.com/kb/en/mariadb-1021-release-notes/) and before, the default file format is`Antelope`. In [MariaDB 10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/) and later, the default file format is `Barracuda` and `Antelope` is deprecated.
A table's tablespace is tagged with the lowest InnoDB file format that supports the table's [row format](../innodb-storage-formats/index). So, even if the `Barracuda` file format is enabled, tables that use the `COMPACT` or `REDUNDANT` row formats will be tagged with the `Antelope` file format in the [information\_schema.INNODB\_SYS\_TABLES](../information-schema-innodb_sys_tables-table/index) table.
Supported File Formats
----------------------
The [InnoDB](../innodb/index) storage engine supports two different file formats:
* `Antelope`
* `Barracuda`
### Antelope
In [MariaDB 10.2.1](https://mariadb.com/kb/en/mariadb-1021-release-notes/) and before, the default file format is `Antelope`. In [MariaDB 10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/) and later, the `Antelope` file format is deprecated.
`Antelope` is the original InnoDB file format. It supports the `COMPACT` and `REDUNDANT` row formats, but not the `DYNAMIC` or `COMPRESSED` row formats.
### Barracuda
In [MariaDB 10.1](../what-is-mariadb-101/index) and before, the `Barracuda` file format is only supported if the [innodb\_file\_per\_table](../innodb-system-variables/index#innodb_file_per_table) system variable is set to `ON`. In [MariaDB 10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/) and later, the default file format is `Barracuda` and `Antelope` is deprecated.
`Barracuda` is a newer InnoDB file format. It supports the `COMPACT`, `REDUNDANT`, `DYNAMIC` and `COMPRESSED` row formats. Tables with large BLOB or TEXT columns in particular could benefit from the dynamic row format.
### Future Formats
InnoDB might use new file formats in the future. Each format will have an identifier from 0 to 25, and a name. The names have already been decided, and are animal names listed in an alphabetical order: Antelope, Barracuda, Cheetah, Dragon, Elk, Fox, Gazelle, Hornet, Impala, Jaguar, Kangaroo, Leopard, Moose, Nautilus, Ocelot, Porpoise, Quail, Rabbit, Shark, Tiger, Urchin, Viper, Whale, Xenops, Yak and Zebra.
Checking a Table's File Format.
-------------------------------
The [information\_schema.INNODB\_SYS\_TABLES](../information-schema-innodb_sys_tables-table/index) table can be queried to see the file format used by a table.
A table's tablespace is tagged with the lowest InnoDB file format that supports the table's [row format](../innodb-storage-formats/index). So, even if the `Barracuda` file format is enabled, tables that use the `COMPACT` or `REDUNDANT` row formats will be tagged with the `Antelope` file format in the [information\_schema.INNODB\_SYS\_TABLES](../information-schema-innodb_sys_tables-table/index) table.
Compatibility
-------------
Each tablespace is tagged with the id of the most recent file format used by one of its tables. All versions of InnoDB can read tables that use an older file format. However, it can not read from more recent formats. For this reason, each time InnoDB opens a table it checks the tablespace's format, and returns an error if a newer format is used.
This check can be skipped via the [innodb\_file\_format\_check](../innodb-system-variables/index#innodb_file_format_check) variable. Beware that, is InnoDB tries to repair a table in an unknown format, the table will be corrupted! This happens on restart if innodb\_file\_format\_check is disabled and the server crashed, or it was closed with fast shutdown.
To downgrade a table from the Barracuda format to Antelope, the table's `ROW_FORMAT` can be set to a value supported by Antelope, via an [ALTER TABLE](../alter-table/index) statement. This recreates the indexes.
The Antelope format can be used to make sure that tables work on MariaDB and MySQL servers which are older than 5.5.
See Also
--------
* [InnoDB Storage Formats](../innodb-storage-formats/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB 5.3 TODO MariaDB 5.3 TODO
================
Older version of this page can be found at [mariadb-53-todo-not](../mariadb-53-todo-not/index).
*Shortly before a 5.3 release, this page lists the remaining TODO items before the release. Currently, it is empty.*
See Also:
---------
* [What is MariaDB 5.3](../what-is-mariadb-53/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema hosts Table Performance Schema hosts Table
==============================
Description
-----------
The `hosts` table contains a row for each host used by clients to connect to the server, containing current and total connections.
The size is determined by the [performance\_schema\_hosts\_size](../performance-schema-system-variables/index#performance_schema_hosts_size) system variable, which, if set to zero, will disable connection statistics in the hosts table.
It contains the following columns:
| Column | Description |
| --- | --- |
| `HOST` | Host name used by the client to connect, `NULL` for internal threads or user sessions that failed to authenticate. |
| `CURRENT_CONNECTIONS` | Current number of the host's connections. |
| `TOTAL_CONNECTIONS` | Total number of the host's connections |
Example
-------
```
SELECT * FROM hosts;
+-----------+---------------------+-------------------+
| HOST | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS |
+-----------+---------------------+-------------------+
| localhost | 1 | 45 |
| NULL | 20 | 23 |
+-----------+---------------------+-------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Information Schema TABLESPACES Table Information Schema TABLESPACES Table
====================================
The [Information Schema](../information_schema/index) `TABLESPACES` table contains information about active tablespaces..
The table is a MariaDB and MySQL extension, and does not include information about InnoDB tablespaces.
| Column | Description |
| --- | --- |
| `TABLESPACE_NAME` | |
| `ENGINE` | |
| `TABLESPACE_TYPE` | |
| `LOGFILE_GROUP_NAME` | |
| `EXTENT_SIZE` | |
| `AUTOEXTEND_SIZE` | |
| `MAXIMUM_SIZE` | |
| `NODEGROUP_ID` | |
| `TABLESPACE_COMMENT` | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Migrating to MariaDB from MySQL Migrating to MariaDB from MySQL
================================
.
| Title | Description |
| --- | --- |
| [MariaDB versus MySQL - Features](../mariadb-vs-mysql-features/index) | MariaDB advantage in delivering enterprise-level high availability, scalability and security. |
| [MariaDB versus MySQL - Compatibility](../mariadb-vs-mysql-compatibility/index) | Compatibility and differences with MariaDB related to high availability, security and scalability. |
| [Upgrading from MySQL to MariaDB](../upgrading-from-mysql-to-mariadb/index) | Upgrading from MySQL to MariaDB. |
| [Incompatibilities and Feature Differences Between MariaDB 10.7 and MySQL 8.0](../incompatibilities-and-feature-differences-between-mariadb-107-and-mysql-80/index) | List of incompatibilities and feature differences between MariaDB 10.7 and MySQL 8.0. |
| [Incompatibilities and Feature Differences Between MariaDB 10.6 and MySQL 8.0](../incompatibilities-and-feature-differences-between-mariadb-106-and-mysql-80/index) | List of incompatibilities and feature differences between MariaDB 10.6 and MySQL 8.0. |
| [Incompatibilities and Feature Differences Between MariaDB 10.5 and MySQL 8.0](../incompatibilities-and-feature-differences-between-mariadb-105-and-mysql-80/index) | List of incompatibilities and feature differences between MariaDB 10.5 and MySQL 8.0. |
| [Incompatibilities and Feature Differences Between MariaDB 10.4 and MySQL 8.0](../incompatibilities-and-feature-differences-between-mariadb-104-and-mysql-80/index) | List of incompatibilities and feature differences between MariaDB 10.4 and MySQL 8.0. |
| [Incompatibilities and Feature Differences Between MariaDB 10.3 and MySQL 5.7](../incompatibilities-and-feature-differences-between-mariadb-103-and-mysql-57/index) | List of incompatibilities and feature differences between MariaDB 10.3 and MySQL 5.7. |
| [Incompatibilities and Feature Differences Between MariaDB 10.2 and MySQL 5.7](../incompatibilities-and-feature-differences-between-mariadb-102-and-mysql-57/index) | List of incompatibilities and feature differences between MariaDB 10.2 and MySQL 5.7. |
| [Function Differences Between MariaDB and MySQL](../function-differences-between-mariadb-and-mysql/index) | Functions available only in MariaDB. |
| [System Variable Differences between MariaDB and MySQL](../system-variable-differences-between-mariadb-and-mysql/index) | Comparison of variable differences between major versions of MariaDB and MySQL. |
| [Upgrading from MySQL 5.7 to MariaDB 10.2](../upgrading-from-mysql-57-to-mariadb-102/index) | Following compatibility report was done on 10.2.4 and may get some fixing i... |
| [Installing MariaDB Alongside MySQL](../installing-mariadb-alongside-mysql/index) | MariaDB was designed as a drop in place replacement for MySQL, but you can ... |
| [Moving from MySQL to MariaDB in Debian 9](../moving-from-mysql-to-mariadb-in-debian-9/index) | MariaDB 10.1 is the default mysql server in Debian 9 "Stretch" |
| [Screencast for Upgrading MySQL to MariaDB](../screencast-for-upgrading-mysql-to-mariadb/index) | Screencast for upgrading MySQL 5.1.55 to MariaDB |
| [Upgrading to MariaDB From MySQL 5.0 or Older](../upgrading-to-mariadb-from-mysql-50-or-older/index) | Upgrading to MariaDB from MySQL 5.0 (or older version) |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema setup_consumers Table Performance Schema setup\_consumers Table
=========================================
Lists the types of consumers for which event information is available.
The `setup_consumers` table contains the following columns:
| Column | Description |
| --- | --- |
| `NAME` | Consumer name |
| `ENABLED` | `YES` or `NO` for whether or not the consumer is enabled. You can modify this column to ensure that event information is added, or is not added. |
The table can be modified directly, or the server started with the option enabled, for example:
```
performance-schema-consumer-events-waits-history=ON
```
Example
-------
```
SELECT * FROM performance_schema.setup_consumers;
+--------------------------------+---------+
| NAME | ENABLED |
+--------------------------------+---------+
| events_stages_current | NO |
| events_stages_history | NO |
| events_stages_history_long | NO |
| events_statements_current | YES |
| events_statements_history | NO |
| events_statements_history_long | NO |
| events_waits_current | NO |
| events_waits_history | NO |
| events_waits_history_long | NO |
| global_instrumentation | YES |
| thread_instrumentation | YES |
| statements_digest | YES |
+--------------------------------+---------+
```
See Also
--------
* [Sys Schema ps\_is\_consumer\_enabled function](../ps_is_consumer_enabled/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema events_statements_summary_by_program Table Performance Schema events\_statements\_summary\_by\_program Table
=================================================================
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**The `events_statements_summary_by_program` table, along with many other new [Performance Schema tables](../list-of-performance-schema-tables/index), was added in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/).
Each row in the the [Performance Schema](../performance-schema/index) events\_statements\_summary\_by\_program table summarizes events for a particular stored program (stored procedure, stored function, trigger or event).
It contains the following fields.
| Column | Type | Null | Description |
| --- | --- | --- | --- |
| OBJECT\_TYPE | enum('EVENT', 'FUNCTION', 'PROCEDURE', 'TABLE', 'TRIGGER') | YES | Object type for which the summary is generated. |
| OBJECT\_SCHEMA | varchar(64) | NO | The schema of the object for which the summary is generated. |
| OBJECT\_NAME | varchar(64) | NO | The name of the object for which the summary is generated. |
| COUNT\_STAR | bigint(20) unsigned | NO | The number of summarized events (from events\_statements\_current). This value includes all events, whether timed or nontimed. |
| SUM\_TIMER\_WAIT | bigint(20) unsigned | NO | The number of summarized events (from events\_statements\_current). This value includes all events, whether timed or nontimed. |
| MIN\_TIMER\_WAIT | bigint(20) unsigned | NO | The minimum wait time of the summarized timed events. |
| AVG\_TIMER\_WAIT | bigint(20) unsigned | NO | The average wait time of the summarized timed events. |
| MAX\_TIMER\_WAIT | bigint(20) unsigned | NO | The maximum wait time of the summarized timed events. |
| COUNT\_STATEMENTS | bigint(20) unsigned | NO | Total number of nested statements invoked during stored program execution. |
| SUM\_STATEMENTS\_WAIT | bigint(20) unsigned | NO | The total wait time of the summarized timed statements. This value is calculated only for timed statements because nontimed statements have a wait time of NULL. The same is true for the other xxx\_STATEMENT\_WAIT values. |
| MIN\_STATEMENTS\_WAIT | bigint(20) unsigned | NO | The minimum wait time of the summarized timed statements. |
| AVG\_STATEMENTS\_WAIT | bigint(20) unsigned | NO | The average wait time of the summarized timed statements. |
| MAX\_STATEMENTS\_WAIT | bigint(20) unsigned | NO | The maximum wait time of the summarized timed statements. |
| SUM\_LOCK\_TIME | bigint(20) unsigned | NO | The total time spent (in picoseconds) waiting for table locks for the summarized statements. |
| SUM\_ERRORS | bigint(20) unsigned | NO | The total number of errors that occurend for the summarized statements. |
| SUM\_WARNINGS | bigint(20) unsigned | NO | The total number of warnings that occurend for the summarized statements. |
| SUM\_ROWS\_AFFECTED | bigint(20) unsigned | NO | The total number of affected rows by the summarized statements. |
| SUM\_ROWS\_SENT | bigint(20) unsigned | NO | The total number of rows returned by the summarized statements. |
| SUM\_ROWS\_EXAMINED | bigint(20) unsigned | NO | The total number of rows examined by the summarized statements.The total number of affected rows by the summarized statements. |
| SUM\_CREATED\_TMP\_DISK\_TABLES | bigint(20) unsigned | NO | The total number of on-disk temporary tables created by the summarized statements. |
| SUM\_CREATED\_TMP\_TABLES | bigint(20) unsigned | NO | The total number of in-memory temporary tables created by the summarized statements. |
| SUM\_SELECT\_FULL\_JOIN | bigint(20) unsigned | NO | The total number of full joins executed by the summarized statements. |
| SUM\_SELECT\_FULL\_RANGE\_JOIN | bigint(20) unsigned | NO | The total number of range search joins executed by the summarized statements. |
| SUM\_SELECT\_RANGE | bigint(20) unsigned | NO | The total number of joins that used ranges on the first table executed by the summarized statements. |
| SUM\_SELECT\_RANGE\_CHECK | bigint(20) unsigned | NO | The total number of joins that check for key usage after each row executed by the summarized statements. |
| SUM\_SELECT\_SCAN | bigint(20) unsigned | NO | The total number of joins that did a full scan of the first table executed by the summarized statements. |
| SUM\_SORT\_MERGE\_PASSES | bigint(20) unsigned | NO | The total number of merge passes that the sort algorithm has had to do for the summarized statements. |
| SUM\_SORT\_RANGE | bigint(20) unsigned | NO | The total number of sorts that were done using ranges for the summarized statements. |
| SUM\_SORT\_ROWS | bigint(20) unsigned | NO | The total number of sorted rows that were sorted by the summarized statements. |
| SUM\_SORT\_SCAN | bigint(20) unsigned | NO | The total number of sorts that were done by scanning the table by the summarized statements. |
| SUM\_NO\_INDEX\_USED | bigint(20) unsigned | NO | The total number of statements that performed a table scan without using an index. |
| SUM\_NO\_GOOD\_INDEX\_USED | bigint(20) unsigned | NO | The total number of statements where no good index was found. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Multi-Source Replication Multi-Source Replication
========================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
Multi-source replication means that one server has many primaries from which it replicates.
New Syntax
----------
You specify which primary connection you want to work with by either specifying the connection name in the command or setting [default\_master\_connection](../replication-and-binary-log-server-system-variables/index#default_master_connection) to the connection you want to work with.
The connection name may include any characters and should be less than 64 characters. Connection names are compared without regard to case (case insensitive). You should preferably keep the connection name short as it will be used as a suffix for relay logs and primary info index files.
The new syntax introduced to handle many connections:
* `[CHANGE MASTER ['connection\_name'] TO ...](../change-master-to/index)`. This creates or modifies a connection to a primary.
* `FLUSH RELAY LOGS ['connection_name']`
* `[MASTER\_POS\_WAIT(....,['connection\_name'])](../master_pos_wait/index)`
* `[RESET SLAVE ['connection\_name'] [ALL](../reset-slave/index)]`. This is used to reset a replica's replication position or to remove a replica permanently.
* `[SHOW RELAYLOG ['connection\_name'] EVENTS](../show-relaylog-events/index)`
* `[SHOW SLAVE ['connection\_name'] STATUS](../show-slave-status/index)`
* `[SHOW ALL SLAVES STATUS](../show-slave-status/index)`
* `[START SLAVE ['connection\_name'](../start-slave/index)...]]`
* `[START ALL SLAVES ...](../start-slave/index)`
* `[STOP SLAVE ['connection\_name'] ...](../stop-slave/index)`
* `[STOP ALL SLAVES ...](../stop-slave/index)`
The original old-style connection is an empty string `''`. You don't have to use this connection if you don't want to.
You create new primary connections with [CHANGE MASTER](../change-master-to/index).
You delete the connection permanently with [RESET SLAVE 'connection\_name' ALL](../reset-slave/index).
Replication Variables for Multi-Source
--------------------------------------
The new replication variable [default\_master\_connection](../replication-and-binary-log-server-system-variables/index#default_master_connection) specifies which connection will be used for commands and variables if you don't specify a connection. By default this is `''` (the default connection name).
The following replication variables are local for the connection. (In other words, they show the value for the `@@default_master_connection` connection). We are working on making all the important ones local for the connection.
| Type | Name | Description |
| --- | --- | --- |
| Variable | [max\_relay\_log\_size](../replication-and-binary-log-server-system-variables/index#max_relay_log_size) | Max size of relay log. Is set at startup to `max_binlog_size` if 0 |
| Variable | [replicate\_do\_db](../replication-and-binary-log-server-system-variables/index#replicate_do_db) | Tell the replica to restrict replication to updates of tables whose names appear in the comma-separated list. For statement-based replication, only the default database (that is, the one selected by USE) is considered, not any explicitly mentioned tables in the query. For row-based replication, the actual names of table(s) being updated are checked. |
| Variable | [replicate\_do\_table](../replication-and-binary-log-server-system-variables/index#replicate_do_table) | Tells the replica to restrict replication to tables in the comma-separated list |
| Variable | [replicate\_ignore\_db](../replication-and-binary-log-server-system-variables/index#replicate_ignore_db) | Tell the replica to restrict replication to updates of tables whose names do not appear in the comma-separated list. For statement-based replication, only the default database (that is, the one selected by USE) is considered, not any explicitly mentioned tables in the query. For row-based replication, the actual names of table(s) being updated are checked. |
| Variable | [replicate\_ignore\_table](../replication-and-binary-log-server-system-variables/index#replicate_ignore_table) | Tells the replica thread to not replicate any statement that updates the specified table, even if any other tables might be updated by the same statement. |
| Variable | [replicate\_wild\_do\_table](../replication-and-binary-log-server-system-variables/index#replicate_wild_do_table) | Tells the replica thread to restrict replication to statements where any of the updated tables match the specified database and table name patterns. |
| Variable | [replicate\_wild\_ignore\_table](../replication-and-binary-log-server-system-variables/index#replicate_wild_ignore_table) | Tells the replica thread to not replicate to the tables that match the given wildcard pattern. |
| Status | [Slave\_heartbeat\_period](../replication-and-binary-log-status-variables/index#slave_heartbeat_period) | How often to request a heartbeat packet from the primary (in seconds). |
| Status | [Slave\_received\_heartbeats](../replication-and-binary-log-status-variables/index#slave_received_heartbeats) | How many heartbeats we have got from the primary. |
| Status | [Slave\_running](../replication-and-binary-log-status-variables/index#slave_running) | Shows if the replica is running. YES means that the sql thread and the IO thread are active. No means either one is not running. '' means that `@@default_master_connection` doesn't exist. |
| Variable | [Sql\_slave\_skip\_counter](../replication-and-binary-log-server-system-variables/index#sql_slave_skip_counter) | How many entries in the replication log that should be skipped (mainly used in case of errors in the log). |
You can access all of the above variables with either `SESSION` or `GLOBAL`.
Note that in contrast to MySQL, all variables always show the correct active value!
Example:
```
set @@default_master_connection='';
show status like 'Slave_running';
set @@default_master_connection='other_connection';
show status like 'Slave_running';
```
If `@@default_master_connection` contains a non existing name, you will get a warning.
All other primary-related variables are global and affect either only the '' connections or all connections. For example, [Slave\_retried\_transactions](../replication-and-binary-log-status-variables/index#slave_retried_transactions) now shows the total number of retried transactions over all replicas.
If you need to set [gtid\_slave\_pos](../global-transaction-id/index#gtid_slave_pos) you need to set this for all primaries at the same time.
New status variables:
| Name | Description |
| --- | --- |
| `[Com\_start\_all\_slaves](../replication-and-binary-log-server-status-variables/index#com_start_all_slaves)` | Number of executed `START ALL SLAVES` commands. |
| `[Com\_start\_slave](../replication-and-binary-log-server-status-variables/index#com_start_slave)` | Number of executed `START SLAVE` commands. This replaces `Com_slave_start`. |
| `[Com\_stop\_slave](../replication-and-binary-log-server-status-variables/index#com_stop_slave)` | Number of executed `STOP SLAVE` commands. This replaces `Com_slave_stop`. |
| `[Com\_stop\_all\_slaves](../replication-and-binary-log-server-status-variables/index#com_stop_all_slaves)` | Number of executed `STOP ALL SLAVES` commands. |
`[SHOW ALL SLAVES STATUS](../show-slave-status/index)` has the following new columns:
| Name | Description |
| --- | --- |
| `Connection_name` | Name of the primary connection. This is the first variable. |
| `Slave_SQL_State` | State of SQL thread. |
| `Retried_transactions` | Number of retried transactions for this connection. |
| `Max_relay_log_size` | Max relay log size for this connection. |
| `Executed_log_entries` | How many log entries the replica has executed. |
| `Slave_received_heartbeats` | How many heartbeats we have got from the primary. |
| `Slave_heartbeat_period` | How often to request a heartbeat packet from the primary (in seconds). |
New Files
---------
The basic principle of the new files used by multi source replication is that they have the same name as the original relay log files suffixed with `connection_name` before the extension. The main exception is the file that holds all connection is named as the normal `master-info-file` with a `multi-` prefix.
When you are using multi source, the following new files are created:
| Name | Description |
| --- | --- |
| `multi-master-info-file` | The `master-info-file` (normally `master.info`) with a `multi-` prefix. This contains all primary connections in use. |
| `master-info-file`-connection\_name`.extension` | Contains the current primary position for what's applied to in the replica. Extension is normally `.info` |
| `relay-log`-connection\_name`.xxxxx` | The relay-log name with a connection\_name suffix. The xxxxx is the relay log number. This contains the replication data read from the primary. |
| `relay-log-index`-connection\_name`.extension` | Contains the name of the active `relay-log`-connection\_name`.xxxxx` files. Extension is normally `.index` |
| `relay-log-info-file`-connection\_name`.extension` | Contains the current primary position for the relay log. Extension is normally `.info` |
When creating the file, the connection name is converted to lower case and all special characters in the connection name are converted, the same way as MySQL table names are converted. This is done to make the file name portable across different systems.
Hint:
Instead of specifying names for `mysqld` with [--relay-log](../replication-and-binary-log-system-variables/index#relay_log), [--relay-log-index](../replication-and-binary-log-system-variables/index#relay_log_index), [--general-log-file](../server-system-variables/index#general_log_file), [--slow-query-log-file](../server-system-variables/index#slow_query_log_file), [--log-bin](../replication-and-binary-log-system-variables/index#log_bin) and [--log-bin-index](../replication-and-binary-log-system-variables/index#log_bin_index), you can just specify [--log-basename](../mysqld-options/index#-log-basename) and all the other variables are set with this as a prefix.
Other Things
------------
* All error messages from a replica with a connection name, that are written to the error log, are prefixed with `Master 'connection_name':`. This makes it easy to see from where an error originated.
* Errors `ER_MASTER_INFO` and `WARN_NO_MASTER_INFO` now includes connection\_name.
* There is no conflict resolution. The assumption is that there are no conflicts in data between the different primaries.
* All executed commands are stored in the normal binary log (nothing new here).
* If the server variable `log_warnings` > 1 then you will get some information in the log about how the multi-master-info file is updated (mainly for debugging).
* [SHOW [FULL] SLAVE STATUS](../show-slave-status/index) has one line per connection and more columns than before. **Note that the first column is the `connection_name`!**
* `[RESET SLAVE](../reset-slave/index)` now deletes all relay-log files.
replicate-... Variables
-----------------------
* One can set the values for the `replicate-...` variables from the command line or in `my.cnf` for a given connection by prefixing the variable with the connection name.
* If one doesn't use any connection name prefix for a `replicate..` variable, then the value will be used as the default value for all connections that don't have a value set for this variable.
Example:
```
mysqld --main_connection.replicate_do_db=main_database --replicate_do_db=other_database
```
The have sets the `replicate_do_db` variable to `main_database` for the connection named `main_connection`. All other connections will use the value `other_database`.
One can also use this syntax to set `replicate-rewrite-db` for a given connection.
Typical Use Cases
-----------------
* You are partitioning your data over many primaries and would like to get it all together on one machine to do analytical queries on all data.
* You have many databases spread over many MariaDB/MySQL servers and would like to have all of them on one machine as an extra backup.
* In a Galera cluster the default replication filter rules like `replicate-do-db` do not apply to replication connections, but also to Galera write set applier threads. By using a named multi-primary replication connection instead, even when replicating from just one primary into the cluster, the primary-replica replication rules can be kept separate from the Galera intra-node replication traffic.
Limitations
-----------
* Each active connection will create 2 threads (as is normal for MariaDB replication).
* You should ensure that all primaries have different `server-id`'s. If you don't do this, you will get into trouble if you try to replicate from the multi-source replica back to your primaries.
* One can change [max\_relay\_log\_size](../replication-and-binary-log-server-system-variables/index#max_relay_log_size) for any active connection, but new connections will always use the server startup value for `max_relay_log_size`, which can't be changed at runtime.
* Option [innodb-recovery-update-relay-log](../innodb-system-variables/index#innodb_recovery_update_relay_log) (xtradb feature to store and restore relay log position for replicas) only works for the default connection ''. As this option is not really safe and can easily cause loss of data if you use storage engines other than InnoDB, we don't recommend this option be used.
* [slave\_net\_timeout](../replication-and-binary-log-server-system-variables/index#slave_net_timeout) affects all connections. We don't check anymore if it's less than [Slave\_heartbeat\_period](../replication-and-binary-log-server-status-variables/index#slave_heartbeat_period), as this doesn't make sense in a multi-source setup.
Incompatibilities with MariaDB/MySQL 5.5
----------------------------------------
* [max\_relay\_log\_size](../replication-and-binary-log-server-system-variables/index#max_relay_log_size) is now (almost) a normal variable and not automatically changed if [max\_binlog\_size](../replication-and-binary-log-server-system-variables/index#max_binlog_size) is changed. To keep things compatible with old config files, we set it to `max_binlog_size` at startup if its value is 0.
* You can now access replication variables that depend on the active connection with either `GLOBAL` or `SESSION`.
* We only write information about relay log positions for recovery if [innodb-recovery-update-relay-log](../xtradbinnodb-server-system-variables/index#innodb_recovery_update_relay_log) is set.
* [Slave\_retried\_transactions](../replication-and-binary-log-status-variables/index#slave_retried_transactions) now shows the total count of retried transactions over all replicas.
* The status variable `Com_slave_start` is replaced with [Com\_start\_slave](../replication-and-binary-log-status-variables/index#com_start_slave).
* The status variable `Com_slave_stop` is replaced with [Com\_stop\_slave](../replication-and-binary-log-status-variables/index#com_stop_slave).
* `FLUSH RELAY LOGS` are not replicated anymore. This is not safe as connection names may be different on the replica.
See Also
--------
* Using multi-source with [global transaction id](../global-transaction-id/index#use-with-multi-source-replication-and-other-multi-master-setups)
* The work in MariaDB is based on the project description at [MDEV-253](https://jira.mariadb.org/browse/MDEV-253).
* The original code base comes from [Taobao, developed by Peng Lixun](http://mysql.taobao.org/index.php/Patch_source_code#Multi-master_replication). A big thanks to them for this important feature!
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb mysql.spider_xa_member Table mysql.spider\_xa\_member Table
==============================
The `mysql.spider_xa_member` table is installed by the [Spider storage engine](../spider/index).
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, this table uses the [Aria](../aria/index) storage engine.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and before, this table uses the [MyISAM](../myisam-storage-engine/index) storage engine.
It contains the following fields:
| Field | Type | Null | Key | Default | Description |
| --- | --- | --- | --- | --- | --- |
| format\_id | int(11) | NO | | 0 | |
| gtrid\_length | int(11) | NO | | 0 | |
| bqual\_length | int(11) | NO | | 0 | |
| data | binary(128) | NO | MUL | | |
| scheme | char(64) | NO | | | |
| host | char(64) | NO | | | |
| port | char(5) | NO | | | |
| socket | text | NO | | NULL | |
| username | char(64) | NO | | | |
| password | char(64) | NO | | | |
| ssl\_ca | text | YES | | NULL | |
| ssl\_capath | text | YES | | NULL | |
| ssl\_cert | text | YES | | NULL | |
| ssl\_cipher | char(64) | YES | | NULL | |
| ssl\_key | text | YES | | NULL | |
| ssl\_verify\_server\_cert | tinyint(4) | NO | | 0 | |
| default\_file | text | YES | | NULL | |
| default\_group | char(64) | YES | | NULL | |
| dsn | char(64) | YES | | NULL | |
| filedsn | text | YES | | NULL | |
| driver | char(64) | YES | | NULL | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb XOR XOR
===
Syntax
------
```
XOR
```
Description
-----------
XOR stands for eXclusive OR. Returns NULL if either operand is NULL. For non-NULL operands, evaluates to 1 if an odd number of operands is non-zero, otherwise 0 is returned.
Examples
--------
```
SELECT 1 XOR 1;
+---------+
| 1 XOR 1 |
+---------+
| 0 |
+---------+
SELECT 1 XOR 0;
+---------+
| 1 XOR 0 |
+---------+
| 1 |
+---------+
SELECT 1 XOR NULL;
+------------+
| 1 XOR NULL |
+------------+
| NULL |
+------------+
```
In the following example, the right `1 XOR 1` is evaluated first, and returns `0`. Then, `1 XOR 0` is evaluated, and `1` is returned.
```
SELECT 1 XOR 1 XOR 1;
+---------------+
| 1 XOR 1 XOR 1 |
+---------------+
| 1 |
+---------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Upgrading from MariaDB 10.1 to MariaDB 10.2 Upgrading from MariaDB 10.1 to MariaDB 10.2
===========================================
### How to Upgrade
For Windows, see [Upgrading MariaDB on Windows](../upgrading-mariadb-on-windows/index) instead.
For MariaDB Galera Cluster, see [Upgrading from MariaDB 10.1 to MariaDB 10.2 with Galera Cluster](../upgrading-from-mariadb-101-to-mariadb-102-with-galera-cluster/index) instead.
Before you upgrade, it would be best to take a backup of your database. This is always a good idea to do before an upgrade. We would recommend [Mariabackup](../mariabackup/index).
The suggested upgrade procedure is:
1. Modify the repository configuration, so the system's package manager installs [MariaDB 10.2](../what-is-mariadb-102/index). For example,
* On Debian, Ubuntu, and other similar Linux distributions, see [Updating the MariaDB APT repository to a New Major Release](../installing-mariadb-deb-files/index#updating-the-mariadb-apt-repository-to-a-new-major-release) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Updating the MariaDB YUM repository to a New Major Release](../yum/index#updating-the-mariadb-yum-repository-to-a-new-major-release) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Updating the MariaDB ZYpp repository to a New Major Release](../installing-mariadb-with-zypper/index#updating-the-mariadb-zypp-repository-to-a-new-major-release) for more information.
2. Set `[innodb\_fast\_shutdown](../xtradbinnodb-server-system-variables/index#innodb_fast_shutdown)` to `0`. It can be changed dynamically with `[SET GLOBAL](../set/index#global-session)`. For example:
`SET GLOBAL innodb_fast_shutdown=0;`
* This step is not necessary when upgrading to [MariaDB 10.2.5](https://mariadb.com/kb/en/mariadb-1025-release-notes/) or later. Omitting it can make the upgrade process far faster. See [MDEV-12289](https://jira.mariadb.org/browse/MDEV-12289) for more information.
3. [Stop MariaDB](../starting-and-stopping-mariadb-automatically/index).
4. Uninstall the old version of MariaDB.
* On Debian, Ubuntu, and other similar Linux distributions, execute the following:
`sudo apt-get remove mariadb-server`
* On RHEL, CentOS, Fedora, and other similar Linux distributions, execute the following:
`sudo yum remove MariaDB-server`
* On SLES, OpenSUSE, and other similar Linux distributions, execute the following:
`sudo zypper remove MariaDB-server`
5. Install the new version of MariaDB.
* On Debian, Ubuntu, and other similar Linux distributions, see [Installing MariaDB Packages with APT](../installing-mariadb-deb-files/index#installing-mariadb-packages-with-apt) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Installing MariaDB Packages with YUM](../yum/index#installing-mariadb-packages-with-yum) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Installing MariaDB Packages with ZYpp](../installing-mariadb-with-zypper/index#installing-mariadb-packages-with-zypp) for more information.
6. Make any desired changes to configuration options in [option files](../configuring-mariadb-with-option-files/index), such as `my.cnf`. This includes removing any options that are no longer supported.
7. [Start MariaDB](../starting-and-stopping-mariadb-automatically/index).
8. Run `[mysql\_upgrade](../mysql_upgrade/index)`.
* `mysql_upgrade` does two things:
1. Ensures that the system tables in the `[mysq](../the-mysql-database-tables/index)l` database are fully compatible with the new version.
2. Does a very quick check of all tables and marks them as compatible with the new version of MariaDB .
### Incompatible Changes Between 10.1 and 10.2
On most servers upgrading from 10.1 should be painless. However, there are some things that have changed which could affect an upgrade:
#### InnoDB Instead of XtraDB
[MariaDB 10.2](../what-is-mariadb-102/index) uses [InnoDB](../innodb/index) as the default storage engine, rather than XtraDB, used in [MariaDB 10.1](../what-is-mariadb-101/index) and before. See [Why does MariaDB 10.2 use InnoDB instead of XtraDB?](../why-does-mariadb-102-use-innodb-instead-of-xtradb/index) In most cases this should have minimal effect as the latest InnoDB has incorporated most of the improvements made in earlier versions of XtraDB. Note that certain [XtraDB system variables](../xtradbinnodb-server-system-variables/index) are now ignored (although they still exist so as to permit easy upgrading).
#### Options That Have Changed Default Values
In particular, take note of the changes to [innodb\_strict\_mode](../xtradbinnodb-server-system-variables/index#innodb_strict_mode), [sql\_mode](../server-system-variables/index#sql_mode), [binlog\_format](../replication-and-binary-log-server-system-variables/index#binlog_format), [binlog\_checksum](../replication-and-binary-log-server-system-variables/index#binlog_checksum) and [innodb\_checksum\_algorithm](../xtradbinnodb-server-system-variables/index#innodb_checksum_algorithm).
| Option | Old default value | New default value |
| --- | --- | --- |
| [aria\_recover(\_options)](../aria-system-variables/index#aria_recover_options) | NORMAL | BACKUP, QUICK |
| [binlog\_annotate\_row\_events](../replication-and-binary-log-server-system-variables/index#binlog_annotate_row_events) | OFF | ON |
| [binlog\_checksum](../replication-and-binary-log-server-system-variables/index#binlog_checksum) | NONE | CRC32 |
| [binlog\_format](../replication-and-binary-log-server-system-variables/index#binlog_format) | STATEMENT | MIXED |
| [group\_concat\_max\_len](../server-system-variables/index#group_concat_max_len) | 1024 | 1048576 |
| [innodb\_autoinc\_lock\_mode](../xtradbinnodb-server-system-variables/index#innodb_autoinc_lock_mode) | 1 | 2 |
| [innodb\_buffer\_pool\_dump\_at\_shutdown](../xtradbinnodb-server-system-variables/index#innodb_buffer_pool_dump_at_shutdown) | OFF | ON |
| [innodb\_buffer\_pool\_dump\_pct](../xtradbinnodb-server-system-variables/index#innodb_buffer_pool_dump_pct) | 100 | 25 |
| [innodb\_buffer\_pool\_instances](../xtradbinnodb-server-system-variables/index#innodb_buffer_pool_instances) | 8 | Varies |
| [innodb\_buffer\_pool\_load\_at\_startup](../xtradbinnodb-server-system-variables/index#innodb_buffer_pool_load_at_startup) | OFF | ON |
| [innodb\_checksum\_algorithm](../xtradbinnodb-server-system-variables/index#innodb_checksum_algorithm) | innodb | crc32 |
| [innodb\_file\_format](../xtradbinnodb-server-system-variables/index#innodb_file_format) | Antelope | Barracuda |
| [innodb\_large\_prefix](../xtradbinnodb-server-system-variables/index#innodb_large_prefix) | OFF | ON |
| [innodb\_lock\_schedule\_algorithm](../xtradbinnodb-server-system-variables/index#innodb_lock_schedule_algorithm) | VATS | FCFS |
| [innodb\_log\_compressed\_pages](../xtradbinnodb-server-system-variables/index#innodb_log_compressed_pages) | OFF | ON |
| [innodb\_max\_dirty\_pages\_pct\_lwm](../xtradbinnodb-server-system-variables/index#innodb_max_dirty_pages_pct_lwm) | 0.001000 | 0 |
| [innodb\_max\_undo\_log\_size](../xtradbinnodb-server-system-variables/index#innodb_max_undo_log_size) | 1073741824 | 10485760 |
| [innodb\_purge\_threads](../xtradbinnodb-server-system-variables/index#innodb_purge_threads) | 1 | 4 |
| [innodb\_strict\_mode](../xtradbinnodb-server-system-variables/index#innodb_strict_mode) | OFF | ON |
| [innodb\_undo\_directory](../xtradbinnodb-server-system-variables/index#innodb_undo_directory) | . | NULL |
| [innodb\_use\_atomic\_writes](../xtradbinnodb-server-system-variables/index#innodb_use_atomic_writes) | OFF | ON |
| [innodb\_use\_trim](../xtradbinnodb-server-system-variables/index#innodb_use_trim) | OFF | ON |
| [lock\_wait\_timeout](../server-system-variables/index#lock_wait_timeout) | 31536000 | 86400 |
| [log\_slow\_admin\_statements](../server-system-variables/index#log_slow_admin_statements) | OFF | ON |
| [log\_slow\_slave\_statements](../replication-and-binary-log-server-system-variables/index#log_slow_slave_statements) | OFF | ON |
| [log\_warnings](../server-system-variables/index#log_warnings) | 1 | 2 |
| [max\_allowed\_packet](../server-system-variables/index#max_allowed_packet) | 4M | 16M |
| [max\_long\_data\_size](../server-system-variables/index#max_long_data_size) | 4M | 16M |
| [myisam\_recover\_options](../myisam-system-variables/index#myisam_recover_options) | NORMAL | BACKUP, QUICK |
| [optimizer\_switch](../server-system-variables/index#optimizer_switch) | See [Optimizer Switch](../optimizer_switch/index) for details. |
| [replicate\_annotate\_row\_events](../replication-and-binary-log-server-system-variables/index#replicate_annotate_row_events) | OFF | ON |
| [server\_id](../replication-and-binary-log-server-system-variables/index#server_id) | 0 | 1 |
| [slave\_net\_timeout](../replication-and-binary-log-server-system-variables/index#slave_net_timeout) | 3600 | 60 |
| [sql\_mode](../server-system-variables/index#sql_mode) | NO\_AUTO\_CREATE\_USER, NO\_ENGINE\_SUBSTITUTION | STRICT\_TRANS\_TABLES, ERROR\_FOR\_DIVISION\_BY\_ZERO, NO\_AUTO\_CREATE\_USER, NO\_ENGINE\_SUBSTITUTION |
| [thread\_cache\_size](../server-system-variables/index#thread_cache_size) | 0 | Auto |
| [thread\_pool\_max\_threads](../thread-pool-system-and-status-variables/index) | 1000 | 65536 |
| [thread\_stack](../server-system-variables/index#thread_stack) | 295936 | 299008 |
#### Options That Have Been Removed or Renamed
The following options should be removed or renamed if you use them in your [option files](../configuring-mariadb-with-option-files/index):
| Option | Reason |
| --- | --- |
| aria\_recover | Renamed to [aria\_recover\_options](../aria-system-variables/index#aria_recover_options) to match [myisam\_recover\_options](../myisam-system-variables/index#myisam_recover_options). |
| [innodb\_additional\_mem\_pool\_size](../xtradbinnodb-server-system-variables/index#innodb_additional_mem_pool_size) | Deprecated in [MariaDB 10.0](../what-is-mariadb-100/index). |
| [innodb\_api\_bk\_commit\_interval](../xtradbinnodb-server-system-variables/index#innodb_api_bk_commit_interval) | Memcache never implemented in MariaDB. |
| [innodb\_api\_disable\_rowlock](../xtradbinnodb-server-system-variables/index#innodb_api_disable_rowlock) | Memcache never implemented in MariaDB. |
| [innodb\_api\_enable\_binlog](../xtradbinnodb-server-system-variables/index#innodb_api_enable_binlog) | Memcache never implemented in MariaDB. |
| [innodb\_api\_enable\_mdl](../xtradbinnodb-server-system-variables/index#innodb_api_enable_mdl) | Memcache never implemented in MariaDB. |
| [|innodb\_api\_trx\_level](../xtradbinnodb-server-system-variables/index#innodb_api_trx_level) | Memcache never implemented in MariaDB. |
| [innodb\_use\_sys\_malloc](../xtradbinnodb-server-system-variables/index#innodb_use_sys_malloc) | Deprecated in [MariaDB 10.0](../what-is-mariadb-100/index). |
#### Reserved Words
New [reserved words](../reserved-words/index): OVER, RECURSIVE and ROWS. These can no longer be used as [identifiers](../identifier-names/index) without being quoted.
#### TokuDB
[TokuDB](../tokudb/index) has been split into a separate package, mariadb-plugin-tokudb.
#### Replication
[Replication](../standard-replication/index) from legacy MySQL servers may require setting [binlog\_checksum](../replication-and-binary-log-server-system-variables/index#binlog_checksum) to NONE.
#### SQL Mode
[SQL\_MODE](../sql_mode/index) has been changed; in particular, NOT NULL fields with no default will no longer fall back to a dummy value for inserts which do not specify a value for that field.
#### Auto\_increment
[Auto\_increment](../auto_increment/index) columns are no longer permitted in [CHECK constraints](../constraint/index), [DEFAULT value expressions](../create-table/index#default) and [virtual columns](../virtual-computed-columns/index). They were permitted in earlier versions, but did not work correctly.
#### TLS
Starting with [MariaDB 10.2](../what-is-mariadb-102/index), when the user specifies the `--ssl` option with a [client or utility](../clients-utilities/index), the [client or utility](../clients-utilities/index) will not [verify the server certificate](../secure-connections-overview/index#server-certificate-verification) by default. In order to verify the server certificate, the user must specify the `--ssl-verify-server-cert` option to the [client or utility](../clients-utilities/index). For more information, see the [list of options](../mysql-command-line-client/index#options) for the `[mysql](../mysql-command-line-client/index)` client.
### Major New Features To Consider
You might consider using the following major new features in [MariaDB 10.2](../what-is-mariadb-102/index):
* [Window Functions](../window-functions/index)
* [mysqlbinlog](../mysqlbinlog/index) now supports continuous binary log backups
* [Recursive Common Table Expressions](../recursive-common-table-expressions-overview/index)
* [JSON functions](../json-functions/index)
* See also [System Variables Added in MariaDB 10.2](../system-variables-added-in-mariadb-102/index).
### See Also
* [The features in MariaDB 10.2](../what-is-mariadb-102/index)
* [Upgrading from MariaDB 10.1 to MariaDB 10.2 with Galera Cluster](../upgrading-from-mariadb-101-to-mariadb-102-with-galera-cluster/index)
* [Upgrading from MariaDB 10.0 to MariaDB 10.1](../upgrading-from-mariadb-100-to-mariadb-101/index)
* [Upgrading from MariaDB 5.5 to MariaDB 10.0](../upgrading-from-mariadb-55-to-mariadb-100/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_GEOMETRYTYPE ST\_GEOMETRYTYPE
================
Syntax
------
```
ST_GeometryType(g)
GeometryType(g)
```
Description
-----------
Returns as a string the name of the geometry type of which the geometry instance `g` is a member. The name corresponds to one of the instantiable Geometry subclasses.
`ST_GeometryType()` and `GeometryType()` are synonyms.
Examples
--------
```
SELECT GeometryType(GeomFromText('POINT(1 1)'));
+------------------------------------------+
| GeometryType(GeomFromText('POINT(1 1)')) |
+------------------------------------------+
| POINT |
+------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Buildbot Setup for Virtual Machines - Red Hat Buildbot Setup for Virtual Machines - Red Hat
==============================================
This category contains articles documenting how the MariaDB Red Hat-based buildbot build and test VMs were created.
| Title | Description |
| --- | --- |
| [Buildbot Setup for Virtual Machines - Fedora 20](../buildbot-setup-for-virtual-machines-fedora-20/index) | Base install qemu-img create -f qcow2 /kvm/vms/vm-fedora20-i386-ser |
| [Buildbot Setup for Virtual Machines - Fedora 19](../buildbot-setup-for-virtual-machines-fedora-19/index) | Base install qemu-img create -f qcow2 /kvm/vms/vm-fedora19-i386-ser |
| [Buildbot Setup for Virtual Machines - Fedora 18](../buildbot-setup-for-virtual-machines-fedora-18/index) | Base install qemu-img create -f qcow2 /kvm/vms/vm-fedora18-i386-ser |
| [Buildbot Setup for Virtual Machines - Fedora 17](../buildbot-setup-for-virtual-machines-fedora-17/index) | Base install qemu-img create -f qcow2 /kvm/vms/vm-fedora17-i386-ser |
| [Buildbot Setup for Virtual Machines - Fedora 16](../buildbot-setup-for-virtual-machines-fedora-16/index) | Base install qemu-img create -f qcow2 /kvm/vms/vm-fedora16-i386-ser |
| [Buildbot Setup for Virtual Machines - CentOS 6.2](../buildbot-setup-for-virtual-machines-centos-62/index) | Base install qemu-img create -f qcow2 /kvm/vms/vm-centos6-amd64-ser |
| [Buildbot Setup for Virtual Machines - Red Hat 6 x86](../buildbot-setup-for-virtual-machines-red-hat-6-x86/index) | The following steps were used to create a Red Hat 6 x86 buildslave. Initial Setup cd vms q |
| [Buildbot Setup for Virtual Machines - CentOS 5 i386](../buildbot-setup-for-virtual-machines-centos-5-i386/index) | Base install cd /kvm qemu-img create -f qcow2 vms/vm-centos5-i386-ba |
| [Buildbot Setup for Virtual Machines - Centos 5 amd64](../buildbot-setup-for-virtual-machines-centos-5-amd64/index) | Base install cd /kvm wget http://ftp.klid.dk/ftp/centos/5.3/isos/x86 |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Deploying Docker Containers with Puppet Deploying Docker Containers with Puppet
=======================================
Puppet can also be used to manage Docker container upgrades and configuration changes. Docker has more specific tools for this purpose, but sometimes there are reasons to choose alternatives. See [Benefits of Managing Docker Containers with Automation Software](../benefits-of-managing-docker-containers-with-orchestration-software/index).
In this page you will find out what managing Docker with Puppet looks like. All the snippets in this page use the `docker` resource type, supported by the Puppet company.
How to Install, Upgrade or Uninstall Docker with Puppet
-------------------------------------------------------
Installing or upgrading Docker is simple:
```
class { 'docker':
use_upstream_package_source => false,
version => '17.09.0~ce-0~debian',
}
```
In this example we are using our system's repositories instead of Docker official repositories, and we are specifying the desired version. To upgrade Docker later, all we need to do is to modify the version number. While specifying a version is not mandatory, it is a good idea because it makes our manifest more reproducible.
To uninstall Docker:
```
class { 'docker':
ensure => absent
}
```
Check the `docker` resource type documentation to find out how to use more features: for example you can use Docker Enterprise Edition, or bind the Docker daemon to a TCP port.
How to Build or Pull Docker Images with Puppet
----------------------------------------------
To pull an image from Dockerhub:
```
docker::image { 'mariadb:10.0': }
```
We specified the `10.0` tag to get the desired MariaDB version. If we don't, the image with the `latest` tag will be used. Note that this is not desirable in production, because it can lead to unexpected upgrades.
You can also write a Dockerfile yourself, and then build it to create a Docker image. To do so, you need to instruct Puppet to copy the Dockerfile to the target and then build it::
```
file { '/path/to/remote/Dockerfile':
ensure => file,
source => 'puppet:///path/to/local/Dockerfile',
}
docker::image { 'image_name':
docker_file => '/path/to/remote/Dockerfile'
}
```
It is also possible to subscribe to Dockerfile changes, and automatically rebuild the image whenever a new file is found:
```
docker::image { 'image_name':
docker_file => '/path/to/remote/Dockerfile'
subscribe => File['/path/to/remote/Dockerfile'],
}
```
To remove an image that was possibly built or pulled:
```
docker::image { 'mariadb':
ensure => absent
}
```
How to Deploy Containers with Puppet
------------------------------------
To run a container:
```
docker::run { 'mariadb-01':
image => 'mariadb:10.5',
ports => ['3306:6606']
}
```
`mariadb-01` is the contained name. We specified the optional `10.5` tag, and we mapped the guest port 3306 to the host port 6606. In production, you normally don't map ports because you don't need to connect MariaDB clients from the host system to MariaDB servers in the containers. Third-party tools can be installed as separate containers.
References
----------
* [docker resource type documentation](https://forge.puppet.com/modules/puppetlabs/docker), in Puppet documentation.
---
Content initially contributed by [Vettabase Ltd](https://vettabase.com/).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb DATABASE DATABASE
========
Syntax
------
```
DATABASE()
```
Description
-----------
Returns the default (current) database name as a string in the utf8 [character set](../data-types-character-sets-and-collations/index). If there is no default database, DATABASE() returns NULL. Within a [stored routine](../stored-routines/index), the default database is the database that the routine is associated with, which is not necessarily the same as the database that is the default in the calling context.
SCHEMA() is a synonym for DATABASE().
To select a default database, the [USE](../use/index) statement can be run. Another way to set the default database is specifying its name at [mysql](../mysql-command-line-client/index) command line client startup.
Examples
--------
```
SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| NULL |
+------------+
USE test;
Database changed
SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| test |
+------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Buildbot Setup for Virtual Machines - CentOS 5 i386 Buildbot Setup for Virtual Machines - CentOS 5 i386
===================================================
Base install
------------
```
cd /kvm
qemu-img create -f qcow2 vms/vm-centos5-i386-base.qcow2 8G
# ISO (dvd) install:
kvm -m 2047 -hda /kvm/vms/vm-centos5-i386-base.qcow2 -cdrom CentOS-5.3-i386-bin-DVD.iso -redir 'tcp:2225::22' -boot d -smp 2 -cpu qemu32,-nx -net nic,model=virtio -net user
```
Configure for serial console
----------------------------
```
(cd vms && qemu-img create -b vm-centos5-i386-base.qcow2 -f qcow2 vm-centos5-i386-serial.qcow2)
kvm -m 2047 -hda /kvm/vms/vm-centos5-i386-serial.qcow2 -cdrom CentOS-5.3-i386-bin-DVD.iso -redir 'tcp:2225::22' -boot c -smp 2 -cpu qemu32,-nx -net nic,model=virtio -net user -nographic
```
Add to /boot/grub/menu.lst:
```
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=3 serial console
```
also add in menu.lst to kernel line (after removing `quiet splash'):
```
console=tty0 console=ttyS0,115200n8
```
Add login prompt on serial console:
```
cat >>/etc/inittab <<END
# Serial console.
S0:2345:respawn:/sbin/agetty -h -L ttyS0 19200 vt100
END
```
Create account.
```
useradd buildbot
# Password is disabled by default in Centos5.
usermod -a -G wheel buildbot
visudo
# Uncomment the line "%wheel ALL=(ALL) NOPASSWD: ALL"
# Comment out this line:
# Defaults requiretty
# Put in public ssh key for own account and host buildbot account.
# Note that Centos5 seems to require .ssh/authorized_keys chmod go-rwx.
su - buildbot
mkdir .ssh
chmod go-rwx .ssh
cat >.ssh/authorized_keys
# Paste the id_dsa.pub key, see above.
chmod go-rwx .ssh/authorized_keys
```
Image for rpm build
-------------------
```
qemu-img create -b vm-centos5-i386-serial.qcow2 -f qcow2 vm-centos5-i386-build.qcow2
kvm -m 2047 -hda /kvm/vms/vm-centos5-i386-build.qcow2 -cdrom /kvm/CentOS-5.3-i386-bin-DVD.iso -redir 'tcp:2225::22' -boot c -smp 2 -cpu qemu32,-nx -net nic,model=virtio -net user -nographic
```
Install compilers etc:
```
sudo yum groupinstall "Development Tools"
sudo yum install gperf readline-devel ncurses-devel zlib-devel libaio-devel openssl-devel perl perl\(DBI\)
```
Download 5.0 rpm for shared-compat:
```
sudo mkdir -p /srv/shared/yum/CentOS/5/i386/RPMS/
cd /srv/shared/yum/CentOS/5/i386/RPMS/
sudo wget http://mirror.ourdelta.org/yum/CentOS/5/i386/RPMS/MySQL-OurDelta-shared-5.0.87.d10-65.el5.i386.rpm
```
Image for install/test
----------------------
```
qemu-img create -b vm-centos5-i386-serial.qcow2 -f qcow2 vm-centos5-i386-install.qcow2
kvm -m 2047 -hda /kvm/vms/vm-centos5-i386-install.qcow2 -cdrom /kvm/CentOS-5.3-i386-bin-DVD.iso -redir 'tcp:2225::22' -boot c -smp 2 -cpu qemu32,-nx -net nic,model=virtio -net user -nographic
```
Install extra dependencies:
```
sudo yum install perl perl\(DBI\)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema events_transactions_history Table Performance Schema events\_transactions\_history Table
======================================================
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**The events\_transactions\_history table was introduced in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/).
The `events_transactions_history` table contains the most recent completed transaction events for each thread.
The number of records stored per thread in the table is determined by the [performance\_schema\_events\_transactions\_history\_size](../performance-schema-system-variables/index#performance_schema_events_transactions_history_size) system variable, which is autosized on startup.
If adding a completed transaction event would cause the table to exceed this limit, the oldest thread row is discarded.
All of a thread's rows are discarded when the thread ends.
The table contains the following columns:
| Column | Type | Description |
| --- | --- | --- |
| THREAD\_ID | bigint(20) unsigned | The thread associated with the event. |
| EVENT\_ID | bigint(20) unsigned | The event id associated with the event. |
| END\_EVENT\_ID | bigint(20) unsigned | This column is set to NULL when the event starts and updated to the thread current event number when the event ends. |
| EVENT\_NAME | varchar(128) | The name of the instrument from which the event was collected. This is a NAME value from the setup\_instruments table. |
| STATE | enum('ACTIVE', 'COMMITTED',' ROLLED BACK') | The current transaction state. The value is ACTIVE (after START TRANSACTION or BEGIN), COMMITTED (after COMMIT), or ROLLED BACK (after ROLLBACK). |
| TRX\_ID | bigint(20) unsigned | Unused. |
| GTID | varchar(64) | Transaction [GTID](../gtid/index), using the format DOMAIN-SERVER\_ID-SEQUENCE\_NO. |
| XID\_FORMAT\_ID | int(11) | XA transaction format ID for GTRID and BQUAL values. |
| XID\_GTRID | varchar(130) | XA global transaction ID. |
| XID\_BQUAL | varchar(130) | XA transaction branch qualifier. |
| XA\_STATE | varchar(64) | The state of the XA transaction. The value is ACTIVE (after XA START), IDLE (after XA END), PREPARED (after XA PREPARE), ROLLED BACK (after XA ROLLBACK), or COMMITTED (after XA COMMIT). |
| SOURCE | varchar(64) | The name of the source file containing the instrumented code that produced the event and the line number in the file at which the instrumentation occurs. |
| TIMER\_START | bigint(20) unsigned | The unit is picoseconds. When event timing started. NULL if event has no timing information. |
| TIMER\_END | bigint(20) unsigned | The unit is picoseconds. When event timing ended. NULL if event has no timing information. |
| TIMER\_WAIT | bigint(20) unsigned | The unit is picoseconds. Event duration. NULL if event has not timing information. |
| ACCESS\_MODE | enum('READ ONLY', 'READ WRITE') | Transaction access mode. |
| ISOLATION\_LEVEL | varchar(64) | Transaction isolation level. One of: REPEATABLE READ, READ COMMITTED, READ UNCOMMITTED, or SERIALIZABLE. |
| AUTOCOMMIT | enum('YES', 'NO') | NO |
| NUMBER\_OF\_SAVEPOINTS | bigint(20) unsigned | The number of SAVEPOINT statements issued during the transaction. |
| NUMBER\_OF\_ROLLBACK\_TO\_SAVEPOINT | bigint(20) unsigned | The number of ROLLBACK\_TO\_SAVEPOINT statements issued during the transaction. |
| NUMBER\_OF\_RELEASE\_SAVEPOINT | bigint(20) unsigned | The number of RELEASE\_SAVEPOINT statements issued during the transaction. |
| OBJECT\_INSTANCE\_BEGIN | bigint(20) unsigned | Unused. |
| NESTING\_EVENT\_ID | bigint(20) unsigned | The EVENT\_ID value of the event within which this event is nested. |
| NESTING\_EVENT\_TYPE | enum('TRANSACTION',' STATEMENT', 'STAGE', 'WAIT') | The nesting event type. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Subqueries and JOINs Subqueries and JOINs
====================
A [subquery](../subqueries/index) can quite often, but not in all cases, be rewritten as a [JOIN](../join/index).
Rewriting Subqueries as JOINS
-----------------------------
A subquery using `IN` can be rewritten with the `DISTINCT` keyword, for example:
```
SELECT * FROM table1 WHERE col1 IN (SELECT col1 FROM table2);
```
can be rewritten as:
```
SELECT DISTINCT table1.* FROM table1, table2 WHERE table1.col1=table2.col1;
```
`NOT IN` or `NOT EXISTS` queries can also be rewritten. For example, these two queries returns the same result:
```
SELECT * FROM table1 WHERE col1 NOT IN (SELECT col1 FROM table2);
SELECT * FROM table1 WHERE NOT EXISTS (SELECT col1 FROM table2 WHERE table1.col1=table2.col1);
```
and both can be rewritten as:
```
SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE table2.id IS NULL;
```
Subqueries that can be rewritten as a LEFT JOIN are sometimes more efficient.
Using Subqueries instead of JOINS
---------------------------------
There are some scenarios, though, which call for subqueries rather than joins:
* When you want duplicates, but not false duplicates. Suppose `Table_1` has three rows — {`1`,`1`,`2`} — and `Table_2` has two rows — {`1`,`2`,`2`}. If you need to list the rows in `Table_1` which are also in `Table_2`, only this subquery-based `SELECT` statement will give the right answer (`1`,`1`,`2`):
```
SELECT Table_1.column_1
FROM Table_1
WHERE Table_1.column_1 IN
(SELECT Table_2.column_1
FROM Table_2);
```
* This SQL statement won't work:
```
SELECT Table_1.column_1
FROM Table_1,Table_2
WHERE Table_1.column_1 = Table_2.column_1;
```
* because the result will be {`1`,`1`,`2`,`2`} — and the duplication of 2 is an error. This SQL statement won't work either:
```
SELECT DISTINCT Table_1.column_1
FROM Table_1,Table_2
WHERE Table_1.column_1 = Table_2.column_1;
```
* because the result will be {`1`,`2`} — and the removal of the duplicated 1 is an error too.
* When the outermost statement is not a query. The SQL statement:
```
UPDATE Table_1 SET column_1 = (SELECT column_1 FROM Table_2);
```
* can't be expressed using a join unless some rare SQL3 features are used.
* When the join is over an expression. The SQL statement:
```
SELECT * FROM Table_1
WHERE column_1 + 5 =
(SELECT MAX(column_1) FROM Table_2);
```
* is hard to express with a join. In fact, the only way we can think of is this SQL statement:
```
SELECT Table_1.*
FROM Table_1,
(SELECT MAX(column_1) AS max_column_1 FROM Table_2) AS Table_2
WHERE Table_1.column_1 + 5 = Table_2.max_column_1;
```
* which still involves a parenthesized query, so nothing is gained from the transformation.
* When you want to see the exception. For example, suppose the question is: what books are longer than Das Kapital? These two queries are effectively almost the same:
```
SELECT DISTINCT Bookcolumn_1.*
FROM Books AS Bookcolumn_1 JOIN Books AS Bookcolumn_2 USING(page_count)
WHERE title = 'Das Kapital';
SELECT DISTINCT Bookcolumn_1.*
FROM Books AS Bookcolumn_1
WHERE Bookcolumn_1.page_count >
(SELECT DISTINCT page_count
FROM Books AS Bookcolumn_2
WHERE title = 'Das Kapital');
```
* The difference is between these two SQL statements is, if there are two editions of *Das Kapital* (with different page counts), then the self-join example will return the books which are longer than the shortest edition of *Das Kapital*. That might be the wrong answer, since the original question didn't ask for "... longer than `ANY` book named *Das Kapital*" (it seems to contain a false assumption that there's only one edition).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Differences between JSON_QUERY and JSON_VALUE Differences between JSON\_QUERY and JSON\_VALUE
===============================================
**MariaDB starting with [10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/)**JSON functions were added in [MariaDB 10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/).
The primary difference between the two functions is that *JSON\_QUERY* returns an object or an array, while *JSON\_VALUE* returns a scalar.
Take the following JSON document as an example
```
SET @json='{ "x": [0,1], "y": "[0,1]", "z": "Monty" }';
```
Note that data member "x" is an array, and data members "y" and "z" are strings. The following examples demonstrate the differences between the two functions.
```
SELECT JSON_QUERY(@json,'$'), JSON_VALUE(@json,'$');
+--------------------------------------------+-----------------------+
| JSON_QUERY(@json,'$') | JSON_VALUE(@json,'$') |
+--------------------------------------------+-----------------------+
| { "x": [0,1], "y": "[0,1]", "z": "Monty" } | NULL |
+--------------------------------------------+-----------------------+
SELECT JSON_QUERY(@json,'$.x'), JSON_VALUE(@json,'$.x');
+-------------------------+-------------------------+
| JSON_QUERY(@json,'$.x') | JSON_VALUE(@json,'$.x') |
+-------------------------+-------------------------+
| [0,1] | NULL |
+-------------------------+-------------------------+
SELECT JSON_QUERY(@json,'$.y'), JSON_VALUE(@json,'$.y');
+-------------------------+-------------------------+
| JSON_QUERY(@json,'$.y') | JSON_VALUE(@json,'$.y') |
+-------------------------+-------------------------+
| NULL | [0,1] |
+-------------------------+-------------------------+
SELECT JSON_QUERY(@json,'$.z'), JSON_VALUE(@json,'$.z');
+-------------------------+-------------------------+
| JSON_QUERY(@json,'$.z') | JSON_VALUE(@json,'$.z') |
+-------------------------+-------------------------+
| NULL | Monty |
+-------------------------+-------------------------+
SELECT JSON_QUERY(@json,'$.x[0]'), JSON_VALUE(@json,'$.x[0]');
+----------------------------+----------------------------+
| JSON_QUERY(@json,'$.x[0]') | JSON_VALUE(@json,'$.x[0]') |
+----------------------------+----------------------------+
| NULL | 0 |
+----------------------------+----------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysql.event Table mysql.event Table
=================
The `mysql.event` table contains information about MariaDB [events](../stored-programs-and-views-events/index). Similar information can be obtained by viewing the [INFORMATION\_SCHEMA.EVENTS](../information-schema-events-table/index) table, or with the [SHOW EVENTS](show-event) and [SHOW CREATE EVENT](../show-create-event/index) statements.
The table is upgraded live, and there is no need to restart the server if the table has changed.
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, this table uses the [Aria](../aria/index) storage engine.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and before, this table uses the [MyISAM](../myisam-storage-engine/index) storage engine.
The `mysql.event` table contains the following fields:
| Field | Type | Null | Key | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `db` | `char(64)` | NO | PRI | | |
| `name` | `char(64)` | NO | PRI | | |
| `body` | `longblob` | NO | | `NULL` | |
| `definer` | `char(141)` | NO | | | |
| `execute_at` | `datetime` | YES | | `NULL` | |
| `interval_value` | `int(11)` | YES | | `NULL` | |
| `interval_field` | `enum('YEAR', 'QUARTER', 'MONTH', 'DAY', 'HOUR', 'MINUTE', 'WEEK', 'SECOND', 'MICROSECOND', 'YEAR_MONTH', 'DAY_HOUR', 'DAY_MINUTE', 'DAY_SECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'MINUTE_SECOND', 'DAY_MICROSECOND', 'HOUR_MICROSECOND', 'MINUTE_MICROSECOND', 'SECOND_MICROSECOND')` | YES | | `NULL` | |
| `created` | `timestamp` | NO | | `CURRENT_TIMESTAMP` | |
| `modified` | `timestamp` | NO | | 0000-00-00 00:00:00 | |
| `last_executed` | `datetime` | YES | | `NULL` | |
| `starts` | `datetime` | YES | | `NULL` | |
| `ends` | `datetime` | YES | | `NULL` | |
| `status` | `enum('ENABLED', 'DISABLED', 'SLAVESIDE_DISABLED')` | NO | | `ENABLED` | Current status of the event, one of enabled, disabled, or disabled on the slaveside. |
| `on_completion` | `enum('DROP','PRESERVE')` | NO | | `DROP` | |
| `sql_mode` | `set('REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH')` | NO | | | The [SQL\_MODE](../sql-mode/index) at the time the event was created. |
| `comment` | `char(64)` | NO | | | |
| `originator` | `int(10) unsigned` | NO | | `NULL` | |
| `time_zone` | `char(64)` | NO | | `SYSTEM` | |
| `character_set_client` | `char(32)` | YES | | `NULL` | |
| `collation_connection` | `char(32)` | YES | | `NULL` | |
| `db_collation` | `char(32)` | YES | | `NULL` | |
| `body_utf8` | `longblob` | YES | | `NULL` | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Certified S3 Object Storage Providers Certified S3 Object Storage Providers
=====================================
### Hardware (On Prem)
* [Quantum ActiveScale](https://www.quantum.com/en/products/object-storage)
* [IBM Cloud Object Storage](https://www.ibm.com/cloud/object-storage) (*Formerly known as CleverSafe*)
* [DELL EMC](https://www.delltechnologies.com/sk-sk/storage/ecs/index.htm)
### Cloud (IaaS)
* [AWS S3](https://aws.amazon.com/pm/serv-s3)
* [Google GCS](https://cloud.google.com/storage)
* [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/)
### Software Based
*Due to the frequent code changes and deviation from the AWS standards, none are approved at this time.*
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Obsolete Table Commands Obsolete Table Commands
========================
Table commands that have been removed from MariaDB
| Title | Description |
| --- | --- |
| [BACKUP TABLE (removed)](../backup-table-removed/index) | For backing up tables. Removed. |
| [RESTORE TABLE (removed)](../restore-table-removed/index) | Restores a table from a backup. Removed. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ColumnStore Data Manipulation Statements ColumnStore Data Manipulation Statements
=========================================
ColumnStore SQL statements for querying and manipulating data, such as SELECT, UPDATE, DELETE etc.
| Title | Description |
| --- | --- |
| [ColumnStore Select](../columnstore-select/index) | Used to query the database and display table data |
| [ColumnStore Insert](../columnstore-insert/index) | Add data to tables |
| [ColumnStore Update](../columnstore-update/index) | The UPDATE statement changes data stored in rows. Syntax Single-table syntax: UPDATE tabl |
| [ColumnStore Delete](../columnstore-delete/index) | Used to remove rows from tables |
| [ColumnStore LOAD DATA INFILE](../columnstore-load-data-infile/index) | Using the LOAD DATA INFILE statement for bulk data loading. |
| [Analyzing Queries in ColumnStore](../analyzing-queries-in-columnstore/index) | Utilities and commands to monitor queries and their performance |
| [ColumnStore Disk-Based Joins](../columnstore-disk-based-joins/index) | How to enable disk-based joins on the UM node |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SQLPro Studio SQLPro Studio
=============
[SQLPro Studio](https://sqlprostudio.com/) is a fully native database client for macOS [macOS](https://sqlprostudio.com/) and [iOS](https://apps.apple.com/app/sqlpro-studio-database-client/id1273366668). It supports databases such as MySQL, Postgres, Microsoft SQL Server, SQLite, Oracle and more.

Features include:
* Syntax highlighting & Autocomplete (sometimes called intellisense).
* Customizable themes allowing the query editor to be completely customized.
* The ability to run multiple queries at one time (and a customizable run query shortcut).
* Improved query error detection (errors in queries will be underlined red).
* Full dark mode & light mode support, along with custom themes.
Other features include:
* Complete SSH Tunnel support.
* Inline data filtering.
* Exporting & Exporting options to CSV, JSON & XML.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SQL_ERROR_LOG Plugin System Variables SQL\_ERROR\_LOG Plugin System Variables
=======================================
This page documents system variables related to the [SQL\_Error\_Log Plugin](../sql_error_log-plugin/index). See [Server System Variables](../server-system-variables/index) for a complete list of system variables and instructions on setting them.
See also the [Full list of MariaDB options, system and status variables](../full-list-of-mariadb-options-system-and-status-variables/index).
#### `sql_error_log_filename`
* **Description:** The name (and optionally path) of the logfile containing the errors. Rotation will use a naming convention such as `sql_error_log_filename.001`. If no path is specified, the log file will be written to the [data directory](../server-system-variables/index#datadir).
* **Commandline:** `--sql-error-log-filename=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:** `sql_errors.log`
---
#### `sql_error_log_rate`
* **Description:** The logging sampling rate. Setting to `10`, for example, means that one in ten errors will be logged. If set to zero, logging is disabled. The default, `1`, logs every error.
* **Commandline:** `--sql-error-log-rate=#`
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** `string`
* **Default Value:** `1`
---
#### `sql_error_log_rotate`
* **Description:** Setting to #1 `forces log rotation.`
* **Commandline:** `--sql-error-log-rate[={0|1}]`
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** `boolean`
* **Default Value:** `OFF`
---
#### `sql_error_log_rotations`
* **Description:** Number of rotations before the log is removed. When rotated, the current log file is stored and a new, empty, log is created. Any rotations older than this setting are removed.
* **Commandline:** `--sql-error-log-rotations=#`
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** `numeric`
* **Default Value:** `9`
* **Range:** `1` to `999`
---
#### `sql_error_log_size_limit`
* **Description:** The log file size limit in bytes. After reaching this size, the log file is rotated.
* **Commandline:** `--sql-error-log-size-limit=#`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `numeric`
* **Default Value:** `1000000`
* **Range:** `100` to `9223372036854775807`
---
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Sample my.cnf Files Sample my.cnf Files
===================
Place holder for sample my.cnf files, customized for different memory size and storage engines. In addition, we'd like to hear from you what works for you, so the knowledge can be crowd-sourced and shared.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MultiPolygonFromWKB MultiPolygonFromWKB
===================
Synonym for [MPolyFromWKB](../mpolyfromwkb/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Repairing MariaDB Tables for SQL Server Users Repairing MariaDB Tables for SQL Server Users
=============================================
Repairing tables in MariaDB is not similar to repairing tables in SQL Server.
The first thing to understand is that every MariaDB table is handled by a [storage engine](../understanding-mariadb-architecture/index#storage-engines). Storage engines are plugins that know how to physically read and write a table, so each storage engine allows one to repair tables in different ways. The default storage engine is [InnoDB](../innodb/index).
MariaDB provides specific SQL statements to deal with corrupted tables:
* [CHECK TABLE](../check-table/index) checks if a table is corrupted;
* [REPAIR TABLE](../repair-table/index) repairs a table if it is corrupted.
As a general rule, there is no reason why a table that is corrupted on a master should also be corrupted on the slaves. Therefore, `REPAIR` is generally used with the `NO_WRITE_TO_BINLOG` option, to avoid replicating it to the slaves.
Partitioned Tables
------------------
[Partitioned tables](../partitioning-tables/index) are normally split into multiple physical files (one per partition). Even if one of the partitions is corrupted, in most cases other partitions are healthy.
For this reason, `CHECK TABLE` and `REPAIR TABLE` don't work on partitioned tables. Instead, use [ALTER TABLE](../alter-table/index) to check or repair a single partition.
For example:
```
ALTER TABLE orders CHECK PARTITION p_2019, p_2020;
ALTER TABLE orders REPAIR PARTITION p_2019, p_2020;
```
Indexes
-------
Indexes can get corrupted. However, as long as data is not corrupted, indexes can always be dropped and rebuilt with [ALTER TABLE](../alter-table/index):
```
ALTER TABLE customer DROP INDEX idx_email;
ALTER TABLE customer ADD INDEX idx_email (email);
```
Checking and Repairing Tables
-----------------------------
Here we discuss how to repair tables, depending on the storage engine.
### InnoDB
InnoDB follows the "fail fast" philosophy. If table corruption is detected, by default InnoDB deliberately causes MariaDB to crash to avoid corruption propagation, logging an error into the [error log](../error-log/index). This happens even if the corruption is found with a `CHECK TABLE` statement. This behavior can be changed with the [innodb\_corrupt\_table\_action](../innodb-system-variables/index#innodb_corrupt_table_action) server variable.
To repair an InnoDB table after a crash:
1. Restart MariaDB with the `[--innodb-force-recovery](../innodb-system-variables/index#innodb_force_recovery)` option set to a low but non-zero value.
2. If MariaDB fails to start, retry with a higher value. Repeat until you succeed.
At this point, you can follow two different procedures, depending if you can use a backup or not. Provided that you have a usable backup, it is often the best option to bring the database up quickly. But if you want to reduce the data loss as much as possible, you prefer to follow the second method.
Restoring a backup:
1. Drop the whole database with [DROP DATABASE](../drop-database/index).
2. Restore a backup of the database. The exact procedure depends on the [type of backup](../mariadb-backups-overview-for-sql-server-users/index).
Recovering existing data:
1. Dump data from the corrupter table, ordered by primary key. MariaDB could crash when it finds damaged data. Repeat the process skipping damaged data.
2. Save somewhere the table structure with [SHOW CREATE TABLE](../show-create-table/index).
3. Restart MariaDB.
4. Drop the table with [DROP TABLE](../drop-table/index).
5. Recreate the table and restore the dump.
For more details, see [InnoDB Recovery Modes](../innodb-recovery-modes/index).
### Aria and MyISAM
[MyISAM](../myisam-storage-engine/index) is not crash-safe. In case of a MariaDB crash, the changes applied to MyISAM tables but not yet flushed to the disk are lost.
[Aria](../aria/index) is crash-safe by default, which means that in case of a crash, after repairing any table that is damaged, no changes are lost. However, Aria tables are not crash-safe if created with `TRANSACTIONAL=0` or `ROW_FORMAT` set to `FIXED` or `DYNAMIC`.
System tables use the Aria storage engine and they are crash-safe.
To check if a MyISAM/Aria table is corrupted, we can use [CHECK TABLE](../check-table/index). To repair a MyISAM/Aria table, one can use [REPAIR TABLE](../repair-table/index). Before running `REPAIR TABLE` against big tables, consider increasing [myisam\_repair\_threads](../myisam-system-variables/index#myisam_repair_threads) or [aria\_repair\_threads](../aria-system-variables/index#aria_repair_threads).
MyISAM and Aria tables can also be automatically repaired when corruption is detected. This is particularly useful for Aria, in case corrupted system tables prevent MariaDB from starting. See [myisam\_recover\_options](../myisam-system-variables/index#myisam_recover_options) and [aria\_recover\_options](../aria-system-variables/index#aria_recover_options). By default Aria runs the quickest repair type. Occasionally, to repair a system table, we may have to start MariaDB in this way:
```
mysqld --aria-recover-options=BACKUP,FORCE
```
It is also possible to stop MariaDB and repair MyISAM tables with [myisamchk](../myisamchk/index), and Aria tables with [aria\_chk](../aria_chk/index). With default values, a repair can be unnecessarily very slow. Before running these tools, be sure to check the [Memory and Disk Use With myisamchk](../memory-and-disk-use-with-myisamchk/index) page.
### Other Storage Engines
Notes on the different storage engines:
* For [MyRocks](../myrocks/index), see [MyRocks and CHECK TABLE](../myrocks-and-check-table/index).
* With [ARCHIVE](../archive/index), `REPAIR TABLE` also improves the compression rate.
* For [CSV](../csv/index), see [Checking and Rpairing CSV Tables](../checking-and-repairing-csv-tables/index).
* Some special storage engines, like [MEMORY](../memory-storage-engine/index) or [BLACKHOLE](../blackhole/index), do not support any form of check and repair.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InnoDB Encryption InnoDB Encryption
==================
Data-at-rest encryption configuration and use with the InnoDB storage engine.
| Title | Description |
| --- | --- |
| [InnoDB Encryption Overview](../innodb-encryption-overview/index) | Data-at-rest encryption for tables that use the InnoDB storage engine. |
| [Enabling InnoDB Encryption](../innodb-enabling-encryption/index) | Configuration and procedure for enabling data-at-rest encryption for InnoDB tables. |
| [Disabling InnoDB Encryption](../disabling-innodb-encryption/index) | Configuration and procedure to disable data-at-rest encryption for InnoDB tables. |
| [InnoDB Background Encryption Threads](../innodb-background-encryption-threads/index) | InnoDB performs some encryption and decryption operations with background encryption threads. |
| [InnoDB Encryption Keys](../innodb-encryption-keys/index) | InnoDB uses encryption key management plugins to support the use of multiple encryption keys. |
| [InnoDB Encryption Troubleshooting](../innodb-encryption-troubleshooting/index) | Troubleshooting InnoDB encryption |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb FIRST_VALUE FIRST\_VALUE
============
**MariaDB starting with [10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/)**The FIRST\_VALUE() function was first introduced with other [window functions](../window-functions/index) in [MariaDB 10.2](../what-is-mariadb-102/index).
Syntax
------
```
FIRST_VALUE(expr) OVER (
[ PARTITION BY partition_expression ]
[ ORDER BY order_list ]
)
```
Description
-----------
`FIRST_VALUE` returns the first result from an ordered set, or NULL if no such result exists.
Examples
--------
```
CREATE TABLE t1 (
pk int primary key,
a int,
b int,
c char(10),
d decimal(10, 3),
e real
);
INSERT INTO t1 VALUES
( 1, 0, 1, 'one', 0.1, 0.001),
( 2, 0, 2, 'two', 0.2, 0.002),
( 3, 0, 3, 'three', 0.3, 0.003),
( 4, 1, 2, 'three', 0.4, 0.004),
( 5, 1, 1, 'two', 0.5, 0.005),
( 6, 1, 1, 'one', 0.6, 0.006),
( 7, 2, NULL, 'n_one', 0.5, 0.007),
( 8, 2, 1, 'n_two', NULL, 0.008),
( 9, 2, 2, NULL, 0.7, 0.009),
(10, 2, 0, 'n_four', 0.8, 0.010),
(11, 2, 10, NULL, 0.9, NULL);
SELECT pk, FIRST_VALUE(pk) OVER (ORDER BY pk) AS first_asc,
LAST_VALUE(pk) OVER (ORDER BY pk) AS last_asc,
FIRST_VALUE(pk) OVER (ORDER BY pk DESC) AS first_desc,
LAST_VALUE(pk) OVER (ORDER BY pk DESC) AS last_desc
FROM t1
ORDER BY pk DESC;
+----+-----------+----------+------------+-----------+
| pk | first_asc | last_asc | first_desc | last_desc |
+----+-----------+----------+------------+-----------+
| 11 | 1 | 11 | 11 | 11 |
| 10 | 1 | 10 | 11 | 10 |
| 9 | 1 | 9 | 11 | 9 |
| 8 | 1 | 8 | 11 | 8 |
| 7 | 1 | 7 | 11 | 7 |
| 6 | 1 | 6 | 11 | 6 |
| 5 | 1 | 5 | 11 | 5 |
| 4 | 1 | 4 | 11 | 4 |
| 3 | 1 | 3 | 11 | 3 |
| 2 | 1 | 2 | 11 | 2 |
| 1 | 1 | 1 | 11 | 1 |
+----+-----------+----------+------------+-----------+
```
```
CREATE OR REPLACE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SELECT i,
FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and 1 FOLLOWING) AS f_1f,
LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW and 1 FOLLOWING) AS l_1f,
FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS f_1p1f,
LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS f_1p1f,
FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS f_2p1p,
LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) AS f_2p1p,
FIRST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS f_1f2f,
LAST_VALUE(i) OVER (ORDER BY i ROWS BETWEEN 1 FOLLOWING AND 2 FOLLOWING) AS f_1f2f
FROM t1;
+------+------+------+--------+--------+--------+--------+--------+--------+
| i | f_1f | l_1f | f_1p1f | f_1p1f | f_2p1p | f_2p1p | f_1f2f | f_1f2f |
+------+------+------+--------+--------+--------+--------+--------+--------+
| 1 | 1 | 2 | 1 | 2 | NULL | NULL | 2 | 3 |
| 2 | 2 | 3 | 1 | 3 | 1 | 1 | 3 | 4 |
| 3 | 3 | 4 | 2 | 4 | 1 | 2 | 4 | 5 |
| 4 | 4 | 5 | 3 | 5 | 2 | 3 | 5 | 6 |
| 5 | 5 | 6 | 4 | 6 | 3 | 4 | 6 | 7 |
| 6 | 6 | 7 | 5 | 7 | 4 | 5 | 7 | 8 |
| 7 | 7 | 8 | 6 | 8 | 5 | 6 | 8 | 9 |
| 8 | 8 | 9 | 7 | 9 | 6 | 7 | 9 | 10 |
| 9 | 9 | 10 | 8 | 10 | 7 | 8 | 10 | 10 |
| 10 | 10 | 10 | 9 | 10 | 8 | 9 | NULL | NULL |
+------+------+------+--------+--------+--------+--------+--------+--------+
```
See Also
--------
* [LAST\_VALUE](../last_value/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb CEIL CEIL
====
Syntax
------
```
CEIL(X)
```
Description
-----------
CEIL() is a synonym for [CEILING()](../ceiling/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ColumnStore User Defined Aggregate and Window Functions ColumnStore User Defined Aggregate and Window Functions
=======================================================
Introduction
------------
Starting with MariaDB ColumnStore 1.1, the ability to create and use user defined aggregate and window functions is supported in addition to scalar functions. With Columnstore 1.2, multiple parameters are supported. A C++ SDK is provided as well as 3 reference examples that provide additional functions that may be of general use:
* **median** - mathematical median, equivalent to percentile\_cont(0.5)
* **avg\_mode** - mathematical mode, i.e the most frequent value in the set
* **ssq** - sum of squares, i.e the sum of each individual number squared in the set
Similar to built in functions, the SDK supports distributed aggregate execution where as much of the calculation is scaled out across PM nodes and then collected / finalized in the UM node. Window functions (due to the ordering requirement) are only executed at the UM level.
Using user defined aggregate functions
--------------------------------------
The reference examples above are included in the standard build of MariaDB ColumnStore and so can be used by registering them as user defined aggregate functions. The same can be done for new functions assuming the instance has the updated libraries included. From a mcsmysql prompt:
```
CREATE AGGREGATE FUNCTION median returns REAL soname 'libudf_mysql.so';
CREATE AGGREGATE FUNCTION avg_mode returns REAL soname 'libudf_mysql.so';
CREATE AGGREGATE FUNCTION ssq returns REAL soname 'libudf_mysql.so';
```
After this these may be used in the same way as any other aggregate or window function like sum:
```
SELECT grade,
AVG(loan_amnt) avg,
MEDIAN(loan_amnt) median
FROM loanstats
GROUP BY grade
ORDER BY grade;
```
Developing a new function
-------------------------
This requires a MariaDB ColumnStore source tree and necessary tools to compile C/C++ code. The SDK and reference examples are available in the [utils/udfsdk](https://github.com/mariadb-corporation/mariadb-columnstore-engine/tree/master/utils/udfsdk) directory of the source tree. This contains the SDK documentation which is also available here:
* [1.2.x UDAF SDK Guide](https://mariadb.com/kb/en/columnstore-user-defined-aggregate-and-window-functions/+attachment/mariadb_columnstore_udaf_sdk_1-2 "1.2.x UDAF SDK Guide")
Limitations
-----------
* The implementation of the median and avg\_mode functions will scale in memory consumption to the size of the set of unique values in the aggregation.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb JSON_EXTRACT JSON\_EXTRACT
=============
**MariaDB starting with [10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/)**JSON functions were added in [MariaDB 10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/).
Syntax
------
```
JSON_EXTRACT(json_doc, path[, path] ...)
```
Description
-----------
Extracts data from a JSON document. The extracted data is selected from the parts matching the path arguments. Returns all matched values; either as a single matched value, or, if the arguments could return multiple values, a result autowrapped as an array in the matching order.
Returns NULL if no paths match or if any of the arguments are NULL.
An error will occur if any path argument is not a valid path, or if the json\_doc argument is not a valid JSON document.
The path expression be a [JSONPath expression](../jsonpath-expressions/index) as supported by MariaDB
Examples
--------
```
SET @json = '[1, 2, [3, 4]]';
SELECT JSON_EXTRACT(@json, '$[1]');
+-----------------------------+
| JSON_EXTRACT(@json, '$[1]') |
+-----------------------------+
| 2 |
+-----------------------------+
SELECT JSON_EXTRACT(@json, '$[2]');
+-----------------------------+
| JSON_EXTRACT(@json, '$[2]') |
+-----------------------------+
| [3, 4] |
+-----------------------------+
SELECT JSON_EXTRACT(@json, '$[2][1]');
+--------------------------------+
| JSON_EXTRACT(@json, '$[2][1]') |
+--------------------------------+
| 4 |
+--------------------------------+
```
See Also
--------
* [JSON video tutorial](https://www.youtube.com/watch?v=sLE7jPETp8g) covering JSON\_EXTRACT.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Selecting Data Selecting Data
===============
The `SELECT` statement is used for retrieving data from tables, for select specific data, often based on a criteria given in the `WHERE` clause.
| Title | Description |
| --- | --- |
| [SELECT](../select/index) | SQL statement used primarily for retrieving data from a MariaDB database. |
| [Joins & Subqueries](../joins-subqueries/index) | Documentation on the JOIN, UNION, EXCEPT and INTERSECT clauses, and on subqueries. |
| [LIMIT](../limit/index) | Documentation of the LIMIT clause. |
| [ORDER BY](../order-by/index) | Order the results returned from a resultset. |
| [GROUP BY](../group-by/index) | Aggregate data in a SELECT statement with the GROUP BY clause. |
| [Common Table Expressions](../common-table-expressions/index) | Common table expressions are temporary named result sets |
| [SELECT WITH ROLLUP](../select-with-rollup/index) | Adds extra rows to the resultset that represent super-aggregate summaries |
| [SELECT INTO OUTFILE](../select-into-outfile/index) | Write the resultset to a formatted file |
| [SELECT INTO DUMPFILE](../select-into-dumpfile/index) | Write a binary string into file |
| [FOR UPDATE](../for-update/index) | Acquires a lock on the rows |
| [LOCK IN SHARE MODE](../lock-in-share-mode/index) | Acquires a write lock. |
| [Optimizer Hints](../optimizer-hints/index) | Optimizer hints There are some options available in SELECT to affect the ex... |
| [PROCEDURE](../procedure/index) | The PROCEDURE Clause of the SELECT Statement. |
| [HANDLER](../handler/index) | Direct access to reading rows from the storage engine. |
| [DUAL](../dual/index) | Dummy table name |
| [SELECT ... OFFSET ... FETCH](../select-offset-fetch/index) | Allows one to specify an offset, a number of rows to be returned, and wheth... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ALTER VIEW ALTER VIEW
==========
Syntax
------
```
ALTER
[ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]
```
Description
-----------
This statement changes the definition of a [view](../views/index), which must exist. The syntax is similar to that for [CREATE VIEW](../create-view/index) and the effect is the same as for `CREATE OR REPLACE VIEW` if the view exists. This statement requires the `CREATE VIEW` and `DROP` [privileges](../grant/index#table-privileges) for the view, and some privilege for each column referred to in the `SELECT` statement. `ALTER VIEW` is allowed only to the definer or users with the [SUPER](../grant/index#global-privileges) privilege.
Example
-------
```
ALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;
```
See Also
--------
* [CREATE VIEW](../create-view/index)
* [DROP VIEW](../drop-view/index)
* [SHOW CREATE VIEW](../show-create-view/index)
* [INFORMATION SCHEMA VIEWS Table](../information-schema-views-table/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_DISTANCE ST\_DISTANCE
============
Syntax
------
```
ST_DISTANCE(g1,g2)
```
Description
-----------
Returns the distance between two geometries, or null if not given valid inputs.
Example
-------
```
SELECT ST_Distance(POINT(1,2),POINT(2,2));
+------------------------------------+
| ST_Distance(POINT(1,2),POINT(2,2)) |
+------------------------------------+
| 1 |
+------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb aria_chk aria\_chk
=========
`aria_chk` is used to check, repair, optimize, sort and get information about [Aria](../aria/index) tables.
With the MariaDB server you can use [CHECK TABLE](../sql-commands-check-table/index), [REPAIR TABLE](../repair-table/index) and [OPTIMIZE TABLE](../optimize-table/index) to do similar things.
Note: `aria_chk` should not be used when MariaDB is running. MariaDB assumes that no one is changing the tables it's using!
Usage:
```
aria_chk [OPTIONS] aria_tables[.MAI]
```
Aria table information is stored in 2 files: the `.MAI` file contains base table information and the index and the `.MAD` file contains the data. `aria_chk` takes one or more `.MAI` files as arguments.
The following groups are read from the my.cnf files:
* `[maria_chk]`
* `[aria_chk]`
Options and Variables
---------------------
### Global Options
The following options to handle option files may be given as the first argument:
| Option | Description |
| --- | --- |
| ``--`print-defaults` | Print the program argument list and exit. |
| ``--`no-defaults` | Don't read default options from any option file. |
| ``--`defaults-file=#` | Only read default options from the given file #. |
| ``--`defaults-extra-file=#` | Read this file after the global files are read. |
### Main Arguments
| Option | Description |
| --- | --- |
| `-`#``, ``--`debug=...` | Output debug log. Often this is 'd:t:o,filename'. |
| `-H`, ``--`HELP` | Display this help and exit. |
| `-?`, ``--`help` | Display this help and exit. |
| ``--`datadir=path` | Path for control file (and logs if `--logdir` not used). |
| ``--`ignore-control-file` | Don't open the control file. Only use this if you are sure the tables are not used by another program |
| ``--`logdir=path` | Path for log files. |
| ``--`require-control-file` | Abort if we can't find/read the maria\_log\_control file |
| `-s`, ``--`silent` | Only print errors. One can use two -s to make aria\_chk very silent. |
| `-t`, ``--`tmpdir=path` | Path for temporary files. Multiple paths can be specified, separated by colon (:) on Unix or semicolon (;) on Windows. They will be used in a round-robin fashion. |
| `-v`, ``--`verbose` | Print more information. This can be used with `--description` and `--check`. Use many -v for more verbosity. |
| `-V`, ``--`version` | Print version and exit. |
| `-w`, ``--`wait` | Wait if table is locked. |
### Check Options (--check is the Default Action for aria\_chk):
| Option | Description |
| --- | --- |
| `-c`, ``--`check` | Check table for errors. |
| `-e`, ``--`extend-check` | Check the table VERY throughly. Only use this in extreme cases as aria\_chk should normally be able to find out if the table is ok even without this switch. |
| `-F`, ``--`fast` | Check only tables that haven't been closed properly. |
| `-C`, ``--`check-only-changed` | Check only tables that have changed since last check. |
| `-f`, ``--`force` | Restart with '`-r`' if there are any errors in the table. States will be updated as with '`--update-state`'. |
| `-i`, ``--`information` | Print statistics information about table that is checked. |
| `-m`, ``--`medium-check` | Faster than extend-check, and finds 99.99% of all errors. Should be good enough for most cases. |
| `-U`, ``--`update-state` | Mark tables as crashed if any errors were found and clean if check didn't find any errors but table was marked as 'not clean' before. This allows one to get rid of warnings like 'table not properly closed'. If table was updated, update also the timestamp for when the check was made. This option is on by default! Use `--skip-update-state` to disable. |
| `-T`, ``--`read-only` | Don't mark table as checked. |
### Recover (Repair) Options (When Using '--recover' or '--safe-recover'):
| Option | Description |
| --- | --- |
| `-B`, ``--`backup` | Make a backup of the .MAD file as 'filename-time.BAK'. |
| ``--`correct-checksum` | Correct checksum information for table. |
| `-D`, ``--`data-file-length=`#`` | Max length of data file (when recreating data file when it's full). |
| `-e`, ``--`extend-check` | Try to recover every possible row from the data file Normally this will also find a lot of garbage rows; Don't use this option if you are not totally desperate. |
| `-f`, ``--`force` | Overwrite old temporary files. |
| `-k`, ``--`keys-used=`#`` | Tell MARIA to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts. |
| ``--`max-record-length=`#`` | Skip rows bigger than this if aria\_chk can't allocate memory to hold it. |
| `-r`, ``--`recover` | Can fix almost anything except unique keys that aren't unique. |
| `-n`, ``--`sort-recover` | Forces recovering with sorting even if the temporary file would be very big. |
| `-p`, ``--`parallel-recover` | Uses the same technique as '-r' and '-n', but creates all the keys in parallel, in different threads. |
| `-o`, ``--`safe-recover` | Uses old recovery method; Slower than '-r' but can handle a couple of cases where '-r' reports that it can't fix the data file. |
| ``--`transaction-log` | Log repair command to transaction log. This is needed if one wants to use the maria\_read\_log to repeat the repair. |
| ``--`character-sets-dir=...` | Directory where character sets are. |
| ``--`set-collation=name` | Change the collation used by the index. |
| `-q`, ``--`quick` | Faster repair by not modifying the data file. One can give a second '`-q`' to force aria\_chk to modify the original datafile in case of duplicate keys. NOTE: Tables where the data file is currupted can't be fixed with this option. |
| `-u`, ``--`unpack` | Unpack file packed with [aria\_pack](../aria_pack/index). |
### Other Options
| Option | Description |
| --- | --- |
| `-a`, ``--`analyze` | Analyze distribution of keys. Will make some joins in MariaDB faster. You can check the calculated distribution by using '`--description --verbose table_name`'. |
| ``--`stats_method=name` | Specifies how index statistics collection code should treat NULLs. Possible values of name are "nulls\_unequal" (default for 4.1/5.0), "nulls\_equal" (emulate 4.0), and "nulls\_ignored". |
| `-d`, ``--`description` | Prints some information about table. |
| `-A`, ``--`set-auto-increment[=value]` | Force auto\_increment to start at this or higher value If no value is given, then sets the next auto\_increment value to the highest used value for the auto key + 1. |
| `-S`, ``--`sort-index` | Sort index blocks. This speeds up 'read-next' in applications. |
| `-R`, ``--`sort-records=`#`` | Sort records according to an index. This makes your data much more localized and may speed up things (It may be VERY slow to do a sort the first time!). |
| `-b`, ``--`block-search=`#`` | Find a record, a block at given offset belongs to. |
| `-z`, ``--`zerofill` | Remove transaction id's from the data and index files and fills empty space in the data and index files with zeroes. Zerofilling makes it possible to move the table from one system to another without the server having to do an automatic zerofill. It also allows one to compress the tables better if one want to archive them. |
| ``--`zerofill-keep-lsn` | Like `--zerofill` but does not zero out LSN of data/index pages. |
### Variables
| Option | Description |
| --- | --- |
| `page_buffer_size` | Size of page buffer. Used by `--safe-repair` |
| `read_buffer_size` | Read buffer size for sequential reads during scanning |
| `write_buffer_size` | Write buffer size for sequential writes during repair of fixed size or dynamic size rows |
| `sort_buffer_size` | Size of sort buffer. Used by `--recover` |
| `sort_key_blocks` | Internal buffer for sorting keys; Don't touch :) |
Usage
-----
One main usage of `aria_chk` is when you want to do a fast check of all Aria tables in your system. This is faster than doing it in MariaDB as you can allocate all free memory to the buffers.
Assuming you have a bit more than 2G free memory.
The following commands, run in the MariaDB data directory, check all your tables and repairs only those that have an error:
```
aria_chk --check --sort_order --force --sort_buffer_size=1G */*.MAI
```
If you want to optimize all your tables: (The `--zerofill` is used here to fill up empty space with `\0` which can speed up compressed backups).
```
aria_chk --analyze --sort-index --page_buffer_size=1G --zerofill */*.MAI
```
In case you have a serious problem and have to use `--safe-recover`:
```
aria_chk --safe-recover --zerofill --page_buffer_size=2G */*.MAI
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Using CONNECT - Partitioning and Sharding Using CONNECT - Partitioning and Sharding
=========================================
CONNECT supports the MySQL/MariaDB partition specification. It is done similar to the way [MyISAM](../myisam/index) or [InnoDB](../innodb/index) do by using the PARTITION engine that must be enabled for this to work. This type of partitioning is sometimes referred as “horizontal partitioning”.
Partitioning enables you to distribute portions of individual tables across a file system according to rules which you can set largely as needed. In effect, different portions of a table are stored as separate tables in different locations. The user-selected rule by which the division of data is accomplished is known as a partitioning function, which in MariaDB can be the modulus, simple matching against a set of ranges or value lists, an internal hashing function, or a linear hashing function.
CONNECT takes this notion a step further, by providing two types of partitioning:
1. File partitioning. Each partition is stored in a separate file like in multiple tables.
2. Table partitioning. Each partition is stored in a separate table like in TBL tables.
Partition engine issues
-----------------------
Using partitions sometimes requires creating the tables in an unnatural way to avoid some error due to several partition engine bugs:
1. Engine specific column and index options are not recognized and cause a syntax error when the table is created. The workaround is to create the table in two steps, a CREATE TABLE statement followed by an ALTER TABLE statement.
2. The connection string, when specified for the table, is lost by the partition engine. The workaround is to specify the connection string in the *option\_list*.
3. [MySQL upstream bug #71095](https://bugs.mysql.com/bug.php?id=71095). In case of list columns partitioning it sometimes causes a false “impossible where” clause to be raised. This makes a wrong void result returned when it should not be void. There is no workaround but this bug should be hopefully fixed.
The following examples are using the above workaround syntax to address these issues.
File Partitioning
-----------------
File partitioning applies to file-based CONNECT table types. As with multiple tables, physical data is stored in several files instead of just one. The differences to multiple tables are:
1. Data is distributed amongst the different files following the partition rule.
2. Unlike multiple tables, partitioned tables are not read only.
3. Unlike multiple tables, partitioned tables can be indexable.
4. The file names are generated from the partition names.
5. Query pruning is automatically made by the partition engine.
The table file names are generated differently depending on whether the table is an inward or outward table. For inward tables, for which the file name is not specified, the partition file names are:
```
Data file name: table_name#P#partition_name.table_file_type
Index file name: table_name#P#partition_name.index_file_type
```
For instance for the table:
```
CREATE TABLE t1 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=FIX
partition by range(id) (
partition first values less than(10),
partition middle values less than(50),
partition last values less than(MAXVALUE));
```
CONNECT will generate in the current data directory the files:
```
| t1#P#first.fix
| t1#P#first.fnx
| t1#P#middle.fix
| t1#P#middle.fnx
| t1#P#last.fix
| t1#P#last.fnx
```
This is similar to what the partition engine does for other engines - CONNECT partitioned inward tables behave like other engines partition tables do. Just the data format is different.
Note: If sub-partitioning is used, inward table files and index files are named:
```
| table_name#P#partition_name#SP#subpartition_name.type
| table_name#P#partition_name#SP#subpartition_name.index_type
```
### Outward Tables
The real problems occur with outward tables, in particular when they are created from already existing files. The first issue is to make the partition table use the correct existing file names. The second one, only for already existing not void tables, is to be sure the partitioning function match the distribution of the data already existing in the files.
The first issue is addressed by the way data file names are constructed. For instance let us suppose we want to make a table from the fixed formatted files:
```
E:\Data\part1.txt
E:\Data\part2.txt
E:\Data\part3.txt
```
This can be done by creating a table such as:
```
create table t2 (
id int not null,
msg varchar(32),
index XID(id))
engine=connect table_type=FIX file_name='E:/Data/part%s.txt'
partition by range(id) (
partition `1` values less than(10),
partition `2` values less than(50),
partition `3` values less than(MAXVALUE));
```
The rule is that for each partition the matching file name is internally generated by replacing in the given FILE \_ NAME option value the “%s” part by the partition name.
If the table was initially void, further inserts will populate it according to the partition function. However, if the files did exist and contained data, this is your responsibility to determine what partition function actually matches the data distribution in them. This means in particular that partitioning by key or by hash cannot be used (except in exceptional cases) because you have almost no control over what the used algorithm does.
In the example above, there is no problem if the table is initially void, but if it is not, serious problems can be met if the initial distribution does not match the table distribution. Supposing a row in which “id” as the value 12 was initially contained in the part1.txt file, it will be seen when selecting the whole table but if you ask:
```
select * from t2 where id = 12;
```
The result will have 0 rows. This is because according to the partition function query pruning will only look inside the second partition and will miss the row that is in the wrong partition.
One way to check for wrong distribution if for instance to compare the results from queries such as:
```
SELECT partition_name, table_rows FROM
information_schema.partitions WHERE table_name = 't2';
```
And
```
SELECT CASE WHEN id < 10 THEN 1 WHEN id < 50 THEN 2 ELSE 3 END
AS pn, COUNT(*) FROM part3 GROUP BY pn;
```
If they match, the distribution can be correct although this does not prove it. However, if they do not match, the distribution is surely wrong.
#### Partitioning on a Special Column
There are some cases where the files of a multiple table do not contain columns that can be used for range or list partitioning. For instance, let’s suppose we have a multiple table based on the following files:
```
tmp/boston.txt
tmp/chicago.txt
tmp/atlanta.txt
```
Each of them containing the same kind of data:
```
ID: int
First_name: varchar(16)
Last_name: varchar(30)
Birth: date
Hired: date
Job: char(10)
Salary: double(8,2)
```
A multiple table can be created on them, for instance by:
```
create table mulemp (
id int NOT NULL,
first_name varchar(16) NOT NULL,
last_name varchar(30) NOT NULL,
birth date NOT NULL date_format='DD/MM/YYYY',
hired date NOT NULL date_format='DD/MM/YYYY',
job char(10) NOT NULL,
salary double(8,2) NOT NULL
) engine=CONNECT table_type=FIX file_name='tmp/*.txt' multiple=1;
```
The issue is that if we want to create a partitioned table on these files, there are no columns to use for defining a partition function. Each city file can have the same kind of column values and there is no way to distinguish them.
However, there is a solution. It is to add to the table a special column that will be used by the partition function. For instance, the new table creation can be done by:
```
create table partemp (
id int NOT NULL,
first_name varchar(16) NOT NULL,
last_name varchar(30) NOT NULL,
birth date NOT NULL date_format='DD/MM/YYYY',
hired date NOT NULL date_format='DD/MM/YYYY',
job char(16) NOT NULL,
salary double(10,2) NOT NULL,
city char(12) default 'boston' special=PARTID,
index XID(id)
) engine=CONNECT table_type=FIX file_name='E:/Data/Test/%s.txt';
alter table partemp
partition by list columns(city) (
partition `atlanta` values in('atlanta'),
partition `boston` values in('boston'),
partition `chicago` values in('chicago'));
```
Note 1: we had to do it in two steps because of the column CONNECT options.
Note 2: the special column PARTID returns the name of the partition in which the row is located.
Note 3: here we could have used the FNAME special column instead because the file name is specified as being the partition name.
This may seem rather stupid because it means for instance that a row will be in partition boston if it belongs to the partition boston! However, it works because the partition engine doesn’t know about special columns and behaves as if the city column was a real column.
What happens if we populate it by?
```
insert into partemp(id,first_name,last_name,birth,hired,job,salary) values
(1205,'Harry','Cover','1982-10-07','2010-09-21','MANAGEMENT',125000.00);
insert into partemp values
(1524,'Jim','Beams','1985-06-18','2012-07-25','SALES',52000.00,'chicago'),
(1431,'Johnny','Walker','1988-03-12','2012-08-09','RESEARCH',46521.87,'boston'),
(1864,'Jack','Daniels','1991-12-01','2013-02-16','DEVELOPMENT',63540.50,'atlanta');
```
The value given for the city column (explicitly or by default) will be used by the partition engine to decide in which partition to insert the rows. It will be ignored by CONNECT (a special column cannot be given a value) but later will return the matching value. For instance:
```
select city, first_name, job from partemp where id in (1524,1431);
```
This query returns:
| city | first\_name | job |
| --- | --- | --- |
| boston | Johnny | RESEARCH |
| chicago | Jim | SALES |
Everything works as if the city column was a real column contained in the table data files.
#### Partitioning of zipped tables
Two cases are currently supported:
If a table is based on several zipped files, portioning is done the standard way as above. This is the *file\_name* option specifying the name of the zip files that shall contain the ‘%s’ part used to generate the file names.
If a table is based on only one zip file containing several entries, this will be indicated by placing the ‘%s’ part in the entry option value.
Note: If a table is based on several zipped files each containing several entries, only the first case is possible. Using sub-partitioning to make partitions on each entries is not supported yet.
Table Partitioning
------------------
With table partitioning, each partition is physically represented by a sub-table. Compared to standard partitioning, this brings the following features:
1. The partitions can be tables driven by different engines. This relieves the current existing limitation of the partition engine.
2. The partitions can be tables driven by engines not currently supporting partitioning.
3. Partition tables can be located on remote servers, enabling table sharding.
4. Like for TBL tables, the columns of the partition table do not necessarily match the columns of the sub-tables.
The way it is done is to create the partition table with a table type referring to other tables, [PROXY](../connect-table-types-proxy-table-type/index), [MYSQL](../connect-table-types-mysql-table-type-accessing-mysqlmariadb-tables/index) [ODBC](../connect-table-types-odbc-table-type-accessing-tables-from-other-dbms/index) or [JDBC](../connect-jdbc-table-type-accessing-tables-from-other-dbms/index). Let us see how this is done on a simple example. Supposing we have created the following tables:
```
create table xt1 (
id int not null,
msg varchar(32))
engine=myisam;
create table xt2 (
id int not null,
msg varchar(32)); /* engine=innoDB */
create table xt3 (
id int not null,
msg varchar(32))
engine=connect table_type=CSV;
```
We can for instance create a partition table using these tables as physical partitions by:
```
create table t3 (
id int not null,
msg varchar(32))
engine=connect table_type=PROXY tabname='xt%s'
partition by range columns(id) (
partition `1` values less than(10),
partition `2` values less than(50),
partition `3` values less than(MAXVALUE));
```
Here the name of each partition sub-table will be made by replacing the ‘%s’ part of the tabname option value by the partition name. Now if we do:
```
insert into t3 values
(4, 'four'),(7,'seven'),(10,'ten'),(40,'forty'),
(60,'sixty'),(81,'eighty one'),(72,'seventy two'),
(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
```
The rows will be distributed in the different sub-tables according to the partition function. This can be seen by executing the query:
```
select partition_name, table_rows from
information_schema.partitions where table_name = 't3';
```
This query replies:
| partition\_name | table\_rows |
| --- | --- |
| 1 | 4 |
| 2 | 4 |
| 3 | 3 |
Query pruning is of course automatic, for instance:
```
explain partitions select * from t3 where id = 81;
```
This query replies:
| id | select\_type | table | partitions | type | possible\_keys | key | key\_len | ref | rows | Extra |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | SIMPLE | part5 | 3 | ALL | <null> | <null> | <null> | <null> | 22 | Using where |
When executing this select query, only sub-table xt3 will be used.
### Indexing with Table Partitioning
Using the [PROXY](../connect-table-types-proxy-table-type/index) table type seems natural. However, in this current version, the issue is that PROXY (and [ODBC](../connect-table-types-odbc-table-type-accessing-tables-from-other-dbms/index)) tables are not indexable. This is why, if you want the table to be indexed, you must use the [MYSQL](../connect-table-types-mysql-table-type-accessing-mysqlmariadb-tables/index) table type. The CREATE TABLE statement will be almost the same:
```
create table t4 (
id int key not null,
msg varchar(32))
engine=connect table_type=MYSQL tabname='xt%s'
partition by range columns(id) (
partition `1` values less than(10),
partition `2` values less than(50),
partition `3` values less than(MAXVALUE));
```
The column *id* is declared as a key, and the table type is now MYSQL. This makes Sub-tables accessed by calling a MariaDB server as MYSQL tables do. Note that this modifies only the way CONNECT sub-tables are accessed.
However, indexing just make the partitioned table use “remote indexing” the way FEDERATED tables do. This means that when sending the query to retrieve the table data, a where clause will be added to the query. For instance, let’s suppose you ask:
```
select * from t4 where id = 7;
```
The query sent to the server will be:
```
SELECT `id`, `msg` FROM `xt1` WHERE `id` = 7
```
On a query like this one, it does not change much because the where clause could have been added anyway by the cond\_push function, but it does make a difference in case of joins. The main thing to understand is that real indexing is done by the called table and therefore that it should be indexed.
This also means that the xt1, xt2, and xt3 table indexes should be made separately because creating the t2 table as indexed does not make the indexes on the sub-tables.
### Sharding with Table Partitioning
Using table partitioning can have one more advantage. Because the sub-tables can address a table located on another server, it is possible to shard a table on separate servers and hardware machines. This may be required to access as one table data already located on several remote machines, such as servers of a company branches. Or it can be just used to split a huge table for performance reason. For instance, supposing we have created the following tables:
```
create table rt1 (id int key not null, msg varchar(32))
engine=federated connection='mysql://root@host1/test/sales';
create table rt2 (id int key not null, msg varchar(32))
engine=federated connection='mysql://root@host2/test/sales';
create table rt3 (id int key not null, msg varchar(32))
engine=federated connection='mysql://root@host3/test/sales';
```
Creating the partition table accessing all these will be almost like what we did with the t4 table:
```
create table t5 (
id int key not null,
msg varchar(32))
engine=connect table_type=MYSQL tabname='rt%s'
partition by range columns(id) (
partition `1` values less than(10),
partition `2` values less than(50),
partition `3` values less than(MAXVALUE));
```
.
The only difference is the tabname option now referring to the rt1, rt2, and rt3 tables. However, even if it works, this is not the best way to do it. This is because accessing a table via the MySQL API is done twice per table. Once by CONNECT to access the FEDERATED table on the local server, then a second time by FEDERATED engine to access the remote table.
The CONNECT MYSQL table type being used anyway, you’d rather use it to directly access the remote tables. Indeed, the partition names can also be used to modify the connection URL’s. For instance, in the case shown above, the partition table can be created as:
```
create table t6 (
id int key not null,
msg varchar(32))
engine=connect table_type=MYSQL
option_list='connect=mysql://root@host%s/test/sales'
partition by range columns(id) (
partition `1` values less than(10),
partition `2` values less than(50),
partition `3` values less than(MAXVALUE));
```
Several things can be noted here:
1. As we have seen before, the partition engine currently loses the connection string. This is why it was specified as “connect” in the option list.
2. For each partition sub-tables, the “%s” part of the connection string has been replaced by the partition name.
3. It is not needed anymore to define the rt1, rt2, and rt3 tables (even it does not harm) and the FEDERATED engine is no more used to access the remote tables.
This is a simple case where the connection string is almost the same for all the sub-tables. But what if the sub-tables are accessed by very different connection strings? For instance:
```
For rt1: connection='mysql://root:[email protected]:3307/test/xt1'
For rt2: connection='mysql://foo:foopass@denver/dbemp/xt2'
For rt3: connection='mysql://root@huston :5505/test/tabx'
```
There are two solutions. The first one is to use the parts of the connection string to differentiate as partition names:
```
create table t7 (
id int key not null,
msg varchar(32))
engine=connect table_type=MYSQL
option_list='connect=mysql://%s'
partition by range columns(id) (
partition `root:[email protected]:3307/test/xt1` values less than(10),
partition `foo:foopass@denver/dbemp/xt2` values less than(50),
partition `root@huston :5505/test/tabx` values less than(MAXVALUE));
```
The second one, allowing avoiding too complicated partition names, is to create federated servers to access the remote tables (if they do not already exist, else just use them). For instance the first one could be:
```
create server `server_one` foreign data wrapper 'mysql'
options
(host '127.0.0.1',
database 'test',
user 'root',
password 'tinono',
port 3307);
```
Similarly, “server\_two” and “server\_three” would be created and the final partition table would be created as:
```
create table t8 (
id int key not null,
msg varchar(32))
engine=connect table_type=MYSQL
option_list='connect=server_%s'
partition by range columns(id) (
partition `one/xt1` values less than(10),
partition `two/xt2` values less than(50),
partition `three/tabx` values less than(MAXVALUE));
```
It would be even simpler if all remote tables had the same name on the remote databases, for instance if they all were named xt1, the connection string could be set as “server\_%s/xt1” and the partition names would be just “one”, “two”, and “three”.
#### Sharding on a Special Column
The technique we have seen above with file partitioning is also available with table partitioning. Companies willing to use as one table data sharded on the company branch servers can, as we have seen, add to the table create definition a special column. For instance:
```
create table t9 (
id int not null,
msg varchar(32),
branch char(16) default 'main' special=PARTID,
index XID(id))
engine=connect table_type=MYSQL
option_list='connect=server_%s/sales'
partition by range columns(id) (
partition `main` values in('main'),
partition `east` values in('east'),
partition `west` values in('west'));
```
This example assumes that federated servers had been created named “server\_main”, “server\_east” and “server\_west” and that all remote tables are named “sales”. Note also that in this example, the column id is no more a key.
Current Partition Limitations
-----------------------------
Because the partition engine was written before some other engines were added to MariaDB, the way it works is sometime incompatible with these engines, in particular with CONNECT.
### Update statement
With the sample tables above, you can do update statements such as:
```
update t2 set msg = 'quatre' where id = 4;
```
It works perfectly and is accepted by CONNECT. However, let us consider the statement:
```
update t2 set id = 41 where msg = 'four';
```
This statement is not accepted by CONNECT. The reason is that the column id being part of the partition function, changing its value may require the modified row to be moved to another partition. The way it is done by the partition engine is to delete the old row and to re-insert the new modified one. However, this is done in a way that is not currently compatible with CONNECT (remember that CONNECT supports UPDATE in a specific way, in particular for the table type MYSQL) This limitation could be temporary. Meanwhile the workaround is to manually do what is done above,
Deleting the row to modify and inserting the modified row:
```
delete from t2 where id = 4;
insert into t2 values(41, 'four');
```
### Alter Table statement
For all CONNECT outward tables, the ALTER TABLE statement does not make any change in the table data. This is why ALTER TABLE should not be used; in particular to modify the partition definition, except of course to correct a wrong definition. Note that using ALTER TABLE to create a partition table in two steps because column options would be lost is valid as it applies to a table that is not yet partitioned.
As we have seen, it is also safe to use it to create or drop indexes. Otherwise, a simple rule of thumb is to avoid altering a table definition and better drop and re-create a table whose definition must be modified. Just remember that for outward CONNECT tables, dropping a table does not erase the data and that creating it does not modify existing data.
### Rowid special column
Each partition being handled separately as one table, the ROWID special column returns the rank of the row in its partition, not in the whole table. This means that for partition tables ROWID and ROWNUM are equivalent.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb TIME_FORMAT TIME\_FORMAT
============
Syntax
------
```
TIME_FORMAT(time,format)
```
Description
-----------
This is used like the [DATE\_FORMAT()](../date_format/index) function, but the format string may contain format specifiers only for hours, minutes, and seconds. Other specifiers produce a NULL value or 0.
Examples
--------
```
SELECT TIME_FORMAT('100:00:00', '%H %k %h %I %l');
+--------------------------------------------+
| TIME_FORMAT('100:00:00', '%H %k %h %I %l') |
+--------------------------------------------+
| 100 100 04 04 4 |
+--------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema cond_instances Table Performance Schema cond\_instances Table
========================================
Description
-----------
The `cond_instances` table lists all conditions while the server is executing. A condition, or instrumented condition object, is an internal code mechanism used for signalling that a specific event has occurred so that any threads waiting for this condition can continue.
The maximum number of conditions stored in the performance schema is determined by the [performance\_schema\_max\_cond\_instances](../performance-schema-system-variables/index#performance_schema_max_cond_instances) system variable.
| Column | Description |
| --- | --- |
| `NAME` | Client user name for the connection, or `NULL` if an internal thread. |
| `OBJECT_INSTANCE_BEGIN` | Address in memory of the instrumented condition. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ps_thread_stack ps\_thread\_stack
=================
Syntax
------
```
sys.ps_thread_stack(thread_id, verbose)
```
Description
-----------
`ps_thread_stack` is a [stored function](../stored-functions/index) available with the [Sys Schema](../sys-schema/index) that, for a given *thread\_id*, returns all statements, stages, and events within the Performance Schema, as a JSON formatted stack.
The boolean *verbose* argument specifies whether or not to include `file:lineno` information in the events.
Examples
--------
```
SELECT sys.ps_thread_stack(13, FALSE) AS thread_stack\G
*************************** 1. row ***************************
thread_stack: {"rankdir": "LR","nodesep": "0.10",
"stack_created": "2022-03-28 16:01:06",
"mysql_version": "10.8.2-MariaDB",
"mysql_user": "msandbox@localhost",
"events": []}
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb TokuDB Differences TokuDB Differences
==================
TokuDB has been deprecated by its upstream maintainer. It is disabled from [MariaDB 10.5](../what-is-mariadb-105/index) and has been been removed in [MariaDB 10.6](../what-is-mariadb-106/index) - [MDEV-19780](https://jira.mariadb.org/browse/MDEV-19780). We recommend [MyRocks](../myrocks/index) as a long-term migration path.
Because we, the MariaDB developers, don't want to add a lot of new features or big code changes to a stable release, not all TokuDB features will be merged at once into MariaDB. Instead they will be added in stages.
On this page we list all the known differences between the TokuDB from [Tokutek](http://www.tokutek.com) and the default MariaDB version from [MariaDB.org](https://downloads.mariadb.org):
All MariaDB versions
--------------------
* TokuDB is not the default storage engine.
+ If you want to enable this, you have to start mysqld with: `--default-storage-engine=tokudb`.
* Auto increment for second part of a key behaves as documented (and as it does in MyISAM and other storage engines).
* The DDL syntax is different. While binaries from Tokutek have the patched SQL parser, TokuDB in MariaDB uses the special [Storage Engine API extension](../engine-defined-new-tablefieldindex-attributes/index). Thus in Tokutek binaries you write `CLUSTERED KEY (columns)` and, for example, `ROW_FORMAT=TOKUDB_LZMA`. And in MariaDB you write `KEY (columns) CLUSTERING=YES` and `COMPRESSION=TOKUDB_LZMA`.
Features missing in [MariaDB 5.5](../what-is-mariadb-55/index)
--------------------------------------------------------------
* No online [ALTER TABLE](../alter-table/index).
+ All alter table that changes data or indexes requires a table copy.
* No online [OPTIMIZE TABLE](../optimize-table/index).
* No `INSERT NOAR` or `UPDATE NOAR` commands.
* No gdb stack trace on sigsegv
* IMPORTANT: the compression type does not default to the [tokudb\_row\_format](../tokudb-system-variables/index#tokudb_row_format) session variable as it does with Tokutek's builds. If `COMPRESSION=` is not included in `CREATE TABLE` or `ALTER TABLE ENGINE=TokuDB` then the TokuDB table will be uncompressed (before 5.5.37) or zlib-compressed (5.5.37 and later).
Features missing in [MariaDB 10.0](../what-is-mariadb-100/index)
----------------------------------------------------------------
[MariaDB 10.0](../what-is-mariadb-100/index) (starting from 10.0.5) has online [ALTER TABLE](../alter-table/index). So the features missing will be:
* No `INSERT NOAR` or `UPDATE NOAR` commands.
+ We are working with Tokutek to improve this feature before adding it to MariaDB.
* No online [OPTIMIZE TABLE](../optimize-table/index) before [10.0.11](https://mariadb.com/kb/en/mariadb-10011-release-notes/) ([r4199](http://bazaar.launchpad.net/~maria-captains/maria/10.0/revision/4199))
* No gdb stack trace on sigsegv
* Before 10.0.10 the compression type did not default to the [tokudb\_row\_format](../tokudb-system-variables/index#tokudb_row_format) session variable. If `COMPRESSION=` was not included in `CREATE TABLE` or `ALTER TABLE ENGINE=TokuDB` then the TokuDB table was created uncompressed.
Version of the TokuDB plugin included on MariaDB
------------------------------------------------
This is found on the [TokuDB](../tokudb/index) page.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysqlbinlog mysqlbinlog
============
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-binlog` is a symlink to `mysqlbinlog`.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mariadb-binlog` is the name of the tool, with `mysqlbinlog` a symlink .
`mysqlbinlog` is a utility included with MariaDB for processing [binary log](../binary-log/index) and [relay log](../relay-log/index) files.
The MariaDB server's binary log is a set of files containing "events" which represent modifications to the contents of a MariaDB database. These events are written in a binary (i.e. non-human-readable) format. The mysqlbinlog utility is used to view these events in plain text.
| Title | Description |
| --- | --- |
| [Using mysqlbinlog](../using-mysqlbinlog/index) | Viewing the binary log with mysqlbinlog. |
| [mysqlbinlog Options](../mysqlbinlog-options/index) | Options supported by mysqlbinlog. |
| [Annotate\_rows\_log\_event](../annotate_rows_log_event/index) | Annotate\_rows events accompany row events and describe the query which caused the row event. |
| [mariadb-binlog](../mariadb-binlog/index) | Symlink or new name for mysqlbinlog. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema EVENTS Table Information Schema EVENTS Table
===============================
The [Information Schema](../information_schema/index) `EVENTS` table stores information about [Events](../stored-programs-and-views-events/index) on the server.
It contains the following columns:
| Column | Description |
| --- | --- |
| `EVENT_CATALOG` | Always `def`. |
| `EVENT_SCHEMA` | Database where the event was defined. |
| `EVENT_NAME` | Event name. |
| `DEFINER` | Event definer. |
| `TIME_ZONE` | Time zone used for the event's scheduling and execution, by default `SYSTEM`. |
| `EVENT_BODY` | `SQL`. |
| `EVENT_DEFINITION` | The SQL defining the event. |
| `EVENT_TYPE` | Either `ONE TIME` or `RECURRING`. |
| `EXECUTE_AT` | `[DATETIME](../datetime/index)` when the event is set to execute, or `NULL` if recurring. |
| `INTERVAL_VALUE` | Numeric interval between event executions for a recurring event, or `NULL` if not recurring. |
| `INTERVAL_FIELD` | Interval unit (e.g., `HOUR`) |
| `SQL_MODE` | The `[SQL\_MODE](../sql-mode/index)` at the time the event was created. |
| `STARTS` | Start `[DATETIME](../datetime/index)` for a recurring event, `NULL` if not defined or not recurring. |
| `ENDS` | End `[DATETIME](../datetime/index)` for a recurring event, `NULL` if not defined or not recurring. |
| `STATUS` | One of `ENABLED`, `DISABLED` or /`SLAVESIDE_DISABLED`. |
| `ON_COMPLETION` | The `ON COMPLETION` clause, either `PRESERVE` or `NOT PRESERVE` . |
| `CREATED` | When the event was created. |
| `LAST_ALTERED` | When the event was last changed. |
| `LAST_EXECUTED` | When the event was last run. |
| `EVENT_COMMENT` | The comment provided in the `[CREATE EVENT](../create-event/index)` statement, or an empty string if none. |
| `ORIGINATOR` | MariaDB server ID on which the event was created. |
| `CHARACTER_SET_CLIENT` | `[character\_set\_client](../server-system-variables/index#character_set_client)` system variable session value at the time the event was created. |
| `COLLATION_CONNECTION` | [collation\_connection](../server-system-variables/index#collation_connection) system variable session value at the time the event was created. |
| `DATABASE_COLLATION` | Database [collation](../data-types-character-sets-and-collations/index) with which the event is linked. |
The `[SHOW EVENTS](../show-events/index)` and `[SHOW CREATE EVENT](../show-create-event/index)` statements provide similar information.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysql.spider_table_sts Table mysql.spider\_table\_sts Table
==============================
The `mysql.spider_table_sts` table is installed by the [Spider storage engine](../spider/index).
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, this table uses the [Aria](../aria/index) storage engine.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and before, this table uses the [MyISAM](../myisam-storage-engine/index) storage engine.
It contains the following fields:
| Field | Type | Null | Key | Default | Description |
| --- | --- | --- | --- | --- | --- |
| db\_name | char(64) | NO | PRI | | |
| table\_name | char(199) | NO | PRI | | |
| data\_file\_length | bigint(20) unsigned | NO | | 0 | |
| max\_data\_file\_length | bigint(20) unsigned | NO | | 0 | |
| index\_file\_length | bigint(20) unsigned | NO | | 0 | |
| records | bigint(20) unsigned | NO | | 0 | |
| mean\_rec\_length | bigint(20) unsigned | NO | | 0 | |
| check\_time | datetime | NO | | 0000-00-00 00:00:00 | |
| create\_time | datetime | NO | | 0000-00-00 00:00:00 | |
| update\_time | datetime | NO | | 0000-00-00 00:00:00 | |
| checksum | bigint(20) unsigned | YES | | NULL | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SHOW MASTER STATUS SHOW MASTER STATUS
==================
Syntax
------
```
SHOW MASTER STATUS
SHOW BINLOG STATUS -- From MariaDB 10.5.2
```
Description
-----------
Provides status information about the [binary log](../binary-log/index) files of the primary.
This statement requires the [SUPER](../grant/index#super) privilege, the [REPLICATION\_CLIENT](../grant/index#replication-client) privilege, or, from [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), the [BINLOG MONITOR](../grant/index#binlog-monitor) privilege.
To see information about the current GTIDs in the binary log, use the [gtid\_binlog\_pos](../global-transaction-id/index#gtid_binlog_pos) variable.
`SHOW MASTER STATUS` was renamed to `SHOW BINLOG STATUS` in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), but the old name remains an alias for compatibility purposes.
Example
-------
```
SHOW MASTER STATUS;
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000016 | 475 | | |
+--------------------+----------+--------------+------------------+
SELECT @@global.gtid_binlog_pos;
+--------------------------+
| @@global.gtid_binlog_pos |
+--------------------------+
| 0-1-2 |
+--------------------------+
```
See Also
--------
* [MariaDB replication](../high-availability-performance-tuning-mariadb-replication/index)
* [Using and Maintaining the Binary Log](../using-and-maintaining-the-binary-log/index)
* [The gtid\_binlog\_pos variable](../global-transaction-id/index#gtid_binlog_pos)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LOAD TABLE FROM MASTER (removed) LOAD TABLE FROM MASTER (removed)
================================
Syntax
------
```
LOAD TABLE tbl_name FROM MASTER
```
Description
-----------
This feature has been removed from recent versions of MariaDB.
Since the current implementation of `[LOAD DATA FROM MASTER](../load-data-from-master-removed/index)` and `LOAD TABLE FROM MASTER` is very limited, these statements are deprecated in versions 4.1 of MySQL and above. We will introduce a more advanced technique (called "online backup") in a future version. That technique will have the additional advantage of working with more storage engines.
For MariaDB and MySQL 5.1 and earlier, the recommended alternative solution to using `LOAD DATA FROM MASTER` or `LOAD TABLE FROM MASTER` is using [mysqldump](../mysqldump/index) or [mysqlhotcopy](../mysqlhotcopy/index). The latter requires Perl and two Perl modules (DBI and DBD:mysql) and works for [MyISAM](../myisam/index) and [ARCHIVE](../archive/index) tables only. With mysqldump, you can create SQL dumps on the master and pipe (or copy) these to a mysql client on the slave. This has the advantage of working for all storage engines, but can be quite slow, since it works using `SELECT`.
Transfers a copy of the table from the master to the slave. This statement is implemented mainly debugging `LOAD DATA FROM MASTER` operations. To use `LOAD TABLE`, the account used for connecting to the master server must have the `RELOAD` and `[SUPER](../grant/index#global-privileges)` privileges on the master and the `SELECT` privilege for the master table to load. On the slave side, the user that issues `LOAD TABLE FROM MASTER` must have privileges for dropping and creating the table.
The conditions for `LOAD DATA FROM MASTER` apply here as well. For example, `LOAD TABLE FROM MASTER` works only for MyISAM tables. The timeout notes for `LOAD DATA FROM MASTER` apply as well.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb JSON_DETAILED JSON\_DETAILED
==============
**MariaDB starting with [10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/)**This function was added in [MariaDB 10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/).
Syntax
------
```
JSON_DETAILED(json_doc[, tab_size])
```
Description
-----------
Represents JSON in the most understandable way emphasizing nested structures.
Example
-------
```
SET @j = '{ "A":1,"B":[2,3]}';
SELECT @j;
+--------------------+
| @j |
+--------------------+
| { "A":1,"B":[2,3]} |
+--------------------+
SELECT JSON_DETAILED(@j);
+------------------------------------------------------------+
| JSON_DETAILED(@j) |
+------------------------------------------------------------+
| {
"A": 1,
"B":
[
2,
3
]
} |
+------------------------------------------------------------+
```
See Also
--------
* [JSON video tutorial](https://www.youtube.com/watch?v=sLE7jPETp8g) covering JSON\_DETAILED.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ADDDATE ADDDATE
=======
Syntax
------
```
ADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)
```
Description
-----------
When invoked with the `INTERVAL` form of the second argument, `ADDDATE()` is a synonym for `[DATE\_ADD()](../date_add/index)`. The related function `[SUBDATE()](../subdate/index)` is a synonym for `[DATE\_SUB()](../date_sub/index)`. For information on the `INTERVAL` unit argument, see the discussion for `[DATE\_ADD()](../date_add/index)`.
When invoked with the days form of the second argument, MariaDB treats it as an integer number of days to be added to *expr*.
Examples
--------
```
SELECT DATE_ADD('2008-01-02', INTERVAL 31 DAY);
+-----------------------------------------+
| DATE_ADD('2008-01-02', INTERVAL 31 DAY) |
+-----------------------------------------+
| 2008-02-02 |
+-----------------------------------------+
SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY);
+----------------------------------------+
| ADDDATE('2008-01-02', INTERVAL 31 DAY) |
+----------------------------------------+
| 2008-02-02 |
+----------------------------------------+
```
```
SELECT ADDDATE('2008-01-02', 31);
+---------------------------+
| ADDDATE('2008-01-02', 31) |
+---------------------------+
| 2008-02-02 |
+---------------------------+
```
```
CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES
("2007-01-30 21:31:07"),
("1983-10-15 06:42:51"),
("2011-04-21 12:34:56"),
("2011-10-30 06:31:41"),
("2011-01-30 14:03:25"),
("2004-10-07 11:19:34");
```
```
SELECT d, ADDDATE(d, 10) from t1;
+---------------------+---------------------+
| d | ADDDATE(d, 10) |
+---------------------+---------------------+
| 2007-01-30 21:31:07 | 2007-02-09 21:31:07 |
| 1983-10-15 06:42:51 | 1983-10-25 06:42:51 |
| 2011-04-21 12:34:56 | 2011-05-01 12:34:56 |
| 2011-10-30 06:31:41 | 2011-11-09 06:31:41 |
| 2011-01-30 14:03:25 | 2011-02-09 14:03:25 |
| 2004-10-07 11:19:34 | 2004-10-17 11:19:34 |
+---------------------+---------------------+
SELECT d, ADDDATE(d, INTERVAL 10 HOUR) from t1;
+---------------------+------------------------------+
| d | ADDDATE(d, INTERVAL 10 HOUR) |
+---------------------+------------------------------+
| 2007-01-30 21:31:07 | 2007-01-31 07:31:07 |
| 1983-10-15 06:42:51 | 1983-10-15 16:42:51 |
| 2011-04-21 12:34:56 | 2011-04-21 22:34:56 |
| 2011-10-30 06:31:41 | 2011-10-30 16:31:41 |
| 2011-01-30 14:03:25 | 2011-01-31 00:03:25 |
| 2004-10-07 11:19:34 | 2004-10-07 21:19:34 |
+---------------------+------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Performance Schema events_waits_history Table Performance Schema events\_waits\_history Table
===============================================
The `events_waits_history` table by default contains the ten most recent completed wait events per thread. This number can be adjusted by setting the [performance\_schema\_events\_waits\_history\_size](../performance-schema-system-variables/index#performance_schema_events_waits_history_size) system variable when the server starts up.
The table structure is identical to the [events\_waits\_current](../performance-schema-events_waits_current-table/index) table structure, and contains the following columns:
| Column | Description |
| --- | --- |
| `THREAD_ID` | Thread associated with the event. Together with `EVENT_ID` uniquely identifies the row. |
| `EVENT_ID` | Thread's current event number at the start of the event. Together with `THREAD_ID` uniquely identifies the row. |
| `END_EVENT_ID` | `NULL` when the event starts, set to the thread's current event number at the end of the event. |
| `EVENT_NAME` | Event instrument name and a `NAME` from the `setup_instruments` table |
| `SOURCE` | Name and line number of the source file containing the instrumented code that produced the event. |
| `TIMER_START` | Value in picoseconds when the event timing started or `NULL` if timing is not collected. |
| `TIMER_END` | Value in picoseconds when the event timing ended, or `NULL` if timing is not collected. |
| `TIMER_WAIT` | Value in picoseconds of the event's duration or `NULL` if timing is not collected. |
| `SPINS` | Number of spin rounds for a mutex, or `NULL` if spin rounds are not used, or spinning is not instrumented. |
| `OBJECT_SCHEMA` | Name of the schema that contains the table for table I/O objects, otherwise `NULL` for file I/O and synchronization objects. |
| `OBJECT_NAME` | File name for file I/O objects, table name for table I/O objects, the socket's `IP:PORT` value for a socket object or `NULL` for a synchronization object. |
| `INDEX NAME` | Name of the index, `PRIMARY` for the primary key, or `NULL` for no index used. |
| `OBJECT_TYPE` | FILE for a file object, `TABLE` or `TEMPORARY TABLE` for a table object, or `NULL` for a synchronization object. |
| `OBJECT_INSTANCE_BEGIN` | Address in memory of the object. |
| `NESTING_EVENT_ID` | EVENT\_ID of event within which this event nests. |
| `NESTING_EVENT_TYPE` | Nesting event type. Either `statement`, `stage` or `wait`. |
| `OPERATION` | Operation type, for example read, write or lock |
| `NUMBER_OF_BYTES` | Number of bytes that the operation read or wrote, or `NULL` for table I/O waits. |
| `FLAGS` | Reserved for use in the future. |
It is possible to empty this table with a `TRUNCATE TABLE` statement.
[events\_waits\_current](../performance-schema-events_waits_current-table/index) and [events\_waits\_history\_long](../performance-schema-events_waits_history_long-table/index) are related tables.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MICROSECOND MICROSECOND
===========
Syntax
------
```
MICROSECOND(expr)
```
Description
-----------
Returns the microseconds from the time or datetime expression *expr* as a number in the range from 0 to 999999.
If *expr* is a time with no microseconds, zero is returned, while if *expr* is a date with no time, zero with a warning is returned.
Examples
--------
```
SELECT MICROSECOND('12:00:00.123456');
+--------------------------------+
| MICROSECOND('12:00:00.123456') |
+--------------------------------+
| 123456 |
+--------------------------------+
SELECT MICROSECOND('2009-12-31 23:59:59.000010');
+-------------------------------------------+
| MICROSECOND('2009-12-31 23:59:59.000010') |
+-------------------------------------------+
| 10 |
+-------------------------------------------+
SELECT MICROSECOND('2013-08-07 12:13:14');
+------------------------------------+
| MICROSECOND('2013-08-07 12:13:14') |
+------------------------------------+
| 0 |
+------------------------------------+
SELECT MICROSECOND('2013-08-07');
+---------------------------+
| MICROSECOND('2013-08-07') |
+---------------------------+
| 0 |
+---------------------------+
1 row in set, 1 warning (0.00 sec)
SHOW WARNINGS;
+---------+------+----------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------+
| Warning | 1292 | Truncated incorrect time value: '2013-08-07' |
+---------+------+----------------------------------------------+
```
See Also
--------
* [Microseconds in MariaDB](../microseconds-in-mariadb/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb S3 Storage Engine S3 Storage Engine
==================
**MariaDB starting with [10.5](../what-is-mariadb-105/index)**The [S3 storage engine](index) has been available since [MariaDB 10.5.4](https://mariadb.com/kb/en/mariadb-1054-release-notes/).
S3 is a read-only storage engine that stores its data in Amazon S3.
| Title | Description |
| --- | --- |
| [Using the S3 Storage Engine](../using-the-s3-storage-engine/index) | Using the S3 storage engine. |
| [Testing the Connections to S3](../testing-the-connections-to-s3/index) | Steps to help verify where an S3 problem could be. |
| [S3 Storage Engine Internals](../s3-storage-engine-internals/index) | The S3 storage engine is based on the Aria code. |
| [aria\_s3\_copy](../aria_s3_copy/index) | Copies an Aria table to and from S3. |
| [S3 Storage Engine Status Variables](../s3-storage-engine-status-variables/index) | S3 Storage Engine-related status variables. |
| [S3 Storage Engine System Variables](../s3-storage-engine-system-variables/index) | S3 Storage Engine-related system variables. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb AsWKT AsWKT
=====
A synonym for [ST\_AsText()](../st_astext/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema ROCKSDB_DBSTATS Table Information Schema ROCKSDB\_DBSTATS Table
=========================================
The [Information Schema](../information_schema/index) `ROCKSDB_DBSTATS` table is included as part of the [MyRocks](../myrocks/index) storage engine.
The `PROCESS` [privilege](../grant/index) is required to view the table.
It contains the following columns:
| Column | Description |
| --- | --- |
| `STAT_TYPE` | |
| `VALUE` | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb PointOnSurface PointOnSurface
==============
A synonym for [ST\_PointOnSurface](../st_pointonsurface/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb YEARWEEK YEARWEEK
========
Syntax
------
```
YEARWEEK(date), YEARWEEK(date,mode)
```
Description
-----------
Returns year and week for a date. The mode argument works exactly like the mode argument to [WEEK()](../week/index). The year in the result may be different from the year in the date argument for the first and the last week of the year.
Examples
--------
```
SELECT YEARWEEK('1987-01-01');
+------------------------+
| YEARWEEK('1987-01-01') |
+------------------------+
| 198652 |
+------------------------+
```
```
CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES
("2007-01-30 21:31:07"),
("1983-10-15 06:42:51"),
("2011-04-21 12:34:56"),
("2011-10-30 06:31:41"),
("2011-01-30 14:03:25"),
("2004-10-07 11:19:34");
```
```
SELECT * FROM t1;
+---------------------+
| d |
+---------------------+
| 2007-01-30 21:31:07 |
| 1983-10-15 06:42:51 |
| 2011-04-21 12:34:56 |
| 2011-10-30 06:31:41 |
| 2011-01-30 14:03:25 |
| 2004-10-07 11:19:34 |
+---------------------+
6 rows in set (0.02 sec)
```
```
SELECT YEARWEEK(d) FROM t1 WHERE YEAR(d) = 2011;
+-------------+
| YEARWEEK(d) |
+-------------+
| 201116 |
| 201144 |
| 201105 |
+-------------+
3 rows in set (0.03 sec)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Multi Master in maria db Multi Master in maria db
========================
Can we configure Multi Master in Maria Db. I have testing three node A, B, C in Maria DB in Galera cluster. This 3 node belongs to one site. I want to configure HA with another site having the same setting as A1,B1, C1. Now i want to make A and B as master of C1. A,B,C, A1,B1,and C1 will have same db. Will it maintain the txId while replication?
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ASCII ASCII
=====
Syntax
------
```
ASCII(str)
```
Description
-----------
Returns the numeric ASCII value of the leftmost character of the string argument. Returns `0` if the given string is empty and `NULL` if it is `NULL`.
`ASCII()` works for 8-bit characters.
Examples
--------
```
SELECT ASCII(9);
+----------+
| ASCII(9) |
+----------+
| 57 |
+----------+
SELECT ASCII('9');
+------------+
| ASCII('9') |
+------------+
| 57 |
+------------+
SELECT ASCII('abc');
+--------------+
| ASCII('abc') |
+--------------+
| 97 |
+--------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb About SHOW About SHOW
==========
`SHOW` has many forms that provide information about databases, tables, columns, or status information about the server. These include:
* [SHOW AUTHORS](../show-authors/index)
* [SHOW CHARACTER SET [like\_or\_where]](../show-character-set/index)
* [SHOW COLLATION [like\_or\_where]](../show-collation/index)
* [SHOW [FULL] COLUMNS FROM tbl\_name [FROM db\_name] [like\_or\_where]](../show-columns/index)
* [SHOW CONTRIBUTORS](../show-contributors/index)
* [SHOW CREATE DATABASE db\_name](../show-create-database/index)
* [SHOW CREATE EVENT event\_name](../show-create-event/index)
* [SHOW CREATE PACKAGE package\_name](../show-create-package/index)
* [SHOW CREATE PACKAGE BODY package\_name](../show-create-package-body/index)
* [SHOW CREATE PROCEDURE proc\_name](../show-create-procedure/index)
* [SHOW CREATE TABLE tbl\_name](../show-create-table/index)
* [SHOW CREATE TRIGGER trigger\_name](../show-create-trigger/index)
* [SHOW CREATE VIEW view\_name](../show-create-view/index)
* [SHOW DATABASES [like\_or\_where]](../show-databases/index)
* [SHOW ENGINE engine\_name {STATUS | MUTEX}](../show-engine/index)
* [SHOW [STORAGE] ENGINES](../show-engines/index)
* [SHOW ERRORS [LIMIT [offset,] row\_count]](../show-errors/index)
* [SHOW [FULL] EVENTS](../show-events/index)
* [SHOW FUNCTION CODE func\_name](../show-function-code/index)
* [SHOW FUNCTION STATUS [like\_or\_where]](../show-function-status/index)
* [SHOW GRANTS FOR user](../show-grants/index)
* [SHOW INDEX FROM tbl\_name [FROM db\_name]](../show-index/index)
* [SHOW INNODB STATUS](../show-innodb-status/index)
* [SHOW OPEN TABLES [FROM db\_name] [like\_or\_where]](../show-open-tables/index)
* [SHOW PLUGINS](../show-plugins/index)
* [SHOW PROCEDURE CODE proc\_name](../show-procedure-code/index)
* [SHOW PROCEDURE STATUS [like\_or\_where]](../show-procedure-status/index)
* [SHOW PRIVILEGES](../show-privileges/index)
* [SHOW [FULL] PROCESSLIST](../show-processlist/index)
* [SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]](../show-profile/index)
* [SHOW PROFILES](../show-profiles/index)
* [SHOW [GLOBAL | SESSION] STATUS [like\_or\_where]](../show-status/index)
* [SHOW TABLE STATUS [FROM db\_name] [like\_or\_where]](../show-table-status/index)
* [SHOW TABLES [FROM db\_name] [like\_or\_where]](../show-tables/index)
* [SHOW TRIGGERS [FROM db\_name] [like\_or\_where]](../show-triggers/index)
* [SHOW [GLOBAL | SESSION] VARIABLES [like\_or\_where]](../show-variables/index)
* [SHOW WARNINGS [LIMIT [offset,] row\_count]](../show-warnings/index)
```
like_or_where:
LIKE 'pattern'
| WHERE expr
```
If the syntax for a given `SHOW` statement includes a `LIKE 'pattern'` part, `'pattern'` is a string that can contain the SQL "`%`" and "`_`" wildcard characters. The pattern is useful for restricting statement output to matching values.
Several `SHOW` statements also accept a `WHERE` clause that provides more flexibility in specifying which rows to display. See [Extended Show](../extended-show/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb IS_IPV6 IS\_IPV6
========
Syntax
------
```
IS_IPV6(expr)
```
Description
-----------
Returns 1 if the expression is a valid IPv6 address specified as a string, otherwise returns 0. Does not consider IPv4 addresses to be valid IPv6 addresses.
Examples
--------
```
SELECT IS_IPV6('48f3::d432:1431:ba23:846f');
+--------------------------------------+
| IS_IPV6('48f3::d432:1431:ba23:846f') |
+--------------------------------------+
| 1 |
+--------------------------------------+
1 row in set (0.02 sec)
SELECT IS_IPV6('10.0.1.1');
+---------------------+
| IS_IPV6('10.0.1.1') |
+---------------------+
| 0 |
+---------------------+
```
See Also
--------
* [INET6](../inet6/index) data type
* [INET6\_ATON](../inet6_aton/index)
* [INET6\_NTOA](../inet6_ntoa/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CONCAT CONCAT
======
Syntax
------
```
CONCAT(str1,str2,...)
```
Description
-----------
Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:
```
SELECT CONCAT(CAST(int_col AS CHAR), char_col);
```
`CONCAT()` returns `NULL` if any argument is `NULL`.
A `NULL` parameter hides all information contained in other parameters from the result. Sometimes this is not desirable; to avoid this, you can:
* Use the `[CONCAT\_WS()](../concat_ws/index)` function with an empty separator, because that function is `NULL`-safe.
* Use `[IFNULL()](../ifnull/index)` to turn NULLs into empty strings.
### Oracle Mode
**MariaDB starting with [10.3](../what-is-mariadb-103/index)**In [Oracle mode from MariaDB 10.3](../sql_modeoracle-from-mariadb-103/index#null-handling), `CONCAT` ignores [NULL](null).
Examples
--------
```
SELECT CONCAT('Ma', 'ria', 'DB');
+---------------------------+
| CONCAT('Ma', 'ria', 'DB') |
+---------------------------+
| MariaDB |
+---------------------------+
SELECT CONCAT('Ma', 'ria', NULL, 'DB');
+---------------------------------+
| CONCAT('Ma', 'ria', NULL, 'DB') |
+---------------------------------+
| NULL |
+---------------------------------+
SELECT CONCAT(42.0);
+--------------+
| CONCAT(42.0) |
+--------------+
| 42.0 |
+--------------+
```
Using `IFNULL()` to handle NULLs:
```
SELECT CONCAT('The value of @v is: ', IFNULL(@v, ''));
+------------------------------------------------+
| CONCAT('The value of @v is: ', IFNULL(@v, '')) |
+------------------------------------------------+
| The value of @v is: |
+------------------------------------------------+
```
In [Oracle mode](../sql_modeoracle-from-mariadb-103/index#null-handling), from [MariaDB 10.3](../what-is-mariadb-103/index):
```
SELECT CONCAT('Ma', 'ria', NULL, 'DB');
+---------------------------------+
| CONCAT('Ma', 'ria', NULL, 'DB') |
+---------------------------------+
| MariaDB |
+---------------------------------+
```
See Also
--------
* [GROUP\_CONCAT()](../group_concat/index)
* [Oracle mode from MariaDB 10.3](../sql_modeoracle-from-mariadb-103/index#null-handling)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb & &
=
Syntax
------
```
&
```
Description
-----------
Bitwise AND. Converts the values to binary and compares bits. Only if both the corresponding bits are 1 is the resulting bit also 1.
See also [bitwise OR](../bitwise-or/index).
Examples
--------
```
SELECT 2&1;
+-----+
| 2&1 |
+-----+
| 0 |
+-----+
SELECT 3&1;
+-----+
| 3&1 |
+-----+
| 1 |
+-----+
SELECT 29 & 15;
+---------+
| 29 & 15 |
+---------+
| 13 |
+---------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_BUFFER ST\_BUFFER
==========
Syntax
------
```
ST_BUFFER(g1,r)
BUFFER(g1,r)
```
Description
-----------
Returns a geometry that represents all points whose distance from geometry *`g1`* is less than or equal to distance, or radius, *`r`*.
Uses for this function could include creating for example a new geometry representing a buffer zone around an island.
BUFFER() is a synonym.
Examples
--------
Determining whether a point is within a buffer zone:
```
SET @g1 = ST_GEOMFROMTEXT('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))');
SET @g2 = ST_GEOMFROMTEXT('POINT(8 8)');
SELECT ST_WITHIN(@g2,ST_BUFFER(@g1,5));
+---------------------------------+
| ST_WITHIN(@g2,ST_BUFFER(@g1,5)) |
+---------------------------------+
| 1 |
+---------------------------------+
SELECT ST_WITHIN(@g2,ST_BUFFER(@g1,1));
+---------------------------------+
| ST_WITHIN(@g2,ST_BUFFER(@g1,1)) |
+---------------------------------+
| 0 |
+---------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb About FederatedX About FederatedX
================
The FederatedX storage engine is a fork of MySQL's [Federated storage engine](https://dev.mysql.com/doc/refman/5.5/en/federated-storage-engine.html), which is no longer being developed by Oracle. The original purpose of FederatedX was to keep this storage engine's development progressing-- to both add new features as well as fix old bugs.
Since [MariaDB 10.0](../what-is-mariadb-100/index), the [CONNECT](../connect/index) storage engine also allows access to a remote database via MySQL or ODBC connection (table types: [MYSQL](../connect-table-types-mysql-table-type-accessing-mysqlmariadb-tables/index), [ODBC](../connect-table-types-odbc-table-type-accessing-tables-from-other-dbms/index)). However, in the current implementation there are several limitations.
What is the FederatedX storage engine?
--------------------------------------
The FederatedX Storage Engine is a storage engine that works with both MariaDB and MySQL. Where other storage engines are built as interfaces to lower-level file-based data stores, FederatedX uses libmysql to talk to the data source, the data source being a remote RDBMS. Currently, since FederatedX only uses libmysql, it can only talk to another MySQL RDBMS. The plan is of course to be able to use other RDBMS systems as a data source. There is an existing project Federated ODBC which was able to use PostgreSQL as a remote data source, and it is this type of functionality which will be brought to FederatedX in subsequent versions.
History
-------
The history of FederatedX is derived from the History of Federated. Cisco needed a MySQL storage engine that would allow them to consolidate remote tables on some sort of routing device, being able to interact with these remote tables as if they were local to the device, but not actually on the device, since the routing device had only so much storage space. The first prototype of the Federated Storage Engine was developed by JD (need to check on this- Brian Aker can verify) using the HANDLER interface. Brian handed the code to Patrick Galbraith and explained how it needed to work, and with Brian and Monty's tutelage and Patrick had a working Federated Storage Engine with MySQL 5.0. Eventually, Federated was released to the public in a MySQL 5.0 release.
When MySQL 5.1 became the production release of MySQL, Federated had more features and enhancements added to it, namely:
* New Federated SERVER added to the parser. This was something Cisco needed that made it possible to change the connection parameters for numerous Federated tables at once without having to alter or re-create the Federated tables.
* Basic Transactional support-- for supporting remote transactional tables
* Various bugs that needed to be fixed from MySQL 5.0
* Plugin capability
In [MariaDB 10.0.2](https://mariadb.com/kb/en/mariadb-1002-release-notes/) FederatedX got support for assisted [table discovery](../table-discovery/index).
Installing the Plugin
---------------------
Although the plugin's shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.
The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing `[INSTALL SONAME](../install-soname/index)` or `[INSTALL PLUGIN](../install-plugin/index)`. For example:
```
INSTALL SONAME 'ha_federatedx';
```
The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options. This can be specified as a command-line argument to `[mysqld](../mysqld-options/index)` or it can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
plugin_load_add = ha_federatedx
```
Uninstalling the Plugin
-----------------------
You can uninstall the plugin dynamically by executing `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)`. For example:
```
UNINSTALL SONAME 'ha_federatedx';
```
If you installed the plugin by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index), then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
How FederatedX works
--------------------
Every storage engine has to implement derived standard handler class API methods for a storage engine to work. FederatedX is no different in that regard. The big difference is that FederatedX needs to implement these handler methods in such as to construct SQL statements to run on the remote server and if there is a result set, process that result set into the internal handler format so that the result is returned to the user.
### Internal workings of FederatedX
Normal database files are local and as such: You create a table called 'users', a file such as 'users.MYD' is created. A handler reads, inserts, deletes, updates data in this file. The data is stored in particular format, so to read, that data has to be parsed into fields, to write, fields have to be stored in this format to write to this data file.
With the FederatedX storage engine, there will be no local files for each table's data (such as .MYD). A foreign database will store the data that would normally be in this file. This will necessitate the use of MySQL client API to read, delete, update, insert this data. The data will have to be retrieve via an SQL call "`SELECT \* FROM users`". Then, to read this data, it will have to be retrieved via `mysql\_fetch\_row` one row at a time, then converted from the column in this select into the format that the handler expects.
The basic functionality of how FederatedX works is:
* The user issues an SQL statement against the local federatedX table. This statement is parsed into an item tree
* FederatedX uses the mysql handler API to implement the various methods required for a storage engine. It has access to the item tree for the SQL statement issued, as well as the Table object and each of its Field members. At
* With this information, FederatedX constructs an SQL statement
* The constructed SQL statement is sent to the Foreign data source through libmysql using the mysql client API
* The foreign database reads the SQL statement and sends the result back through the mysql client API to the origin
* If the original SQL statement has a result set from the foreign data source, the FederatedX storage engine iterates through the result set and converts each row and column to the internal handler format
* If the original SQL statement only returns the number of rows returned (affected\_rows), that number is added to the table stats which results in the user seeing how many rows were affected.
#### FederatedX table creation
The create table will simply create the .frm file, and within the `CREATE TABLE` SQL statement, there SHALL be any of the following :
```
connection=scheme://username:password@hostname:port/database/tablename
connection=scheme://username@hostname/database/tablename
connection=scheme://username:password@hostname/database/tablename
connection=scheme://username:password@hostname/database/tablename
```
Or using the syntax introduced in MySQL versions 5.1 for a Federated server (SQL/MED Spec xxxx)
```
connection="connection_one"
connection="connection_one/table_foo"
```
An example of a connect string specifying all the connection parameters would be:
```
connection=mysql://username:password@hostname:port/database/tablename
```
Or, using a Federated server, first a server is created:
```
create server 'server_one' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db1',
USER 'root',
PASSWORD '',
PORT 3306,
SOCKET '',
OWNER 'root');
```
Then the FederatedX table is created specifying the newly created Federated server:
```
CREATE TABLE federatedx.t1 (
`id` int(20) NOT NULL,
`name` varchar(64) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='server_one';
```
(Note that in MariaDB, the original Federated storage engine is replaced with the new FederatedX storage engine. And for backward compatibility, the old name "FEDERATED" is used in create table. So in MariaDB, the engine type should be given as "FEDERATED" without an extra "X", not "FEDERATEDX").
The equivalent of above, if done specifying all the connection parameters
```
CONNECTION="mysql://[email protected]:3306/db1/t1"
```
You can also change the server to point to a new schema:
```
ALTER SERVER 'server_one' options(DATABASE 'db2');
```
All subsequent calls to any FederatedX table using the 'server\_one' will now be against db2.t1! Guess what? You no longer have to perform an alter table in order to point one or more FederatedX tables to a new server!
This `connection="connection string"` is necessary for the handler to be able to connect to the foreign server, either by URL, or by server name.
### Method calls
One way to see how the FederatedX storage engine works is to compile a debug build of MariaDB and turn on a trace log. Using a two column table, with one record, the following SQL statements shown below, can be analyzed for what internal methods they result in being called.
#### SELECT
If the query is for instance "`SELECT \* FROM foo`", then the primary methods you would see with debug turned on would be first:
```
ha_federatedx::info
ha_federatedx::scan_time:
ha_federatedx::rnd_init: share->select_query SELECT * FROM foo
ha_federatedx::extra
```
Then for every row of data retrieved from the foreign database in the result set:
```
ha_federatedx::rnd_next
ha_federatedx::convert_row_to_internal_format
ha_federatedx::rnd_next
```
After all the rows of data that were retrieved, you would see:
```
ha_federatedx::rnd_end
ha_federatedx::extra
ha_federatedx::reset
```
#### INSERT
If the query was "`INSERT INTO foo (id, ts) VALUES (2, now());`", the trace would be:
```
ha_federatedx::write_row
ha_federatedx::reset
```
#### UPDATE
If the query was "`UPDATE foo SET ts = now() WHERE id = 1;`", the resultant trace would be:
```
ha_federatedx::index_init
ha_federatedx::index_read
ha_federatedx::index_read_idx
ha_federatedx::rnd_next
ha_federatedx::convert_row_to_internal_format
ha_federatedx::update_row
ha_federatedx::extra
ha_federatedx::extra
ha_federatedx::extra
ha_federatedx::external_lock
ha_federatedx::reset
```
FederatedX capabilities and limitations
---------------------------------------
* Tables MUST be created on the foreign server prior to any action on those tables via the handler, first version. IMPORTANT: IF you MUST use the FederatedX storage engine type on the REMOTE end, make sure that the table you connect to IS NOT a table pointing BACK to your ORIGINAL table! You know and have heard the screeching of audio feedback? You know putting two mirrors in front of each other how the reflection continues for eternity? Well, need I say more?!
* There is no way for the handler to know if the foreign database or table has changed. The reason for this is that this database has to work like a data file that would never be written to by anything other than the database. The integrity of the data in the local table could be breached if there was any change to the foreign database.
* Support for SELECT, INSERT, UPDATE, DELETE indexes.
* No ALTER TABLE, DROP TABLE or any other Data Definition Language calls.
* Prepared statements will not be used in the first implementation, it remains to to be seen whether the limited subset of the client API for the server supports this.
* This uses SELECT, INSERT, UPDATE, DELETE and not HANDLER for its implementation.
* This will not work with the query cache.
How do you use FederatedX?
--------------------------
To use this handler, it's very simple. You must have two databases running, either both on the same host, or on different hosts.
First, on the foreign database you create a table, for example:
```
CREATE TABLE test_table (
id int(20) NOT NULL auto_increment,
name varchar(32) NOT NULL default '',
other int(20) NOT NULL default '0',
PRIMARY KEY (id),
KEY name (name),
KEY other_key (other))
DEFAULT CHARSET=latin1;
```
Then, on the server that will be connecting to the foreign host (client), you create a federated table without specifying the table structure:
```
CREATE TABLE test_table ENGINE=FEDERATED
CONNECTION='mysql://[email protected]:9306/federatedx/test_federatedx';
```
Notice the "ENGINE" and "CONNECTION" fields? This is where you respectively set the engine type, "FEDERATED" and foreign host information, this being the database your 'client' database will connect to and use as the "data file". Obviously, the foreign database is running on port 9306, so you want to start up your other database so that it is indeed on port 9306, and your FederatedX database on a port other than that. In my setup, I use port 5554 for FederatedX, and port 5555 for the foreign database.
Alternatively (or if you're using MariaDB before version 10.0.2) you specify the federated table structure explicitly:
```
CREATE TABLE test_table (
id int(20) NOT NULL auto_increment,
name varchar(32) NOT NULL default '',
other int(20) NOT NULL default '0',
PRIMARY KEY (id),
KEY name (name),
KEY other_key (other))
ENGINE=FEDERATED
DEFAULT CHARSET=latin1
CONNECTION='mysql://[email protected]:9306/federatedx/test_federatedx';
```
In this case the table structure must match exactly the table on the foreign server.
### How to see the storage engine in action
When developing this handler, I compiled the FederatedX database with debugging:
```
./configure --with-federatedx-storage-engine \
--prefix=/home/mysql/mysql-build/federatedx/ --with-debug
```
Once compiled, I did a 'make install' (not for the purpose of installing the binary, but to install all the files the binary expects to see in the directory I specified in the build with
```
--prefix=/home/code-dev/maria
```
Then, I started the foreign server:
```
/usr/local/mysql/bin/mysqld_safe \
--user=mysql --log=/tmp/mysqld.5555.log -P 5555
```
Then, I went back to the directory containing the newly compiled mysqld `<builddir>/sql/`, started up gdb:
```
gdb ./mysqld
```
Then, within the (gdb) prompt:
```
(gdb) run --gdb --port=5554 --socket=/tmp/mysqld.5554 --skip-innodb --debug
```
Next, I open several windows for each:
1. Tail the debug trace: tail -f /tmp/mysqld.trace|grep ha\_fed
2. Tail the SQL calls to the foreign database: tail -f /tmp/mysqld.5555.log
3. A window with a client open to the federatedx server on port 5554
4. A window with a client open to the federatedx server on port 5555
I would create a table on the client to the foreign server on port 5555, and then to the FederatedX server on port 5554. At this point, I would run whatever queries I wanted to on the FederatedX server, just always remembering that whatever changes I wanted to make on the table, or if I created new tables, that I would have to do that on the foreign server.
Another thing to look for is 'show variables' to show you that you have support for FederatedX handler support:
```
show variables like '%federat%'
```
and:
```
show storage engines;
```
Both should display the federatedx storage handler.
How do I create a federated server?
-----------------------------------
A federated server is a way to have a foreign data source defined-- with all connection parameters-- so that you don't have to specify explicitly the connection parameters in a string.
For instance, say if you wanted to create a table, t1, that you would specify with
```
connection="mysql://[email protected]/first_db/t1"
```
You could instead create this with a server:
```
create server 'server_one' foreign data wrapper 'mysql' options
(HOST '192.168.1.123',
DATABASE 'first_db',
USER 'patg',
PASSWORD '',
PORT 3306,
SOCKET '',
OWNER 'root');
```
You could now instead specify the server instead of the full URL connection string
```
connect="server_one"
```
How does FederatedX differ from the old Federated Engine?
---------------------------------------------------------
FederatedX from a user point of view is the same for the most part. What is different with FederatedX and Federated is the following:
* Rewrite of the main Federated source code from one single ha\_federated.cc file into three main abstracted components:
+ ha\_federatedx.cc - Core implementation of FederatedX
+ federated\_io.cc - Parent connection class to be over-ridden by derived classes for each RDBMS/client lib
+ federatated\_io\_<driver>.cc - derived federated\_io class for a given RDBMS
+ federated\_txn.cc - New support for using transactional engines on the foreign server using a connection poll
* Various bugs fixed (need to look at opened bugs for Federated)
Where can I get FederatedX
--------------------------
FederatedX is part of [MariaDB 5.1](../what-is-mariadb-51/index) and later. MariaDB merged with the latest FederatedX when there is a need to get a bug fixed. You can get the latest code/follow/participate in the project from the [FederatedX home page](http://launchpad.net/federatedx).
### What are the plans for FederatedX?
* Support for other RDBMS vendors using ODBC
* Support for pushdown conditions
* Ability to limit result set sizes
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SET Commands SET Commands
=============
| Title | Description |
| --- | --- |
| [SET](../set/index) | Set a variable value. |
| [SET CHARACTER SET](../set-character-set/index) | Maps all strings sent between the current client and the server with the given mapping. |
| [SET GLOBAL SQL\_SLAVE\_SKIP\_COUNTER](../set-global-sql_slave_skip_counter/index) | Skips a number of events from the primary. |
| [SET NAMES](../set-names/index) | The character set used to send statements to the server, and results back to the client. |
| [SET PASSWORD](../set-password/index) | Assign password to an existing MariaDB user. |
| [SET ROLE](../set-role/index) | Enable a role. |
| [SET SQL\_LOG\_BIN](../set-sql_log_bin/index) | Set binary logging for the current connection. |
| [SET STATEMENT](../set-statement/index) | Set variable values on a per-query basis |
| [SET TRANSACTION](../set-transaction/index) | Sets the transaction isolation level. |
| [SET Variable](../set-variable/index) | Used to insert a value into a variable with a code block. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema INDEX_STATISTICS Table Information Schema INDEX\_STATISTICS Table
==========================================
The [Information Schema](../information_schema/index) `INDEX_STATISTICS` table shows statistics on index usage and makes it possible to do such things as locating unused indexes and generating the commands to remove them.
This is part of the [User Statistics](../user-statistics/index) feature, which is not enabled by default.
It contains the following columns:
| Field | Type | Notes |
| --- | --- | --- |
| `TABLE_SCHEMA` | `VARCHAR(192)` | The schema (database) name. |
| `TABLE_NAME` | `VARCHAR(192)` | The table name. |
| `INDEX_NAME` | `VARCHAR(192)` | The index name (as visible in `[SHOW CREATE TABLE](../show-create-table/index)`). |
| `ROWS_READ` | `INT(21)` | The number of rows read from this index. |
Example
-------
```
SELECT * FROM information_schema.INDEX_STATISTICS
WHERE TABLE_NAME = "author";
+--------------+------------+------------+-----------+
| TABLE_SCHEMA | TABLE_NAME | INDEX_NAME | ROWS_READ |
+--------------+------------+------------+-----------+
| books | author | by_name | 15 |
+--------------+------------+------------+-----------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb StorageManager StorageManager
===============
| Title | Description |
| --- | --- |
| [Certified S3 Object Storage Providers](../certified-s3-object-storage-providers/index) | Hardware (On Prem) Quantum ActiveScale IBM Cloud Object Storage (Formerly known as Cle |
| [Sample storagemanager.cnf](../storagemanager-sample-storagemanagercnf/index) | Sample storagemanager.cnf [ObjectStorage] service = S3 object\_size = 5M metadata\_path = /v |
| [Using StorageManager With IAM Role](../using-storagemanager-with-iam-role/index) | AWS IAM Role Configuration We have added a new feature in Columnstore 5.5.2... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema PROCESSLIST Table Information Schema PROCESSLIST Table
====================================
The [Information Schema](../information_schema/index) `PROCESSLIST` table contains information about running threads.
Similar information can also be returned with the `[SHOW [FULL] PROCESSLIST](../show-processlist/index)` statement, or the `[mysqladmin processlist](../mysqladmin/index)` command.
It contains the following columns:
| Column | Description |
| --- | --- |
| `ID` | Connection identifier. |
| `USER` | MariaDB User. |
| `HOST` | Connecting host. |
| `DB` | Default database, or `NULL` if none. |
| `COMMAND` | Type of command running, corresponding to the `Com_` [status variables](../server-status-variables/index). See [Thread Command Values](../thread-command-values/index). |
| `TIME` | Seconds that the thread has spent on the current `COMMAND` so far. |
| `STATE` | Current state of the thread. See [Thread States](../thread-states/index). |
| `INFO` | Statement the thread is executing, or `NULL` if none. |
| `TIME_MS` | Time in milliseconds with microsecond precision that the thread has spent on the current `COMMAND` so far ([see more](../time_ms-column-in-information_schemaprocesslist/index)). |
| `STAGE` | The stage the process is currently in. |
| `MAX_STAGE` | The maximum number of stages. |
| `PROGRESS` | The progress of the process within the current stage (0-100%). |
| `MEMORY_USED` | Memory in bytes used by the thread. |
| `EXAMINED_ROWS` | Rows examined by the thread. Only updated by UPDATE, DELETE, and similar statements. For SELECT and other statements, the value remains zero. |
| `QUERY_ID` | Query ID. |
| `INFO_BINARY` | Binary data information |
| `TID` | Thread ID ([MDEV-6756](https://jira.mariadb.org/browse/MDEV-6756)) |
Note that as a difference to MySQL, in MariaDB the `TIME` column (and also the `TIME_MS` column) are not affected by any setting of `[@TIMESTAMP](../server-system-variables/index#timestamp)`. This means that it can be reliably used also for threads that change `@TIMESTAMP` (such as the [replication](../replication/index) SQL thread). See also [MySQL Bug #22047](http://bugs.mysql.com/bug.php?id=22047).
As a consequence of this, the `TIME` column of `SHOW FULL PROCESSLIST` and `INFORMATION_SCHEMA.PROCESSLIST` can not be used to determine if a slave is lagging behind. For this, use instead the `Seconds_Behind_Master` column in the output of [SHOW SLAVE STATUS](../show-slave-status/index).
Note that the `PROGRESS` field from the information schema, and the `PROGRESS` field from `SHOW PROCESSLIST` display different results. `SHOW PROCESSLIST` shows the total progress, while the information schema shows the progress for the current stage only.. To retrieve a similar "total" Progress value from `information_schema.PROCESSLIST` as the one from `SHOW PROCESSLIST`, use
```
SELECT CASE WHEN Max_Stage < 2 THEN Progress ELSE (Stage-1)/Max_Stage*100+Progress/Max_Stage END
AS Progress FROM INFORMATION_SCHEMA.PROCESSLIST;
```
Example
-------
```
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST\G
*************************** 1. row ***************************
ID: 9
USER: msandbox
HOST: localhost
DB: NULL
COMMAND: Query
TIME: 0
STATE: Filling schema table
INFO: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
TIME_MS: 0.351
STAGE: 0
MAX_STAGE: 0
PROGRESS: 0.000
MEMORY_USED: 85392
EXAMINED_ROWS: 0
QUERY_ID: 15
INFO_BINARY: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
TID: 11838
*************************** 2. row ***************************
ID: 5
USER: system user
HOST:
DB: NULL
COMMAND: Daemon
TIME: 0
STATE: InnoDB shutdown handler
INFO: NULL
TIME_MS: 0.000
STAGE: 0
MAX_STAGE: 0
PROGRESS: 0.000
MEMORY_USED: 24160
EXAMINED_ROWS: 0
QUERY_ID: 0
INFO_BINARY: NULL
TID: 3856
...
```
See Also
--------
* [TIME\_MS column in Information Schema SHOW PROCESSLIST](../time_ms-column-in-information_schemaprocesslist/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB Audit Plugin - Location and Rotation of Logs MariaDB Audit Plugin - Location and Rotation of Logs
====================================================
Logs can be written to a separate file or to the system logs. If you prefer to have the logging separated from other system information, the value of the variable, [server\_audit\_output\_type](../mariadb-audit-plugin-system-variables/index#server_audit_output_type) should be set to `file`. Incidentally, `file` is the only option on Windows systems.
You can force a rotation by enabling the [server\_audit\_file\_rotate\_now](../mariadb-audit-plugin-system-variables/index#server_audit_file_rotate_now) variable like so:
```
SET GLOBAL server_audit_file_rotate_now = ON;
```
### Separate log files
In addition to setting [server\_audit\_output\_type](../mariadb-audit-plugin-system-variables/index#server_audit_output_type), you will have to provide the file path and name of the audit file. This is set in the variable, [server\_audit\_file\_path](../mariadb-audit-plugin-system-variables/index#server_audit_file_path). You can set the file size limit of the log file with the variable, [server\_audit\_file\_rotate\_size](../mariadb-audit-plugin-system-variables/index#server_audit_file_rotate_size).
So, if rotation is on and the log file has reached the size limit you set, a copy is created with a consecutive number as extension, the original file will be truncated to be used for the auditing again. To limit the number of log files created, set the variable, [server\_audit\_file\_rotations](../mariadb-audit-plugin-system-variables/index#server_audit_file_rotations). You can force log file rotation by setting the variable, [server\_audit\_file\_rotate\_now](../mariadb-audit-plugin-system-variables/index#server_audit_file_rotate_now) to a value of `ON`. When the number of files permitted is reached, the oldest file will be overwritten. Below is an example of how the variables described above might be set in a server's configuration files:
```
[mysqld]
...
server_audit_file_rotate_now=ON
server_audit_file_rotate_size=1000000
server_audit_file_rotations=5
...
```
### System logs
For security reasons, it's better sometimes to use the system logs instead of a local file owned by the `mysql` user. To do this, the value of [server\_audit\_output\_type](../mariadb-audit-plugin-system-variables/index#server_audit_output_type) needs to be set to `syslog`. Advanced configurations, such as using a remote `syslogd` service, are part of the `syslogd` configuration.
The variables, [server\_audit\_syslog\_ident](../mariadb-audit-plugin-system-variables/index#server_audit_syslog_ident) and [server\_audit\_syslog\_info](../mariadb-audit-plugin-system-variables/index#server_audit_syslog_info) can be used to identify a system log entry made by the audit plugin. If a remote `syslogd` service is used for several MariaDB servers, these same variables are also used to identify the MariaDB server.
Below is an example of a system log entry taken from a server which had [server\_audit\_syslog\_ident](../mariadb-audit-plugin-system-variables/index#server_audit_syslog_ident) set to the default value of `mysql-server_auditing`, and [server\_audit\_syslog\_info](../mariadb-audit-plugin-system-variables/index#server_audit_syslog_info) set to `<prod1>`.
```
Aug 717:19:58localhostmysql-server_auditing:
<prod1> localhost.localdomain,root,localhost,1,7,
QUERY, mysql, 'SELECT * FROM user',0
```
Although the default values for [server\_audit\_syslog\_facility](../mariadb-audit-plugin-system-variables/index#server_audit_syslog_facility) and [server\_audit\_syslog\_priority](../mariadb-audit-plugin-system-variables/index#server_audit_syslog_priority) should be sufficient in most cases, they can be changed based on the definition in `syslog.h` for the functions `openlog()` and `syslog()`.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb TLS and Cryptography Libraries Used by MariaDB TLS and Cryptography Libraries Used by MariaDB
==============================================
When MariaDB Server is compiled with TLS and cryptography support, it is usually either statically linked with MariaDB's bundled TLS and cryptography library or dynamically linked with the system's [OpenSSL](https://www.openssl.org/) library. MariaDB's bundled TLS library is either [wolfSSL](https://www.wolfssl.com/products/wolfssl/) or [yaSSL](https://www.wolfssl.com/products/yassl/), depending on the server version.
When a MariaDB client or client library is compiled with TLS and cryptography support, it is usually either statically linked with MariaDB's bundled TLS and cryptography library or dynamically linked with the system's TLS and cryptography library, which might be [OpenSSL](https://www.openssl.org/), [GnuTLS](https://www.gnutls.org/), or [Schannel](https://docs.microsoft.com/en-us/windows/desktop/secauthn/secure-channel).
Checking Dynamically vs. Statically Linked
------------------------------------------
Dynamically linking MariaDB to the system's TLS and cryptography library can often be beneficial, since this allows you to fix bugs in the system's TLS and cryptography library independently of MariaDB. For example, when information on the [Heartbleed Bug](http://heartbleed.com/) in [OpenSSL](https://www.openssl.org/) was released in 2014, the bug could be mitigated by simply updating your system to use a fixed version of the [OpenSSL](https://www.openssl.org/) library, and then restarting the MariaDB Server.
You can verify that `mysqld` is in fact dynamically linked to the [OpenSSL](https://www.openssl.org/) shared library on your system by using the `[ldd](https://linux.die.net/man/1/ldd)` command:
```
$ ldd $(which mysqld) | grep -E '(libssl|libcrypto)'
libssl.so.10 => /lib64/libssl.so.10 (0x00007f8736386000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f8735f25000)
```
If the command does not return any results, then either your `mysqld` is statically linked to the TLS and cryptography library on your system or your `mysqld` is not built with TLS and cryptography support at all.
Checking If the Server Uses OpenSSL
-----------------------------------
In [MariaDB 10.0](../what-is-mariadb-100/index) and later, if you aren't sure whether your server is linked with [OpenSSL](https://www.openssl.org/) or the bundled TLS library, then you can check the value of the `[have\_openssl](../ssl-system-variables/index#have_openssl)` system variable. For example:
```
SHOW GLOBAL VARIABLES LIKE 'have_openssl';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_openssl | YES |
+---------------+-------+
```
Checking the Server's OpenSSL Version
-------------------------------------
In [MariaDB 10.1](../what-is-mariadb-101/index) and later, if you want to see what version of [OpenSSL](https://www.openssl.org/) your server is using, then you can check the value of the `[version\_ssl\_library](../ssl-system-variables/index#version_ssl_library)` system variable. For example:
```
SHOW GLOBAL VARIABLES LIKE 'version_ssl_library';
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| version_ssl_library | OpenSSL 1.0.1e-fips 11 Feb 2013 |
+---------------------+---------------------------------+
```
Note that the version returned by this system variable does not always necessarily correspond to the exact version of the [OpenSSL](https://www.openssl.org/) package installed on the system. [OpenSSL](https://www.openssl.org/) shared libraries tend to contain interfaces for multiple versions at once to allow for backward compatibility. Therefore, if the [OpenSSL](https://www.openssl.org/) package installed on the system is newer than the [OpenSSL](https://www.openssl.org/) version that the MariaDB Server binary was built with, then the MariaDB Server binary might use one of the interfaces for an older version. See [MDEV-15848](https://jira.mariadb.org/browse/MDEV-15848) for more information. For example:
```
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
$ rpm -q openssl
openssl-1.0.2k-12.el7.x86_64
$ mysql -u root --batch --execute="SHOW GLOBAL VARIABLES LIKE 'version_ssl_library';"
Variable_name Value
version_ssl_library OpenSSL 1.0.1e-fips 11 Feb 2013
$ ldd $(which mysqld) | grep libcrypto
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f3dd3482000)
$ readelf -a /lib64/libcrypto.so.10 | grep SSLeay_version
1374: 000000000006f5d0 21 FUNC GLOBAL DEFAULT 13 [email protected]
1375: 000000000006f5f0 21 FUNC GLOBAL DEFAULT 13 SSLeay_version@OPENSSL_1.0.1
1377: 000000000006f580 70 FUNC GLOBAL DEFAULT 13 SSLeay_version@@OPENSSL_1.0.2
```
FIPS Certification
------------------
[Federal Information Processing Standards (FIPS)](https://www.nist.gov/itl/itl-publications/federal-information-processing-standards-fips) are standards published by the U.S. federal government that are used to establish requirements for various aspects of computer systems. [FIPS 140-2](https://www.nist.gov/publications/security-requirements-cryptographic-modules-includes-change-notices-1232002?pub_id=902003) is a set of standards for security requirements for cryptographic modules.
This standard is relevant when discussing the TLS and cryptography libraries used by MariaDB. Some of these libraries have been certified to meet the standards set by FIPS 140-2.
### FIPS Certification by OpenSSL
The [OpenSSL](https://www.openssl.org/) library has a special FIPS mode that has been certified to meet the FIPS 140-2 standard. In FIPS mode, only algorithms and key sizes that meet the FIPS 140-2 standard are enabled by the library.
MariaDB does not yet support enabling FIPS mode within the database server. See [MDEV-20260](https://jira.mariadb.org/browse/MDEV-20260) for more information. Therefore, if you would like to use OpenSSL's FIPS mode with MariaDB, then you would either need to enable FIPS mode at the kernel level or enable it via the OpenSSL configuration file, system-wide or only for the MariaDB process.. See the following resources for more information on how to do that:
* [Red Hat Enterprise Linux 7: Security Guide: Chapter 8. Federal Standards and Regulations](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/chap-federal_standards_and_regulations)
* [Ubuntu Security Certifications Documentation: FIPS for Ubuntu 16.04 and 18.04](https://security-certs.docs.ubuntu.com/en/fips)
* [OpenSSL 1.0.2, configuration file method](https://www.openssl.org/docs/fips/UserGuide-2.0.pdf#page=73)
* [OpenSSL 3.0 configuration file method](https://www.openssl.org/docs/man3.0/man7/fips_module.html#Making-all-applications-use-the-FIPS-module-by-default)
### FIPS Certification by wolfSSL
The standard version of the [wolfSSL](https://www.wolfssl.com/products/wolfssl/) library has not been certified to meet the FIPS 140-2 standard, but a special ["FIPS-ready"](https://www.wolfssl.com/wolfssl-fips-ready/) version has been certified. Unfortunately, the "FIPS-ready" version of wolfSSL uses a license that is incompatible with MariaDB's license, so it cannot be used with MariaDB.
### FIPS Certification by yaSSL
The [yaSSL](https://www.wolfssl.com/products/yassl/) library has not been certified to meet the FIPS 140-2 standard.
Libraries Used by Each Platform and Package
-------------------------------------------
### MariaDB Server
#### MariaDB Server on Windows
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**MariaDB Server is statically linked with the bundled [wolfSSL](https://www.wolfssl.com/products/wolfssl/) library in [MSI](../installing-mariadb-msi-packages-on-windows/index) and [ZIP](../installing-mariadb-windows-zip-packages/index) packages on Windows.
**MariaDB until [10.4.5](https://mariadb.com/kb/en/mariadb-1045-release-notes/)**MariaDB Server is statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library in [MSI](../installing-mariadb-msi-packages-on-windows/index) and [ZIP](../installing-mariadb-windows-zip-packages/index) packages on Windows.
#### MariaDB Server on Linux
##### MariaDB Server in Binary Tarballs
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**In [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/) and later, MariaDB Server is statically linked with the bundled [wolfSSL](https://www.wolfssl.com/products/wolfssl/) library in [binary tarballs](../installing-mariadb-binary-tarballs/index) on Linux.
**MariaDB until [10.4.5](https://mariadb.com/kb/en/mariadb-1045-release-notes/)**In [MariaDB 10.4.5](https://mariadb.com/kb/en/mariadb-1045-release-notes/) and before, MariaDB Server is statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library in [binary tarballs](../installing-mariadb-binary-tarballs/index) on Linux.
##### MariaDB Server in DEB Packages
MariaDB Server is dynamically linked with the system's [OpenSSL](https://www.openssl.org/) library in `[.deb](../installing-mariadb-deb-files/index)` packages.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and before, MariaDB Server is statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library in `[.deb](../installing-mariadb-deb-files/index)` packages provided by Debian's and Ubuntu's default repositories.
See [Differences in MariaDB in Debian (and Ubuntu)](../differences-in-mariadb-in-debian-and-ubuntu/index) for more information.
##### MariaDB Server in RPM Packages
MariaDB Server is dynamically linked with the system's [OpenSSL](https://www.openssl.org/) library in `[.rpm](../rpm/index)` packages.
### MariaDB Clients and Utilities
In [MariaDB 10.2](../what-is-mariadb-102/index) and later, [MariaDB Connector/C](../mariadb-connector-c/index) has been [included with MariaDB Server](../about-mariadb-connector-c/index#integration-with-mariadb-server), and the bundled and the [clients and utilities](../clients-utilities/index) are linked with it. On some platforms, [MariaDB Connector/C](../mariadb-connector-c/index) and these [clients and utilities](../clients-utilities/index) may use a different TLS library than the one used by MariaDB Server and [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html).
#### MariaDB Clients and Utilities on Windows
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**In [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/) and later, MariaDB's [clients and utilities](../clients-utilities/index) and [MariaDB Connector/C](../mariadb-connector-c/index) are are dynamically linked with the system's [Schannel](https://docs.microsoft.com/en-us/windows/desktop/secauthn/secure-channel) libraries in [MSI](../installing-mariadb-msi-packages-on-windows/index) and [ZIP](../installing-mariadb-windows-zip-packages/index) packages on Windows. [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) is still statically linked with the bundled [wolfSSL](https://www.wolfssl.com/products/wolfssl/) library.
**MariaDB starting with [10.2](../what-is-mariadb-102/index)**In [MariaDB 10.2](../what-is-mariadb-102/index) and later, MariaDB's [clients and utilities](../clients-utilities/index) and [MariaDB Connector/C](../mariadb-connector-c/index) are are dynamically linked with the system's [Schannel](https://docs.microsoft.com/en-us/windows/desktop/secauthn/secure-channel) libraries in [MSI](../installing-mariadb-msi-packages-on-windows/index) and [ZIP](../installing-mariadb-windows-zip-packages/index) packages on Windows. [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) is still statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library.
**MariaDB until [10.1](../what-is-mariadb-101/index)**In [MariaDB 10.1](../what-is-mariadb-101/index) and before, MariaDB's [clients and utilities](../clients-utilities/index) and [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) are statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library in [MSI](../installing-mariadb-msi-packages-on-windows/index) and [ZIP](../installing-mariadb-windows-zip-packages/index) packages on Windows.
#### MariaDB Clients and Utilities on Linux
##### MariaDB Clients and Utilities in Binary Tarballs
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**In [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/) and later, MariaDB's [clients and utilities](../clients-utilities/index) and [MariaDB Connector/C](../mariadb-connector-c/index) are statically linked with the [GnuTLS](https://www.gnutls.org/) library in [binary tarballs](../installing-mariadb-binary-tarballs/index) on Linux. [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) is still statically linked with the bundled [wolfSSL](https://www.wolfssl.com/products/wolfssl/) library.
**MariaDB starting with [10.2](../what-is-mariadb-102/index)**In [MariaDB 10.2](../what-is-mariadb-102/index) and later, MariaDB's [clients and utilities](../clients-utilities/index) and [MariaDB Connector/C](../mariadb-connector-c/index) are statically linked with the [GnuTLS](https://www.gnutls.org/) library in [binary tarballs](../installing-mariadb-binary-tarballs/index) on Linux. [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) is still statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library.
**MariaDB until [10.1](../what-is-mariadb-101/index)**In [MariaDB 10.1](../what-is-mariadb-101/index) and before, MariaDB's [clients and utilities](../clients-utilities/index) and [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) are statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library in [binary tarballs](../installing-mariadb-binary-tarballs/index) on Linux.
##### MariaDB Clients and Utilities in DEB Packages
MariaDB's [clients and utilities](../clients-utilities/index), [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html), and [MariaDB Connector/C](../mariadb-connector-c/index) are dynamically linked with the system's [OpenSSL](https://www.openssl.org/) library in `[.deb](../installing-mariadb-deb-files/index)` packages.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.2](../what-is-mariadb-102/index) and 10.3, MariaDB's [clients and utilities](../clients-utilities/index) and [MariaDB Connector/C](../mariadb-connector-c/index) are dynamically linked with the system's [GnuTLS](https://www.gnutls.org/) library in `[.deb](../installing-mariadb-deb-files/index)` packages provided by Debian's and Ubuntu's default repositories. [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) is still statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) libraries.
**MariaDB until [10.1](../what-is-mariadb-101/index)**In [MariaDB 10.1](../what-is-mariadb-101/index) and earlier, MariaDB's [clients and utilities](../clients-utilities/index) and [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html) are statically linked with the bundled [yaSSL](https://www.wolfssl.com/products/yassl/) library in `[.deb](../installing-mariadb-deb-files/index)` packages provided by Debian's and Ubuntu's default repositories.
See [Differences in MariaDB in Debian (and Ubuntu)](../differences-in-mariadb-in-debian-and-ubuntu/index) for more information.
##### MariaDB Clients and Utilities in RPM Packages
MariaDB's [clients and utilities](../clients-utilities/index), [libmysqlclient](https://dev.mysql.com/doc/refman/5.5/en/c-api.html), and [MariaDB Connector/C](../mariadb-connector-c/index) are dynamically linked with the system's [OpenSSL](https://www.openssl.org/) library in `[.rpm](../rpm/index)` packages.
Updating Dynamically Linked OpenSSL Libraries on Linux
------------------------------------------------------
When the MariaDB Server or clients and utilities are dynamically linked to the system's [OpenSSL](https://www.openssl.org/) library, it makes it very easy to update the libraries. The information below will show how to update these libraries for each platform.
### Updating Dynamically Linked OpenSSL Libraries with yum/dnf
On RHEL, CentOS, Fedora, and other similar Linux distributions, it is highly recommended to update the libraries using `[yum](../yum/index)` or `[dnf](https://en.wikipedia.org/wiki/DNF_(software))`. Starting with RHEL 8 and Fedora 22, `yum` has been replaced by `dnf`, which is the next major version of `yum`. However, `yum` commands still work on many systems that use `dnf`. For example:
Update the package by executing the following command:
```
sudo yum update openssl
```
And then [restart](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index) MariaDB server and any clients or applications that use the library.
### Updating Dynamically Linked OpenSSL Libraries with apt-get
On Debian, Ubuntu, and other similar Linux distributions, it is highly recommended to recommended to update the libraries using `[apt-get](https://wiki.debian.org/apt-get)`. For example:
First update the package cache by executing the following command:
```
sudo apt update
```
And then update the package by executing the following command:
```
sudo apt-get update openssl
```
And then [restart](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index) MariaDB server and any clients or applications that use the library.
### Updating Dynamically Linked OpenSSL Libraries with zypper
On SLES, OpenSUSE, and other similar Linux distributions, it is highly recommended to recommended to update the libraries using `[zypper](../installing-mariadb-with-zypper/index)`. For example:
Update the package by executing the following command:
```
sudo zypper update openssl
```
And then [restart](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index) MariaDB server and any clients or applications that use the library.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb dbForge Studio for MariaDB dbForge Studio for MariaDB
==========================
**[dbForge Studio for MariaDB](https://www.devart.com/dbforge/mysql/studio/mariadb-gui-client.html)** is a universal IDE with GUI tools that has all the necessary built-in capabilities to work with MariaDB and MySQL databases for their development, management, and administration. It allows for creating, managing, and editing the data without the need to store them locally.
This powerful GUI tool offers a rich visual design that is perfect for working with large scripts, preparing data reports, and database projects. At any time, you can back up or restore your data, export or import them to and from the most commonly used formats, and compare or synchronize the MariaDB databases. Apart from that, dbForge Studio supports the following servers:
* MariaDB,
* SkySQL (the MariaDB cloud database),
* All MySQL Server versions,
* Percona servers and TokuDB,
* MySQL and MariaDB on Amazon RDS and Amazon Aurora.
* Google Cloud, Alibaba Cloud, Tencent Cloud, Galera Cluster,
* Sphinx, etc.
Key Features:
-------------
### 1. Intelligent SQL Coding
* Automatic code completion
* MariaDB syntax highlighting
* Code refactoring and formatting
* CRUD generation
### 2. Database Compare and Sync
* Data and schema synchronization and comparison
* Recurring database sync tasks planning
* Comparison report generation
### 3. Import/Export Data MariaDB
* MariaDB data export to 14 commonly-used formats
* Data import from 10 popular formats into MariaDB table
* Rich customization ability
* Command-line automation for data tasks
### 4. MariaDB Admin Tools
* MariaDB databases backing up and restoring
* User accounts and permissions configuration
* Table maintenance
* Database scripts generation
### 5. Copy Database
* Source and Target servers’ selection
* Database to be copied or dropped selection
* Configuration of the database copying parameters
* Progress of copying tracing and abortion of the copying
### 6. Database Designer
* Schema diagrams generation
* Visual database construction
* Foreign key relations between tables

### 7. Data Generator
* Data customization supported by multiple generators
* All kinds of generators: basic, meaningful, and user-defined
* Real-time preview of generated data
* Command-line interface
### 8. Query Profiler
* Visual query profiling
* Profiling results comparison
### 9. Visual Query Builder
* Automatic generation of the script template for queries
* Easy navigation through the database objects
* Support for different query types
### 10. Table Designer
* Table creation and editing in MariaDB with no code
* Automatic data type setting for frequently-used column values
* Errors prevention while working with tables
* MariaDB script automatic generation according to the changes made by a user
### 11. Database Refactoring
* Renaming database objects with preview
* Refactoring script
### 12. Database Projects
* MariaDB version control system providing efficient database team development
* Scripts folder for exporting a database project to a MariaDB script file
### 13. Report and Analysis
* Pivot tables for summarizing and viewing the data
* A powerful wizard with robust features
* Full command-line support
* 9 formats for reports' delivery

### 14. Database Documenter
* A comprehensive overview of the database structure
* Examine the internal dependencies between objects and databases
* Customize the style and generate the docs in several formats
### 15. Support for MariaDB objects:
* Packages
* Sequences
Nowadays, with the growing popularity of the MariaDB database, the demand for a convenient, multi-functional tool is increasing, too. This solution must meet users’ needs, be easy to work with and provide constant support. Fortunately, [dbForge Studio for MariaDB and MySQL](https://www.devart.com/dbforge/mysql/studio/) is such a solution. This database tool is one of the most appreciated worldwide and trusted by many people. Devart’s dbForge Studio has received a lot of awards that confirm its overwhelming popularity.
Download a free 30-day trial of dbForge Studio for MariaDB and MySQL [here](https://www.devart.com/dbforge/mysql/studio/download.html).
[Documentation](https://docs.devart.com/studio-for-mysql)
[Editions](https://www.devart.com/dbforge/mysql/studio/editions.html)
| Version | Introduced |
| --- | --- |
| dbForge Studio for MySQL 9.1 | Connectivity support for [MariaDB 10.9](../what-is-mariadb-109/index) is added |
| dbForge Studio for MySQL 9.0 | Connectivity support for [MariaDB 10.5](../what-is-mariadb-105/index)-10.6 |
| dbForge Studio for MySQL 8.1 | Support for [MariaDB 10.4](../what-is-mariadb-104/index) |
| dbForge Studio for MySQL 8.0 | Support for [MariaDB 10.3](../what-is-mariadb-103/index) |
| dbForge Studio for MySQL 7.3 | Support for [MariaDB 10.2](../what-is-mariadb-102/index), Support for [MariaDB 10.1](../what-is-mariadb-101/index), Support for MariaDB Galera Cluster 10.0 Series |
| dbForge Studio for MySQL 6.1 | [MariaDB 10.0](../what-is-mariadb-100/index), [MariaDB 5.5](../what-is-mariadb-55/index) |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb TIME Function TIME Function
=============
Syntax
------
```
TIME(expr)
```
Description
-----------
Extracts the time part of the time or datetime expression `expr` and returns it as a string.
Examples
--------
```
SELECT TIME('2003-12-31 01:02:03');
+-----------------------------+
| TIME('2003-12-31 01:02:03') |
+-----------------------------+
| 01:02:03 |
+-----------------------------+
SELECT TIME('2003-12-31 01:02:03.000123');
+------------------------------------+
| TIME('2003-12-31 01:02:03.000123') |
+------------------------------------+
| 01:02:03.000123 |
+------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Group Commit for the Binary Log Group Commit for the Binary Log
===============================
Overview
--------
The server supports group commit. This is an important optimization that helps MariaDB reduce the number of expensive disk operations that are performed.
Durability
----------
In ACID terminology, the "D" stands for durability. In order to ensure durability with group commit, [innodb\_flush\_log\_at\_trx\_commit=1](../xtradbinnodb-server-system-variables/index#innodb_flush_log_at_trx_commit) and/or [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog) should be set. These settings are needed to ensure that if the server crashes, then any transaction that was committed prior to the time of crash will still be present in the database after crash recovery.
### Durable InnoDB Data and Binary Logs
Setting both [innodb\_flush\_log\_at\_trx\_commit=1](../xtradbinnodb-server-system-variables/index#innodb_flush_log_at_trx_commit) and [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog) provides the most durability and the best guarantee of [replication](../high-availability-performance-tuning-mariadb-replication/index) consistency after a crash.
### Non-Durable InnoDB Data
If [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog) is set, but [innodb\_flush\_log\_at\_trx\_commit](../xtradbinnodb-server-system-variables/index#innodb_flush_log_at_trx_commit) is not set to `1` or `3`, then it is possible after a crash to end up in a state where a transaction present in a server's [binary log](../binary-log/index) is missing from the server's [InnoDB redo log](../xtradbinnodb-redo-log/index). If the server is a [replication master](../high-availability-performance-tuning-mariadb-replication/index), then that means that the server can become inconsistent with its slaves, since the slaves may have replicated transactions from the master's [binary log](../binary-log/index) that are no longer present in the master's local [InnoDB](../innodb/index) data.
### Non-Durable Binary Logs
If [innodb\_flush\_log\_at\_trx\_commit](../xtradbinnodb-server-system-variables/index#innodb_flush_log_at_trx_commit) is set to `1` or `3`, but [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog) is not set, then it is possible after a crash to end up in a state where a transaction present in a server's [InnoDB redo log](../xtradbinnodb-redo-log/index) is missing from the server's [binary log](../binary-log/index). If the server is a [replication master](../high-availability-performance-tuning-mariadb-replication/index), then that also means that the server can become inconsistent with its slaves, since the server's slaves would not be able to replicate the missing transactions from the server's [binary log](../binary-log/index).
### Non-Durable InnoDB Data and Binary Logs
Setting [innodb\_flush\_log\_at\_trx\_commit=1](../innodb-system-variables/index#innodb_flush_log_at_trx_commit) when [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog) is not set can also cause the transaction to be missing from the server's [InnoDB redo log](../xtradbinnodb-redo-log/index) due to some optimizations added in those versions. In that case, it is recommended to always set [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog). If you can't do that, then it is recommended to set [innodb\_flush\_log\_at\_trx\_commit](../xtradbinnodb-server-system-variables/index#innodb_flush_log_at_trx_commit) to `3`, rather than `1`. See [Non-durable Binary Log Settings](../binary-log-group-commit-and-innodb-flushing-performance/index#non-durable-binary-log-settings) for more information.
Amortizing Disk Flush Costs
---------------------------
After every transaction [COMMIT](../commit/index), the server normally has to flush any changes the transaction made to the [InnoDB redo log](../xtradbinnodb-redo-log/index) and the [binary log](../binary-log/index) to disk (i.e. by calling system calls such as `fsync()` or `fdatasync()` or similar). This helps ensure that the data changes made by the transaction are stored durably on the disk. Disk flushing is a time-consuming operation, and can easily impose limits on throughput in terms of the number of transactions-per-second (TPS) which can be committed.
The idea with group commit is to amortize the costs of each flush to disk over multiple commits from multiple parallel transactions. For example, if there are 10 transactions trying to commit in parallel, then we can force all of them to be flushed disk at once with a single system call, rather than do one system call for each commit. This can greatly reduce the need for flush operations, and can consequently greatly improve the throughput of transactions-per-second (TPS).
However, to see the positive effects of group commit, the workload must have sufficient parallelism. A good rule of thumb is that at least three parallel transactions are needed for group commit to be effective. For example, while the first transaction is waiting for its flush operation to complete, the other two transactions will queue up waiting for their turn to flush their changes to disk. When the first transaction is done, a single system call can be used to flush the two queued-up transactions, saving in this case one of the three system calls.
In addition to sufficient parallelism, it is also necessary to have enough transactions per second wanting to commit that the flush operations are a bottleneck. If no such bottleneck exists (i.e. transactions never or rarely need to wait for the flush of another to complete), then group commit will provide little to no improvement.
Changing Group Commit Frequency
-------------------------------
The frequency of group commits can be changed by configuring the [binlog\_commit\_wait\_usec](../replication-and-binary-log-system-variables/index#binlog_commit_wait_usec) and [binlog\_commit\_wait\_count](../replication-and-binary-log-system-variables/index#binlog_commit_wait_count) system variables.
Measuring Group Commit Ratio
----------------------------
Two status variables are available for checking how effective group commit is at reducing flush overhead. These are the [Binlog\_commits](../replication-and-binary-log-status-variables/index#binlog_commits) and [Binlog\_group\_commits](../replication-and-binary-log-status-variables/index#binlog_group_commits) status variables. We can obtain those values with the following query:
```
SHOW GLOBAL STATUS WHERE Variable_name IN('Binlog_commits', 'Binlog_group_commits');
```
[Binlog\_commits](../replication-and-binary-log-status-variables/index#binlog_commits) is the total number of transactions committed to the [binary log](../binary-log/index).
[Binlog\_group\_commits](../replication-and-binary-log-status-variables/index#binlog_group_commits) is the total number of groups committed to the [binary log](../binary-log/index). As explained in the previous sections of this page, a group commit is when a group of transactions is flushed to the [binary log](../binary-log/index) together by sharing a single flush system call. When [sync\_binlog=1](../replication-and-binary-log-server-system-variables/index#sync_binlog) is set, then this is also the total number of flush system calls executed in the process of flushing commits to the [binary log](../binary-log/index).
Thus the extent to which group commit is effective at reducing the number of flush system calls on the binary log can be determined by the ratio between these two status variables. [Binlog\_commits](../replication-and-binary-log-status-variables/index#binlog_commits) will always be as equal to or greater than [Binlog\_group\_commits](../replication-and-binary-log-status-variables/index#binlog_group_commits). The greater the difference is between these status variables, the more effective group commit was at reducing flush overhead.
To calculate the group commit ratio, we actually need the values of these status variables from two snapshots. Then we can calculate the ratio with the following formula:
`transactions/group commit` = (`Binlog_commits` (*snapshot2*) - `Binlog_commits` (*snapshot1*))/(`Binlog_group_commits` (*snapshot2*) - `Binlog_group_commits` (*snapshot1*))
For example, if we had the following first snapshot:
```
SHOW GLOBAL STATUS WHERE Variable_name IN('Binlog_commits', 'Binlog_group_commits');
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Binlog_commits | 120 |
| Binlog_group_commits | 120 |
+----------------------+-------+
2 rows in set (0.00 sec)
```
And the following second snapshot:
```
SHOW GLOBAL STATUS WHERE Variable_name IN('Binlog_commits', 'Binlog_group_commits');
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Binlog_commits | 220 |
| Binlog_group_commits | 145 |
+----------------------+-------+
2 rows in set (0.00 sec)
```
Then we would have:
`transactions/group commit` = (220 - 120) / (145 - 120) = 100 / 25 = 4 `transactions/group commit`
If your group commit ratio is too close to 1, then it may help to [change your group commit frequency](index#changing-group-commit-frequency).
Use of Group Commit with Parallel Replication
---------------------------------------------
Group commit is also used to enable [conservative mode of in-order parallel replication](../parallel-replication/index#conservative-mode-of-in-order-parallel-replication).
Effects of Group Commit on InnoDB Performance
---------------------------------------------
When both [innodb\_flush\_log\_at\_trx\_commit=1](../xtradbinnodb-server-system-variables/index#innodb_flush_log_at_trx_commit) (the default) is set and the [binary log](../binary-log/index) is enabled, there is now one less sync to disk inside InnoDB during commit (2 syncs shared between a group of transactions instead of 3). See [Binary Log Group Commit and InnoDB Flushing Performance](../binary-log-group-commit-and-innodb-flushing-performance/index) for more information.
Status Variables
----------------
[Binlog\_commits](../replication-and-binary-log-status-variables/index#binlog_commits) is the total number of transactions committed to the [binary log](../binary-log/index).
[Binlog\_group\_commits](../replication-and-binary-log-status-variables/index#binlog_group_commits) is the total number of groups committed to the [binary log](../binary-log/index).
[Binlog\_group\_commit\_trigger\_count](../replication-and-binary-log-status-variables/index#binlog_group_commit_trigger_count) is the total number of group commits triggered because of the number of [binary log](../binary-log/index) commits in the group reached the limit set by the system variable [binlog\_commit\_wait\_count](../replication-and-binary-log-system-variables/index#binlog_commit_wait_count).
[Binlog\_group\_commit\_trigger\_lock\_wait](../replication-and-binary-log-status-variables/index#binlog_group_commit_trigger_lock_wait) is the total number of group commits triggered because a [binary log](../binary-log/index) commit was being delayed because of a lock wait where the lock was held by a prior binary log commit. When this happens the later binary log commit is placed in the next group commit.
[Binlog\_group\_commit\_trigger\_timeout](../replication-and-binary-log-status-variables/index#binlog_group_commit_trigger_timeout) is the total number of group commits triggered because of the time since the first [binary log](../binary-log/index) commit reached the limit set by the system variable [binlog\_commit\_wait\_usec](../replication-and-binary-log-system-variables/index#binlog_commit_wait_usec).
To query these variables, use a statement such as:
```
SHOW GLOBAL STATUS LIKE 'Binlog_%commit%';
```
See Also
--------
* [Parallel Replication](../parallel-replication/index)
* [Binary Log Group Commit and InnoDB Flushing Performance](../binary-log-group-commit-and-innodb-flushing-performance/index)
* [Group commit benchmark](http://www.facebook.com/note.php?note_id=10150211546215933)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore software upgrade 1.0.15 to 1.0.16 MariaDB ColumnStore software upgrade 1.0.15 to 1.0.16
=====================================================
MariaDB ColumnStore software upgrade 1.0.15 to 1.0.16
-----------------------------------------------------
Note: Columnstore.xml modifications you manually made are not automatically carried forward on an upgrade. These modifications will need to be incorporated back into .XML once the upgrade has occurred.
The previous configuration file will be saved as /usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave.
If you have specified a root database password (which is good practice), then you must configure a .my.cnf file with user credentials for the upgrade process to use. Create a .my.cnf file in the user home directory with 600 file permissions with the following content (updating PASSWORD as appropriate):
```
[mysqladmin]
user = root
password = PASSWORD
```
### Additional Library Install: Jemalloc
**Note**: This release introduces a dependency on the jemalloc os library to resolve some memory management issues that can lead to memory leaks. On each ColumnStore you must install jemalloc:
For CentOS:
```
yum install epel-release
yum install jemalloc
```
For Ubuntu and Debian:
```
apt-get install libjemalloc1
```
For SLES:
```
zypper addrepo https://download.opensuse.org/repositories/network:cluster/SLE_12_SP3/network:cluster.repo
zypper refresh
zypper install jemalloc
```
### Choosing the type of upgrade
As noted on the Preparing guide, you can installing MariaDB ColumnStore with the use of soft-links. If you have the softlinks be setup at the Data Directory Levels, like mariadb/columnstore/data and mariadb/columnstore/dataX, then your upgrade will happen without any issues. In the case where you have a softlink at the top directory, like /usr/local/mariadb, you will need to upgrade using the binary package. If you updating using the rpm package and tool, this softlink will be deleted when you perform the upgrade process and the upgrade will fail.
#### Root User Installs
#### Upgrading MariaDB ColumnStore using RPMs
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.0.16-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.** Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
```
# tar -zxf mariadb-columnstore-1.0.16-1-centos#.x86_64.rpm.tar.gz
```
* Upgrade the RPMs. The MariaDB ColumnStore software will be installed in /usr/local/.
```
# rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
# rpm -ivh mariadb-columnstore-*1.0.16*rpm
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml.rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
For RPM Upgrade, the previous configuration file will be saved as:
/usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory -mariadb-columnstore-1.0.16-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# /usr/local/mariadb/columnstore/bin/pre-uninstall
```
* Unpack the tarball, in the /usr/local/ directory.
```
# tar -zxvf -mariadb-columnstore-1.0.16-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# /usr/local/mariadb/columnstore/bin/post-install
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
### Upgrading MariaDB ColumnStore using the DEB package
A DEB upgrade would be done on a system that supports DEBs like Debian or Ubuntu systems.
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory
mariadb-columnstore-1.0.16-1.amd64.deb.tar.gz
(DEB 64-BIT) to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate DEBs.
```
# tar -zxf mariadb-columnstore-1.0.16-1.amd64.deb.tar.gz
```
* Remove, purge and install all MariaDB ColumnStore debs
```
# cd /root/
# dpkg -r $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg -P $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg --install mariadb-columnstore-*1.0.16-1*deb
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
#### Non-Root User Installs
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /home/'non-root-user" directory
mariadb-columnstore-1.0.16-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# $HOME/mariadb/columnstore/bin/pre-uninstall
--installdir= /home/guest/mariadb/columnstore
```
* Unpack the tarball, which will generate the $HOME/ directory.
```
# tar -zxvf -mariadb-columnstore-1.0.16-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# $HOME/mariadb/columnstore/bin/post-install
--installdir=/home/guest/mariadb/columnstore
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# $HOME/mariadb/columnstore/bin/postConfigure -u -i /home/guest/mariadb/columnstore
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb SHOW VARIABLES SHOW VARIABLES
==============
Syntax
------
```
SHOW [GLOBAL | SESSION] VARIABLES
[LIKE 'pattern' | WHERE expr]
```
Description
-----------
`SHOW VARIABLES` shows the values of MariaDB [system variables](../server-system-variables/index). This information also can be obtained using the `[mysqladmin](../mysqladmin/index)` variables command. The `LIKE` clause, if present, indicates which variable names to match. The `WHERE` clause can be given to select rows using more general conditions.
With the `GLOBAL` modifier, `SHOW VARIABLES` displays the values that are used for new connections to MariaDB. With `SESSION`, it displays the values that are in effect for the current connection. If no modifier is present, the default is `SESSION`. `LOCAL` is a synonym for `SESSION`. With a `LIKE` clause, the statement displays only rows for those variables with names that match the pattern. To obtain the row for a specific variable, use a `LIKE` clause as shown:
```
SHOW VARIABLES LIKE 'maria_group_commit';
SHOW SESSION VARIABLES LIKE 'maria_group_commit';
```
To get a list of variables whose name match a pattern, use the "`%`" wildcard character in a `LIKE` clause:
```
SHOW VARIABLES LIKE '%maria%';
SHOW GLOBAL VARIABLES LIKE '%maria%';
```
Wildcard characters can be used in any position within the pattern to be matched. Strictly speaking, because "`_`" is a wildcard that matches any single character, you should escape it as "`\_`" to match it literally. In practice, this is rarely necessary.
The `WHERE` and `LIKE` clauses can be given to select rows using more general conditions, as discussed in [Extended SHOW](../extended-show/index).
See `[SET](../set/index)` for information on setting server system variables.
See [Server System Variables](../server-system-variables/index) for a list of all the variables that can be set.
You can also see the server variables by querying the [Information Schema GLOBAL\_VARIABLES and SESSION\_VARIABLES](../information-schema-global_variables-and-session_variables-tables/index) tables.
Examples
--------
```
SHOW VARIABLES LIKE 'aria%';
+------------------------------------------+---------------------+
| Variable_name | Value |
+------------------------------------------+---------------------+
| aria_block_size | 8192 |
| aria_checkpoint_interval | 30 |
| aria_checkpoint_log_activity | 1048576 |
| aria_force_start_after_recovery_failures | 0 |
| aria_group_commit | none |
| aria_group_commit_interval | 0 |
| aria_log_file_size | 1073741824 |
| aria_log_purge_type | immediate |
| aria_max_sort_file_size | 9223372036853727232 |
| aria_page_checksum | ON |
| aria_pagecache_age_threshold | 300 |
| aria_pagecache_buffer_size | 134217728 |
| aria_pagecache_division_limit | 100 |
| aria_recover | NORMAL |
| aria_repair_threads | 1 |
| aria_sort_buffer_size | 134217728 |
| aria_stats_method | nulls_unequal |
| aria_sync_log_dir | NEWFILE |
| aria_used_for_temp_tables | ON |
+------------------------------------------+---------------------+
```
```
SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM
INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'max_error_count' OR
VARIABLE_NAME LIKE 'innodb_sync_spin_loops';
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 64 |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+
SET GLOBAL max_error_count=128;
SELECT VARIABLE_NAME, SESSION_VALUE, GLOBAL_VALUE FROM
INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE
VARIABLE_NAME LIKE 'max_error_count' OR
VARIABLE_NAME LIKE 'innodb_sync_spin_loops';
+---------------------------+---------------+--------------+
| VARIABLE_NAME | SESSION_VALUE | GLOBAL_VALUE |
+---------------------------+---------------+--------------+
| MAX_ERROR_COUNT | 64 | 128 |
| INNODB_SYNC_SPIN_LOOPS | NULL | 30 |
+---------------------------+---------------+--------------+
SET GLOBAL max_error_count=128;
SHOW VARIABLES LIKE 'max_error_count';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 64 |
+-----------------+-------+
SHOW GLOBAL VARIABLES LIKE 'max_error_count';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 128 |
+-----------------+-------+
```
Because the following variable only has a global scope, the global value is returned even when specifying SESSION (in this case by default):
```
SHOW VARIABLES LIKE 'innodb_sync_spin_loops';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| innodb_sync_spin_loops | 30 |
+------------------------+-------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LevelDB Storage Engine LevelDB Storage Engine
======================
Basic feature list
------------------
* single-statement transactions
* secondary indexes
* HANDLER implementation with extensions to support atomic multi-put (kind of like multi-statement transactions)
* binlog XA on the master to be crash safe
* crash-proof slave replication state
* (almost) non blocking schema change
* full test coverage via mysql-test-run
* hot backup
* possible options are to have LevelDB instance per mysqld, per schema or per table
Implementation overview
-----------------------
### One leveldb instance
We consider using one LevelDB instance for mysqld process. LevelDB keys will be prefixed with 'dbname.table\_name', 'dbname.table\_name.index\_name' (or their shorter equivalents). This will allow to store arbitrary number of tables/indexes in one LevelDB instance.
### Transaction support
LevelDB supports
* read snapshots
* batch updates
when you have just those, there is no easy way to support full transactional semantics in the way it is required from MySQL table engine.
If we limit ourselves to single-statement transactions which touch limited numbers of rows, they could be implemented as follows:
* updates done by the statement are accumulated in a batch
* if the statement is committed, the batch is applied. LevelDB guarantees this will be an atomic operation
* if the statement is rolled back, the batch is simply discarded.
(Note: the "Test implementation" uses exactly this approach. It presents itself to MySQL as a non-transactional engine which is able to roll back a statement)
(Note: According to Serg: Storage Engine API does not specify whether the changes made to table data should be immediately visible, or remain invisible until the end of the statement. Both kinds of behavior are allowed).
*TODO: what if two transactions attempt to make conflicting changes? Will one of them get a conflict? A: NO, because LevelDB's operations cannot get in conflict. Delete() means "delete if exists" and Put() means "write, or overwrite". Therefore, no conflicts possible. TODO: is this ok? (more on this below)*
### Data formats
LevelDB compresses data with something called SnappyCompressor.
We will rely on it to make the storage compact. Data that goes into LevelDB's key will be stored in KeyTupleFormat (which allows mysql's lookup/index ordering functions to work). Data that goes into LevelDB's value will be stored in table->record[0] format, except blobs. (Blobs will require special storage convention because they store a char\* pointer in table->record[0]).
(TODO: is it okay not to support blobs in the first milestone?)
(note: datatypes in the provided benchmark are: composite primary/secondary keys, INTs and VARCHARs (are they latin1 or utf-8?)).
### Secondary Indexes
#### Unique secondary indexes
Unique secondary index is stored in a {KEY->VALUE} mapping in LevelDB, where index columns are used as KEY, and Primary Key columns are used as VALUE. This way,
* "index-only" scans are possible
* non-"index-only" scan is a two step process (access the index, access the primary index).
We need to support unique indexes, but not in the first milestone.
Note: unique indexes may prevent read-before-write optimization. There is a @@unique\_checks variable (used at least by InnoDB) which can be used to offer no-guarantees fast execution.
#### Non-unique secondary indexes
LevelDB stores {KEY->VALUE} mappings. Non-unique index will need to have some unique values for KEY. This is possible if we do
```
KEY = {index_columns, primary_key_columns}.
VALUE = {nothing}
```
(todo: check if leveldb allows zero-sized values).
Using primary key as suffix will make DB::Get() useless. Instead, we will have to do lookups with:
```
get(secondary_index_key_val)
{
open cursor for (secondary_index_key_val)
read the first record
if (record > secondary_index_key_val)
return NOT_FOUND;
else
return FOUND;
}
```
### Non-blocking schema changes
* There is a requirement that doing schema changes does not block other queries from running.
* Reclaiming space immediately after some parts of data were dropped is not important.
Possible approaches we could use:
* Record format that support multiple versions. That way, adding/modifying/ dropping a non-indexed column may be instant. Note that this is applicable for records, not keys.
* Background creation/dropping of indexes.
### Hot backup
Hot backup will be made outside of this project. The idea is to hard-link the files so that they can't be deleted by compaction process, and then copy them over.
SQL Command mapping for LevelDB
-------------------------------
### INSERT
There will be two kinds of INSERTs
1. No-reads INSERT-or-UPDATE, with semantics like in LevelDB's DB::Put() operation.
2. a "real" INSERT with SQL semantics
#### INSERT-or-UPDATE (low priority)
SergeiG has pointed out that SQL layer already has support for write-optimized INSERTs (it was implemented for NDB Cluster).
When the table has no triggers, REPLACE command will call handler->extra(HA\_EXTRA\_WRITE\_CAN\_REPLACE), after which handler->write\_row() calls are allowed to silently overwrite rows.
The number of affected rows returned by the statement is actually upper bound.
(note: TokuDB documentation mentions they have something similar with INSERTs. They allow no-reads REPLACE and INSERT IGNORE, when the table has no triggers, there is no RBR binary logging, etc - the same conditions as we will have)
##### Batching
It is possible to batch multi-line REPLACE commands. (TODO: Can no-read REPLACEs fail at all? If not, we can limit batch size and use multiple batches if necessary. If yes, we'll have to document that big REPLACEs may fail in the middle of a statement/ Q: is this OK?)
#### Regular INSERT
Regular INSERT will do a read before write and will use "gap locking" to make sure its DB::Put() call doesn't overwrite somebody's data.
### UPDATE
UPDATE will do a read before write and will use record locking to make sure it's not overwriting somebody else's changes (or not updating a row that has just been deleted).
*Note: mysql-5.6 has [WL#5906](http://askmonty.org/worklog/?tid=5906) (see link at the bottom)read before write removal (RBWR). It is not exactly what we need, but is similar (and ugly)*
### DELETE
Currently, a DELETE statement has to do a read. Records are deleted through handler->delete\_row() call of the Storage Engine API, which has the meaning "delete the row that was just read".
There will be two kinds of DELETE statement:
* Write-optimized DELETE IF\_EXISTS
* Regular DELETE
#### DELETE IF\_EXISTS (low priority)
This is a write-optimized version. It will have semantics close to LevelDB's DB::Delete() call. We will have to modify the SQL layer to support it.
The syntax will be
<<code lang='sql'> DELETE NO\_READ FROM tbl WHERE ... <</code>>
the option NO\_READ will be supported only for single-table DELETEs, and will require that - the WHERE clause refers to primary key columns only - the WHERE clause allows to construct a list of primary keys to be deleted. - there ORDER BY clause
if the above conditions are not met, the statement will fail with an error. if they are met, the statement translate into handler->delete\_row() calls, without any read calls.
mysql\_affected\_rows() will return an upper bound of how many rows could be deleted.
#### Regular DELETE
Regular DELETE will have to use locking.
### SELECT
#### Will use snapshot
SELECTs will allocate/use a snapshot for reading data. This way, sql layer will not get non-repeatable reads within a statement.
Q: is this needed? Using snapshots has some cost?
#### Range scans
* LevelDB cursors can be used for range scans.
* DB::GetApproximateSizes() can be used to implement handler::records\_in\_range()
* There is nothing for rec\_per\_key (index statistics)
### ALTER TABLE
MySQL 5.6 should support online ALTER TABLE operations (as InnoDB now supports them).
TODO: what does the storage engine needs to do to inform the SQL layer that it is running a long DDL change which does not prevent other selects/updates from running?
Binlog XA on Master
-------------------
This is about keeping binlog and LevelDB in sync on the master. MySQL does it as follows:
* prepare transaction in the storage engine
* write it into the binlog
* commit it in the engine
If transactions are grouped, they are committed in the same order as they were written into the binary log.
Recovery proceeds as follows:
* Read the last binlog file and note XIDs of transactions that are there.
* for each storage engine,
+ scan the committed transactions and compare their XIDs to those we've found in the binlog.
+ If transaction is the binlog - commit, otherwise - roll it back)
(note that the order the transactions are applied in is determined from the engine, not from the binlog)
TODO: suggestions about how PREPARE/COMMIT/recovery should work for LevelDB. (got some ideas after discussion with Kristian, need to write them down)
Crash-proof slave
-----------------
MySQL 5.6 stores information that used to be in relay\_log.info in InnoDB. That way, InnoDB and relay\_log.info (aka binlog position) are always in sync.
It seems, switching to storing relay\_log.info in a LevelDB table is sufficient for crash-proof slave. (note: this implies that semantics of operations over LevelDB table is sufficiently close to that of a regular MySQL storage engine, like innodb).
Other details
-------------
* The target version is MySQL 5.6 (good, because LevelDB API uses STL and 5.6-based versions support compiling with STL).
* It is ok to make changes to LevelDB itself
* There is a "Test implementation" at <https://github.com/tbdingqi/tbleveldb>.
* Task tracking for this is done here: [MDEV-3841](https://jira.mariadb.org/browse/MDEV-3841)
* We may want to check out this: <http://dev.mysql.com/worklog/task/?id=5906>. It is pushed into 5.6
Milestones
----------
* Milestone #1 is described at [leveldb-storage-engine-ms1](../leveldb-storage-engine-ms1/index)
* Subsequent development is described at [leveldb-storage-engine-development](../leveldb-storage-engine-development/index)
* Milestone #2 is described at [leveldb-storage-engine-ms2](../leveldb-storage-engine-ms2/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Upgrading from MariaDB Galera Cluster 5.5 to MariaDB Galera Cluster 10.0 Upgrading from MariaDB Galera Cluster 5.5 to MariaDB Galera Cluster 10.0
========================================================================
Performing a Rolling Upgrade
----------------------------
The following steps can be used to perform a rolling upgrade from MariaDB Galera Cluster 5.5 to MariaDB Galera Cluster 10.0. In a rolling upgrade, each node is upgraded individually, so the cluster is always operational. There is no downtime from the application's perspective.
First, before you get started:
1. First, take a look at [Upgrading from MariaDB 5.5 to MariaDB 10.0](../upgrading-from-mariadb-55-to-mariadb-100/index) to see what has changed between the major versions.
1. Check whether any system variables or options have been changed or removed. Make sure that your server's configuration is compatible with the new MariaDB version before upgrading.
2. Check whether replication has changed in the new MariaDB version in any way that could cause issues while the cluster contains upgraded and non-upgraded nodes.
3. Check whether any new features have been added to the new MariaDB version. If a new feature in the new MariaDB version cannot be replicated to the old MariaDB version, then do not use that feature until all cluster nodes have been upgrades to the new MariaDB version.
2. Next, make sure that the Galera version numbers are compatible.
1. If you are upgrading from the most recent MariaDB Galera Cluster 5.5 release to MariaDB Galera Cluster 10.0, then the versions will be compatible. The latest releases of MariaDB Galera Cluster 5.5 and MariaDB Galera Cluster 10.0 use Galera 3 (i.e. Galera wsrep provider versions 25.3.x), so they should be compatible.
2. If you are running an older MariaDB Galera Cluster 5.5 release that still uses Galera 2 (i.e. Galera wsrep provider versions 25.2.x), then it is recommended to first upgrade to the latest MariaDB Galera Cluster 5.5 release that uses Galera 3 (i.e. Galera wsrep provider versions 25.3.x).
3. See [What is MariaDB Galera Cluster?: Galera wsrep provider Versions](../what-is-mariadb-galera-cluster/index#galera-wsrep-provider-versions) for information on which MariaDB releases uses which Galera wsrep provider versions.
3. Ideally, you want to have a large enough gcache to avoid a [State Snapshot Transfer (SST)](../introduction-to-state-snapshot-transfers-ssts/index) during the rolling upgrade. The gcache size can be configured by setting `[gcache.size](../wsrep_provider_options/index#gcachesize)` For example:
`wsrep_provider_options="gcache.size=2G"`
Before you upgrade, it would be best to take a backup of your database. This is always a good idea to do before an upgrade. We would recommend [Percona XtraBackup](../backup-restore-and-import-clients-percona-xtrabackup/index).
Then, for each node, perform the following steps:
1. Modify the repository configuration, so the system's package manager installs [MariaDB 10.1](../what-is-mariadb-101/index). For example,
* On Debian, Ubuntu, and other similar Linux distributions, see [Updating the MariaDB APT repository to a New Major Release](../installing-mariadb-deb-files/index#updating-the-mariadb-apt-repository-to-a-new-major-release) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Updating the MariaDB YUM repository to a New Major Release](../yum/index#updating-the-mariadb-yum-repository-to-a-new-major-release) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Updating the MariaDB ZYpp repository to a New Major Release](../installing-mariadb-with-zypper/index#updating-the-mariadb-zypp-repository-to-a-new-major-release) for more information.
2. If you use a load balancing proxy such as MaxScale or HAProxy, make sure to drain the server from the pool so it does not receive any new connections.
3. Set `[innodb\_fast\_shutdown](../xtradbinnodb-server-system-variables/index#innodb_fast_shutdown)` to `0`. It can be changed dynamically with `[SET GLOBAL](../set/index#global-session)`. For example:
`SET GLOBAL innodb_fast_shutdown=0;`
4. [Stop MariaDB](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
5. Uninstall the old version of MariaDB and the Galera wsrep provider.
* On Debian, Ubuntu, and other similar Linux distributions, execute the following:
`sudo apt-get remove mariadb-galera-server galera`
* On RHEL, CentOS, Fedora, and other similar Linux distributions, execute the following:
`sudo yum remove MariaDB-Galera-server galera`
* On SLES, OpenSUSE, and other similar Linux distributions, execute the following:
`sudo zypper remove MariaDB-Galera-server galera`
6. Install the new version of MariaDB and the Galera wsrep provider.
* On Debian, Ubuntu, and other similar Linux distributions, see [Installing MariaDB Packages with APT](../installing-mariadb-deb-files/index#installing-mariadb-packages-with-apt) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Installing MariaDB Packages with YUM](../yum/index#installing-mariadb-packages-with-yum) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Installing MariaDB Packages with ZYpp](../installing-mariadb-with-zypper/index#installing-mariadb-packages-with-zypp) for more information.
7. Make any desired changes to configuration options in [option files](../configuring-mariadb-with-option-files/index), such as `my.cnf`. This includes removing any system variables or options that are no longer supported.
8. [Start MariaDB](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
9. Run `[mysql\_upgrade](../mysql_upgrade/index)` with the `--skip-write-binlog` option.
* `mysql_upgrade` does two things:
1. Ensures that the system tables in the `[mysq](../the-mysql-database-tables/index)l` database are fully compatible with the new version.
2. Does a very quick check of all tables and marks them as compatible with the new version of MariaDB .
When this process is done for one node, move onto the next node.
Note that when upgrading the Galera wsrep provider, sometimes the Galera protocol version can change. The Galera wsrep provider should not start using the new protocol version until all cluster nodes have been upgraded to the new version, so this is not generally an issue during a rolling upgrade. However, this can cause issues if you restart a non-upgraded node in a cluster where the rest of the nodes have been upgraded.
:
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Docker Security Concerns Docker Security Concerns
========================
When using Docker containers in production, it is important to be aware of Docker security concerns.
Host System Security
--------------------
All Docker containers are built upon the host system's kernel. If the host system's kernel has security bugs, those bugs are also present in the containers.
In particular, Docker leverages two Linux features:
* Namespaces, to isolate containers from each other and make sure that a container can't establish unauthorized connections to another container.
* cgroups, to limit the resources (CPU, memory, IO) that each container can consume.
The administrators of a system running Docker should be particularly careful to upgrade the kernel whenever security bugs to these features are fixed.
Docker, like most container technologies, uses the runC open source library. runC security bugs are likely to affect Docker.
Finally, Docker's own security bugs potentially affect all containers.
It is important to note that when we upgrade the kernel, runC or Docker itself we cause downtime for all the containers running on the system.
Images Security
---------------
Docker containers are built from images. If security is a major concern, you should make sure that the images you use are secure.
If you want to be sure that you are pulling authentic images, you should only pull images signed with [Docker Content Trust](../creating-a-custom-docker-image/index#docker-content-trust).
The images should create and use a system user with less privileges than root. For example, the MariaDB daemon usually runs as a user called `mysql`, who belongs the `mysql` group. There is no need to run it as root (and by default it will refuse to start as root). Containers should not run it as root. Using an unprivileged user will reduce the chances that a bug in Docker or in the kernel will allow the user to gain access to the host system.
Updated images should be used. An image usually downloads packages information at build time. If the image is not recently built, a newly created container will have old packages. Updating the packages on container creation and regularly re-updating them will ensure that the container uses packages with the most recent versions. Rebuilding an image often will reduce the time necessary to update the packages the first time.
Security bugs are usually important for a database server, so you don't want your version of MariaDB to contain known security bugs. But suppose you also have a bug in Docker, in runC, or in the kernel. A bug in a user-facing application may allow an attacker to exploit a bug in those lower level technologies. So, after gaining access to the container, an attacker may gain access to the host system. This is why system administrators should keep both the host system and the software running in the containers updated.
References
----------
For more information, see the following links:
* [Docker security](https://docs.docker.com/engine/security/) on Docker documentation.
* [Linux namespaces](https://en.wikipedia.org/wiki/Linux_namespaces) on Wikipedia.
* [cgroups](https://en.wikipedia.org/wiki/Cgroups) on Wikipedia.
* [runC repository](https://github.com/opencontainers/runc).
---
Content initially contributed by [Vettabase Ltd](https://vettabase.com/).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb HandlerSocket HandlerSocket
==============
HandlerSocket gives you direct access to [InnoDB](../innodb/index) and [SPIDER](../spider/index). It is included in MariaDB as a ready-to use plugin.
HandlerSocket is a NoSQL plugin for MariaDB. It works as a daemon inside the mysqld process, accepting TCP connections, and executing requests from clients. HandlerSocket does not support SQL queries. Instead, it supports simple CRUD operations on tables.
HandlerSocket can be much faster than mysqld/libmysql in some cases because it has lower CPU, disk, and network overhead:
1. To lower CPU usage it does not parse SQL.
2. Next, it batch-processes requests where possible, which further reduces CPU usage and lowers disk usage.
3. Lastly, the client/server protocol is very compact compared to mysql/libmysql, which reduces network usage.
| Title | Description |
| --- | --- |
| [HandlerSocket Installation](../handlersocket-installation/index) | Installing the HandlerSocket plugin. |
| [HandlerSocket Configuration Options](../handlersocket-configuration-options/index) | HandlerSocket configuration options. |
| [HandlerSocket Client Libraries](../handlersocket-client-libraries/index) | Available HandlerSocket Client Libraries |
| [Testing HandlerSocket in a Source Distribution](../testing-handlersocket-in-a-source-distribution/index) | Testing HandlerSocket in a source distribution. |
| [HandlerSocket External Resources](../handlersocket-external-resources/index) | HandlerSocket external resources and documentation |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb TIMEDIFF TIMEDIFF
========
Syntax
------
```
TIMEDIFF(expr1,expr2)
```
Description
-----------
TIMEDIFF() returns `expr1` - `expr2` expressed as a time value. `expr1` and `expr2` are time or date-and-time expressions, but both must be of the same type.
Examples
--------
```
SELECT TIMEDIFF('2000:01:01 00:00:00', '2000:01:01 00:00:00.000001');
+---------------------------------------------------------------+
| TIMEDIFF('2000:01:01 00:00:00', '2000:01:01 00:00:00.000001') |
+---------------------------------------------------------------+
| -00:00:00.000001 |
+---------------------------------------------------------------+
SELECT TIMEDIFF('2008-12-31 23:59:59.000001', '2008-12-30 01:01:01.000002');
+----------------------------------------------------------------------+
| TIMEDIFF('2008-12-31 23:59:59.000001', '2008-12-30 01:01:01.000002') |
+----------------------------------------------------------------------+
| 46:58:57.999999 |
+----------------------------------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Debugging MariaDB With a Debugger Debugging MariaDB With a Debugger
=================================
If you have MariaDB [compiled for debugging](../compiling-mariadb-for-debugging/index) you can both use it in a debugger, like ddd or gdb, and get comprehensive trace files of the execution of MariaDB. The trace files allow you to both see the flow of the code and to see the differences in execution by by comparing two trace files.
Core dumps are also much easier to investigate if they come from a debug binary.
Note that a binary compiled for debugging and tracing is about 10-20% slower than a normal binary. If you just compile a binary for debugging (option `-g` with gcc) the speed difference compared to a normal binary is negligible.
### Checking That MariaDB is Compiled For Debugging
Execute:
```
mariadbd --debug --help
```
If you are using MariaDB before 10.5, then you should use `mysqld` instead of `mariadbd`!
If you get an error `unknown option '--debug`, then MariaDB is not compiled for debugging and tracing.
### Building MariaDB for Debugging Starting from 5.5
On Unix you need to pass `-DCMAKE_BUILD_TYPE=Debug` to cmake to compile with debug information.
### Building [MariaDB 5.3](../what-is-mariadb-53/index) and Older
Here is how you compile with debug on older versions:
Use the scripts in the BUILD directory that will compile MariaDB with most common debug options and plugins, for example:
```
./BUILD/compile-pentium64-debug-max
```
For the most common configurations there exists a fine-tuned script in the BUILD directory.
If you want to use [valgrind](http://valgrind.org/), a very good memory instrumentation tool and memory overrun checker, you should use
```
./BUILD/compile-pentium64-valgrind-max
```
Some recommended debugging scripts for Intel/AMD are:
```
BUILD/compile-pentium64-debug-max
BUILD/compile-pentium64-valgrind-max
```
This is an example of how to compile MariaDB for debugging in your home directory with [MariaDB 5.2.9](https://mariadb.com/kb/en/mariadb-529-release-notes/) as an example:
```
cd ~
mkdir mariadb
cd mariadb
tar xvf mariadb-5.2.9.tar.gz
ln -s mariadb-5.2.9 current
cd current
./BUILD/compile-pentium64-debug-max
```
The last command will produce a debug version of `sql/mysqld`.
### Debugging MariaDB From the Source Directory
#### Creating the MariaDB Database Directory
The following example creates the MariaDB databases in `/data`.
```
./scripts/mysql_install_db --srcdir=. --datadir=/data
```
#### Running MariaDB in a Debugger
The following example is using `ddd`, an excellent graphical debugger in Linux. If you don't have `ddd` installed, you can use `gdb` instead.
```
cd sql
ddd ./mariadbd &
```
In `ddd` or `gdb`
```
run --datadir=/data --language=./share/english --gdb
```
You can [set the options in your /.my.cnf file](../running-mariadb-from-the-build-directory/index) so as not to have to repeat them on the `run` line.
If you run `mysqld` with `--debug`, you will get a [trace file](../creating-a-trace-file/index) in /tmp/mysqld.trace that shows what is happening.
Note that you can have different options in the configuration file for each MariaDB version (like having a specific language directory).
### Debugging MariaDB Server with mysql-test-run
If you get a crash while running `mysql-test-run` you can debug this in a debugger by using one of the following options:
```
mysql-test-run --gdb failing-test-name
```
or if you prefer the `ddd` debugger:
```
mysql-test-run --ddd failing-test-name
```
#### Sample .my.cnf file to Make Debugging Easier
```
[client-server]
socket=/tmp/mysql-dbug.sock
port=3307
[mariadb]
datadir=/my/data
loose-innodb_file_per_table
server_id= 1
log-basename=master
loose-debug-mutex-deadlock-detector
max-connections=20
lc-messages=en_us
[mariadb-10.0]
lc-messages-dir=/my/maria-10.0/sql/share
[mariadb-10.1]
lc-messages-dir=/my/maria-10.1/sql/share
[mariadb-10.2]
lc-messages-dir=/my/maria-10.2/sql/share
[mariadb-10.3]
lc-messages-dir=/my/maria-10.3/sql/share
```
The above `.my.cnf` file:
* Uses an explicit socket for both client and server.
* Assumes the server source is in /my/maria-xxx. You should change this to point to where your sources are located.
* Has a unique patch for each MariaDB version so that one doesn't have to specify [--lc-messages-dir](../server-system-variables/index#lc_messages_dir) or [--language](../server-system-variables/index#language) even if one switches between debugging different MariaDB versions.
### See Also
* [Creating a trace file](../creating-a-trace-file/index)
* [Configuring MariaDB with my.cnf](../configuring-mariadb-with-mycnf/index)
* [Running mariadbd from the build director](../running-mariadb-from-the-build-directory/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SHOW TABLE_STATISTICS SHOW TABLE\_STATISTICS
======================
Syntax
------
```
SHOW TABLE_STATISTICS
```
Description
-----------
The `SHOW TABLE_STATISTICS` statementis part of the [User Statistics](../user-statistics/index) feature. It was removed as a separate statement in [MariaDB 10.1.1](https://mariadb.com/kb/en/mariadb-1011-release-notes/), but effectively replaced by the generic [SHOW information\_schema\_table](../information-schema-plugins-show-and-flush-statements/index) statement. The [information\_schema.TABLE\_STATISTICS](../information-schema-table_statistics-table/index) table shows statistics on table usage
The [userstat](../server-system-variables/index#userstat) system variable must be set to 1 to activate this feature. See the [User Statistics](../user-statistics/index) and [information\_schema.TABLE\_STATISTICS](../information-schema-table_statistics-table/index) articles for more information.
Example
-------
```
SHOW TABLE_STATISTICS\G
*************************** 1. row ***************************
Table_schema: mysql
Table_name: proxies_priv
Rows_read: 2
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 2. row ***************************
Table_schema: test
Table_name: employees_example
Rows_read: 7
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 3. row ***************************
Table_schema: mysql
Table_name: user
Rows_read: 16
Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 4. row ***************************
Table_schema: mysql
Table_name: db
Rows_read: 2
Rows_changed: 0
Rows_changed_x_#indexes: 0
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Screencast for Upgrading MySQL to MariaDB Screencast for Upgrading MySQL to MariaDB
=========================================
There is a [screencast](http://www.youtube.com/watch?v=rF7wChx0uzQ) for upgrading from MySQL 5.1.55 to MariaDB. Watch this example to see how easy this process is. It really is just a "drop in replacement" to MySQL.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LOCATE LOCATE
======
Syntax
------
```
LOCATE(substr,str), LOCATE(substr,str,pos)
```
Description
-----------
The first syntax returns the position of the first occurrence of substring `substr` in string `str`. The second syntax returns the position of the first occurrence of substring `substr` in string `str`, starting at position `pos`. Returns 0 if `substr` is not in `str`.
`LOCATE()` performs a case-insensitive search.
If any argument is `NULL`, returns `NULL.`
[INSTR()](../instr/index) is the same as the two-argument form of `LOCATE()`, except that the order of the arguments is reversed.
Examples
--------
```
SELECT LOCATE('bar', 'foobarbar');
+----------------------------+
| LOCATE('bar', 'foobarbar') |
+----------------------------+
| 4 |
+----------------------------+
SELECT LOCATE('My', 'Maria');
+-----------------------+
| LOCATE('My', 'Maria') |
+-----------------------+
| 0 |
+-----------------------+
SELECT LOCATE('bar', 'foobarbar', 5);
+-------------------------------+
| LOCATE('bar', 'foobarbar', 5) |
+-------------------------------+
| 7 |
+-------------------------------+
```
See Also
--------
* [INSTR()](../instr/index) ; Returns the position of a string withing a string
* [SUBSTRING\_INDEX()](../substring_index/index) ; Returns the substring from string before count occurrences of a delimiter
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Boolean Literals Boolean Literals
================
In MariaDB, `FALSE` is a synonym of 0 and `TRUE` is a synonym of 1. These constants are case insensitive, so `TRUE`, `True`, and `true` are equivalent.
These terms are not synonyms of 0 and 1 when used with the `[IS](../is/index)` operator. So, for example, `10 IS TRUE` returns 1, while `10 = TRUE` returns 0 (because 1 != 10).
The `IS` operator accepts a third constant exists: `UNKNOWN`. It is always a synonym of [NULL](../null-values-in-mariadb/index).
`TRUE` and `FALSE` are [reserved words](../reserved-words/index), while `UNKNOWN` is not.
See Also
--------
* [BOOLEAN](../boolean/index) type
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb GeometryFromWKB GeometryFromWKB
===============
A synonym for [ST\_GeomFromWKB](../st_geomfromwkb/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema INNODB_SYS_TABLES Table Information Schema INNODB\_SYS\_TABLES Table
============================================
The [Information Schema](../information_schema/index) `INNODB_SYS_TABLES` table contains information about InnoDB tables.
The `PROCESS` [privilege](../grant/index) is required to view the table.
It has the following columns:
| Field | Type | Null | Key | Default | Description |
| --- | --- | --- | --- | --- | --- |
| TABLE\_ID | bigint(21) unsigned | NO | | 0 | Unique InnoDB table identifier. |
| NAME | varchar(655) | NO | | | Database and table name, or the uppercase InnoDB system table name. |
| FLAG | int(11) | NO | | 0 | See [Flag](#flag) below |
| N\_COLS | int(11) unsigned (>= [MariaDB 10.5](../what-is-mariadb-105/index)) int(11) (<= [MariaDB 10.4](../what-is-mariadb-104/index)) | NO | | 0 | Number of columns in the table. |
| SPACE | int(11) unsigned (>= [MariaDB 10.5](../what-is-mariadb-105/index)) int(11) (<= [MariaDB 10.4](../what-is-mariadb-104/index)) | NO | | 0 | Tablespace identifier where the index resides. `0` represents the InnoDB system tablespace, while any other value represents a table created in file-per-table mode (see the [innodb\_file\_per\_table](../xtradbinnodb-server-system-variables/index#innodb_file_per_table) system variable). Remains unchanged after a `[TRUNCATE TABLE](../truncate-table/index)` statement. |
| FILE\_FORMAT | varchar(10) | YES | | NULL | [InnoDB file format](../innodb-file-format/index) (Antelope or Barracuda). Removed in [MariaDB 10.3](../what-is-mariadb-103/index). |
| ROW\_FORMAT | enum('Redundant', 'Compact', 'Compressed', 'Dynamic') (>= [MariaDB 10.5](../what-is-mariadb-105/index))varchar(12) (<= [MariaDB 10.4](../what-is-mariadb-104/index)) | YES | | NULL | [InnoDB storage format](../innodb-storage-formats/index) (Compact, Redundant, Dynamic, or Compressed). |
| ZIP\_PAGE\_SIZE | int(11) unsigned | NO | | 0 | For Compressed tables, the zipped page size. |
| SPACE\_TYPE | enum('Single','System') (>= [MariaDB 10.5](../what-is-mariadb-105/index))varchar(10) (<= [MariaDB 10.4](../what-is-mariadb-104/index)) | YES | | NULL | |
Flag
----
The flag field returns the dict\_table\_t::flags that correspond to the data dictionary record.
| Bit | Description |
| --- | --- |
| `0` | Set if ROW\_FORMAT is not REDUNDANT. |
| `1` to `4` | `0`, except for ROW\_FORMAT=COMPRESSED, where they will determine the KEY\_BLOCK\_SIZE (the compressed page size). |
| `5` | Set for ROW\_FORMAT=DYNAMIC or ROW\_FORMAT=COMPRESSED. |
| `6` | Set if the DATA DIRECTORY attribute was present when the table was originally created. |
| `7` | Set if the page\_compressed attribute is present. |
| `8` to `11` | Determine the page\_compression\_level. |
| `12` `13` | Normally `00`, but `11` for "no-rollback tables" ([MariaDB 10.3](../what-is-mariadb-103/index) CREATE SEQUENCE). In [MariaDB 10.1](../what-is-mariadb-101/index), these bits could be `01` or `10` for ATOMIC\_WRITES=ON or ATOMIC\_WRITES=OFF. |
Note that the table flags returned here are not the same as tablespace flags (FSP\_SPACE\_FLAGS).
Example
-------
```
SELECT * FROM information_schema.INNODB_SYS_TABLES LIMIT 2\G
*************************** 1. row ***************************
TABLE_ID: 14
NAME: SYS_DATAFILES
FLAG: 0
N_COLS: 5
SPACE: 0
ROW_FORMAT: Redundant
ZIP_PAGE_SIZE: 0
SPACE_TYPE: System
*************************** 2. row ***************************
TABLE_ID: 11
NAME: SYS_FOREIGN
FLAG: 0
N_COLS: 7
SPACE: 0
ROW_FORMAT: Redundant
ZIP_PAGE_SIZE: 0
SPACE_TYPE: System
2 rows in set (0.00 sec)
```
See Also
--------
* [InnoDB Data Dictionary Troubleshooting](../innodb-data-dictionary-troubleshooting/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Upgrading from MariaDB 10.3 to MariaDB 10.4 with Galera Cluster Upgrading from MariaDB 10.3 to MariaDB 10.4 with Galera Cluster
===============================================================
**MariaDB starting with [10.1](../what-is-mariadb-101/index)**Since [MariaDB 10.1](../what-is-mariadb-101/index), the [MySQL-wsrep](https://github.com/codership/mysql-wsrep) patch has been merged into MariaDB Server. Therefore, in [MariaDB 10.1](../what-is-mariadb-101/index) and above, the functionality of MariaDB Galera Cluster can be obtained by installing the standard MariaDB Server packages and the Galera wsrep provider library package.
Beginning in [MariaDB 10.1](../what-is-mariadb-101/index), [Galera Cluster](../what-is-mariadb-galera-cluster/index) ships with the MariaDB Server. Upgrading a Galera Cluster node is very similar to upgrading a server from [MariaDB 10.3](../what-is-mariadb-103/index) to [MariaDB 10.4](../what-is-mariadb-104/index). For more information on that process as well as incompatibilities between versions, see the [Upgrade Guide](../upgrading-from-mariadb-103-to-mariadb-104/index).
Performing a Rolling Upgrade
----------------------------
The following steps can be used to perform a rolling upgrade from [MariaDB 10.3](../what-is-mariadb-103/index) to [MariaDB 10.4](../what-is-mariadb-104/index) when using Galera Cluster. In a rolling upgrade, each node is upgraded individually, so the cluster is always operational. There is no downtime from the application's perspective.
First, before you get started:
1. First, take a look at [Upgrading from MariaDB 10.3 to MariaDB 10.4](../upgrading-from-mariadb-103-to-mariadb-104/index) to see what has changed between the major versions.
1. Check whether any system variables or options have been changed or removed. Make sure that your server's configuration is compatible with the new MariaDB version before upgrading.
2. Check whether replication has changed in the new MariaDB version in any way that could cause issues while the cluster contains upgraded and non-upgraded nodes.
3. Check whether any new features have been added to the new MariaDB version. If a new feature in the new MariaDB version cannot be replicated to the old MariaDB version, then do not use that feature until all cluster nodes have been upgrades to the new MariaDB version.
2. Next, make sure that the Galera version numbers are compatible.
1. If you are upgrading from the most recent [MariaDB 10.3](../what-is-mariadb-103/index) release to [MariaDB 10.4](../what-is-mariadb-104/index), then the versions will be compatible. [MariaDB 10.3](../what-is-mariadb-103/index) uses Galera 3 (i.e. Galera wsrep provider versions 25.3.x), and [MariaDB 10.4](../what-is-mariadb-104/index) uses Galera 4 (i.e. Galera wsrep provider versions 26.4.x). This means that upgrading to [MariaDB 10.4](../what-is-mariadb-104/index) also upgrades the system to Galera 4. However, Galera 3 and Galera 4 should be compatible for the purposes of a rolling upgrade, as long as you are using Galera 26.4.2 or later.
2. See [What is MariaDB Galera Cluster?: Galera wsrep provider Versions](../what-is-mariadb-galera-cluster/index#galera-wsrep-provider-versions) for information on which MariaDB releases uses which Galera wsrep provider versions.
3. Ideally, you want to have a large enough gcache to avoid a [State Snapshot Transfer (SST)](../introduction-to-state-snapshot-transfers-ssts/index) during the rolling upgrade. The gcache size can be configured by setting `[gcache.size](../wsrep_provider_options/index#gcachesize)` For example:
`wsrep_provider_options="gcache.size=2G"`
Before you upgrade, it would be best to take a backup of your database. This is always a good idea to do before an upgrade. We would recommend [Mariabackup](../mariabackup/index).
Then, for each node, perform the following steps:
1. Modify the repository configuration, so the system's package manager installs [MariaDB 10.4](../what-is-mariadb-104/index). For example,
* On Debian, Ubuntu, and other similar Linux distributions, see [Updating the MariaDB APT repository to a New Major Release](../installing-mariadb-deb-files/index#updating-the-mariadb-apt-repository-to-a-new-major-release) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Updating the MariaDB YUM repository to a New Major Release](../yum/index#updating-the-mariadb-yum-repository-to-a-new-major-release) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Updating the MariaDB ZYpp repository to a New Major Release](../installing-mariadb-with-zypper/index#updating-the-mariadb-zypp-repository-to-a-new-major-release) for more information.
2. If you use a load balancing proxy such as MaxScale or HAProxy, make sure to drain the server from the pool so it does not receive any new connections.
3. [Stop MariaDB](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
4. Uninstall the old version of MariaDB and the Galera wsrep provider.
* On Debian, Ubuntu, and other similar Linux distributions, execute the following:
`sudo apt-get remove mariadb-server galera`
* On RHEL, CentOS, Fedora, and other similar Linux distributions, execute the following:
`sudo yum remove MariaDB-server galera`
* On SLES, OpenSUSE, and other similar Linux distributions, execute the following:
`sudo zypper remove MariaDB-server galera`
5. Install the new version of MariaDB and the Galera wsrep provider.
* On Debian, Ubuntu, and other similar Linux distributions, see [Installing MariaDB Packages with APT](../installing-mariadb-deb-files/index#installing-mariadb-packages-with-apt) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Installing MariaDB Packages with YUM](../yum/index#installing-mariadb-packages-with-yum) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Installing MariaDB Packages with ZYpp](../installing-mariadb-with-zypper/index#installing-mariadb-packages-with-zypp) for more information.
6. Make any desired changes to configuration options in [option files](../configuring-mariadb-with-option-files/index), such as `my.cnf`. This includes removing any system variables or options that are no longer supported.
7. On Linux distributions that use `systemd` you may need to increase the service startup timeout as the default timeout of 90 seconds may not be sufficient. See [Systemd: Configuring the Systemd Service Timeout](../systemd/index#configuring-the-systemd-service-timeout) for more information.
8. [Start MariaDB](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
9. Run `[mysql\_upgrade](../mysql_upgrade/index)` with the `--skip-write-binlog` option.
* `mysql_upgrade` does two things:
1. Ensures that the system tables in the `[mysq](../the-mysql-database-tables/index)l` database are fully compatible with the new version.
2. Does a very quick check of all tables and marks them as compatible with the new version of MariaDB .
When this process is done for one node, move onto the next node.
Note that when upgrading the Galera wsrep provider, sometimes the Galera protocol version can change. The Galera wsrep provider should not start using the new protocol version until all cluster nodes have been upgraded to the new version, so this is not generally an issue during a rolling upgrade. However, this can cause issues if you restart a non-upgraded node in a cluster where the rest of the nodes have been upgraded.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SSL/TLS System Variables SSL/TLS System Variables
========================
The system variables listed on this page relate to encrypting data during transfer between servers and clients using the Transport Layer Security (TLS) protocol. Often, the term Secure Sockets Layer (SSL) is used interchangeably with TLS, although strictly speaking the SSL protocol is the predecessor of TLS and is no longer considered secure.
For compatibility reasons, the TLS system variables in MariaDB still use the `ssl_` prefix, but MariaDB only supports its more secure successors. For more information on SSL/TLS in MariaDB, see [Secure Connections Overview](../secure-connections-overview/index).
Variables
---------
#### `have_openssl`
* **Description:** This variable shows whether the server is linked with [OpenSSL](https://www.openssl.org/) rather than MariaDB's bundled TLS library, which might be [wolfSSL](https://www.wolfssl.com/products/wolfssl/) or [yaSSL](https://www.wolfssl.com/products/yassl/).
+ In [MariaDB 10.0.1](https://mariadb.com/kb/en/mariadb-1001-release-notes/) and later, if this system variable shows `YES`, then the server is linked with OpenSSL.
+ In [MariaDB 10.0.0](https://mariadb.com/kb/en/mariadb-1000-release-notes/) and before, this system variable was an alias for the `[have\_ssl](#have_ssl)` system variable.
+ See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms.
* **Scope:** Global
* **Dynamic:** No
---
#### `have_ssl`
* **Description:** This variable shows whether the server supports using [TLS](../data-in-transit-encryption/index) to secure connections.
+ If the value is `YES`, then the server supports TLS, and TLS is enabled.
+ If the value is `DISABLED`, then the server supports TLS, but TLS is **not** enabled.
+ If the value is `NO`, then the server was not compiled with TLS support, so TLS cannot be enabled.
+ When TLS is supported, check the `[have\_openssl](#have_openssl)` system variable to determine whether the server is using OpenSSL or MariaDB's bundled TLS library. See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms.
* **Scope:** Global
* **Dynamic:** No
---
#### `ssl_ca`
* **Description:** Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for [TLS](../data-in-transit-encryption/index). This system variable requires that you use the absolute path, not a relative path. This system variable implies the `[ssl](../mysqld-options/index#-ssl)` option.
+ See [Secure Connections Overview: Certificate Authorities (CAs)](../secure-connections-overview/index#certificate-authorities-cas) for more information.
* **Commandline:** `--ssl-ca=file_name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `file name`
---
#### `ssl_capath`
* **Description:** Defines a path to a directory that contains one or more PEM files that should each contain one X509 certificate for a trusted Certificate Authority (CA) to use for [TLS](../data-in-transit-encryption/index). This system variable requires that you use the absolute path, not a relative path. The directory specified by this variable needs to be run through the `[openssl rehash](https://www.openssl.org/docs/man1.1.1/man1/rehash.html)` command. This system variable implies the `[ssl](../mysqld-options/index#-ssl)` option.
+ See [Secure Connections Overview: Certificate Authorities (CAs)](../secure-connections-overview/index#certificate-authorities-cas) for more information.
* **Commandline:** `--ssl-capath=directory_name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `directory name`
---
#### `ssl_cert`
* **Description:** Defines a path to the X509 certificate file to use for [TLS](../data-in-transit-encryption/index). This system variable requires that you use the absolute path, not a relative path. This system variable implies the `[ssl](../mysqld-options/index#-ssl)` option.
* **Commandline:** `--ssl-cert=name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `file name`
* **Default Value:** None
---
#### `ssl_cipher`
* **Description:** List of permitted ciphers or cipher suites to use for [TLS](../data-in-transit-encryption/index). Besides cipher names, if MariaDB was compiled with OpenSSL, this variable could be set to "SSLv3" or "TLSv1.2" to allow all SSLv3 or all TLSv1.2 ciphers. Note that the TLSv1.3 ciphers cannot be excluded when using OpenSSL, even by using this system variable. See [Using TLSv1.3](../using-tlsv13/index) for details. This system variable implies the `[ssl](../mysqld-options/index#-ssl)` option.
* **Commandline:** `--ssl-cipher=name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:** None
---
#### `ssl_crl`
* **Description:** Defines a path to a PEM file that should contain one or more revoked X509 certificates to use for [TLS](../data-in-transit-encryption/index). This system variable requires that you use the absolute path, not a relative path.
+ See [Secure Connections Overview: Certificate Revocation Lists (CRLs)](../secure-connections-overview/index#certificate-revocation-lists-crls) for more information.
+ This variable is only valid if the server was built with OpenSSL. If the server was built with [wolfSSL](https://www.wolfssl.com/products/wolfssl/) or [yaSSL](https://www.wolfssl.com/products/yassl/), then this variable is not supported. See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms.
* **Commandline:** `--ssl-crl=name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `file name`
* **Default Value:** None
* **Introduced:** [MariaDB 10.0.0](https://mariadb.com/kb/en/mariadb-1000-release-notes/)
---
#### `ssl_crlpath`
* **Description:** Defines a path to a directory that contains one or more PEM files that should each contain one revoked X509 certificate to use for [TLS](../data-in-transit-encryption/index). This system variable requires that you use the absolute path, not a relative path. The directory specified by this variable needs to be run through the `[openssl rehash](https://www.openssl.org/docs/man1.1.1/man1/rehash.html)` command.
+ See [Secure Connections Overview: Certificate Revocation Lists (CRLs)](../secure-connections-overview/index#certificate-revocation-lists-crls) for more information.
+ This variable is only supported if the server was built with OpenSSL. If the server was built with [wolfSSL](https://www.wolfssl.com/products/wolfssl/) or [yaSSL](https://www.wolfssl.com/products/yassl/), then this variable is not supported. See [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index) for more information about which libraries are used on which platforms.
* **Commandline:** `--ssl-crlpath=name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `directory name`
* **Default Value:** None
* **Introduced:** [MariaDB 10.0.0](https://mariadb.com/kb/en/mariadb-1000-release-notes/)
---
#### `ssl_key`
* **Description:** Defines a path to a private key file to use for [TLS](../data-in-transit-encryption/index). This system variable requires that you use the absolute path, not a relative path. This system variable implies the [ssl](../mysqld-options/index#-ssl) option.
* **Commandline:** `--ssl-key=name`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:** None
---
#### `tls_version`
* **Description:** This system variable accepts a comma-separated list (with no whitespaces) of TLS protocol versions. A TLS protocol version will only be enabled if it is present in this list. All other TLS protocol versions will not be permitted.
+ See [Secure Connections Overview: TLS Protocol Versions](../secure-connections-overview/index#tls-protocol-versions) for more information.
* **Commandline:** `--tls-version=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `enumerated`
* **Default Value:** TLSv1.1,TLSv1.2,TLSv1.3
* **Valid Values:** TLSv1.0,TLSv1.1,TLSv1.2,TLSv1.3
* **Introduced:** [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)
---
#### `version_ssl_library`
* **Description:** The version of the [TLS](../data-in-transit-encryption/index) library that is being used. Note that the version returned by this system variable does not always necessarily correspond to the exact version of the OpenSSL package installed on the system. OpenSSL shared libraries tend to contain interfaces for multiple versions at once to allow for backward compatibility. Therefore, if the OpenSSL package installed on the system is newer than the OpenSSL version that the MariaDB server binary was built with, then the MariaDB server binary might use one of the interfaces for an older version.
+ See [TLS and Cryptography Libraries Used by MariaDB: Checking the Server's OpenSSL Version](../tls-and-cryptography-libraries-used-by-mariadb/index#checking-the-servers-openssl-version) for more information.
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:** None
* **Introduced:** [MariaDB 10.1.3](https://mariadb.com/kb/en/mariadb-1013-release-notes/)
---
See Also
--------
* [Secure Connections Overview](../secure-connections-overview/index)
* [System Variables](../server-system-variables/index) for a complete list of system variables and instructions on setting them.
* [Full list of MariaDB options, system and status variables](../full-list-of-mariadb-options-system-and-status-variables/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MySQL Sandbox MySQL Sandbox
=============
MySQL Sandbox has been deprecated. See [dbdeployer](../dbdeployer/index) instead.
MySQL Sandbox is a Perl Module for installing multiple versions of MariaDB and/or MySQL in isolation from each other. It is primarily used for easily testing different server versions.
Visit <http://mysqlsandbox.net/> for details on how to install and use it.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Thread Command Values Thread Command Values
=====================
A thread can have any of the following `COMMAND` values (displayed by the `COMMAND` field listed by the [SHOW PROCESSLIST](../show-processlist/index) statement or in the [Information Schema PROCESSLIST Table](../information-schema-processlist-table/index), as well as the `PROCESSLIST_COMMAND` value listed in the [Performance Schema threads Table](../performance-schema-threads-table/index)). These indicate the nature of the thread's activity.
| Value | Description |
| --- | --- |
| Binlog Dump | Master thread for sending [binary log](../binary-log/index) contents to a slave. |
| Change user | Executing a change user operation. |
| Close stmt | Closing a [prepared statement](../prepared-statements/index). |
| Connect | [Replication](../replication/index) slave is connected to its master. |
| Connect Out | Replication slave is in the process of connecting to its master. |
| Create DB | Executing an operation to create a database. |
| Daemon | Internal server thread rather than for servicing a client connection. |
| Debug | Generating debug information. |
| Delayed insert | A delayed-insert handler. |
| Drop DB | Executing an operation to drop a database. |
| Error | Error. |
| Execute | Executing a [prepared statement](../prepared-statements/index). |
| Fetch | Fetching the results of an executed [prepared statement](../prepared-statements/index). |
| Field List | Retrieving table column information. |
| Init DB | Selecting default database. |
| Kill | Killing another thread. |
| Long Data | Retrieving long data from the result of executing a [prepared statement](../prepared-statements/index). |
| Ping | Handling a server ping request. |
| Prepare | Preparing a [prepared statement](../prepared-statements/index). |
| Processlist | Preparing processlist information about server threads. |
| Query | Executing a statement. |
| Quit | In the process of terminating the thread. |
| Refresh | [Flushing](../flush/index) a table, logs or caches, or refreshing replication server or [status variable](../server-status-variables/index) information. |
| Register Slave | Registering a slave server. |
| Reset stmt | Resetting a [prepared statement](../prepared-statements/index). |
| Set option | Setting or resetting a client statement execution option. |
| Sleep | Waiting for the client to send a new statement. |
| Shutdown | Shutting down the server. |
| Statistics | Preparing status information about the server. |
| Table Dump | Sending the contents of a table to a slave. |
| Time | Not used. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb ROW_NUMBER ROW\_NUMBER
===========
**MariaDB starting with [10.2](../what-is-mariadb-102/index)**ROW\_NUMBER() was first introduced with [window functions](../window-functions/index) in [MariaDB 10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/).
Syntax
------
```
ROW_NUMBER() OVER (
[ PARTITION BY partition_expression ]
[ ORDER BY order_list ]
)
```
Description
-----------
ROW\_NUMBER() is a [window function](../window-functions/index) that displays the number of a given row, starting at one and following the [ORDER BY](../order-by/index) sequence of the window function, with identical values receiving different row numbers. It is similar to the [RANK()](../rank/index) and [DENSE\_RANK()](../dense_rank/index) functions except that in that function, identical values will receive the same rank for each result.
Examples
--------
The distinction between [DENSE\_RANK()](../dense_rank/index), [RANK()](../rank/index) and ROW\_NUMBER():
```
CREATE TABLE student(course VARCHAR(10), mark int, name varchar(10));
INSERT INTO student VALUES
('Maths', 60, 'Thulile'),
('Maths', 60, 'Pritha'),
('Maths', 70, 'Voitto'),
('Maths', 55, 'Chun'),
('Biology', 60, 'Bilal'),
('Biology', 70, 'Roger');
SELECT
RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS rank,
DENSE_RANK() OVER (PARTITION BY course ORDER BY mark DESC) AS dense_rank,
ROW_NUMBER() OVER (PARTITION BY course ORDER BY mark DESC) AS row_num,
course, mark, name
FROM student ORDER BY course, mark DESC;
+------+------------+---------+---------+------+---------+
| rank | dense_rank | row_num | course | mark | name |
+------+------------+---------+---------+------+---------+
| 1 | 1 | 1 | Biology | 70 | Roger |
| 2 | 2 | 2 | Biology | 60 | Bilal |
| 1 | 1 | 1 | Maths | 70 | Voitto |
| 2 | 2 | 2 | Maths | 60 | Thulile |
| 2 | 2 | 3 | Maths | 60 | Pritha |
| 4 | 3 | 4 | Maths | 55 | Chun |
+------+------------+---------+---------+------+---------+
```
See Also
--------
* [RANK()](../rank/index)
* [DENSE\_RANK()](../dense_rank/index)
* [ORDER BY](../order-by/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ColumnStore Data Types ColumnStore Data Types
======================
ColumnStore supports the following data types:
Numeric Data Types
------------------
| Datatypes | Column Size | Description |
| --- | --- | --- |
| [BOOLEAN](../boolean/index) | 1-byte | A synonym for "TINYINT(1)". Supported from version 1.2.0 onwards. |
| [TINYINT](../tinyint/index) | 1-byte | A very small integer. Numeric value with scale 0. Signed: -126 to +127. Unsigned: 0 to 253. |
| [SMALLINT](../smallint/index) | 2-bytes | A small integer. Signed: -32,766 to 32,767. Unsigned: 0 to 65,533. |
| [MEDIUMINT](../mediumint/index) | 3-bytes | A medium integer. Signed: -8388608 to 8388607. Unsigned: 0 to 16777215. Supported starting with MariaDB ColumnStore 1.4.2. |
| [INTEGER/INT](../int/index) | 4-bytes | A normal-size integer. Numeric value with scale 0. Signed: -2,147,483,646 to 2,147,483,647. Unsigned: 0 to 4,294,967,293 |
| [BIGINT](../bigint/index) | 8-bytes | A large integer. Numeric value with scale 0. Signed: -9,223,372,036,854,775,806 to+9,223,372,036,854,775,807 Unsigned: 0 to +18,446,744,073,709,551,613 |
| [DECIMAL/NUMERIC](../decimal/index) | 2, 4, or 8 bytes | A packed fixed-point number that can have a specific total number of digits and with a set number of digits after a decimal. The maximum precision (total number of digits) that can be specified is 18. |
| [FLOAT](../float/index) | 4 bytes | Stored in 32-bit IEEE-754 floating point format. As such, the number of significant digits is about 6and the range of values is approximately +/- 1e38.The MySQL extension to specify precision and scale is not supported. |
| [DOUBLE/REAL](../double/index) | 8 bytes | Stored in 64-bit IEEE-754 floating point format. As such, the number of significant digits is about 15 and the range of values is approximately +/-1e308. The MySQL extension to specify precision and scale is not supported. “REAL” is a synonym for “DOUBLE”. |
String Data Types
-----------------
| Datatypes | Column Size | Description |
| --- | --- | --- |
| [CHAR](../char/index) | 1, 2, 4, or 8 bytes | Holds letters and special characters of fixed length. Max length is 255. Default and minimum size is 1 byte. |
| [VARCHAR](../varchar/index) | 1, 2, 4, or 8 bytes or 8-byte token | Holds letters, numbers, and special characters of variable length. Max length = 8000 bytes or characters and minimum length = 1 byte or character. |
| [TINYTEXT](../tinytext/index) | 255 bytes | Holds a small amount of letters, numbers, and special characters of variable length. Supported from version 1.1.0 onwards. |
| [TINYBLOB](../tinyblob/index) | 255 bytes | Holds a small amount of binary data of variable length. Supported from version 1.1.0 onwards. |
| [TEXT](../text/index) | 64 KB | Holds letters, numbers, and special characters of variable length. Supported from version 1.1.0 onwards. |
| [BLOB](../blob/index) | 64 KB | Holds binary data of variable length. Supported from version 1.1.0 onwards. |
| [MEDIUMTEXT](../mediumtext/index) | 16 MB | Holds a medium amount of letters, numbers, and special characters of variable length. Supported from version 1.1.0 onwards. |
| [MEDIUMBLOB](../mediumblob/index) | 16 MB | Holds a medium amount of binary data of variable length. Supported from version 1.1.0 onwards. |
| [LONGTEXT](../longtext/index) | 1.96 GB | Holds a large amount of letters, numbers, and special characters of variable length. Supported from version 1.1.0 onwards. |
| [LONGBLOB](../longblob/index) | 1.96 GB | Holds a large amount of binary data of variable length. Supported from version 1.1.0 onwards. |
Date and Time Data Types
------------------------
| Datatypes | Column Size | Description |
| --- | --- | --- |
| [DATE](../date/index) | 4-bytes | Date has year, month, and day. The internal representation of a date is a string of 4 bytes. The first 2 bytes represent the year, .5 bytes the month, and .75 bytes the day in the following format: YYYY-MM-DD. Supported range is 1000-01-01 to 9999-12-31. |
| [DATETIME](../datetime/index) | 8-bytes | A date and time combination. Supported range is 1000-01-01 00:00:00 to 9999-12-31 23:59:59. From version 1.2.0 microseconds are also supported. |
| [TIME](../time/index) | 8-bytes | Holds hour, minute, second and optionally microseconds for time. Supported range is '-838:59:59.999999' to '838:59:59.999999'. Supported from version 1.2.0 onwards. |
| [TIMESTAMP](../timestamp/index) | 4-bytes | Values are stored as the number of seconds since 1970-01-01 00:00:00 UTC, and optionally microseconds. The max value is currently 2038-01-19 03:14:07 UTC. Supported starting with MariaDB ColumnStore 1.4.2. |
### Notes
* ColumnStore treats a zero-length string as a NULL value.
* As with core MariaDB, ColumnStore employs “saturation semantics” on integer values. This means that if a value is inserted into an integer field that is too big/small for it to hold (i.e. it is more negative or more positive than the values indicated above), ColumnStore will “saturate” that value to the min/max value indicated above as appropriate. For example, for a SMALLINT column, if 32800 is attempted, the actual value inserted will be 32767.
* ColumnStore largest negative and positive numbers appears to be 2 less than what MariaDB supports. ColumnStore reserves these for its internal use and they cannot be used. For example, if there is a need to store -128 in a column, the TINYINT datatype cannot be used; the SMALLINT datatype must be used instead. If the value -128 is inserted into a TINYINT column, ColumnStore will saturate it to -126 (and issue a warning).
* ColumnStore truncates rather than rounds decimal constants that have too many digits after the decimal point during bulk load and when running SELECT statements. For INSERT and UPDATE, however, the MariaDB parser will round such constants. You should verify that ETL tools used and any INSERT/UPDATEstatements only specify the correct number of decimal digits to avoid potential confusion.
* An optional display width may be added to the BIGINT, INTEGER/INT, SMALLINT & TINYINT columns. As with core MariaDB tables, this value does not affect the internal storage requirements of the column nor does it affect the valid value ranges.
* All columns in ColumnStore are nullable and the default value for any column is NULL. You may optionally specify NOT NULL for any column and/or one with a DEFAULT value.
* Unlike other MariaDB storage engines, the actual storage limit for LONGBLOB/LONGTEXT is 2,100,000,000 bytes instead of 4GB per entry. MariaDB's client API is limited to a row length of 1GB.
* Timestamp und current\_timestamp still not supported. ([MCOL-3694](https://jira.mariadb.org/browse/MCOL-3694) / [MCOL-1039](https://jira.mariadb.org/browse/MCOL-1039))
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Buildbot Setup for Virtual Machines - Ubuntu 11.04 "natty" Buildbot Setup for Virtual Machines - Ubuntu 11.04 "natty"
==========================================================
Base install
------------
```
qemu-img create -f qcow2 vm-natty-amd64-serial.qcow2 8G
kvm -m 1024 -hda vm-natty-amd64-serial.qcow2 -cdrom /kvm/iso/ubuntu-11.04-server-amd64.iso -redir tcp:2255::22 -boot d -smp 2 -cpu qemu64 -net nic,model=virtio -net user
# Install, picking default options mostly, only adding openssh server.
kvm -m 1024 -hda vm-natty-amd64-serial.qcow2 -cdrom /kvm/iso/ubuntu-11.04-server-amd64.iso -redir tcp:2255::22 -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
ssh -p 2255 localhost
# edit /boot/grub/menu.lst and visudo, see below
ssh -t -p 2255 localhost "mkdir .ssh; sudo addgroup $USER sudo"
scp -P 2255 authorized_keys localhost:.ssh/
echo $'Buildbot\n\n\n\n\ny' | ssh -p 2255 localhost 'chmod -R go-rwx .ssh; sudo adduser --disabled-password buildbot; sudo addgroup buildbot sudo; sudo mkdir ~buildbot/.ssh; sudo cp .ssh/authorized_keys ~buildbot/.ssh/; sudo chown -R buildbot:buildbot ~buildbot/.ssh; sudo chmod -R go-rwx ~buildbot/.ssh'
scp -P 2255 ttyS0.conf buildbot@localhost:
ssh -p 2255 buildbot@localhost 'sudo cp ttyS0.conf /etc/init/; rm ttyS0.conf; sudo shutdown -h now'
```
```
qemu-img create -f qcow2 vm-natty-i386-serial.qcow2 8G
kvm -m 1024 -hda vm-natty-i386-serial.qcow2 -cdrom /kvm/iso/ubuntu-11.04-server-i386.iso -redir tcp:2256::22 -boot d -smp 2 -cpu qemu32,-nx -net nic,model=virtio -net user
# Install, picking default options mostly, only adding openssh server.
kvm -m 1024 -hda vm-natty-i386-serial.qcow2 -cdrom /kvm/iso/ubuntu-11.04-server-i386.iso -redir tcp:2256::22 -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
ssh -p 2256 localhost
# edit /boot/grub/menu.lst and visudo, see below
ssh -t -p 2256 localhost "mkdir .ssh; sudo addgroup $USER sudo"
scp -P 2256 authorized_keys localhost:.ssh/
echo $'Buildbot\n\n\n\n\ny' | ssh -p 2256 localhost 'chmod -R go-rwx .ssh; sudo adduser --disabled-password buildbot; sudo addgroup buildbot sudo; sudo mkdir ~buildbot/.ssh; sudo cp .ssh/authorized_keys ~buildbot/.ssh/; sudo chown -R buildbot:buildbot ~buildbot/.ssh; sudo chmod -R go-rwx ~buildbot/.ssh'
scp -P 2256 ttyS0.conf buildbot@localhost:
ssh -p 2256 buildbot@localhost 'sudo cp ttyS0.conf /etc/init/; rm ttyS0.conf; sudo shutdown -h now'
```
Enabling passwordless sudo:
```
sudo VISUAL=vi visudo
# Add line at end: `%sudo ALL=NOPASSWD: ALL'
```
Editing /boot/grub/menu.lst:
```
sudo vi /etc/default/grub
# Add/edit these entries:
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL="serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
sudo update-grub
```
VMs for building .debs
----------------------
```
for i in 'vm-natty-amd64-serial.qcow2 2255 qemu64' 'vm-natty-i386-serial.qcow2 2256 qemu64' ; do \
set $i; \
runvm --user=buildbot --logfile=kernel_$2.log --base-image=$1 --port=$2 --cpu=$3 "$(echo $1 | sed -e 's/serial/build/')" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get update" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get -y build-dep mysql-server-5.1" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get install -y devscripts hardening-wrapper fakeroot doxygen texlive-latex-base ghostscript libevent-dev libssl-dev zlib1g-dev libreadline6-dev" ; \
done
```
VMs for install testing.
------------------------
See above for how to obtain my.seed and sources.append.
```
for i in 'vm-natty-amd64-serial.qcow2 2255 qemu64' 'vm-natty-i386-serial.qcow2 2256 qemu64' ; do \
set $i; \
runvm --user=buildbot --logfile=kernel_$2.log --base-image=$1 --port=$2 --cpu=$3 "$(echo $1 | sed -e 's/serial/install/')" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get update" \
"sudo DEBIAN_FRONTEND=noninteractive apt-get install -y debconf-utils" \
"= scp -P $2 my.seed sources.append buildbot@localhost:/tmp/" \
"sudo debconf-set-selections /tmp/my.seed" \
"sudo sh -c 'cat /tmp/sources.append >> /etc/apt/sources.list'"; \
done
```
VMs for upgrade testing
-----------------------
```
for i in 'vm-natty-amd64-install.qcow2 2255 qemu64' 'vm-natty-i386-install.qcow2 2256 qemu64' ; do \
set $i; \
runvm --user=buildbot --logfile=kernel_$2.log --base-image=$1 --port=$2 --cpu=$3 "$(echo $1 | sed -e 's/install/upgrade/')" \
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server-5.1' \
'mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"' ;\
done
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore software upgrade 1.0.12 to 1.0.13 MariaDB ColumnStore software upgrade 1.0.12 to 1.0.13
=====================================================
MariaDB ColumnStore software upgrade 1.0.12 to 1.0.13
-----------------------------------------------------
Note: Columnstore.xml modifications you manually made are not automatically carried forward on an upgrade. These modifications will need to be incorporated back into .XML once the upgrade has occurred.
The previous configuration file will be saved as /usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave.
If you have specified a root database password (which is good practice), then you must configure a .my.cnf file with user credentials for the upgrade process to use. Create a .my.cnf file in the user home directory with 600 file permissions with the following content (updating PASSWORD as appropriate):
```
[mysqladmin]
user = root
password = PASSWORD
```
### Choosing the type of upgrade
As noted on the Preparing guide, you can installing MariaDB ColumnStore with the use of soft-links. If you have the softlinks be setup at the Data Directory Levels, like mariadb/columnstore/data and mariadb/columnstore/dataX, then your upgrade will happen without any issues. In the case where you have a softlink at the top directory, like /usr/local/mariadb, you will need to upgrade using the binary package. If you updating using the rpm package and tool, this softlink will be deleted when you perform the upgrade process and the upgrade will fail.
#### Root User Installs
#### Upgrading MariaDB ColumnStore using RPMs
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.0.13-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.** Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
```
# tar -zxf mariadb-columnstore-1.0.13-1-centos#.x86_64.rpm.tar.gz
```
* Upgrade the RPMs. The MariaDB ColumnStore software will be installed in /usr/local/.
```
# rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
# rpm -ivh mariadb-columnstore-*1.0.13*rpm
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml.rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
For RPM Upgrade, the previous configuration file will be saved as:
/usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory -mariadb-columnstore-1.0.13-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# /usr/local/mariadb/columnstore/bin/pre-uninstall
```
* Unpack the tarball, in the /usr/local/ directory.
```
# tar -zxvf -mariadb-columnstore-1.0.13-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# /usr/local/mariadb/columnstore/bin/post-install
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
### Upgrading MariaDB ColumnStore using the DEB package
A DEB upgrade would be done on a system that supports DEBs like Debian or Ubuntu systems.
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory
mariadb-columnstore-1.0.13-1.amd64.deb.tar.gz
(DEB 64-BIT) to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate DEBs.
```
# tar -zxf mariadb-columnstore-1.0.13-1.amd64.deb.tar.gz
```
* Remove and install all MariaDB ColumnStore debs
```
# cd /root/
# dpkg -r $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg --install mariadb-columnstore-*1.0.13-1*deb
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
#### Non-Root User Installs
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /home/'non-root-user" directory
mariadb-columnstore-1.0.13-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# $HOME/mariadb/columnstore/bin/pre-uninstall
--installdir= /home/guest/mariadb/columnstore
```
* Unpack the tarball, which will generate the $HOME/ directory.
```
# tar -zxvf -mariadb-columnstore-1.0.13-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# $HOME/mariadb/columnstore/bin/post-install
--installdir=/home/guest/mariadb/columnstore
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# $HOME/mariadb/columnstore/bin/postConfigure -u -i /home/guest/mariadb/columnstore
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Slow Query Log Overview Slow Query Log Overview
=======================
The slow query log is a record of SQL queries that took a long time to perform.
Note that, if your queries contain user's passwords, the slow query log may contain passwords too. Thus, it should be protected.
The number of rows affected by the slow query are also recorded in the slow query log.
Enabling the Slow Query Log
---------------------------
The slow query log is disabled by default.
To enable the slow query log, set the [slow\_query\_log](../server-system-variables/index#slow_query_log) system variable to `1`. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL slow_query_log=1;
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
slow_query_log
```
Configuring the Slow Query Log Filename
---------------------------------------
By default, the slow query log is written to `${hostname}-slow.log` in the [datadir](../server-system-variables/index#datadir) directory. However, this can be changed.
One way to configure the slow query log filename is to set the [slow\_query\_log\_file](../server-system-variables/index#slow_query_log_file) system variable. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL slow_query_log_file='mariadb-slow.log';
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
slow_query_log
slow_query_log_file=mariadb-slow.log
```
If it is a relative path, then the [slow\_query\_log\_file](../server-system-variables/index#slow_query_log_file) is relative to the [datadir](../server-system-variables/index#datadir) directory.
However, the [slow\_query\_log\_file](../server-system-variables/index#slow_query_log_file) system variable can also be an absolute path. For example:
```
[mariadb]
...
slow_query_log
slow_query_log_file=/var/log/mysql/mariadb-slow.log
```
Another way to configure the slow query log filename is to set the [log-basename](../mysqld-options/index#-log-basename) option, which configures MariaDB to use a common prefix for all log files (e.g. slow query log, [general query log](../general-query-log/index), [error log](../error-log/index), [binary logs](../binary-log/index), etc.). The slow query log filename will be built by adding `-slow.log` to this prefix. This option cannot be set dynamically. It can be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log-basename=mariadb
slow_query_log
```
The [log-basename](../mysqld-options/index#-log-basename) cannot be an absolute path. The log file name is relative to the [datadir](../server-system-variables/index#datadir) directory.
Choosing the Slow Query Log Output Destination
----------------------------------------------
The slow query log can either be written to a file on disk, or it can be written to the [slow\_log](../mysqlslow_log-table/index) table in the [mysql](../the-mysql-database-tables/index) database. To choose the slow query log output destination, set the [log\_output](../server-system-variables/index#log_output) system variable.
### Writing the Slow Query Log to a File
The slow query log is output to a file by default. However, it can be explicitly chosen by setting the [log\_output](../server-system-variables/index#log_output) system variable to `FILE`. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL log_output='FILE';
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
```
### Writing the Slow Query Log to a Table
The slow query log can either be written to the [slow\_log](../mysqlslow_log-table/index) table in the [mysql](../the-mysql-database-tables/index) database by setting the [log\_output](../server-system-variables/index#log_output) system variable to `TABLE`. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL log_output='TABLE';
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=TABLE
slow_query_log
```
Some rows in this table might look like this:
```
SELECT * FROM mysql.slow_log\G
...
*************************** 2. row ***************************
start_time: 2014-11-11 07:56:28.721519
user_host: root[root] @ localhost []
query_time: 00:00:12.000215
lock_time: 00:00:00.000000
rows_sent: 1
rows_examined: 0
db: test
last_insert_id: 0
insert_id: 0
server_id: 1
sql_text: SELECT SLEEP(12)
thread_id: 74
...
```
See [Writing logs into tables](../writing-logs-into-tables/index) for more information.
Disabling the Slow Query Log for a Session
------------------------------------------
A user can disable logging to the slow query log for a connection by setting the [slow\_query\_log](../server-system-variables/index#slow_query_log) system variable to `0`. For example:
```
SET SESSION slow_query_log=0;
```
Disabling the Slow Query Log for Specific Statements
----------------------------------------------------
In [MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/) and later, it is possible to disable logging to the slow query log for specific types of statements by setting the [log\_slow\_disabled\_statements](../server-system-variables/index#log_slow_disabled_statements) system variable. This option cannot be set dynamically. It can be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
general_log
general_log_file=queries.log
log_slow_disabled_statements='admin,call,slave,sp'
```
Configuring the Slow Query Log Time
-----------------------------------
The time that defines a slow query can be configured by setting the [long\_query\_time](../server-system-variables/index#long_query_time) system variable. It uses a units of seconds, with an optional milliseconds component. The default value is `10`. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL long_query_time=5.0;
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
```
Logging Queries That Don't Use Indexes
--------------------------------------
It can be beneficial to log queries that don't use indexes to the slow query log, since queries that don't use indexes can usually be optimized either by adding an index or by doing a slight rewrite. The slow query log can be configured to log queries that don't use indexes regardless of their execution time by setting the [log\_queries\_not\_using\_indexes](../server-system-variables/index#log_queries_not_using_indexes) system variable. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL log_queries_not_using_indexes=ON;
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
log_queries_not_using_indexes=ON
```
As a significant number of queries can run quickly even without indexes, you can use the [min\_examined\_row\_limit](../server-system-variables/index#min_examined_row_limit) system variable with [log\_queries\_not\_using\_indexes](../server-system-variables/index#log_queries_not_using_indexes) to limit the logged queries to those having a material impact on the server.
Logging Queries That Examine a Minimum Row Limit
------------------------------------------------
It can be beneficial to log queries that examine a minimum number of rows. The slow query log can be configured to log queries that examine a minimum number of rows regardless of their execution time by setting the [min\_examined\_row\_limit](../server-system-variables/index#min_examined_row_limit) system variable. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL min_examined_row_limit=100000;
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
min_examined_row_limit=100000
```
Logging Slow Administrative Statements
--------------------------------------
By default, the Slow Query Log only logs slow non-administrative statements. To log administrative statements, set the [log\_slow\_admin\_statements](../server-system-variables/index#log_slow_admin_statements) system variable. The Slow Query Log considers the following statements administrative: [ALTER TABLE](../alter-table/index), [ANALYZE TABLE](../analyze-table/index), [CHECK TABLE](../sql-commands-check-table/index), [CREATE INDEX](../create-index/index), [DROP INDEX](../drop-index/index), [OPTIMIZE TABLE](../optimize-table/index), and [REPAIR TABLE](../repair-table/index). In [MariaDB 10.3](../what-is-mariadb-103/index) and later, this also includes [ALTER SEQUENCE](../alter-sequence/index) statements.
You can dynamically enable this feature using a [SET GLOBAL](../set/index#global-session) statement. For example:
```
SET GLOBAL log_slow_admin_statements=ON;
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
log_slow_admin_statements=ON
```
Enabling the Slow Query Log for Specific Criteria
-------------------------------------------------
It is possible to enable logging to the slow query log for queries that meet specific criteria by configuring the [log\_slow\_filter](../server-system-variables/index#log_slow_filter) system variable. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL log_slow_filter='filesort,filesort_on_disk,tmp_table,tmp_table_on_disk';
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
log_slow_filter=filesort,filesort_on_disk,tmp_table,tmp_table_on_disk
```
Throttling the Slow Query Log
-----------------------------
The slow query log can create a lot of I/O, so it can be beneficial to throttle it in some cases. The slow query log can be throttled by configuring the [log\_slow\_rate\_limit](../server-system-variables/index#log_slow_rate_limit) system variable. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL log_slow_rate_limit=5;
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
log_slow_rate_limit=5
```
Configuring the Slow Query Log Verbosity
----------------------------------------
There are a few optional pieces of information that can be included in the slow query log for each query. This optional information can be included by configuring the [log\_slow\_verbosity](../server-system-variables/index#log_slow_verbosity) system variable. It can be changed dynamically with [SET GLOBAL](../set/index#global-session). For example:
```
SET GLOBAL log_slow_verbosity='query_plan,explain';
```
It can also be set in a server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index) prior to starting up the server. For example:
```
[mariadb]
...
log_output=FILE
slow_query_log
slow_query_log_file=slow-queries.log
long_query_time=5.0
log_slow_verbosity=query_plan,explain
```
It is possible to have [EXPLAIN output printed in the slow query log](../explain-in-the-slow-query-log/index).
Viewing the Slow Query Log
--------------------------
Slow query logs written to file can be viewed with any text editor, or you can use the [mysqldumpslow](../mysqldumpslow/index) tool to ease the process by summarizing the information.
Queries that you find in the log are key queries to try to optimize by constructing a [more efficient query](../query-optimizations/index) or by making [better use of indexes](../optimization-and-indexes/index).
For queries that appear in the log that cannot be optimized in the above ways, perhaps because they are simply very large selects, due to slow hardware, or very high lock/cpu/io contention, using shard/clustering/load balancing solutions, better hardware, or stats tables may help to improve these queries.
Slow query logs written to table can be viewed by querying the [slow\_log](../mysqlslow_log-table/index) table.
Variables Related to the Slow Query Log
---------------------------------------
* [slow\_query\_log](../server-system-variables/index#slow_query_log) - enable/disable the slow query log
* [log\_output](../server-system-variables/index#log_output) - how the output will be written
* [slow\_query\_log\_file](../server-system-variables/index#slow_query_log_file) - name of the slow query log file
* [long\_query\_time](../server-system-variables/index#long_query_time) - time in seconds/microseconds defining a slow query
* [log\_queries\_not\_using\_indexes](../server-system-variables/index#log_queries_not_using_indexes) - whether to log queries that don't use indexes
* [log\_slow\_admin\_statements](../server-system-variables/index#log_slow_admin_statements) - whether to log certain admin statements
* [log\_slow\_disabled\_statements](../server-system-variables/index#log_slow_disabled_statements) - types of statements that should not be logged in the slow query log
* [min\_examined\_row\_limit](../server-system-variables/index#min_examined_row_limit) - minimum rows a query must examine to be slow
* [log\_slow\_rate\_limit](../server-system-variables/index#log_slow_rate_limit) - permits a fraction of slow queries to be logged
* [log\_slow\_verbosity](../server-system-variables/index#log_slow_verbosity) - amount of detail in the log
* [log\_slow\_filter](../server-system-variables/index#log_slow_filter) - limit which queries to log
Rotating the Slow Query Log on Unix and Linux
---------------------------------------------
Unix and Linux distributions offer the [logrotate](https://linux.die.net/man/8/logrotate) utility, which makes it very easy to rotate log files. See [Rotating Logs on Unix and Linux](../rotating-logs-on-unix-and-linux/index) for more information on how to use this utility to rotate the slow query log.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Creating a New Merge Tree Creating a New Merge Tree
=========================
This article is obsolete. We don't use bzr anymore. This howto needs to be rewritten to explain how to create a merge tree in git.
**Merge tree** in the context of this HOWTO is a tree created specifically to simplify merges of third-party packages into MariaDB. WIth a merge tree there's a clear separation between upstream changes and our changes and in most cases bzr can do the merges automatically.
Here's how I created a merge tree for pcre:
* prerequisites: we already have pcre in the MariaDB tree, together with our changes (otherwise one can trivially create a bzr repository out of source pcre tarball).
* create an empty repository:
```
mkdir pcre
cd pcre
bzr init
```
* download pcre source tarball of the same version that we have in the tree — `pcre-8.34.tar.bz2`
* unpack it in the same place where the files are in the source tree:
```
tar xf ~/pcre-8.34.tar.bz2
mv pcre-8.34 pcre
```
* Add files to the repository **with the same file-ids as in the MariaDB tree!**
```
bzr add --file-ids-from ~/Abk/mysql/10.0
```
* All done. Commit and push
```
bzr commit -m pcre-8.34
bzr push --remember lp:~maria-captains/maria/pcre-mergetree
```
* Now null-merge that into your MariaDB tree. Note, that for the initial merge you need to specify the revision range `0..1`
```
cd ~/Abk/mysql/10.0
bzr merge -r 0..1 ~/mergetrees/pcre/
```
* Remove pcre files that shouldn't be in MariaDB tree, revert all changes that came from pcre (remember — it's a null-merge, pcre-8.34 is already in MariaDB tree), rename files in place as needed, resolve conflicts:
```
bzr rm `bzr added`
bzr revert --no-backup `bzr modified`
bzr resolve pcre
```
* Verify that the tree is unchanged and commit:
```
bzr status
bzr commit -m 'pcre-8.34 mergetree initial merge'
```
* Congratulations, your new merge tree is ready!
Now see [Merging with a merge tree](../merging-with-a-merge-tree/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MD5 MD5
===
Syntax
------
```
MD5(str)
```
Description
-----------
Calculates an MD5 128-bit checksum for the string.
The return value is a 32-hex digit string, and as of [MariaDB 5.5](../what-is-mariadb-55/index), is a nonbinary string in the connection [character set and collation](../data-types-character-sets-and-collations/index), determined by the values of the [character\_set\_connection](../server-system-variables/index#character_set_connection) and [collation\_connection](../server-system-variables/index#collation_connection) system variables. Before 5.5, the return value was a binary string.
NULL is returned if the argument was NULL.
Examples
--------
```
SELECT MD5('testing');
+----------------------------------+
| MD5('testing') |
+----------------------------------+
| ae2b1fca515949e5d54fb22b8ed95575 |
+----------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Information Schema INNODB_TABLESPACES_SCRUBBING Table Information Schema INNODB\_TABLESPACES\_SCRUBBING Table
=======================================================
**MariaDB [10.1.3](https://mariadb.com/kb/en/mariadb-1013-release-notes/) - [10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)**InnoDB and XtraDB data scrubbing was introduced in [MariaDB 10.1.3](https://mariadb.com/kb/en/mariadb-1013-release-notes/). The table was removed in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/) - see [MDEV-15528](https://jira.mariadb.org/browse/MDEV-15528).
The [Information Schema](../information_schema/index) `INNODB_TABLESPACES_SCRUBBING` table contains [data scrubbing](../xtradb-innodb-data-scrubbing/index) information.
The `PROCESS` [privilege](../grant/index) is required to view the table.
It has the following columns:
| Column | Description |
| --- | --- |
| `SPACE` | InnoDB table space id number. |
| `NAME` | Path to the table space file, without the extension. |
| `COMPRESSED` | The compressed page size, or zero if uncompressed. |
| `LAST_SCRUB_COMPLETED` | Date and time when the last scrub was completed, or `NULL` if never been performed. |
| `CURRENT_SCRUB_STARTED` | Date and time when the current scrub started, or `NULL` if never been performed. |
| `CURRENT_SCRUB_ACTIVE_THREADS` | Number of threads currently scrubbing the tablespace. |
| `CURRENT_SCRUB_PAGE_NUMBER` | Page that the scrubbing thread is currently scrubbing, or `NULL` if not enabled. |
| `CURRENT_SCRUB_MAX_PAGE_NUMBER` | When a scrubbing starts rotating a table space, the field contains its current size. `NULL` if not enabled. |
| `ON_SSD` | The field contains `1` when MariaDB detects that the table space is on a SSD based storage. `0` if not SSD or it could not be determined (since [MariaDB 10.4.4](https://mariadb.com/kb/en/mariadb-1044-release-notes/)) |
Example
-------
```
SELECT * FROM information_schema.INNODB_TABLESPACES_SCRUBBING LIMIT 1\G
*************************** 1. row ***************************
SPACE: 1
NAME: mysql/innodb_table_stats
COMPRESSED: 0
LAST_SCRUB_COMPLETED: NULL
CURRENT_SCRUB_STARTED: NULL
CURRENT_SCRUB_PAGE_NUMBER: NULL
CURRENT_SCRUB_MAX_PAGE_NUMBER: 0
ROTATING_OR_FLUSHING: 0
1 rows in set (0.00 sec)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore software upgrade 1.1.0 Beta to 1.1.1 RC MariaDB ColumnStore software upgrade 1.1.0 Beta to 1.1.1 RC
===========================================================
MariaDB ColumnStore software upgrade 1.1.0 Beta to 1.1.1 RC
-----------------------------------------------------------
Additional Dependency Packages exist for 1.1.1, so make sure you install those based on the "Preparing for ColumnStore Installation" Guide.
Note: Columnstore.xml modifications you manually made are not automatically carried forward on an upgrade. These modifications will need to be incorporated back into .XML once the upgrade has occurred.
The previous configuration file will be saved as /usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave.
If you have specified a root database password (which is good practice), then you must configure a .my.cnf file with user credentials for the upgrade process to use. Create a .my.cnf file in the user home directory with 600 file permissions with the following content (updating PASSWORD as appropriate):
```
[mysqladmin]
user = root
password = PASSWORD
```
### Choosing the type of upgrade
As noted on the Preparing guide, you can installing MariaDB ColumnStore with the use of soft-links. If you have the softlinks be setup at the Data Directory Levels, like mariadb/columnstore/data and mariadb/columnstore/dataX, then your upgrade will happen without any issues. In the case where you have a softlink at the top directory, like /usr/local/mariadb, you will need to upgrade using the binary package. If you updating using the rpm package and tool, this softlink will be deleted when you perform the upgrade process and the upgrade will fail.
#### Root User Installs
#### Upgrading MariaDB ColumnStore using RPMs
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.1.1-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.** Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
```
# tar -zxf mariadb-columnstore-1.1.1-1-centos#.x86_64.rpm.tar.gz
```
* Upgrade the RPMs. The MariaDB ColumnStore software will be installed in /usr/local/.
```
# rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
# rpm -ivh mariadb-columnstore-*1.1.1*rpm
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml.rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
For RPM Upgrade, the previous configuration file will be saved as:
/usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory -mariadb-columnstore-1.1.1-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# /usr/local/mariadb/columnstore/bin/pre-uninstall
```
* Unpack the tarball, in the /usr/local/ directory.
```
# tar -zxvf -mariadb-columnstore-1.1.1-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# /usr/local/mariadb/columnstore/bin/post-install
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
### Upgrading MariaDB ColumnStore using the DEB package
A DEB upgrade would be done on a system that supports DEBs like Debian or Ubuntu systems.
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory
mariadb-columnstore-1.1.1-1.amd64.deb.tar.gz
(DEB 64-BIT) to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate DEBs.
```
# tar -zxf mariadb-columnstore-1.1.1-1.amd64.deb.tar.gz
```
* Remove, purge and install all MariaDB ColumnStore debs
```
# cd /root/
# dpkg -r $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg -P $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg --install mariadb-columnstore-*1.1.1-1*deb
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
#### Non-Root User Installs
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /home/'non-root-user" directory
mariadb-columnstore-1.1.1-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# $HOME/mariadb/columnstore/bin/pre-uninstall
--installdir= /home/guest/mariadb/columnstore
```
* Unpack the tarball, which will generate the $HOME/ directory.
```
# tar -zxvf -mariadb-columnstore-1.1.1-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# $HOME/mariadb/columnstore/bin/post-install
--installdir=/home/guest/mariadb/columnstore
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# $HOME/mariadb/columnstore/bin/postConfigure -u -i /home/guest/mariadb/columnstore
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_DISTANCE_SPHERE ST\_DISTANCE\_SPHERE
====================
**MariaDB starting with [10.2.38](https://mariadb.com/kb/en/mariadb-10238-release-notes/)**`ST_DISTANCE_SPHERE` was introduced in [MariaDB 10.2.38](https://mariadb.com/kb/en/mariadb-10238-release-notes/), [MariaDB 10.3.29](https://mariadb.com/kb/en/mariadb-10329-release-notes/), [MariaDB 10.4.19](https://mariadb.com/kb/en/mariadb-10419-release-notes/) and [MariaDB 10.5.10](https://mariadb.com/kb/en/mariadb-10510-release-notes/).
Syntax
------
```
ST_DISTANCE_SPHERE(g1,g2,[r])
```
Description
-----------
Returns the spherical distance between two geometries (point or multipoint) on a sphere with the optional radius *r* (default is the Earth radius if *r* is not specified), or NULL if not given valid inputs.
Example
-------
```
set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)');
set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');
SELECT ST_Distance_Sphere(@zenica, @sarajevo);
55878.59337591705
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb 10.2.18 Release Upgrade Tests 10.2.18 Release Upgrade Tests
=============================
### Tested revision
2dfb4a8abe3af501f8a6780ed782a2eee5e6f6d5
### Test date
2018-10-03 13:37:05
### Summary
Few unrelated failures due to bugs in previous versions
### Details
| type | pagesize | OLD version | file format | encrypted | compressed | | NEW version | file format | encrypted | compressed | readonly | result | notes |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| recovery | 16 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 16 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| recovery | 4 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 4 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| recovery | 32 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| recovery | 32 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 64 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 64 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| recovery | 8 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 8 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| recovery | 16 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 16 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 4 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 4 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 32 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 32 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 64 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 64 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 8 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 8 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 16 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 4 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 32 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 64 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 8 | 10.2.18 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 16 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 4 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 32 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 64 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 8 | 10.2.18 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 16 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 4 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 32 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 64 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 8 | 10.2.18 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 16 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 4 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 32 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 64 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 8 | 10.2.18 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 16 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 16 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 4 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 4 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 8 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 8 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 16 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 16 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 4 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 8 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 8 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 16 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 16 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 4 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 4 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 32 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 32 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 8 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 8 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 16 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 16 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 4 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 4 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 8 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 8 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 16 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 4 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 32 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 64 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 8 | 10.2.17 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 16 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 4 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 32 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 64 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 8 | 10.2.17 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 16 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 4 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 32 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 64 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 8 | 10.2.17 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 16 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 4 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 32 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 64 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 8 | 10.2.17 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 16 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 16 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 4 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 4 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 8 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 8 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 16 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 16 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 4 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 8 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 8 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 16 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 16 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 4 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 4 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 32 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 32 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 8 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 8 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| crash | 16 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 16 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 4 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 4 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 8 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 8 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 16 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 4 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 32 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 64 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 8 | 10.2.6 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 16 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 4 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 32 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 64 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 8 | 10.2.6 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 16 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 4 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 32 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 64 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 8 | 10.2.6 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 16 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 4 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 32 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 64 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 8 | 10.2.6 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 16 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 16 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 4 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 4 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 8 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 8 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 16 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 16 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 4 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 8 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 8 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 16 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 4 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 32 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 64 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 8 | 10.1.36 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 16 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 4 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 32 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 64 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 8 | 10.1.36 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 16 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 4 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 32 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 64 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 8 | 10.1.36 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 16 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 4 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 32 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 64 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 8 | 10.1.36 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 16 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 16 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 4 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 4 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 8 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 8 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 16 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 16 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 4 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 8 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 8 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.2.18 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.2.18 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.2.18 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.2.18 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 4 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 4 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 8 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 4 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 8 | 10.0.36 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 4 | 10.0.14 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 10.0.14 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.14 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.14 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 4 | 10.0.14 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 10.0.14 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.18 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | **FAIL** | TEST\_FAILURE |
| undo | 4 | 10.0.18 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | **FAIL** | TEST\_FAILURE |
| undo | 8 | 10.0.18 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.18 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 4 | 10.0.18 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 8 | 10.0.18 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
| normal | 64 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 32 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 4 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 4 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 16 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 64 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 32 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| crash | 64 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| crash | 8 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| crash | 32 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| crash | 4 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| crash | 4 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| crash | 8 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| crash | 16 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| crash | 64 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| crash | 32 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 4 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 32 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 64 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 8 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 4 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 32 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 64 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 8 | 5.7.23 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 4 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 4 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 4 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 8 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
| undo | 4 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | OK | |
| undo | 8 | 5.6.41 (inbuilt) | | - | - | => | 10.2.18 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb FLUSH TABLES FOR EXPORT FLUSH TABLES FOR EXPORT
=======================
Syntax
------
```
FLUSH TABLES table_name [, table_name] FOR EXPORT
```
Description
-----------
`FLUSH TABLES ... FOR EXPORT` flushes changes to the specified tables to disk so that binary copies can be made while the server is still running. This works for [Archive](../archive/index), [Aria](../aria/index), [CSV](../csv/index), [InnoDB](../innodb/index), [MyISAM](../myisam/index), [MERGE](../merge/index), and [XtraDB](../xtradb/index) tables.
The table is read locked until one has issued [UNLOCK TABLES](../transactions-unlock-tables/index).
If a storage engine does not support `FLUSH TABLES FOR EXPORT`, a 1031 error ([SQLSTATE](../sqlstate/index) 'HY000') is produced.
If `FLUSH TABLES ... FOR EXPORT` is in effect in the session, the following statements will produce an error if attempted:
* `FLUSH TABLES WITH READ LOCK`
* `FLUSH TABLES ... WITH READ LOCK`
* `FLUSH TABLES ... FOR EXPORT`
* Any statement trying to update any table
If any of the following statements is in effect in the session, attempting `FLUSH TABLES ... FOR EXPORT` will produce an error.
* `FLUSH TABLES ... WITH READ LOCK`
* `FLUSH TABLES ... FOR EXPORT`
* `LOCK TABLES ... READ`
* `LOCK TABLES ... WRITE`
`FLUSH FOR EXPORT` is not written to the [binary log](../binary-log/index).
This statement requires the [RELOAD](../grant/index#global-privileges) and the [LOCK TABLES](../grant/index#database-privileges) privileges.
If one of the specified tables cannot be locked, none of the tables will be locked.
If a table does not exist, an error like the following will be produced:
```
ERROR 1146 (42S02): Table 'test.xxx' doesn't exist
```
If a table is a view, an error like the following will be produced:
```
ERROR 1347 (HY000): 'test.v' is not BASE TABLE
```
Example
-------
```
FLUSH TABLES test.t1 FOR EXPORT;
# Copy files related to the table (see below)
UNLOCK TABLES;
```
For a full description, please see [copying MariaDB tables](../copying-tables-between-different-mariadb-databases-and-mariadb-servers/index).
See Also
--------
* [Copying Tables Between Different MariaDB Databases and MariaDB Servers](../copying-tables-between-different-mariadb-databases-and-mariadb-servers/index)
* [Copying Transportable InnoDB Tablespaces](../innodb-file-per-table-tablespaces/index#copying-transportable-tablespaces)
* [myisampack](../myisampack/index) - Compressing the MyISAM data file for easier distribution.
* [aria\_pack](../aria_pack/index) - Compressing the Aria data file for easier distribution
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing MariaDB .deb Files with Ansible Installing MariaDB .deb Files with Ansible
==========================================
This page refers to the operations described in [Installing MariaDB .deb Files](../installing-mariadb-deb-files/index). Refer to that page for a complete list and explanation of the tasks that should be performed.
Here we discuss how to automate such tasks using Ansible. For example, here we show how to install a package or how to import a GPG key; but for an updated list of the necessary packages and for the keyserver to use, you should refer to [Installing MariaDB .deb Files](../installing-mariadb-deb-files/index).
Adding apt Repositories
-----------------------
To [add a repository](../installing-mariadb-deb-files/index#executing-add-apt-repository):
```
- name: Add specified repository into sources list
ansible.builtin.apt_repository:
repo: deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main
state: present
```
If you prefer to keep the repository information in a [source list file](../installing-mariadb-deb-files/index#creating-a-source-list-file) in the Ansible repository, you can upload that file to the target hosts in this way:
```
- name: Create a symbolic link
ansible.builtin.file:
src: ./file/mariadb.list
dest: /etc/apt/sources.list.d/
owner: root
group: root
mod: 644
state: file
```
Updating the Repository Cache
-----------------------------
Both the Ansible modules [ansible.builtin.apt](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html) and [ansible.builtin.apt\_repository](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_repository_module.html) have an `update_cache` attribute. In ansible.builtin.apt it is set to "no" by default. Whenever a task sets it to 'yes', `apt-get update` is run on the target system. You have three ways to make sure that repositories are updated.
The first is to use ansible.builtin.apt\_repository to add the desired repository, as shown above. So you only need to worry about updating repositories if you use the file method.
The second is to make sure that `update_cache` is set to 'yes' when you install a repository:
```
- name: Install foo
apt:
name: foo
update_cache: yes
```
But if you run certain tasks conditionally, this option may not be very convenient. So the third option is to update the repository cache explicitly as a separate task:
```
- name: Update repositories
apt:
- update_cache: yes
```
Importing MariaDB GPG Key
-------------------------
To [import the GPG key](../installing-mariadb-deb-files/index#importing-the-mariadb-gpg-public-key) for MariaDB we can use the [ansible.builtin.apt\_key](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_key_module.html) Ansible module. For example:
```
- name: Add an apt key by id from a keyserver
ansible.builtin.apt_key:
keyserver: hkp://keyserver.ubuntu.com:80
id: 0xF1656F24C74CD1D8
```
Installing Packages
-------------------
To install Deb packages into a system:
```
- name: Install software-properties-common
apt:
name: software-properties-common
state: present
```
To make sure that a specific version is installed, performing an upgrade or a downgrade if necessary:
```
- name: Install foo 1.0
apt:
name: foo=1.0
```
To install a package or upgrade it to the latest version, use: `state: latest`.
To install multiple packages at once:
```
- name: Install the necessary packages
apt:
pkg:
- pkg1
- pkg2=1.0
```
If all your servers run on the same system, you will always use ansible.builtin.apt and the names and versions of the packages will be the same for all servers. But suppose you have some servers running systems from the Debian family, and others running systems from the Red Hat family. In this case, you may find convenient to use two different task files for two different types of systems. To include the proper file for the target host's system:
```
- include: mariadb-debian.yml
when: "{{ ansible_facts['os_family'] }} == 'Debian'
```
The variables you can use to run the tasks related to the proper system are:
* [ansible\_fact['distribution']](https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#ansible-facts-distribution)
* [ansible\_fact['distribution\_major\_version']](https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#ansible-facts-distribution-major-version)
* [ansible\_fact['os\_family']](https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#ansible-facts-os-family)
There is also a system-independent [package module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html), but if the package names depend on the target system using it may be of very little benefit.
See Also
--------
* [Installing MariaDB .deb Files](../installing-mariadb-deb-files/index)
---
Content initially contributed by [Vettabase Ltd](https://vettabase.com/).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb COMPRESS COMPRESS
========
Syntax
------
```
COMPRESS(string_to_compress)
```
Description
-----------
Compresses a string and returns the result as a binary string. This function requires MariaDB to have been compiled with a compression library such as zlib. Otherwise, the return value is always `NULL`. The compressed string can be uncompressed with `[UNCOMPRESS()](../uncompress/index)`.
The [have\_compress](../server-system-variables/index#have_compress) server system variable indicates whether a compression library is present.
Examples
--------
```
SELECT LENGTH(COMPRESS(REPEAT('a',1000)));
+------------------------------------+
| LENGTH(COMPRESS(REPEAT('a',1000))) |
+------------------------------------+
| 21 |
+------------------------------------+
SELECT LENGTH(COMPRESS(''));
+----------------------+
| LENGTH(COMPRESS('')) |
+----------------------+
| 0 |
+----------------------+
SELECT LENGTH(COMPRESS('a'));
+-----------------------+
| LENGTH(COMPRESS('a')) |
+-----------------------+
| 13 |
+-----------------------+
SELECT LENGTH(COMPRESS(REPEAT('a',16)));
+----------------------------------+
| LENGTH(COMPRESS(REPEAT('a',16))) |
+----------------------------------+
| 15 |
+----------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysql.column_stats Table mysql.column\_stats Table
=========================
The `mysql.column_stats` table is one of three tables storing data used for [Engine-independent table statistics](../engine-independent-table-statistics/index). The others are [mysql.table\_stats](../mysqltable_stats-table/index) and [mysql.index\_stats](../mysqlindex_stats-table/index).
Note that statistics for blob and text columns are not collected. If explicitly specified, a warning is returned.
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, this table uses the [Aria](../aria/index) storage engine.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and before, this table uses the [MyISAM](../myisam-storage-engine/index) storage engine.
The `mysql.column_stats` table contains the following fields:
| Field | Type | Null | Key | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `db_name` | `varchar(64)` | NO | PRI | `NULL` | Database the table is in. |
| `table_name` | `varchar(64)` | NO | PRI | `NULL` | Table name. |
| `column_name` | `varchar(64)` | NO | PRI | `NULL` | Name of the column. |
| `min_value` | `varchar(255)` | YES | | `NULL` | Minimum value in the table (in text form). |
| `max_value` | `varchar(255)` | YES | | `NULL` | Maximum value in the table (in text form). |
| `nulls_ratio` | `decimal(12,4)` | YES | | `NULL` | Fraction of `NULL` values (0- no `NULL`s, 0.5 - half values are `NULL`s, 1 - all values are `NULL`s). |
| `avg_length` | `decimal(12,4)` | YES | | `NULL` | Average length of column value, in bytes. Counted as if one ran `SELECT AVG(LENGTH(col))`. This doesn't count `NULL` bytes, assumes endspace removal for `CHAR(n)`, etc. |
| `avg_frequency` | `decimal(12,4)` | YES | | `NULL` | Average number of records with the same value |
| `hist_size` | `tinyint(3) unsigned` | YES | | `NULL` | Histogram size in bytes, from 0-255, or, from [MariaDB 10.7](../what-is-mariadb-107/index), number of buckets if the histogram type is `JSON_HB`. |
| `hist_type` | `enum('SINGLE_PREC_HB', 'DOUBLE_PREC_HB')` (>= [MariaDB 10.7](../what-is-mariadb-107/index))`enum('SINGLE_PREC_HB', 'DOUBLE_PREC_HB','JSON_HB')` (<= [MariaDB 10.6](../what-is-mariadb-106/index)) | YES | | `NULL` | Histogram type. See the [histogram\_type](../server-system-variables/index#histogram_type) system variable. |
| `histogram` | `blob` (>= [MariaDB 10.7](../what-is-mariadb-107/index))`varbinary(255)` (<=[MariaDB 10.6](../what-is-mariadb-106/index)) | YES | | `NULL` | |
It is possible to manually update the table. See [Manual updates to statistics tables](../engine-independent-table-statistics/index#manual-updates-to-statistics-tables) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Query Cache Information Plugin Query Cache Information Plugin
==============================
The `QUERY_CACHE_INFO` plugin creates the [QUERY\_CACHE\_INFO](../information-schema-query_cache_info-table/index) table in the [INFORMATION\_SCHEMA](../information-schema/index) database. This table shows all queries in the [query cache](../query-cache/index). Querying this table acquires the query cache lock and will result in lock waits for queries that are using or expiring from the query cache. You must have the [PROCESS](../grant/index#global-privileges) privilege to query this table.
Installing the Plugin
---------------------
Although the plugin's shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.
The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing [INSTALL SONAME](../install-soname/index) or [INSTALL PLUGIN](../install-plugin/index). For example:
```
INSTALL SONAME 'query_cache_info';
```
The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the [--plugin-load](../mysqld-options/index#-plugin-load) or the [--plugin-load-add](../mysqld-options/index#-plugin-load-add) options. This can be specified as a command-line argument to [mysqld](../mysqld-options/index) or it can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
plugin_load_add = query_cache_info
```
Uninstalling the Plugin
-----------------------
You can uninstall the plugin dynamically by executing [UNINSTALL SONAME](../uninstall-soname/index) or [UNINSTALL PLUGIN](../uninstall-plugin/index). For example:
```
UNINSTALL SONAME 'query_cache_info';
```
If you installed the plugin by providing the [--plugin-load](../mysqld-options/index#-plugin-load) or the [--plugin-load-add](../mysqld-options/index#-plugin-load-add) options in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index), then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
Example
-------
```
select statement_schema, statement_text, result_blocks_count,
result_blocks_size from information_schema.query_cache_info;
+------------------+------------------+---------------------+--------------------+
| statement_schema | statement_text | result_blocks_count | result_blocks_size |
+------------------+------------------+---------------------+--------------------+
| test | select * from t1 | 1 | 512 |
+------------------+------------------+---------------------+--------------------+
```
Versions
--------
| Version | Status | Introduced |
| --- | --- | --- |
| 1.1 | Stable | [MariaDB 10.1.13](https://mariadb.com/kb/en/mariadb-10113-release-notes/) |
| 1.1 | Gamma | [MariaDB 10.1.8](https://mariadb.com/kb/en/mariadb-1018-release-notes/) |
| 1.0 | Gamma | [MariaDB 10.0.10](https://mariadb.com/kb/en/mariadb-10010-release-notes/) |
| 1.0 | Alpha | [MariaDB 5.5.31](https://mariadb.com/kb/en/mariadb-5531-release-notes/) |
Options
-------
### `query_cache_info`
* **Description:** Controls how the server should treat the plugin when the server starts up.
+ Valid values are:
- `OFF` - Disables the plugin without removing it from the [mysql.plugins](../mysqlplugin-table/index) table.
- `ON` - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.
- `FORCE` - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.
- `FORCE_PLUS_PERMANENT` - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with [UNINSTALL SONAME](../uninstall-soname/index) or [UNINSTALL PLUGIN](../uninstall-plugin/index) while the server is running.
+ See [Plugin Overview: Configuring Plugin Activation at Server Startup](../plugin-overview/index#configuring-plugin-activation-at-server-startup) for more information.
* **Commandline:** `--query-cache-info=value`
* **Data Type:** `enumerated`
* **Default Value:** `ON`
* **Valid Values:** `OFF`, `ON`, `FORCE`, `FORCE_PLUS_PERMANENT`
---
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb aria_pack aria\_pack
==========
aria\_pack is a tool for compressing [Aria](../aria/index) tables. The resulting table are read-only, and usually about 40% to 70% smaller.
aria\_pack is run as follows
```
aria_pack [options] file_name [file_name2...]
```
The file name is the .MAI index file. The extension can be omitted, although keeping it permits wildcards, such as
```
aria_pack *.MAI
```
to compress all the files.
aria\_pack compresses each column separately, and, when the resulting data is read, only the individual rows and columns required need to be decompressed, allowing for quicker reading.
Once a table has been packed, use [aria\_chk -rq](../aria_chk/index) (the quick and recover options) to rebuild its indexes.
Options
-------
The following variables can be set while passed as commandline options to aria\_pack, or set in the [ariapack] section in your [my.cnf](../configuring-mariadb-with-mycnf/index) file.
| Option | Description |
| --- | --- |
| -b, --backup | Make a backup of the table as table\_name.OLD. |
| --character-sets-dir=name | Directory where character sets are. |
| -h, --datadir | Path for control file (and logs if `--logdir` not used). From [MariaDB 10.5.3](https://mariadb.com/kb/en/mariadb-1053-release-notes/) |
| -#, --debug[=name] | Output debug log. Often this is 'd:t:o,filename'. |
| -?, --help | Display help and exit. |
| -f, --force | Force packing of table even if it gets bigger or if tempfile exists. |
| --ignore-control-file | Ignore the control file. From [MariaDB 10.5.3](https://mariadb.com/kb/en/mariadb-1053-release-notes/). |
| -j, --join=name | Join all given tables into 'new\_table\_name'. All tables MUST have identical layouts. |
| --require-control-file | Abort if cannot find control file. From [MariaDB 10.5.3](https://mariadb.com/kb/en/mariadb-1053-release-notes/). |
| -s, --silent | Only write output when an error occurs. |
| -t, --test | Don't pack table, only test packing it. |
| -T, --tmpdir=name | Use temporary directory to store temporary table. |
| -v, --verbose | Write info about progress and packing result. Use many -v for more verbosity! |
| -V, --version | Output version information and exit. |
| -w, --wait | Wait and retry if table is in use. |
Unpacking
---------
To unpack a table compressed with aria\_pack, use the [aria\_chk -u](../aria_chk/index) option.
Example
-------
```
> aria_pack /my/data/test/posts
Compressing /my/data/test/posts.MAD: (1690 records)
- Calculating statistics
- Compressing file
37.71%
> aria_chk -rq --ignore-control-file /my/data/test/posts
- check record delete-chain
- recovering (with keycache) Aria-table '/my/data/test/posts'
Data records: 1690
State updated
```
See Also
--------
* [FLUSH TABLES FOR EXPORT](../flush-tables-for-export/index)
* [myisamchk](../myisamchk/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Spider Benchmarks Spider Benchmarks
=================
This is best run on a cluster of 3 nodes intel NUC servers 12 virtual cores model name : Intel® Core(TM) i3-3217U CPU @ 1.80GHz
All nodes have been running a mysqlslap client attached to the local spider node in the best run.
```
/usr/local/skysql/mysql-client/bin/mysqlslap --user=skysql --password=skyvodka --host=192.168.0.201 --port=5012 -i1000000 -c32 -q "insert into test(c) values('0-31091-138522330')" --create-schema=test
```
`spider_conn_recycle_mode=1;`
The read point select is produce with a 10M rows sysbench table
The write insert a single string into a memory table
Before Engine Condition Push Down patch .
Spider can benefit by 10% additional performance with Independent Storage Engine Statistics.
```
set global use_stat_tables='preferably';
USE backend;
ANALYZE TABLE sbtest;
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Supported Character Sets and Collations Supported Character Sets and Collations
=======================================
Character Sets
--------------
MariaDB supports the following character sets:
Note that the [Mroonga Storage Engine](../mroonga/index) only supports a limited number of character sets. See [Mroonga available character sets](../about-mroonga/index#available-character-sets).
| Charset | Description | Default collation | Maxlen |
| --- | --- | --- | --- |
| armscii8 | ARMSCII-8 Armenian | armscii8\_general\_ci | 1 |
| ascii | US ASCII | ascii\_general\_ci | 1 |
| big5 | Big5 Traditional Chinese | big5\_chinese\_ci | 2 |
| binary | Binary pseudo charset | binary | 1 |
| cp1250 | Windows Central European | cp1250\_general\_ci | 1 |
| cp1251 | Windows Cyrillic | cp1251\_general\_ci | 1 |
| cp1256 | Windows Arabic | cp1256\_general\_ci | 1 |
| cp1257 | Windows Baltic | cp1257\_general\_ci | 1 |
| cp850 | DOS West European | cp850\_general\_ci | 1 |
| cp852 | DOS Central European | cp852\_general\_ci | 1 |
| cp866 | DOS Russian | cp866\_general\_ci | 1 |
| cp932 | SJIS for Windows Japanese | cp932\_japanese\_ci | 2 |
| dec8 | DEC West European | dec8\_swedish\_ci | 1 |
| eucjpms | UJIS for Windows Japanese | eucjpms\_japanese\_ci | 3 |
| euckr | EUC-KR Korean | euckr\_korean\_ci | 2 |
| gb2312 | GB2312 Simplified Chinese | gb2312\_chinese\_ci | 2 |
| gbk | GBK Simplified Chinese | gbk\_chinese\_ci | 2 |
| geostd8 | GEOSTD8 Georgian | geostd8\_general\_ci | 1 |
| greek | ISO 8859-7 Greek | greek\_general\_ci | 1 |
| hebrew | ISO 8859-8 Hebrew | hebrew\_general\_ci | 1 |
| hp8 | HP West European | hp8\_english\_ci | 1 |
| keybcs2 | DOS Kamenicky Czech-Slovak | keybcs2\_general\_ci | 1 |
| koi8r | KOI8-R Relcom Russian | koi8r\_general\_ci | 1 |
| koi8u | KOI8-U Ukrainian | koi8u\_general\_ci | 1 |
| latin1 | cp1252 West European | latin1\_swedish\_ci | 1 |
| latin2 | ISO 8859-2 Central European | latin2\_general\_ci | 1 |
| latin5 | ISO 8859-9 Turkish | latin5\_turkish\_ci | 1 |
| latin7 | ISO 8859-13 Baltic | latin7\_general\_ci | 1 |
| macce | Mac Central European | macce\_general\_ci | 1 |
| macroman | Mac West European | macroman\_general\_ci | 1 |
| sjis | Shift-JIS Japanese | sjis\_japanese\_ci | 2 |
| swe7 | 7bit Swedish | swe7\_swedish\_ci | 1 |
| tis620 | TIS620 Thai | tis620\_thai\_ci | 1 |
| ucs2 | UCS-2 Unicode | ucs2\_general\_ci | 2 |
| ujis | EUC-JP Japanese | ujis\_japanese\_ci | 3 |
| utf8 | UTF-8 Unicode | utf8\_general\_ci | 3/4 (see [OLD\_MODE](../old-mode/index)) |
| utf16 | UTF-16 Unicode | utf16\_general\_ci | 4 |
| utf16le | UTF-16LE Unicode | utf16le\_general\_ci | 4 |
| utf32 | UTF-32 Unicode | utf32\_general\_ci | 4 |
| utf8mb3 | UTF-8 Unicode | utf8mb3\_general\_ci | 3 |
| utf8mb4 | UTF-8 Unicode | utf8mb4\_general\_ci | 4 |
You can see which character sets are available in a particular version by running the [SHOW CHARACTER SET](../show-character-set/index) statement or by querying the [Information Schema CHARACTER\_SETS Table](../information-schema-character_sets-table/index).
Collations
----------
MariaDB supports the following collations:
```
SHOW COLLATION;
+------------------------------+----------+------+---------+----------+---------+
| Collation | Charset | Id | Default | Compiled | Sortlen |
+------------------------------+----------+------+---------+----------+---------+
| big5_chinese_ci | big5 | 1 | Yes | Yes | 1 |
| big5_bin | big5 | 84 | | Yes | 1 |
| big5_chinese_nopad_ci | big5 | 1025 | | Yes | 1 |
| big5_nopad_bin | big5 | 1108 | | Yes | 1 |
| dec8_swedish_ci | dec8 | 3 | Yes | Yes | 1 |
| dec8_bin | dec8 | 69 | | Yes | 1 |
| dec8_swedish_nopad_ci | dec8 | 1027 | | Yes | 1 |
| dec8_nopad_bin | dec8 | 1093 | | Yes | 1 |
| cp850_general_ci | cp850 | 4 | Yes | Yes | 1 |
| cp850_bin | cp850 | 80 | | Yes | 1 |
| cp850_general_nopad_ci | cp850 | 1028 | | Yes | 1 |
| cp850_nopad_bin | cp850 | 1104 | | Yes | 1 |
| hp8_english_ci | hp8 | 6 | Yes | Yes | 1 |
| hp8_bin | hp8 | 72 | | Yes | 1 |
| hp8_english_nopad_ci | hp8 | 1030 | | Yes | 1 |
| hp8_nopad_bin | hp8 | 1096 | | Yes | 1 |
| koi8r_general_ci | koi8r | 7 | Yes | Yes | 1 |
| koi8r_bin | koi8r | 74 | | Yes | 1 |
| koi8r_general_nopad_ci | koi8r | 1031 | | Yes | 1 |
| koi8r_nopad_bin | koi8r | 1098 | | Yes | 1 |
| latin1_german1_ci | latin1 | 5 | | Yes | 1 |
| latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 |
| latin1_danish_ci | latin1 | 15 | | Yes | 1 |
| latin1_german2_ci | latin1 | 31 | | Yes | 2 |
| latin1_bin | latin1 | 47 | | Yes | 1 |
| latin1_general_ci | latin1 | 48 | | Yes | 1 |
| latin1_general_cs | latin1 | 49 | | Yes | 1 |
| latin1_spanish_ci | latin1 | 94 | | Yes | 1 |
| latin1_swedish_nopad_ci | latin1 | 1032 | | Yes | 1 |
| latin1_nopad_bin | latin1 | 1071 | | Yes | 1 |
| latin2_czech_cs | latin2 | 2 | | Yes | 4 |
| latin2_general_ci | latin2 | 9 | Yes | Yes | 1 |
| latin2_hungarian_ci | latin2 | 21 | | Yes | 1 |
| latin2_croatian_ci | latin2 | 27 | | Yes | 1 |
| latin2_bin | latin2 | 77 | | Yes | 1 |
| latin2_general_nopad_ci | latin2 | 1033 | | Yes | 1 |
| latin2_nopad_bin | latin2 | 1101 | | Yes | 1 |
| swe7_swedish_ci | swe7 | 10 | Yes | Yes | 1 |
| swe7_bin | swe7 | 82 | | Yes | 1 |
| swe7_swedish_nopad_ci | swe7 | 1034 | | Yes | 1 |
| swe7_nopad_bin | swe7 | 1106 | | Yes | 1 |
| ascii_general_ci | ascii | 11 | Yes | Yes | 1 |
| ascii_bin | ascii | 65 | | Yes | 1 |
| ascii_general_nopad_ci | ascii | 1035 | | Yes | 1 |
| ascii_nopad_bin | ascii | 1089 | | Yes | 1 |
| ujis_japanese_ci | ujis | 12 | Yes | Yes | 1 |
| ujis_bin | ujis | 91 | | Yes | 1 |
| ujis_japanese_nopad_ci | ujis | 1036 | | Yes | 1 |
| ujis_nopad_bin | ujis | 1115 | | Yes | 1 |
| sjis_japanese_ci | sjis | 13 | Yes | Yes | 1 |
| sjis_bin | sjis | 88 | | Yes | 1 |
| sjis_japanese_nopad_ci | sjis | 1037 | | Yes | 1 |
| sjis_nopad_bin | sjis | 1112 | | Yes | 1 |
| hebrew_general_ci | hebrew | 16 | Yes | Yes | 1 |
| hebrew_bin | hebrew | 71 | | Yes | 1 |
| hebrew_general_nopad_ci | hebrew | 1040 | | Yes | 1 |
| hebrew_nopad_bin | hebrew | 1095 | | Yes | 1 |
| tis620_thai_ci | tis620 | 18 | Yes | Yes | 4 |
| tis620_bin | tis620 | 89 | | Yes | 1 |
| tis620_thai_nopad_ci | tis620 | 1042 | | Yes | 4 |
| tis620_nopad_bin | tis620 | 1113 | | Yes | 1 |
| euckr_korean_ci | euckr | 19 | Yes | Yes | 1 |
| euckr_bin | euckr | 85 | | Yes | 1 |
| euckr_korean_nopad_ci | euckr | 1043 | | Yes | 1 |
| euckr_nopad_bin | euckr | 1109 | | Yes | 1 |
| koi8u_general_ci | koi8u | 22 | Yes | Yes | 1 |
| koi8u_bin | koi8u | 75 | | Yes | 1 |
| koi8u_general_nopad_ci | koi8u | 1046 | | Yes | 1 |
| koi8u_nopad_bin | koi8u | 1099 | | Yes | 1 |
| gb2312_chinese_ci | gb2312 | 24 | Yes | Yes | 1 |
| gb2312_bin | gb2312 | 86 | | Yes | 1 |
| gb2312_chinese_nopad_ci | gb2312 | 1048 | | Yes | 1 |
| gb2312_nopad_bin | gb2312 | 1110 | | Yes | 1 |
| greek_general_ci | greek | 25 | Yes | Yes | 1 |
| greek_bin | greek | 70 | | Yes | 1 |
| greek_general_nopad_ci | greek | 1049 | | Yes | 1 |
| greek_nopad_bin | greek | 1094 | | Yes | 1 |
| cp1250_general_ci | cp1250 | 26 | Yes | Yes | 1 |
| cp1250_czech_cs | cp1250 | 34 | | Yes | 2 |
| cp1250_croatian_ci | cp1250 | 44 | | Yes | 1 |
| cp1250_bin | cp1250 | 66 | | Yes | 1 |
| cp1250_polish_ci | cp1250 | 99 | | Yes | 1 |
| cp1250_general_nopad_ci | cp1250 | 1050 | | Yes | 1 |
| cp1250_nopad_bin | cp1250 | 1090 | | Yes | 1 |
| gbk_chinese_ci | gbk | 28 | Yes | Yes | 1 |
| gbk_bin | gbk | 87 | | Yes | 1 |
| gbk_chinese_nopad_ci | gbk | 1052 | | Yes | 1 |
| gbk_nopad_bin | gbk | 1111 | | Yes | 1 |
| latin5_turkish_ci | latin5 | 30 | Yes | Yes | 1 |
| latin5_bin | latin5 | 78 | | Yes | 1 |
| latin5_turkish_nopad_ci | latin5 | 1054 | | Yes | 1 |
| latin5_nopad_bin | latin5 | 1102 | | Yes | 1 |
| armscii8_general_ci | armscii8 | 32 | Yes | Yes | 1 |
| armscii8_bin | armscii8 | 64 | | Yes | 1 |
| armscii8_general_nopad_ci | armscii8 | 1056 | | Yes | 1 |
| armscii8_nopad_bin | armscii8 | 1088 | | Yes | 1 |
| utf8_general_ci | utf8 | 33 | Yes | Yes | 1 |
| utf8_bin | utf8 | 83 | | Yes | 1 |
| utf8_unicode_ci | utf8 | 192 | | Yes | 8 |
| utf8_icelandic_ci | utf8 | 193 | | Yes | 8 |
| utf8_latvian_ci | utf8 | 194 | | Yes | 8 |
| utf8_romanian_ci | utf8 | 195 | | Yes | 8 |
| utf8_slovenian_ci | utf8 | 196 | | Yes | 8 |
| utf8_polish_ci | utf8 | 197 | | Yes | 8 |
| utf8_estonian_ci | utf8 | 198 | | Yes | 8 |
| utf8_spanish_ci | utf8 | 199 | | Yes | 8 |
| utf8_swedish_ci | utf8 | 200 | | Yes | 8 |
| utf8_turkish_ci | utf8 | 201 | | Yes | 8 |
| utf8_czech_ci | utf8 | 202 | | Yes | 8 |
| utf8_danish_ci | utf8 | 203 | | Yes | 8 |
| utf8_lithuanian_ci | utf8 | 204 | | Yes | 8 |
| utf8_slovak_ci | utf8 | 205 | | Yes | 8 |
| utf8_spanish2_ci | utf8 | 206 | | Yes | 8 |
| utf8_roman_ci | utf8 | 207 | | Yes | 8 |
| utf8_persian_ci | utf8 | 208 | | Yes | 8 |
| utf8_esperanto_ci | utf8 | 209 | | Yes | 8 |
| utf8_hungarian_ci | utf8 | 210 | | Yes | 8 |
| utf8_sinhala_ci | utf8 | 211 | | Yes | 8 |
| utf8_german2_ci | utf8 | 212 | | Yes | 8 |
| utf8_croatian_mysql561_ci | utf8 | 213 | | Yes | 8 |
| utf8_unicode_520_ci | utf8 | 214 | | Yes | 8 |
| utf8_vietnamese_ci | utf8 | 215 | | Yes | 8 |
| utf8_general_mysql500_ci | utf8 | 223 | | Yes | 1 |
| utf8_croatian_ci | utf8 | 576 | | Yes | 8 |
| utf8_myanmar_ci | utf8 | 577 | | Yes | 8 |
| utf8_thai_520_w2 | utf8 | 578 | | Yes | 4 |
| utf8_general_nopad_ci | utf8 | 1057 | | Yes | 1 |
| utf8_nopad_bin | utf8 | 1107 | | Yes | 1 |
| utf8_unicode_nopad_ci | utf8 | 1216 | | Yes | 8 |
| utf8_unicode_520_nopad_ci | utf8 | 1238 | | Yes | 8 |
| ucs2_general_ci | ucs2 | 35 | Yes | Yes | 1 |
| ucs2_bin | ucs2 | 90 | | Yes | 1 |
| ucs2_unicode_ci | ucs2 | 128 | | Yes | 8 |
| ucs2_icelandic_ci | ucs2 | 129 | | Yes | 8 |
| ucs2_latvian_ci | ucs2 | 130 | | Yes | 8 |
| ucs2_romanian_ci | ucs2 | 131 | | Yes | 8 |
| ucs2_slovenian_ci | ucs2 | 132 | | Yes | 8 |
| ucs2_polish_ci | ucs2 | 133 | | Yes | 8 |
| ucs2_estonian_ci | ucs2 | 134 | | Yes | 8 |
| ucs2_spanish_ci | ucs2 | 135 | | Yes | 8 |
| ucs2_swedish_ci | ucs2 | 136 | | Yes | 8 |
| ucs2_turkish_ci | ucs2 | 137 | | Yes | 8 |
| ucs2_czech_ci | ucs2 | 138 | | Yes | 8 |
| ucs2_danish_ci | ucs2 | 139 | | Yes | 8 |
| ucs2_lithuanian_ci | ucs2 | 140 | | Yes | 8 |
| ucs2_slovak_ci | ucs2 | 141 | | Yes | 8 |
| ucs2_spanish2_ci | ucs2 | 142 | | Yes | 8 |
| ucs2_roman_ci | ucs2 | 143 | | Yes | 8 |
| ucs2_persian_ci | ucs2 | 144 | | Yes | 8 |
| ucs2_esperanto_ci | ucs2 | 145 | | Yes | 8 |
| ucs2_hungarian_ci | ucs2 | 146 | | Yes | 8 |
| ucs2_sinhala_ci | ucs2 | 147 | | Yes | 8 |
| ucs2_german2_ci | ucs2 | 148 | | Yes | 8 |
| ucs2_croatian_mysql561_ci | ucs2 | 149 | | Yes | 8 |
| ucs2_unicode_520_ci | ucs2 | 150 | | Yes | 8 |
| ucs2_vietnamese_ci | ucs2 | 151 | | Yes | 8 |
| ucs2_general_mysql500_ci | ucs2 | 159 | | Yes | 1 |
| ucs2_croatian_ci | ucs2 | 640 | | Yes | 8 |
| ucs2_myanmar_ci | ucs2 | 641 | | Yes | 8 |
| ucs2_thai_520_w2 | ucs2 | 642 | | Yes | 4 |
| ucs2_general_nopad_ci | ucs2 | 1059 | | Yes | 1 |
| ucs2_nopad_bin | ucs2 | 1114 | | Yes | 1 |
| ucs2_unicode_nopad_ci | ucs2 | 1152 | | Yes | 8 |
| ucs2_unicode_520_nopad_ci | ucs2 | 1174 | | Yes | 8 |
| cp866_general_ci | cp866 | 36 | Yes | Yes | 1 |
| cp866_bin | cp866 | 68 | | Yes | 1 |
| cp866_general_nopad_ci | cp866 | 1060 | | Yes | 1 |
| cp866_nopad_bin | cp866 | 1092 | | Yes | 1 |
| keybcs2_general_ci | keybcs2 | 37 | Yes | Yes | 1 |
| keybcs2_bin | keybcs2 | 73 | | Yes | 1 |
| keybcs2_general_nopad_ci | keybcs2 | 1061 | | Yes | 1 |
| keybcs2_nopad_bin | keybcs2 | 1097 | | Yes | 1 |
| macce_general_ci | macce | 38 | Yes | Yes | 1 |
| macce_bin | macce | 43 | | Yes | 1 |
| macce_general_nopad_ci | macce | 1062 | | Yes | 1 |
| macce_nopad_bin | macce | 1067 | | Yes | 1 |
| macroman_general_ci | macroman | 39 | Yes | Yes | 1 |
| macroman_bin | macroman | 53 | | Yes | 1 |
| macroman_general_nopad_ci | macroman | 1063 | | Yes | 1 |
| macroman_nopad_bin | macroman | 1077 | | Yes | 1 |
| cp852_general_ci | cp852 | 40 | Yes | Yes | 1 |
| cp852_bin | cp852 | 81 | | Yes | 1 |
| cp852_general_nopad_ci | cp852 | 1064 | | Yes | 1 |
| cp852_nopad_bin | cp852 | 1105 | | Yes | 1 |
| latin7_estonian_cs | latin7 | 20 | | Yes | 1 |
| latin7_general_ci | latin7 | 41 | Yes | Yes | 1 |
| latin7_general_cs | latin7 | 42 | | Yes | 1 |
| latin7_bin | latin7 | 79 | | Yes | 1 |
| latin7_general_nopad_ci | latin7 | 1065 | | Yes | 1 |
| latin7_nopad_bin | latin7 | 1103 | | Yes | 1 |
| utf8mb4_general_ci | utf8mb4 | 45 | Yes | Yes | 1 |
| utf8mb4_bin | utf8mb4 | 46 | | Yes | 1 |
| utf8mb4_unicode_ci | utf8mb4 | 224 | | Yes | 8 |
| utf8mb4_icelandic_ci | utf8mb4 | 225 | | Yes | 8 |
| utf8mb4_latvian_ci | utf8mb4 | 226 | | Yes | 8 |
| utf8mb4_romanian_ci | utf8mb4 | 227 | | Yes | 8 |
| utf8mb4_slovenian_ci | utf8mb4 | 228 | | Yes | 8 |
| utf8mb4_polish_ci | utf8mb4 | 229 | | Yes | 8 |
| utf8mb4_estonian_ci | utf8mb4 | 230 | | Yes | 8 |
| utf8mb4_spanish_ci | utf8mb4 | 231 | | Yes | 8 |
| utf8mb4_swedish_ci | utf8mb4 | 232 | | Yes | 8 |
| utf8mb4_turkish_ci | utf8mb4 | 233 | | Yes | 8 |
| utf8mb4_czech_ci | utf8mb4 | 234 | | Yes | 8 |
| utf8mb4_danish_ci | utf8mb4 | 235 | | Yes | 8 |
| utf8mb4_lithuanian_ci | utf8mb4 | 236 | | Yes | 8 |
| utf8mb4_slovak_ci | utf8mb4 | 237 | | Yes | 8 |
| utf8mb4_spanish2_ci | utf8mb4 | 238 | | Yes | 8 |
| utf8mb4_roman_ci | utf8mb4 | 239 | | Yes | 8 |
| utf8mb4_persian_ci | utf8mb4 | 240 | | Yes | 8 |
| utf8mb4_esperanto_ci | utf8mb4 | 241 | | Yes | 8 |
| utf8mb4_hungarian_ci | utf8mb4 | 242 | | Yes | 8 |
| utf8mb4_sinhala_ci | utf8mb4 | 243 | | Yes | 8 |
| utf8mb4_german2_ci | utf8mb4 | 244 | | Yes | 8 |
| utf8mb4_croatian_mysql561_ci | utf8mb4 | 245 | | Yes | 8 |
| utf8mb4_unicode_520_ci | utf8mb4 | 246 | | Yes | 8 |
| utf8mb4_vietnamese_ci | utf8mb4 | 247 | | Yes | 8 |
| utf8mb4_croatian_ci | utf8mb4 | 608 | | Yes | 8 |
| utf8mb4_myanmar_ci | utf8mb4 | 609 | | Yes | 8 |
| utf8mb4_thai_520_w2 | utf8mb4 | 610 | | Yes | 4 |
| utf8mb4_general_nopad_ci | utf8mb4 | 1069 | | Yes | 1 |
| utf8mb4_nopad_bin | utf8mb4 | 1070 | | Yes | 1 |
| utf8mb4_unicode_nopad_ci | utf8mb4 | 1248 | | Yes | 8 |
| utf8mb4_unicode_520_nopad_ci | utf8mb4 | 1270 | | Yes | 8 |
| cp1251_bulgarian_ci | cp1251 | 14 | | Yes | 1 |
| cp1251_ukrainian_ci | cp1251 | 23 | | Yes | 1 |
| cp1251_bin | cp1251 | 50 | | Yes | 1 |
| cp1251_general_ci | cp1251 | 51 | Yes | Yes | 1 |
| cp1251_general_cs | cp1251 | 52 | | Yes | 1 |
| cp1251_nopad_bin | cp1251 | 1074 | | Yes | 1 |
| cp1251_general_nopad_ci | cp1251 | 1075 | | Yes | 1 |
| utf16_general_ci | utf16 | 54 | Yes | Yes | 1 |
| utf16_bin | utf16 | 55 | | Yes | 1 |
| utf16_unicode_ci | utf16 | 101 | | Yes | 8 |
| utf16_icelandic_ci | utf16 | 102 | | Yes | 8 |
| utf16_latvian_ci | utf16 | 103 | | Yes | 8 |
| utf16_romanian_ci | utf16 | 104 | | Yes | 8 |
| utf16_slovenian_ci | utf16 | 105 | | Yes | 8 |
| utf16_polish_ci | utf16 | 106 | | Yes | 8 |
| utf16_estonian_ci | utf16 | 107 | | Yes | 8 |
| utf16_spanish_ci | utf16 | 108 | | Yes | 8 |
| utf16_swedish_ci | utf16 | 109 | | Yes | 8 |
| utf16_turkish_ci | utf16 | 110 | | Yes | 8 |
| utf16_czech_ci | utf16 | 111 | | Yes | 8 |
| utf16_danish_ci | utf16 | 112 | | Yes | 8 |
| utf16_lithuanian_ci | utf16 | 113 | | Yes | 8 |
| utf16_slovak_ci | utf16 | 114 | | Yes | 8 |
| utf16_spanish2_ci | utf16 | 115 | | Yes | 8 |
| utf16_roman_ci | utf16 | 116 | | Yes | 8 |
| utf16_persian_ci | utf16 | 117 | | Yes | 8 |
| utf16_esperanto_ci | utf16 | 118 | | Yes | 8 |
| utf16_hungarian_ci | utf16 | 119 | | Yes | 8 |
| utf16_sinhala_ci | utf16 | 120 | | Yes | 8 |
| utf16_german2_ci | utf16 | 121 | | Yes | 8 |
| utf16_croatian_mysql561_ci | utf16 | 122 | | Yes | 8 |
| utf16_unicode_520_ci | utf16 | 123 | | Yes | 8 |
| utf16_vietnamese_ci | utf16 | 124 | | Yes | 8 |
| utf16_croatian_ci | utf16 | 672 | | Yes | 8 |
| utf16_myanmar_ci | utf16 | 673 | | Yes | 8 |
| utf16_thai_520_w2 | utf16 | 674 | | Yes | 4 |
| utf16_general_nopad_ci | utf16 | 1078 | | Yes | 1 |
| utf16_nopad_bin | utf16 | 1079 | | Yes | 1 |
| utf16_unicode_nopad_ci | utf16 | 1125 | | Yes | 8 |
| utf16_unicode_520_nopad_ci | utf16 | 1147 | | Yes | 8 |
| utf16le_general_ci | utf16le | 56 | Yes | Yes | 1 |
| utf16le_bin | utf16le | 62 | | Yes | 1 |
| utf16le_general_nopad_ci | utf16le | 1080 | | Yes | 1 |
| utf16le_nopad_bin | utf16le | 1086 | | Yes | 1 |
| cp1256_general_ci | cp1256 | 57 | Yes | Yes | 1 |
| cp1256_bin | cp1256 | 67 | | Yes | 1 |
| cp1256_general_nopad_ci | cp1256 | 1081 | | Yes | 1 |
| cp1256_nopad_bin | cp1256 | 1091 | | Yes | 1 |
| cp1257_lithuanian_ci | cp1257 | 29 | | Yes | 1 |
| cp1257_bin | cp1257 | 58 | | Yes | 1 |
| cp1257_general_ci | cp1257 | 59 | Yes | Yes | 1 |
| cp1257_nopad_bin | cp1257 | 1082 | | Yes | 1 |
| cp1257_general_nopad_ci | cp1257 | 1083 | | Yes | 1 |
| utf32_general_ci | utf32 | 60 | Yes | Yes | 1 |
| utf32_bin | utf32 | 61 | | Yes | 1 |
| utf32_unicode_ci | utf32 | 160 | | Yes | 8 |
| utf32_icelandic_ci | utf32 | 161 | | Yes | 8 |
| utf32_latvian_ci | utf32 | 162 | | Yes | 8 |
| utf32_romanian_ci | utf32 | 163 | | Yes | 8 |
| utf32_slovenian_ci | utf32 | 164 | | Yes | 8 |
| utf32_polish_ci | utf32 | 165 | | Yes | 8 |
| utf32_estonian_ci | utf32 | 166 | | Yes | 8 |
| utf32_spanish_ci | utf32 | 167 | | Yes | 8 |
| utf32_swedish_ci | utf32 | 168 | | Yes | 8 |
| utf32_turkish_ci | utf32 | 169 | | Yes | 8 |
| utf32_czech_ci | utf32 | 170 | | Yes | 8 |
| utf32_danish_ci | utf32 | 171 | | Yes | 8 |
| utf32_lithuanian_ci | utf32 | 172 | | Yes | 8 |
| utf32_slovak_ci | utf32 | 173 | | Yes | 8 |
| utf32_spanish2_ci | utf32 | 174 | | Yes | 8 |
| utf32_roman_ci | utf32 | 175 | | Yes | 8 |
| utf32_persian_ci | utf32 | 176 | | Yes | 8 |
| utf32_esperanto_ci | utf32 | 177 | | Yes | 8 |
| utf32_hungarian_ci | utf32 | 178 | | Yes | 8 |
| utf32_sinhala_ci | utf32 | 179 | | Yes | 8 |
| utf32_german2_ci | utf32 | 180 | | Yes | 8 |
| utf32_croatian_mysql561_ci | utf32 | 181 | | Yes | 8 |
| utf32_unicode_520_ci | utf32 | 182 | | Yes | 8 |
| utf32_vietnamese_ci | utf32 | 183 | | Yes | 8 |
| utf32_croatian_ci | utf32 | 736 | | Yes | 8 |
| utf32_myanmar_ci | utf32 | 737 | | Yes | 8 |
| utf32_thai_520_w2 | utf32 | 738 | | Yes | 4 |
| utf32_general_nopad_ci | utf32 | 1084 | | Yes | 1 |
| utf32_nopad_bin | utf32 | 1085 | | Yes | 1 |
| utf32_unicode_nopad_ci | utf32 | 1184 | | Yes | 8 |
| utf32_unicode_520_nopad_ci | utf32 | 1206 | | Yes | 8 |
| binary | binary | 63 | Yes | Yes | 1 |
| geostd8_general_ci | geostd8 | 92 | Yes | Yes | 1 |
| geostd8_bin | geostd8 | 93 | | Yes | 1 |
| geostd8_general_nopad_ci | geostd8 | 1116 | | Yes | 1 |
| geostd8_nopad_bin | geostd8 | 1117 | | Yes | 1 |
| cp932_japanese_ci | cp932 | 95 | Yes | Yes | 1 |
| cp932_bin | cp932 | 96 | | Yes | 1 |
| cp932_japanese_nopad_ci | cp932 | 1119 | | Yes | 1 |
| cp932_nopad_bin | cp932 | 1120 | | Yes | 1 |
| eucjpms_japanese_ci | eucjpms | 97 | Yes | Yes | 1 |
| eucjpms_bin | eucjpms | 98 | | Yes | 1 |
| eucjpms_japanese_nopad_ci | eucjpms | 1121 | | Yes | 1 |
| eucjpms_nopad_bin | eucjpms | 1122 | | Yes | 1 |
+------------------------------+----------+------+---------+----------+---------+
322 rows in set (0.00 sec)
```
From [MariaDB 10.6.1](https://mariadb.com/kb/en/mariadb-1061-release-notes/), the `utf8*` collations listed above are renamed `utf8mb3*`.
A '`ci`' at the end of a collation name indicates the collation is case insensitive. A '`cs`' at the end of a collation name indicates the collation is case sensitive. A '`nopad`' as part of the name indicates that the collation is of type `NO PAD` as opposed to `PADSPACE` (see below).
NO PAD collations
-----------------
Until [MariaDB 10.1](../what-is-mariadb-101/index), all collations were of type `PADSPACE`. From [MariaDB 10.2](../what-is-mariadb-102/index), 88 new `NO PAD` collations are available. `NO PAD` collations regard trailing spaces as normal characters. You can get a list of all of these by querying the [Information Schema COLLATIONS Table](../information-schema-collations-table/index) as follows:
```
SELECT collation_name FROM information_schema.COLLATIONS
WHERE collation_name LIKE "%nopad%";
+------------------------------+
| collation_name |
+------------------------------+
| big5_chinese_nopad_ci |
| big5_nopad_bin |
...
```
Changes
-------
* [MariaDB 10.10](../what-is-mariadb-1010/index) added the UCA-14.0.0 collations.
* [MariaDB 10.6.1](https://mariadb.com/kb/en/mariadb-1061-release-notes/) changed the `utf8` character set by default to be an alias for utf8mb3 rather than the other way around. It can be set to imply `utf8mb4` by changing the value of the [old\_mode](../old_mode/index) system variable.
* [MariaDB 10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/) added 88 `NO PAD` collations.
* [MariaDB 10.1.15](https://mariadb.com/kb/en/mariadb-10115-release-notes/) added the `utf8_thai_520_w2`, `utf8mb4_thai_520_w2`, `ucs2_thai_520_w2`, `utf16_thai_520_w2` and `utf32_thai_520_w2` collations.
* [MariaDB 10.0.7](https://mariadb.com/kb/en/mariadb-1007-release-notes/) added the `utf8_myanmar_ci`, `ucs2_myanmar_ci`, `utf8mb4_myanmar_ci`, `utf16_myanmar_ci` and `utf32_myanmar_ci` collations.
* [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/) added the `utf8_german2_ci`, `utf8mb4_german2_ci`, `ucs2_german2_ci`, `utf16_german2_ci` and `utf32_german2_ci` collations.
* [MariaDB 5.1.41](https://mariadb.com/kb/en/mariadb-5141-release-notes/) added a Croatian collation patch from [Alexander Barkov](http://www.collation-charts.org/) to fix some problems with the Croatian character set and `LIKE` queries. This patch added `utf8_croatian_ci` and `ucs2_croatian_ci` collations to MariaDB.
See Also
--------
* [Information Schema CHARACTER\_SETS Table](../information-schema-character_sets-table/index)
* [Information Schema COLLATIONS Table](../information-schema-collations-table/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb IS NOT NULL IS NOT NULL
===========
Syntax
------
```
IS NOT NULL
```
Description
-----------
Tests whether a value is not NULL. See also [NULL Values in MariaDB](../null-values-in-mariadb/index).
Examples
--------
```
SELECT 1 IS NOT NULL, 0 IS NOT NULL, NULL IS NOT NULL;
+---------------+---------------+------------------+
| 1 IS NOT NULL | 0 IS NOT NULL | NULL IS NOT NULL |
+---------------+---------------+------------------+
| 1 | 1 | 0 |
+---------------+---------------+------------------+
```
See also
--------
* [NULL values](../null-values/index)
* [IS NULL operator](../is-null/index)
* [COALESCE function](../coalesce/index)
* [IFNULL function](../ifnull/index)
* [NULLIF function](../nullif/index)
* [CONNECT data types](../connect-data-types/index#null-handling)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CRC32C CRC32C
======
**MariaDB starting with [10.8](../what-is-mariadb-108/index)**Introduced in [MariaDB 10.8.0](https://mariadb.com/kb/en/mariadb-1080-release-notes/) to compute a cyclic redundancy check (CRC) value using the Castagnoli polynomial.
Syntax
------
```
CRC32C([par,]expr)
```
Description
-----------
MariaDB has always included a native unary function [CRC32()](../crc32/index) that computes the CRC-32 of a string using the ISO 3309 polynomial that used by zlib and many others.
InnoDB and MyRocks use a different polynomial, which was implemented in SSE4.2 instructions that were introduced in the Intel Nehalem microarchitecture. This is commonly called CRC-32C (Castagnoli).
The CRC32C function uses the Castagnoli polynomial.
This allows `SELECT…INTO DUMPFILE` to be used for the creation of files with valid checksums, such as a logically empty InnoDB redo log file `ib_logfile0` corresponding to a particular log sequence number.
The optional parameter allows the checksum to be computed in pieces: CRC32C('MariaDB')=CRC32C(CRC32C('Maria'),'DB').
Examples
--------
```
SELECT CRC32C('MariaDB');
+-------------------+
| CRC32C('MariaDB') |
+-------------------+
| 809606978 |
+-------------------+
SELECT CRC32C(CRC32C('Maria'),'DB');
+------------------------------+
| CRC32C(CRC32C('Maria'),'DB') |
+------------------------------+
| 809606978 |
+------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Resizing a Virtual Machine Image Resizing a Virtual Machine Image
================================
Some KVM images end up not having enough space on them. In such cases, it is preferable to increase the size of the VM rather than to just delete an image and rebuild it from scratch. The steps outlined below document what was done to increase the size of the Red Hat 5 x86 VM and should be able to be easily adapted to other VMs, should they need the same treatment in the future.
1. Make a copy of the VM to work on (we don't want to change the original):
```
cp -avi vm-rhel5-x86-build.qcow2 vm-rhel5-x86-build-new.qcow2
```
2. Using the `qemu-img` command, resize the image:
```
qemu-img info vm-rhel5-x86-build-new.qcow2
qemu-img resize vm-rhel5-x86-build-new.qcow2 +10G
qemu-img info vm-rhel5-x86-build-new.qcow2
rsync -avP vm-rhel5-x86-build-new.qcow2 terrier:/kvm/vms/
```
Not all versions of `qemu-img` can resize VMs.
3. Boot the newly resized image with gparted:
```
vm=vm-rhel5-x86-build-new.qcow2
kvm -m 2048 -hda /kvm/vms/${vm} -cdrom /kvm/iso/gparted-live-0.14.1-6-i486.iso -boot d -smp 2 -cpu qemu64 -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:22666-:22
```
4. Connect to the VM using VNC from your local machine:
```
vncviewer -via <vmhost> localhost
```
Midway through booting you'll have to reconnect
5. Use gparted to either expand the existing primary partition or, especially on VMs with LVM, add a new partition (since GParted can't change LVM partitions). Exit when finished and shutdown the VM.
6. Boot the VM again, this time without a VNC server:
```
kvm -m 2048 -hda /kvm/vms/${vm} -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:22666-:22 -nographic
```
7. login to the VM:
```
ssh -t -p 22666 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/buildbot.id_dsa buildbot@localhost
```
8. if expanded an existing partition: verify the new size
9. else if you created a new partition:
* mount the new partition to tmp location
```
sudo mount /dev/hda3 /mnt
```
* rsync contents of /home/ to the new partition
```
sudo rsync -avP /home/ /mnt/
```
* edit fstab to mount new partition to /home
```
sudo vi /etc/fstab
```
* mv `/home` to `/home-old`, create `/home` dir, mount `/home`
```
sudo mv -vi /home /home-old;sudo mkdir -v /home;sudo mount /home
```
* (optional) unmount `/mnt`
```
sudo umount /mnt
```
* reboot and verify that things look good
```
sudo /sbin/shutdown -h now
```
* if things do look good (new drive mounted OK, accounts work, etc...), delete `/home-old`
10. Move the old VM to `-old` and the `-new` VM to what the old VM used to be named
```
sudo mv -vi /kvm/vms/vm-rhel5-x86-build.qcow2 vm-rhel5-x86-build-old.qcow2; sudo mv -vi /kvm/vms/vm-rhel5-x86-build-new.qcow2 /kvm/vms/vm-rhel5-x86-build.qcow2
```
11. on other VM hosts, make a copy of the old file then rsync over the updated files (the copy helps speed up the rsync):
```
sudo cp -avi /kvm/vms/vm-rhel5-x86-build.qcow2 /kvm/vms/vm-rhel5-x86-build-old.qcow2
sudo rsync -avP terrier.askmonty.org::kvm/vms/vm-rhel5-x86-build* /kvm/vms/
```
12. Test the new VM with a build to make sure it works
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Filesort with Small LIMIT Optimization Filesort with Small LIMIT Optimization
======================================
Optimization description
------------------------
MySQL 5.6 has an optimization for `ORDER BY ...LIMIT n` queries. When `n` is sufficiently small, the optimizer will use a [priority queue](http://en.wikipedia.org/wiki/Priority_queue) for sorting. The alternative is, roughly speaking, to sort the entire output and then pick only first `n` rows.
The optimization was ported into [MariaDB 10.0](../what-is-mariadb-100/index) in version 10.0.0. The server would not give any indication of whether the optimization was used, though. (This is how the feature was designed by Oracle. In MySQL 5.6, the only way one can see this feature is to examine the optimizer\_trace, which is not currently supported by MariaDB).
Optimization visibility in MariaDB
----------------------------------
**MariaDB starting with [10.0.13](https://mariadb.com/kb/en/mariadb-10013-release-notes/)**Starting from [MariaDB 10.0.13](https://mariadb.com/kb/en/mariadb-10013-release-notes/), there are two ways to check whether filesort has used a priority queue.
### Status variable
The first way is to check the [Sort\_priority\_queue\_sorts](../server-status-variables/index#sort_priority_queue_sorts) status variable. It shows the number of times that sorting was done through a priority queue. (The total number of times sorting was done is a sum [Sort\_range](../server-status-variables/index#sort_range) and [Sort\_scan](../server-status-variables/index#sort_scan)).
### Slow query log
The second way is to check the slow query log. When one uses [Extended statistics in the slow query log](../slow-query-log-extended-statistics/index) and specifies [log\_slow\_verbosity=query\_plan](../server-system-variables/index#log_slow_verbosity), [slow query log](../slow-query-log/index) entries look like this
```
# Time: 140714 18:30:39
# User@Host: root[root] @ localhost []
# Thread_id: 3 Schema: test QC_hit: No
# Query_time: 0.053857 Lock_time: 0.000188 Rows_sent: 11 Rows_examined: 100011
# Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: Yes Filesort_on_disk: No Merge_passes: 0 Priority_queue: Yes
SET timestamp=1405348239;SET timestamp=1405348239;
select * from t1 where col1 between 10 and 20 order by col2 limit 100;
```
Note the "Priority\_queue: Yes" on the last comment line. (`pt-query-digest` is able to parse slow query logs with the Priority\_queue field)
As for `EXPLAIN`, it will give no indication whether filesort uses priority queue or the generic quicksort and merge algorithm. `Using filesort` will be shown in both cases, by both MariaDB and MySQL.
See also
--------
* [LIMIT Optimization](http://dev.mysql.com/doc/refman/5.6/en/limit-optimization.html) page in the MySQL 5.6 manual (search for "priority queue").
* MySQL WorkLog entry, [WL#1393](http://dev.mysql.com/worklog/task/?id=1393)
* [MDEV-415](https://jira.mariadb.org/browse/MDEV-415), [MDEV-6430](https://jira.mariadb.org/browse/MDEV-6430)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb UPDATEXML UPDATEXML
=========
Syntax
------
```
UpdateXML(xml_target, xpath_expr, new_xml)
```
Description
-----------
This function replaces a single portion of a given fragment of XML markup `xml_target` with a new XML fragment `new_xml`, and then returns the changed XML. The portion of `xml_target` that is replaced matches an XPath expression `xpath_expr` supplied by the user. If no expression matching `xpath_expr` is found, or if multiple matches are found, the function returns the original `xml_target` XML fragment. All three arguments should be strings.
Examples
--------
```
SELECT
UpdateXML('<a><b>ccc</b><d></d></a>', '/a', '<e>fff</e>') AS val1,
UpdateXML('<a><b>ccc</b><d></d></a>', '/b', '<e>fff</e>') AS val2,
UpdateXML('<a><b>ccc</b><d></d></a>', '//b', '<e>fff</e>') AS val3,
UpdateXML('<a><b>ccc</b><d></d></a>', '/a/d', '<e>fff</e>') AS val4,
UpdateXML('<a><d></d><b>ccc</b><d></d></a>', '/a/d', '<e>fff</e>') AS val5
\G
*************************** 1. row ***************************
val1: <e>fff</e>
val2: <a><b>ccc</b><d></d></a>
val3: <a><e>fff</e><d></d></a>
val4: <a><b>ccc</b><e>fff</e></a>
val5: <a><d></d><b>ccc</b><d></d></a>
1 row in set (0.00 sec)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Improved SQL Document Parser Performance in Updated dbForge Tools for MySQL and MariaDB Improved SQL Document Parser Performance in Updated dbForge Tools for MySQL and MariaDB
=======================================================================================
Devart has upgraded dbForge Tools for MySQL and MariaDB with improved SQL document parser performance.
Devart, a recognized vendor of database management software, has released new versions of dbForge tools for MySQL product line – dbForge Schema Compare for MySQL, dbForge Data Compare for MySQL, dbForge Query Builder for MySQL and dbForge Data Generator for MySQL.
dbForge Tools for MySQL have the following new features and improvements:
* Improved SQL document parser performance;
* Connection through Named Pipe implemented;
* Improved XML View and new JSON View for Data Editor and Viewer Window;
* Additional SQL statements are supported;
* Syntax Check supports new [MariaDB 10.0](../what-is-mariadb-100/index) - 10.1 statements;
* Styled icons are used by default.
The upgraded versions of dbForge Schema Compare for MySQL, dbForge Data Compare for MySQL, dbForge Query Builder for MySQL and dbForge Data Generator for MySQL are provided with Syntax Check that supports new [MariaDB 10.0](../what-is-mariadb-100/index) - 10.1 statements, also additional SQL statements are supported and other improvements were made.
For more information about dbForge tools for MySQL, please visit <https://www.devart.com/dbforge/mysql/>.
About Devart
Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects. For additional information about Devart, visit <https://www.devart.com/>.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MULTILINESTRING MULTILINESTRING
===============
Syntax
------
```
MultiLineString(ls1,ls2,...)
```
Description
-----------
Constructs a WKB MultiLineString value using [WKB](../wkb/index) [LineString](../linestring/index) arguments. If any argument is not a WKB LineString, the return value is `NULL`.
Example
-------
```
CREATE TABLE gis_multi_line (g MULTILINESTRING);
INSERT INTO gis_multi_line VALUES
(MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2),
Point(3, 5)), LineString(Point(2, 5),Point(5, 8),Point(21, 7))))));
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb 10.1.32 Release Upgrade Tests 10.1.32 Release Upgrade Tests
=============================
### Tested revision
4d83b01537e3f1eb257a8e9a6416938e03adea59
### Test date
2018-04-17 01:44:10
### Summary
Known bug [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112). A few upgrades from MySQL and old MariaDB fail because the old versions hang on shutdown.
### Details
| type | pagesize | OLD version | file format | encrypted | compressed | | NEW version | file format | encrypted | compressed | readonly | result | notes |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| recovery | 16 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 16 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(70) |
| recovery | 4 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 4 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(60) |
| recovery | 32 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(28) |
| recovery | 32 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 64 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 64 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(38) |
| recovery | 8 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| recovery | 8 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(76) |
| recovery | 16 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 16 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 4 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 4 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 32 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 32 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 64 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 64 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| recovery | 8 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| recovery | 8 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 16 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 4 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 32 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 64 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 8 | 10.1.32 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo-recovery | 16 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 4 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 32 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 64 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 8 | 10.1.32 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo-recovery | 16 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 4 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 32 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 64 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 8 | 10.1.32 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo-recovery | 16 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 4 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 32 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 64 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo-recovery | 8 | 10.1.32 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 16 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 16 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 4 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 4 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 8 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 8 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 16 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 16 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 4 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 8 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 8 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 16 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 16 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(54) |
| crash | 4 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 4 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(41) |
| crash | 32 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(50) |
| crash | 32 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(35) |
| crash | 8 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 8 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(43) |
| crash | 16 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 16 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 4 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 4 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 8 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 8 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 16 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 4 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 32 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 64 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 8 | 10.1.31 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 16 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 4 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 32 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 64 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 8 | 10.1.31 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 16 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 4 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 32 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 64 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 8 | 10.1.31 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 16 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 4 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 32 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 64 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 8 | 10.1.31 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 16 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 16 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 4 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 4 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 32 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 64 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 8 | 10.1.13 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| normal | 8 | 10.1.13 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| normal | 16 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 16 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 4 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 32 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 64 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 8 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| normal | 8 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 16 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 16 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(23) |
| crash | 4 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 4 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(52) |
| crash | 32 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(33) |
| crash | 32 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 64 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(21) |
| crash | 8 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| crash | 8 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | **FAIL** | KNOWN\_BUGS [MDEV-13112](https://jira.mariadb.org/browse/MDEV-13112)(49) |
| crash | 16 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 16 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 4 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 4 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 32 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 64 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| crash | 8 | 10.1.10 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| crash | 8 | 10.1.10 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | on | - | => | 10.1.32 (inbuilt) | Barracuda | on | - | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | - | - | => | 10.1.32 (inbuilt) | Barracuda | - | - | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | on | zlib | => | 10.1.32 (inbuilt) | Barracuda | on | zlib | - | OK | |
| undo | 16 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 4 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 32 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 64 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| undo | 8 | 10.1.22 (inbuilt) | Barracuda | - | zlib | => | 10.1.32 (inbuilt) | Barracuda | - | zlib | - | OK | |
| normal | 4 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| normal | 4 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 4 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 8 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 4 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 8 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 4 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 8 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| undo | 4 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| undo | 8 | 10.0.34 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 4 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| normal | 4 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 4 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 8 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 4 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 8 | 10.0.14 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.18 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | **FAIL** | TEST\_FAILURE |
| undo | 4 | 10.0.18 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 8 | 10.0.18 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 10.0.18 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
| undo | 4 | 10.0.18 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
| undo | 8 | 10.0.18 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
| normal | 4 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 8 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| normal | 16 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| normal | 4 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| normal | 8 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 4 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 8 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| crash | 16 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 4 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| crash | 8 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | **FAIL** | TEST\_FAILURE |
| undo | 4 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 8 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | on | - | - | OK | |
| undo | 16 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
| undo | 4 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | OK | |
| undo | 8 | 5.6.39 (inbuilt) | | - | - | => | 10.1.32 (inbuilt) | | - | - | - | **FAIL** | TEST\_FAILURE |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Subqueries Subqueries
===========
A subquery is a query nested in another query.
| Title | Description |
| --- | --- |
| [Scalar Subqueries](../subqueries-scalar-subqueries/index) | Subquery returning a single value. |
| [Row Subqueries](../subqueries-row-subqueries/index) | Subquery returning a row. |
| [Subqueries and ALL](../subqueries-and-all/index) | Return true if the comparison returns true for each row, or the subquery returns no rows. |
| [Subqueries and ANY](../subqueries-and-any/index) | Return true if the comparison returns true for at least one row returned by the subquery. |
| [Subqueries and EXISTS](../subqueries-and-exists/index) | Returns true if the subquery returns any rows. |
| [Subqueries in a FROM Clause](../subqueries-in-a-from-clause/index) | Subqueries are more commonly placed in a WHERE clause, but can also form part of the FROM clause. |
| [Subquery Optimizations](../subquery-optimizations/index) | Articles about subquery optimizations in MariaDB. |
| [Subqueries and JOINs](../subqueries-and-joins/index) | Rewriting subqueries as JOINs, and using subqueries instead of JOINs. |
| [Subquery Limitations](../subquery-limitations/index) | There are a number of limitations regarding subqueries. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Relay Log Relay Log
=========
The relay log is a set of log files created by a replica during [replication](../standard-replication/index).
It's the same format as the [binary log](../binary-log/index), containing a record of events that affect the data or structure; thus, [mysqlbinlog](../mysqlbinlog/index) can be used to display its contents. It consists of a set of relay log files and an index file containing a list of all relay log files.
Events are read from the primary's binary log and written to the replica's relay log. They are then performed on the replica. Old relay log files are automatically removed once they are no longer needed.
Creating Relay Log Files
------------------------
New relay log files are created by the replica at the following times:
* when the IO thread starts
* when the logs are flushed, with [FLUSH LOGS](../flush/index) or [mysqladmin flush-logs](../mysqladmin/index).
* when the maximum size, determined by the [max\_relay\_log\_size](../replication-and-binary-log-server-system-variables/index#max_relay_log_size) system variable, has been reached
Relay Log Names
---------------
By default, the relay log will be given a name `host_name-relay-bin.nnnnnn`, with `host_name` referring to the server's host name, and #nnnnnn `the sequence number.`
This will cause problems if the replica's host name changes, returning the error `Failed to open the relay log` and `Could not find target log during relay log initialization`. To prevent this, you can specify the relay log file name by setting the [relay\_log](../replication-and-binary-log-server-system-variables/index#relay_log) and [relay\_log\_index](../replication-and-binary-log-server-system-variables/index#relay_log_index) system variables.
If you need to overcome this issue while replication is already underway,you can stop the replica, prepend the old relay log index file to the new relay log index file, and restart the replica.
For example:
```
shell> cat NEW_relay_log_name.index >> OLD_relay_log_name.index
shell> mv NEW_relay_log_name.index OLD_relay_log_name.index
```
Viewing Relay Logs
------------------
The [SHOW RELAYLOG EVENTS](../show-relaylog-events/index) shows events in the relay log, and, since relay log files are the same format as binary log files, they can be read with the [mysqlbinlog](../mysqlbinlog/index) utility.
Removing Old Relay Logs
-----------------------
Old relay logs are automatically removed once all events have been implemented on the replica, and the relay log file is no longer needed. This behavior can be changed by adjusting the [relay\_log\_purge](../replication-and-binary-log-server-system-variables/index#relay_log_purge) system variable from its default of `1` to `0`, in which case the relay logs will be left on the server. One can also flush the logs with the [FLUSH RELAY LOGS](../flush/index) commands.
If the relay logs are taking up too much space on the replica, the [relay\_log\_space\_limit](../replication-and-binary-log-server-system-variables/index#relay_log_space_limit) system variable can be set to limit the size. The IO thread will stop until the SQL thread has cleared the backlog. By default there is no limit.
See also
--------
* [FLUSH RELAY LOGS](../flush/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema status_by_thread Table Performance Schema status\_by\_thread Table
===========================================
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**The `session_status` table was added in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/).
The `status_by_thread` table contains status variable information about active foreground threads. The table does not collect statistics for `Com_xxx` variables.
The table contains the following columns:
| Column | Description |
| --- | --- |
| `THREAD_ID` | The thread identifier of the session in which the status variable is defined. |
| `VARIABLE_NAME` | Status variable name. |
| `VARIABLE_VALUE` | Aggregated status variable value. |
If [TRUNCATE TABLE](../truncate-table/index) is run, will aggregate the status for all threads to the global status and account status, then reset the thread status. If account statistics are not collected but host and user status are, the session status is added to host and user status.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Upgrading from MySQL 5.7 to MariaDB 10.2 Upgrading from MySQL 5.7 to MariaDB 10.2
========================================
Following compatibility report was done on 10.2.4 and may get some fixing in next minor releases
* MySQL unix socket plugin can be different. MariaDB can get similar usage via INSTALL PLUGIN unix\_socket SONAME 'auth\_socket.so'; you may have to enable this plugin in config files via load plugin.
* When using data type JSON , one should convert type to TEXT, virtual generated column works the same after.
* When using InnoDB FULLTEXT index one should not use innodb\_defragment
* MySQL re-implemented partitioning in 5.7, thus you cannot perform in-place upgrades for partitioned tables. They will require mysqldump/import to work correctly in MariaDB.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb not_null_range_scan Optimization not\_null\_range\_scan Optimization
===================================
The NOT NULL range scan optimization enables the optimizer to construct range scans from NOT NULL conditions that it was able to infer from the WHERE clause.
The optimization appeared in [MariaDB 10.5.0](https://mariadb.com/kb/en/mariadb-1050-release-notes/). Iit is not enabled by default; one needs to set an `optimizer_switch` flag to enable it.
Description
-----------
A basic (but slightly artificial) example:
```
create table items (
price decimal(8,2),
weight decimal(8,2),
...
index(weight)
);
```
```
-- Find items that cost more than 1000 $currency_units per kg:
set optimizer_switch='not_null_range_scan=on';
explain
select * from items where items.price > items.weight / 1000;
```
The WHERE condition in this form cannot be used for range scans. However, one can infer that it will reject rows that NULL for `weight`. That is, infer an additional condition that
```
weight IS NOT NULL
```
and pass it to the range optimizer. The range optimizer can, in turn, evaluate whether it makes sense to construct range access from the condition:
```
+------+-------------+-------+-------+---------------+--------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+--------+---------+------+------+-------------+
| 1 | SIMPLE | items | range | NULL | weight | 5 | NULL | 1 | Using where |
+------+-------------+-------+-------+---------------+--------+---------+------+------+-------------+
```
Here's another example that's more complex but is based on a real-world query. Consider a join query
```
-- Find orders that were returned
select * from current_orders as O, order_returns as RET
where
O.return_id= RET.id;
```
Here, the optimizer can infer the condition "return\_id IS NOT NULL". If most of the orders are not returned (and so have NULL for return\_id), one can use range access to scan only those orders that had a return.
Controlling the Optimization
----------------------------
The optimization is not enabled by default. One can enable it like so
```
set optimizer_switch='not_null_range_scan=on';
```
Optimizer Trace
---------------
TODO.
See Also
--------
* [MDEV-15777](https://jira.mariadb.org/browse/MDEV-15777) - JIRA bug report which resulted in the optimization
* [NULL Filtering Optimization](https://dev.mysql.com/doc/internals/en/optimizer-nulls-filtering.html) is a related optimization in MySQL and MariaDB. It uses inferred NOT NULL conditions to perform filtering (but not index access)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb TokuDB System Variables TokuDB System Variables
=======================
TokuDB has been deprecated by its upstream maintainer. It is disabled from [MariaDB 10.5](../what-is-mariadb-105/index) and has been been removed in [MariaDB 10.6](../what-is-mariadb-106/index) - [MDEV-19780](https://jira.mariadb.org/browse/MDEV-19780). We recommend [MyRocks](../myrocks/index) as a long-term migration path.
This page lists system variables that are related to [TokuDB](../tokudb/index).
See [Server System Variables](../server-system-variables/index) for a complete list of system variables and instructions on setting them, and [Full list of MariaDB options, system and status variables](../full-list-of-mariadb-options-system-and-status-variables/index) for a complete list of all options, statis variable and system variables in MariaDB.
System Variables
----------------
#### `tokudb_alter_print_error`
* **Description:** Print errors for alter table operations.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_analyze_time`
* **Description:** Time in seconds that [ANALYZE](../analyze-table/index) operations spend on each index when calculating cardinality. Accurate cardinality helps in particular with the performance of complex queries. If no analyzes are run, cardinality will be 1 for primary indexes, and unknown (NULL) for other types of indexes.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `5`
* **Range:** `0` to `4294967295`
---
#### `tokudb_block_size`
* **Description:** Uncompressed size of internal fractal tree and leaf nodes. Changing will only affect tables created after the new setting is in effect. Existing tables will keep the setting they were created with unless the table is dumped and reloaded.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `4194304` (4MB)
* **Range:** `0` to `18446744073709551615`
---
#### `tokudb_bulk_fetch`
* **Description:** If set to `1` (the default), the bulk fetch algorithm is used for SELECT's and DELETE's, including related statements such as INSERT INTO.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_cache_size`
* **Description:** Size in bytes of the TokuDB cache. This variable is read-only and cannot be changed dynamically. To change the value, either set the value in the `my.cnf` file prior to loading TokuDB or restart MariaDB after modifying the configuration. If you have loaded the plugin but not used TokuDB yet, you can unload the plugin then reload it and MariaDB will reload the plugin with the setting from the configuration file. Setting to at least half of the available memory is recommended, although if using directIO instead of buffered IO (see [tokudb\_directio](#tokudb_directio)) , up to 80% of the available memory is recommended. Decrease if other applications require significant memory or swapping is degrading performance.
* **Dynamic:** No
* **Data Type:** numeric
* **Default Value:** Half of the total system memory
---
#### `tokudb_check_jemalloc`
* **Description:** Check if jemalloc is linked.
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `1`
* **Valid Values:** `0` and `1`
---
#### `tokudb_checkpoint_lock`
* **Description:** Mechanism to lock out TokuDB checkpoints. When set to `1`, TokuDB checkpoints are locked out. Setting to `0`, or disconnecting the client, releases the lock.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_checkpoint_on_flush_logs`
* **Description:** TokuDB checkpoint on flush logs.
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_checkpointing_period`
* **Description:** Time in seconds between the beginning of each checkpoint. It is recommended to leave this at the default setting of 1 minute.
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `60`
* **Range:** `0` to `4294967295`
---
#### `tokudb_cleaner_iterations`
* **Description:** Number of internal nodes processed in each cleaner thread period (see [tokudb\_cleaner\_period](#tokudb_cleaner_period)). Setting to `0` turns off cleaner threads.
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `5`
* **Range:** `0` to `18446744073709551615`
---
#### `tokudb_cleaner_period`
* **Description:** Frequency in seconds for the running of the cleaner thread. Setting to `0` turns off cleaner threads.
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `1`
* **Range:** `0` to `18446744073709551615`
---
#### `tokudb_commit_sync`
* **Description:** Whether or not the transaction log is flushed upon transaction commit. Flushing has a minor performance penalty, but switching it off means that committed transactions may not survive a server crash.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_create_index_online`
* **Description:** Whether indexes are hot or not. Hot, or online, indexes (the default) mean that the table is available for inserting and updates while the index is being created. It is slower to create hot indexes.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_data_dir`
* **Description:** Directory where the TokuDB data is stored. By default the variable is empty, in which case the regular [datadir](../server-system-variables/index#datadir) is used.
* **Dynamic:** No
* **Data Type:** string
* **Default Value:** Empty (the MariaDB datadir is used)
---
#### `tokudb_debug`
* **Description:** Setting to a non-zero value turns on various TokuDB debug traces.
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `0`
* **Range:** `0` to `18446744073709551615`
---
#### `tokudb_directio`
* **Description:** When set to ON, TokuDB writes use Direct IO instead of Buffered IO. [tokudb\_cache\_size](#tokudb_cache_size) should be adjusted when using DirectIO.
* **Dynamic:** No
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_disable_hot_alter`
* **Description:** If set to `ON` (`OFF` is default), hot alter table is disabled.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_disable_prefetching`
* **Description:** If prefetching is not disabled (the default), range queries usually benefit from aggressive prefetching of blocks of rows. For range queries with LIMIT clauses, this can create unnecessary IO, and so prefetching can be disabled if these make up a majority of range queries.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_disable_slow_alter`
* **Description:** Usually, TokuDB permits column addition, deletion, expansion, and renaming with minimal locking, very quickly. This variable determines whether certain slow [alter|ALTER]] table statements that cannot take advantage of this feature are permitted. Statements that are slow are those that include a mix of column additions, deletions or expansions, for example, `ALTER TABLE t1 ADD COLUMN c1 int, DROP COLUMN c2`.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `OFF`
---
#### `tokudb_empty_scan`
* **Description:** TokuDB algorithm to check if the table is empty when opened. Setting to `disabled` will reduce this overhead.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** enum
* **Default Value:** `rl`
* **Valid Values:** `lr`, `rl`, `disabled`
---
#### `tokudb_fs_reserve_percent`
* **Description:** If this percentage of the filesystem is not free, inserts will be prohibited. Recommended value is half the size of the available memory. Once disabled, inserts will be re-enabled once twice the reserve is available. TokuDB will freeze entirely if the disk becomes entirely full.
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** numeric
* **Default Value:** `5`
---
#### `tokudb_fsync_log_period`
* **Description:** fsync() operations frequency in milliseconds. If set to `0`, the default, [tokudb\_commit\_sync](#tokudb_commit_sync) control fsync() behavior.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `0`
* **Range:** `0` to `18446744073709551615`
**Warning**: currently values in the 1000-2000 range seem to cause server crashes, see [MDEV-16732](https://jira.mariadb.org/browse/MDEV-16732)
---
#### `tokudb_hide_default_row_format`
* **Description:** Hide the default row format.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_killed_time`
* **Description:** Control lock tree kill callback frequency.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `4000`
* **Range:** `0` to `18446744073709551615`
* **Introduced:** TokuDB 7.1.5
---
#### `tokudb_last_lock_timeout`
* **Description:** Empty by default, when a lock deadlock is detected, or a lock request times out, set to a JSON document describing the most recent lock conflict. Only set when the first bit of [tokudb\_lock\_timeout\_debug](#tokudb_lock_timeout_debug) is set.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** text
* **Default Value:** Empty
---
#### `tokudb_load_save_space`
* **Description:** If set to `1`, the default, bulk loader intermediate data is compressed, otherwise it is uncompressed. Also see [tokudb\_tmp\_dir](#tokudb_tmp_dir).
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_loader_memory_size`
* **Description:** Memory limit for each loader instance used by the TokuDB bulk loader. Memory is taken from the TokuDB cache ([tokudb\_cache\_size](#tokudb_cache_size)), so current cache data may need to be cleared for the loader to begin. Increase if tables are very larger, with multiple secondary indexes.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `100000000` (100M)
* **Range:** `0` to `18446744073709551615`
---
#### `tokudb_lock_timeout`
* **Description:** Time in milliseconds that a transaction will wait for a lock held by another transaction to be released before timing out with a `lock wait timeout` error (-30994). Setting to `0` disables lock waits.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `4000` (4 seconds)
* **Range:** `0` to `18446744073709551615`
---
#### `tokudb_lock_timeout_debug`
* **Description:** When bit zero is set (default `1`), a JSON document describing the most recent lock conflict is reported to [tokudb\_last\_lock\_timeout](#tokudb_last_lock_timeout). When set to `0`, no lock conflicts are reported. When bit one is set, the JSON document is printed to the [error log](../error-log/index).
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `1`
---
#### `tokudb_log_dir`
* **Description:** Directory where the TokuDB log files are stored. By default the variable is empty, in which case the regular [datadir](../server-system-variables/index#datadir) is used.
* **Dynamic:** No
* **Data Type:** string
* **Default Value:** Empty (the MariaDB datadir is used)
---
#### `tokudb_max_lock_memory`
* **Description:** Max memory for locks.
* **Scope:** Global, Session
* **Dynamic:** No
* **Data Type:** numeric
* **Default Value:** `130653952`
---
#### `tokudb_optimize_index_fraction`
* **Description:** When deleting a percentage of the tree (useful when the left side of the tree has many deletions, such as a pattern with increasing ids or dates), it's possible to optimize a subset of the fractal tree, as determined by the value of this variable, which ranges from `0.0` to `1.0` (indicating the whole tree).
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `1.000000`
* **Range:** `0.0` to `1.0`
* **Introduced:** TokuDB 7.5.5
---
#### `tokudb_optimize_index_name`
* **Description:** If set to an index name, will optimize that single index in a table. Empty by default.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** string
* **Default Value:** None
* **Introduced:** TokuDB 7.5.5
---
#### `tokudb_optimize_throttle`
* **Description:** Table optimization utilizes all available resources by default. This variable allows the table optimization speed to be limited in order to reduce the overall resources used. The limit places an upper bound on the number of fractal tree leaf nodes that are optimized per second. `0`, the default, imposes no limit.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `0`
* **Range:** `0` to `18446744073709551615`
* **Introduced:** TokuDB 7.5.5
---
#### `tokudb_pk_insert_mode`
* **Description:** Mode for primary key inserts using either [REPLACE INTO](../replace/index) or [INSERT IGNORE](../ignore/index) on tables with no secondary index, or where all columns in the secondary index are in the primary key. For example `PRIMARY KEY (a,b,c), key (b,c)`
+ `0`: Fast inserts. [Triggers](../triggers/index) may not work, and [row-based replication](../binary-log-formats/index) will not work
+ `1`: Fast inserts if no triggers are defined, otherwise inserts may be slow. Row-based replication will not work.
+ `2`: Slow inserts. Triggers and row-based replication work normally.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** enumerated
* **Default Value:** `1`
* **Valid Values:** `0`, `1`, `2`
---
#### `tokudb_prelock_empty`
* **Description:** If set to `0` (`1` is default), fast bulk loading will be switched off. Usually, TokuDB obtains a table lock on empty tables. If, as is usual, only one transaction is loading the table, this speeds up the inserts. However, if many transactions are loading, only one can have access at a time, so setting this to `0`, avoiding the lock, will speed inserts up in that situation.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_read_block_size`
* **Description:** Uncompressed size in bytes of the read blocks of the fractal tree leaves. Changing will only affect tables created after the new setting is in effect. Existing tables will keep the setting they were created with unless the table is dumped and reloaded. Larger values are better for large range scans and higher compressions, while smaller values are better for point and small range scans.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `65536` (64KB)
* **Range:** `4096` to `4294967295`
---
#### `tokudb_read_buf_size`
* **Description:** Per-client size in bytes of the buffer used for storing bulk fetched values as part of a large range query. Reduce if there are many simultaneous clients. Setting to `0` disables bulk fetching.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `131072` (128KB)
* **Range:** `0` to `1048576`
---
#### `tokudb_read_status_frequency`
* **Description:** Progress is measured every this many reads for display by [SHOW PROCESSLIST](../show-processlist/index). Useful to set to `1` to examine slow queries.
* **Scope:** Global,
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `10000`
* **Range:** `0` to `4294967295`
---
#### `tokudb_row_format`
* **Description:** Compression algorithm used by default to compress data. Can be overridden by a row format specified in the [CREATE TABLE](../create-table/index) statement. note that the library can be specified directly, or an alias used, the mapping of which may change in future. Note that in [MariaDB 5.5](../what-is-mariadb-55/index), and before [MariaDB 10.0.10](https://mariadb.com/kb/en/mariadb-10010-release-notes/), the compression type did not default to this value. See [TokuDB Differences](../tokudb-differences/index).
+ `tokudb_default`, `tokudb_zlib`: Use the zlib library,
+ `tokudb_fast`, `tokudb_quicklz`: Use the quicklz library, the lightest compression with low CPU usage,
+ `tokudb_small`, `tokudb_lzma`: Use the lzma library. the highest compression and highest CPU usage
+ `tokudb_uncompressed`: No compression is used.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** enumerated
* **Default Value:** `tokudb_zlib`
* **Valid Values:** `tokudb_default`, `tokudb_fast`, `tokudb_small`, `tokudb_zlib`, `tokudb_quicklz`, `tokudb_lzma`, `tokudb_uncompressed`
---
#### `tokudb_rpl_check_readonly`
* **Description:** By default, when the slave is in read only mode, row events will be run from the binary log using TokuDB's read-free replication (RFR). Setting this variable to `OFF` turns off the slave read only check, allowing RFR to run when the slave is not read-only. Be careful that you understand the consequences if setting this variable.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_rpl_lookup_rows`
* **Description:** If set to `OFF` (`ON` is default), and [binlog\_format](../replication-and-binary-log-server-system-variables/index#binlog_format) to `ROW` and [read\_only](../server-system-variables/index#read_only) to `ON`, TokuDB replication slaves will not perform row lookups for update or delete row log events, removing the need for the associated IO.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_rpl_lookup_rows_delay`
* **Description:** Can be used to simulate long disk reads by sleeping for the specified time, in microseconds, before the row lookup query. Only useful to change in a test environment.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `0`
---
#### `tokudb_rpl_unique_checks`
* **Description:** If set to `OFF` (`ON` is default), and [binlog\_format](../replication-and-binary-log-server-system-variables/index#binlog_format) to `ROW` and [read\_only](../server-system-variables/index#read_only) to `ON`, TokuDB replication slaves will skip uniqueness checks on inserts and updates, removing the associated IO.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_rpl_unique_checks_delay`
* **Description:** Can be used to simulate long disk reads by sleeping for the specified time, in microseconds, before the row lookup query. Only useful to change in a test environment.
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** numeric
* **Default Value:** `0`
---
#### `tokudb_support_xa`
* **Description:** Whether or not the prepare phase of an XA transaction performs an fsync().
* **Scope:** Global, Session
* **Dynamic:** Yes
* **Data Type:** boolean
* **Default Value:** `ON`
---
#### `tokudb_tmp_dir`
* **Description:** Directory where the TokuDB bulk loaders temporary files are stored. Can be very large, and useful to place on a separate disk. By default the variable is empty, in which case the regular [datadir](../server-system-variables/index#datadir) is used. [tokudb\_load\_save\_space](#tokudb_load_save_space) determines whether the data is compressed or not. The error message `ERROR 1030 (HY000): Got error 1 from storage engine` could indicate that the disk has run out of space.
* **Dynamic:** No
* **Data Type:** `directory name`
* **Default Value:** Empty (the MariaDB datadir is used)
---
#### `tokudb_version`
* **Description:** The TokuDB version of the plugin included on MariaDB.
* **Dynamic:** No
* **Data Type:** `string`
#### `tokudb_write_status_frequency`
* **Description:** Progress is measured every this many writes for display by [SHOW PROCESSLIST](../show-processlist/index). Useful to set to `1` to examine slow queries.
* **Scope:** Global,
* **Dynamic:** Yes
* **Data Type:** `numeric`
* **Default Value:** `1000`
* **Range:** `0` to `4294967295`
---
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Internationalization and Localization Internationalization and Localization
======================================
| Title | Description |
| --- | --- |
| [Server Locale](../server-locale/index) | Server locale. |
| [Time Zones](../time-zones/index) | MariaDB time zones. |
| [Setting the Language for Error Messages](../setting-the-language-for-error-messages/index) | Specifying the language for the server error messages. |
| [Coordinated Universal Time](../coordinated-universal-time/index) | Coordinated Universal Time. |
| [Locales Plugin](../locales-plugin/index) | List compiled-in locales. |
| [mysql\_tzinfo\_to\_sql](../mysql_tzinfo_to_sql/index) | Load time zones to the mysql time zone tables. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb dbForge Documenter for MariaDB and MySQL dbForge Documenter for MariaDB and MySQL
========================================
**[dbForge Documenter](https://www.devart.com/dbforge/mysql/documenter/)** is a useful tool for the MariaDB database that allows for the automatic generation of database documentation in such formats as HTML, PDF, and Markdown. Users can adjust the created documentation with a great variety of options.
dbForge Documenter for MariaDB and MySQL Key Features:
------------------------------------------------------
### 1. Searchable MariaDB & MySQL documentation
Get the benefits of the search as you type principle
View the highlighted matching text after entering the name of a required object in the search field
### 2. Broad compatibility options
MariaDB server versions 5.5-10.6
Various cloud services: Amazon RDS, Amazon Aurora, Google Cloud, Oracle MySQL Cloud, Alibaba Cloud
Security connections: Secure Socket Layer (SSL), Secure Shell (SSH), HTTP Tunneling, PAM Percona

### 3. Broad picture of database structure
Get the detailed MariaDB database information, such as types, details, and properties of the objects, inter-object dependencies, and DDL codes
### 4. Rich customization of document management
Enjoy various style templates allowing for alteration of documentation layout
### 5. Several Document Formats supported:
* HTML and PDF (searchable formats)
* Markdown
### 6. Extended properties support
Edit an object description or add it if it is not specified
Download a free 30-day trial of dbForge Documenter for MariaDB and MySQL [here](https://www.devart.com/dbforge/mysql/documenter/download.html).
[Documentation](https://docs.devart.com/documenter-for-mysql/)
| Version | Introduced |
| --- | --- |
| dbForge Documenter 2.0 | Connectivity support for [MariaDB 10.5](../what-is-mariadb-105/index) is added |
| dbForge Documenter 1.2 | Support for [MariaDB 10.4](../what-is-mariadb-104/index) |
| dbForge Documenter 1.1 | Support for [MariaDB 10.3](../what-is-mariadb-103/index) |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SELECT ... OFFSET ... FETCH SELECT ... OFFSET ... FETCH
===========================
**MariaDB starting with [10.6.0](https://mariadb.com/kb/en/mariadb-1060-release-notes/)**`SELECT ... OFFSET ... FETCH` was introduced in [MariaDB 10.6](../what-is-mariadb-106/index).
Syntax
------
```
OFFSET start { ROW | ROWS }
FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }
```
Description
-----------
The `OFFSET` clause allows one to return only those elements of a resultset that come after a specified offset. The `FETCH` clause specifies the number of rows to return, while `ONLY` or `WITH TIES` specifies whether or not to also return any further results that tie for last place according to the ordered resultset.
Either the singular `ROW` or the plural `ROWS` can be used after the `OFFSET` and `FETCH` clauses; the choice has no impact on the results.
In the case of `WITH TIES`, an [ORDER BY](../order-by/index) clause is required, otherwise an ERROR will be returned.
```
SELECT i FROM t1 FETCH FIRST 2 ROWS WITH TIES;
ERROR 4180 (HY000): FETCH ... WITH TIES requires ORDER BY clause to be present
```
Examples
--------
Given a table with 6 rows:
```
CREATE OR REPLACE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2),(3),(4), (4), (5);
SELECT i FROM t1 ORDER BY i ASC;
+------+
| i |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 4 |
| 5 |
+------+
```
`OFFSET 2` allows one to skip the first two results.
```
SELECT i FROM t1 ORDER BY i ASC OFFSET 2 ROWS;
+------+
| i |
+------+
| 3 |
| 4 |
| 4 |
| 5 |
+------+
```
`FETCH FIRST 3 ROWS ONLY` limits the results to three rows only
```
SELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS ONLY;
+------+
| i |
+------+
| 2 |
| 3 |
| 4 |
+------+
```
The same outcome can also be achieved with the [LIMIT](../limit/index) clause:
```
SELECT i FROM t1 ORDER BY i ASC LIMIT 3 OFFSET 1;
+------+
| i |
+------+
| 2 |
| 3 |
| 4 |
+------+
```
`WITH TIES` ensures the tied result `4` is also returned.
```
SELECT i FROM t1 ORDER BY i ASC OFFSET 1 ROWS FETCH FIRST 3 ROWS WITH TIES;
+------+
| i |
+------+
| 2 |
| 3 |
| 4 |
| 4 |
+------+
```
See Also
--------
* [ORDER BY](../order-by/index)
* [SELECT](../select/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb AUTO_INCREMENT FAQ AUTO\_INCREMENT FAQ
===================
How do I get the last inserted auto\_increment value?
-----------------------------------------------------
Use the [LAST\_INSERT\_ID()](../last_insert_id/index) function:
```
SELECT LAST_INSERT_ID();
```
What if someone else inserts before I select my id?
---------------------------------------------------
[LAST\_INSERT\_ID()](../last_insert_id/index) is connection specific, so there is no problem from race conditions.
How do I get the next value to be inserted?
-------------------------------------------
You don't. Insert, then find out what you did with [LAST\_INSERT\_ID()](../last_insert_id/index).
How do I change what number auto\_increment starts with?
--------------------------------------------------------
`ALTER TABLE yourTable AUTO_INCREMENT = x;` — Next insert will contain `x` or `MAX(autoField) + 1`, whichever is higher
or
`INSERT INTO yourTable (autoField) VALUES (x);` — Next insert will contain `x+1` or `MAX(autoField) + 1`, whichever is higher
Issuing [TRUNCATE TABLE](../truncate-table/index) will delete all the rows in the table, and will reset the auto\_increment value to 0 in most cases (some earlier versions mapped TRUNCATE to DELETE for InnoDB tables, meaning the auto\_increment value would not be reset).
How do I renumber rows once I've deleted some in the middle?
------------------------------------------------------------
Typically, you don't want to. Gaps are hardly ever a problem; if your application can't handle gaps in the sequence, you probably should rethink your application.
Can I do group-wise auto\_increment?
------------------------------------
Yes, if you use the [MyISAM engine](../myisam/index).
How do I get the auto\_increment value in a BEFORE INSERT trigger?
------------------------------------------------------------------
You don't. It's only available after insert.
How do I assign two fields the same auto\_increment value in one query?
-----------------------------------------------------------------------
You can't, not even with an AFTER INSERT trigger. Insert, then go back and update using `LAST_INSERT_ID()`. Those two statements could be wrapped into one stored procedure if you wish.
However, you can mimic this behavior with a BEFORE INSERT trigger and a second table to store the sequence position:
```
CREATE TABLE sequence (table_name VARCHAR(255), position INT UNSIGNED);
INSERT INTO sequence VALUES ('testTable', 0);
CREATE TABLE testTable (firstAuto INT UNSIGNED, secondAuto INT UNSIGNED);
DELIMITER //
CREATE TRIGGER testTable_BI BEFORE INSERT ON testTable FOR EACH ROW BEGIN
UPDATE sequence SET position = LAST_INSERT_ID(position + 1) WHERE table_name = 'testTable';
SET NEW.firstAuto = LAST_INSERT_ID();
SET NEW.secondAuto = LAST_INSERT_ID();
END//
DELIMITER ;
INSERT INTO testTable VALUES (NULL, NULL), (NULL, NULL);
SELECT * FROM testTable;
+-----------+------------+
| firstAuto | secondAuto |
+-----------+------------+
| 1 | 1 |
| 2 | 2 |
+-----------+------------+
```
The same sequence table can maintain separate sequences for multiple tables (or separate sequences for different fields in the same table) by adding extra rows.
Does the auto\_increment field have to be primary key?
------------------------------------------------------
No, it only has to be indexed. It doesn't even have to be unique.
InnoDB and AUTO\_INCREMENT
--------------------------
See [AUTO\_INCREMENT handling in InnoDB](../auto_increment-handling-in-innodb/index)
General Information To Read
---------------------------
[AUTO\_INCREMENT](../auto_increment/index)
Manual Notes
------------
There can be only one `AUTO_INCREMENT` column per table, it must be indexed, and it cannot have a `DEFAULT` value. An `AUTO_INCREMENT` column works properly only if it contains only positive values. Inserting a negative number is regarded as inserting a very large positive number. This is done to avoid precision problems when numbers wrap over from positive to negative and also to ensure that you do not accidentally get an `AUTO_INCREMENT` column that contains 0.
How to start a table with a set AUTO\_INCREMENT value?
------------------------------------------------------
```
CREATE TABLE autoinc_test (
h INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
m INT UNSIGNED
) AUTO_INCREMENT = 100;
INSERT INTO autoinc_test ( m ) VALUES ( 1 );
SELECT * FROM autoinc_test;
+-----+------+
| h | m |
+-----+------+
| 100 | 1 |
+-----+------+
```
See Also
--------
* [AUTO\_INCREMENT](../auto_increment/index)
* [AUTO\_INCREMENT handling in XtraDB/InnoDB](../auto_increment-handling-in-xtradbinnodb/index)
* [LAST\_INSERT\_ID()](../last_insert_id/index)
* [BLACKHOLE and AUTO\_INCREMENT](../blackhole/index#blackhole-and-auto_increment)
* [Sequences](../sequences/index) - an alternative to auto\_increment available from [MariaDB 10.3](../what-is-mariadb-103/index)
*The initial version of this article was copied, with permission, from <http://hashmysql.org/wiki/Autoincrement_FAQ> on 2012-10-05.*
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb NTH_VALUE NTH\_VALUE
==========
**MariaDB starting with [10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/)**The NTH\_VALUE() function was first introduced with other [window functions](../window-functions/index) in [MariaDB 10.2](../what-is-mariadb-102/index).
Syntax
------
```
NTH_VALUE (expr[, num_row]) OVER (
[ PARTITION BY partition_expression ]
[ ORDER BY order_list ]
)
```
Description
-----------
The `NTH_VALUE` function returns the value evaluated at row number `num_row` of the window frame, starting from 1, or NULL if the row does not exist.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Training & Tutorials Training & Tutorials
=====================
This section provides tutorials for those who want to learn about MariaDB and related software.
| Title | Description |
| --- | --- |
| [Beginner MariaDB Articles](../beginner-mariadb-articles/index) | Tutorials for newcomers and beginners to MariaDB. |
| [Basic MariaDB Articles](../basic-mariadb-articles/index) | Basic tutorials -- more advanced than beginner. |
| [Intermediate MariaDB Articles](../intermediate-mariadb-articles/index) | Intermediate level tutorials for MariaDB developers and administrators. |
| [Advanced MariaDB Articles](../advanced-mariadb-articles/index) | Tutorial articles for advanced MariaDB developers and administrators. |
### [Books on MariaDB](../books/index)
| Title | Description |
| --- | --- |
| [Beginner Books](../beginner-books/index) | List of books on MariaDB for newcomers and beginners. |
| [Intermediate and Advanced Books](../intermediate-and-advanced-books/index) | List of books on MariaDB for intermediate and advanced developers and administrators. |
| [Books on MariaDB Code](../books-on-mariadb-code/index) | List of books on coding MariaDB Server and plugins. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Backup and Restore for MariaDB ColumnStore 1.0.x Backup and Restore for MariaDB ColumnStore 1.0.x
================================================
Backup/Restore Process for MariaDB ColumnStore 1.0.x
====================================================
Backup Overview
===============
The high level steps involved in performing a full backup of MariaDB ColumnStore are:
* Suspend write activity on the system.
* Backup the MariaDB Server data files.
* Backup the ColumnStore data files.
* Resume write activity on the system.
Suspend Write Activity
----------------------
To suspend data writes to column store the following command can be issued the admin console:
```
mcsadmin> suspendDatabaseWrites
suspenddatabasewrites Thu Oct 13 13:18:40 2016
This command suspends the DDL/DML writes to the MariaDB Columnstore Database
Do you want to proceed: (y or n) [n]: y
Suspend Calpont Database Writes Request successfully completed
```
Optionally y can be appended as an argument to suspendDatabaseWrites to avoid the confirmation prompt.
Backup the MariaDB Server data files
------------------------------------
The MariaDB Server should be backed up using one of the available backup methods described in the [server backup and restore overview](../backup-and-restore-overview/index). Since the column store data is not stored within the MariaDB Server backup should run very quickly. Utilizing either [mysqldump](../mysqldump/index) or just backing up the directory are straightforward options.
### Using mysqldump
For example:
```
> /usr/local/mariadb/columnstore/mysql/bin/mysqldump --skip-lock-tables --no-data loansdb > mariadb_bkp.sql
```
Note the --no-data option since only the ddl is required for column store tables. The next step will backup the data files. If tables exist using other storage engines then this is likely not appropriate for these.
### Server Data File Directory Backup
Backup can be achieved by simply copying the Server data directories under /usr/local/mariadb/columnstore/.
```
> cp -rp /usr/local/mariadb/columnstore/mysql/db .
```
Backup ColumnStore Data Files
-----------------------------
Backup can be achieved by simply copying the data directories or using vendor supplied backup or snapshot utilities for those directories. A files and directories in the data<N> directories where N represents a unique directory such as data1, data2, etc for each PM server.
```
> cp -rp /usr/local/mariadb/columnstore/data? .
```
Resume Write Activity
---------------------
To resume data writes to column store the following command can be issued the admin console:
```
mcsadmin> resumeDatabaseWrites
resumedatabasewrites Thu Oct 13 13:58:55 2016
This command resumes the DDL/DML writes to the MariaDB Columnstore Database
Do you want to proceed: (y or n) [n]: y
Resume MariaDB Columnstore Database Writes Request successfully completed
```
Optionally y can be appended as an argument to resumeDatabaseWrites to avoid the confirmation prompt.
Restore Overview
================
The high level steps involved in restoring a backup are:
* Restore the MariaDB Instance
* Restore the ColumnStore data files.
Restoring the MariaDB Instance
------------------------------
The appropriate restoration method corresponding to the backup utility used should be performed first to restore the MariaDB server instance.
### mysqldump
If mysqldump was utilized then the backup script is run:
```
> mcsmysql
MariaDB [(none)]> create database loansdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> use loansdb;
Database changed
MariaDB [loansdb]> source mariadb_bkp.sql
Query OK, 0 rows affected (0.00 sec)
...
MariaDB [loansdb]> exit
```
### Restoring the Server Data Files
Backup can be achieved by simply copying the Server data directories under /usr/local/mariadb/columnstore/.
```
> rm -rf /usr/local/mariadb/columnstore/mysql/db
> cp -rpf db /usr/local/mariadb/columnstore/mysql
```
Restoring the ColumnStore Data Files
------------------------------------
The data<N> directories should simply be copied from the backup location or restored via an appropriate backup or snapshot utility. For example:
```
> rm -rf /usr/local/mariadb/columnstore/data?
> cp -rpf data? /usr/local/mariadb/columnstore
> mcsadmin startSystem
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB Basics MariaDB Basics
==============
#### Connecting to MariaDB
MariaDB is a database system, a database server. To interface with the MariaDB server, you can use a client program, or you can write a program or script with one of the popular programming languages (e.g., PHP) using an API (Application Programming Interface) to interface with the MariaDB server. For the purposes of this article, we will focus on using the default client that comes with MariaDB called `mysql`. With this client, you can either enter queries from the command-line, or you can switch to a terminal, that is to say, monitor mode. To start, we'll use the latter.
From the Linux command-line, you would enter the following to log in as the root user and to enter monitor mode:
```
mysql -u root -p -h localhost
```
The `-u` option is for specifying the user name. You would replace `root` here if you want to use a different user name. This is the MariaDB user name, not the Linux user name. The password for the MariaDB user `root` will probably be different from the Linux user `root`. Incidentally, it's not a good security practice to use the `root` user unless you have a specific administrative task to perform for which only `root` has the needed privileges.
The `-p` option above instructs the `mysql` client to prompt you for the password. If the password for the `root` user hasn't been set yet, then the password is blank and you would just hit [Enter] when prompted. The `-h` option is for specifying the host name or the IP address of the server. This would be necessary if the client is running on a different machine than the server. If you've secure-shelled into the server machine, you probably won't need to use the host option. In fact, if you're logged into Linux as `root`, you won't need the user option—the `-p` is all you'll need. Once you've entered the line above along with the password when prompted, you will be logged into MariaDB through the client. To exit, type quit or exit and press [Enter].
#### Creating a Structure
In order to be able to add and to manipulate data, you first have to create a database structure. Creating a database is simple. You would enter something like the following from within the [mysql client](../mysql-command-line-client/index):
```
CREATE DATABASE bookstore;
USE bookstore;
```
This very minimal, first SQL statement will create a sub-directory called bookstore on the Linux filesystem in the directory which holds your MariaDB data files. It won't create any data, obviously. It'll just set up a place to add tables, which will in turn hold data. The second SQL statement above will set this new database as the default database. It will remain your default until you change it to a different one or until you log out of MariaDB.
The next step is to begin creating tables. This is only a little more complicated. To create a simple table that will hold basic data on books, we could enter something like the following:
```
CREATE TABLE books (
isbn CHAR(20) PRIMARY KEY,
title VARCHAR(50),
author_id INT,
publisher_id INT,
year_pub CHAR(4),
description TEXT );
```
This SQL statement creates the table books with six fields, or rather columns. The first column (isbn) is an identification number for each row—this name relates to the unique identifier used in the book publishing business. It has a fixed-width character type of 20 characters. It will be the primary key column on which data will be indexed. The column data type for the book title is a variable width character column of fifty characters at most. The third and fourth columns will be used for identification numbers for the author and the publisher. They are integer data types. The fifth column is used for the publication year of each book. The last column is for entering a description of each book. It's a [TEXT](../text/index) data type, which means that it's a variable width column and it can hold up to 65535 bytes of data for each row. There are several other data types that may be used for columns, but this gives you a good sampling.
To see how the table we created looks, enter the following SQL statement:
```
DESCRIBE books;
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| isbn | char(20) | NO | PRI | NULL | |
| title | varchar(50) | YES | | NULL | |
| author_id | int(11) | YES | | NULL | |
| publisher_id | int(11) | YES | | NULL | |
| year_pub | char(4) | YES | | NULL | |
| description | text | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
```
To change the settings of a table, you can use the [ALTER TABLE](../alter-table/index) statement. I'll cover that statement in another article. To delete a table completely (including its data), you can use the [DROP TABLE](../drop-table/index) statement, followed by the table name. Be careful with this statement since it's not reversible.
The next table we'll create for our examples is the authors table to hold author information. This table will save us from having to enter the author's name and other related data for each book written by each author. It also helps to ensure consistency of data: there's less chance of inadvertent spelling deviations.
```
CREATE TABLE authors
(author_id INT AUTO_INCREMENT PRIMARY KEY,
name_last VARCHAR(50),
name_first VARCHAR(50),
country VARCHAR(50) );
```
We'll join this table to the books table as needed. For instance, we would use it when we want a list of books along with their corresponding authors' names. For a real bookstore's database, both of these tables would probably have more columns. There would also be several more tables. For the examples that follow, these two tables as they are will be enough.
#### Minor Items
Before moving on to the next step of adding data to the tables, let me point out a few minor items that I've omitted mentioning. SQL statements end with a semi-colon (or a \G). You can spread an SQL statement over multiple lines. However, it won't be passed to the server by the client until you terminate it with a semi-colon and hit [Enter]. To cancel an SQL statement once you've started typing it, enter `\c` and press [Enter].
As a basic convention, reserved words are printed in all capital letters. This isn't necessary, though. MariaDB is case-insensitive with regards to reserved words. Database and table names, however, are case-sensitive on Linux. This is because they reference the related directories and files on the filesystem. Column names aren't case sensitive since they're not affected by the filesystem, per se. As another convention, we use lower-case letters for structural names (e.g., table names). It's a matter of preference for deciding on names.
#### Entering Data
The primary method for entering data into a table is to use the [INSERT](../insert/index) statement. As an example, let's enter some information about an author into the authors table. We'll do that like so:
```
INSERT INTO authors
(name_last, name_first, country)
VALUES('Kafka', 'Franz', 'Czech Republic');
```
This will add the name and country of the author Franz Kafka to the authors table. We don't need to give a value for the author\_id since that column was created with the [AUTO\_INCREMENT](../auto_increment/index) option. MariaDB will automatically assign an identification number. You can manually assign one, especially if you want to start the count at a higher number than 1 (e.g., 1000). Since we are not providing data for all of the columns in the table, we have to list the columns for which we are giving data and in the order that the data is given in the set following the VALUES keyword. This means that we could give the data in a different order.
For an actual database, we would probably enter data for many authors. We'll assume that we've done that and move on to entering data for some books. Below is an entry for one of Kafka's books:
```
INSERT INTO books
(title, author_id, isbn, year_pub)
VALUES('The Castle', '1', '0805211063', '1998');
```
This adds a record for Kafka's book, *The Castle*. Notice that we mixed up the order of the columns, but it still works because both sets agree. We indicate that the author is Kafka by giving a value of 1 for the author\_id. This is the value that was assigned by MariaDB when we entered the row for Kafka earlier. Let's enter a few more books for Kafka, but by a different method:
```
INSERT INTO books
(title, author_id, isbn, year_pub)
VALUES('The Trial', '1', '0805210407', '1995'),
('The Metamorphosis', '1', '0553213695', '1995'),
('America', '1', '0805210644', '1995');
```
In this example, we've added three books in one statement. This allows us to give the list of column names once. We also give the keyword `VALUES` only once, followed by a separate set of values for each book, each contained in parentheses and separated by commas. This cuts down on typing and speeds up the process. Either method is fine and both have their advantages. To be able to continue with our examples, let's assume that data on thousands of books has been entered. With that behind us, let's look at how to retrieve data from tables.
#### Retrieving Data
The primary method of retrieving data from tables is to use a [SELECT](../select/index) statement. There are many options available with the [SELECT](../select/index) statement, but you can start simply. As an example, let's retrieve a list of book titles from the books table:
```
SELECT title
FROM books;
```
This will display all of the rows of books in the table. If the table has thousands of rows, MariaDB will display thousands. To limit the number of rows retrieved, we could add a [LIMIT](../select/index#limit) clause to the [SELECT](../select/index) statement like so:
```
SELECT title
FROM books
LIMIT 5;
```
This will limit the number of rows displayed to five. To be able to list the author's name for each book along with the title, you will have to join the books table with the authors table. To do this, we can use the [JOIN](../join-syntax/index) clause like so:
```
SELECT title, name_last
FROM books
JOIN authors USING (author_id);
```
Notice that the primary table from which we're drawing data is given in the `FROM` clause. The table to which we're joining is given in the [JOIN](../join-syntax/index) clause along with the commonly named column (i.e., author\_id) that we're using for the join.
To retrieve the titles of only books written by Kafka based on his name (not the author\_id), we would use the `WHERE` clause with the [SELECT](../select/index) statement. This would be entered like the following:
```
SELECT title AS 'Kafka Books'
FROM books
JOIN authors USING (author_id)
WHERE name_last = 'Kafka';
+-------------------+
| Kafka Books |
+-------------------+
| The Castle |
| The Trial |
| The Metamorphosis |
| America |
+-------------------+
```
This statement will list the titles of Kafka books stored in the database. Notice that I've added the `AS` parameter next to the column name title to change the column heading in the results set to Kafka Books. This is known as an alias. Looking at the results here, we can see that the title for one of Kafka's books is incorrect. His book Amerika is spelled above with a "c" in the table instead of a "k". This leads to the next section on changing data.
#### Changing & Deleting Data
In order to change existing data, a common method is to use the [UPDATE](../update/index) statement. When changing data, though, we need to be sure that we change the correct rows. In our example, there could be another book with the title *America* written by a different author. Since the key column isbn has only unique numbers and we know the ISBN number for the book that we want to change, we can use it to specify the row.
```
UPDATE books
SET title = 'Amerika'
WHERE isbn = '0805210644';
```
This will change the value of the title column for the row specified. We could change the value of other columns for the same row by giving the column = value for each, separated by commas.
If we want to delete a row of data, we can use the [DELETE](../delete/index) statement. For instance, suppose that our fictitious bookstore has decided no longer to carry books by John Grisham. By first running a [SELECT](../select/index) statement, we determine the identification number for the author to be 2034. Using this author identification number, we could enter the following:
```
DELETE FROM books
WHERE author_id = '2034';
```
This statement will delete all rows from the table books for the author\_id given. To do a clean job of it, we'll have to do the same for the authors table. We would just replace the table name in the statement above; everything else would be the same.
#### Conclusion
This is a very basic primer for using MariaDB. Hopefully, it gives you the idea of how to get started with MariaDB. Each of the SQL statements mentioned here have several more options and clauses each. We will cover these statements and others in greater detail in other articles. For now, though, you can learn more about them from experimenting and by further reading of the online documentation.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Creating the MariaDB Binary Tarball Creating the MariaDB Binary Tarball
===================================
How to generate binary tar.gz files.
* [Setup your build environment](../linux_build_environment_setup/index).
* [Build binaries](http://kb.askmonty.org/en/generic-build-instructions) with your preferred options/plugins.
**MariaDB until [5.3](../what-is-mariadb-53/index)*** Use `make_binary_distribution` to generate a binary tar file:
```
cd mariadb-source
./scripts/make_binary_distribution
```
This creates a source file with a name like `mariadb-5.3.2-MariaDB-beta-linux-x86_64.tar.gz` in your current directory.
The other option is to use the bakery scripts. In this case you don't have to compile MariaDB source first.
```
cd $PACKAGING_WORK
bakery/preheat.sh
cd bakery_{number}
bakery/tarbake51.sh last:1 $MARIA_WORK
bakery/autobake51-bintar.sh mariadb-{version_num}-maria-beta-ourdelta{number}.tar.gz
```
**MariaDB starting with [5.5](../what-is-mariadb-55/index)**If the binaries are already built, you can generate a binary tarball with
```
make package
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Using Git with MariaDB Using Git with MariaDB
=======================
Tricks and tips on how to use Git, the source control system MariaDB uses.
| Title | Description |
| --- | --- |
| [MariaDB Source Code](../getting-the-mariadb-source-code/index) | How to get the source code for MariaDB from GitHub. |
| [Using Git](../using-git/index) | Working with the git repository for the source code of MariaDB on GitHub. |
| [Configuring Git to Send Commit Notices](../configuring-git-to-send-commit-notices/index) | Configuring git to send emails when committing changes. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb String Functions String Functions
=================
Functions dealing with strings, such as CHAR, CONVERT, CONCAT, PAD, REGEXP, TRIM, etc.
| Title | Description |
| --- | --- |
| [Regular Expressions Functions](../regular-expressions-functions/index) | Functions for dealing with regular expressions |
| [Dynamic Columns Functions](../dynamic-columns-functions/index) | Functions for storing key/value pairs of data within a column. |
| [ASCII](../ascii/index) | Numeric ASCII value of leftmost character. |
| [BIN](../bin/index) | Returns binary value. |
| [BINARY Operator](../binary-operator/index) | Casts to a binary string. |
| [BIT\_LENGTH](../bit_length/index) | Returns the length of a string in bits. |
| [CAST](../cast/index) | Casts a value of one type to another type. |
| [CHAR Function](../char-function/index) | Returns string based on the integer values for the individual characters. |
| [CHARACTER\_LENGTH](../character_length/index) | Synonym for CHAR\_LENGTH(). |
| [CHAR\_LENGTH](../char_length/index) | Length of the string in characters. |
| [CHR](../chr/index) | Returns string based on integer values of the individual characters. |
| [CONCAT](../concat/index) | Returns concatenated string. |
| [CONCAT\_WS](../concat_ws/index) | Concatenate with separator. |
| [CONVERT](../convert/index) | Convert a value from one type to another type. |
| [ELT](../elt/index) | Returns the N'th element from a set of strings. |
| [EXPORT\_SET](../export_set/index) | Returns an on string for every bit set, an off string for every bit not set. |
| [EXTRACTVALUE](../extractvalue/index) | Returns the text of the first text node matched by the XPath expression. |
| [FIELD](../field/index) | Returns the index position of a string in a list. |
| [FIND\_IN\_SET](../find_in_set/index) | Returns the position of a string in a set of strings. |
| [FORMAT](../format/index) | Formats a number. |
| [FROM\_BASE64](../from_base64/index) | Given a base-64 encoded string, returns the decoded result as a binary string. |
| [HEX](../hex/index) | Returns hexadecimal value. |
| [INSERT Function](../insert-function/index) | Replaces a part of a string with another string. |
| [INSTR](../instr/index) | Returns the position of a string within a string. |
| [LCASE](../lcase/index) | Synonym for LOWER(). |
| [LEFT](../left/index) | Returns the leftmost characters from a string. |
| [LENGTH](../length/index) | Length of the string in bytes. |
| [LENGTHB](../lengthb/index) | Length of the given string, in bytes. |
| [LIKE](../like/index) | Whether expression matches a pattern. |
| [LOAD\_FILE](../load_file/index) | Returns file contents as a string. |
| [LOCATE](../locate/index) | Returns the position of a substring in a string. |
| [LOWER](../lower/index) | Returns a string with all characters changed to lowercase. |
| [LPAD](../lpad/index) | Returns the string left-padded with another string to a given length. |
| [LTRIM](../ltrim/index) | Returns the string with leading space characters removed. |
| [MAKE\_SET](../make_set/index) | Make a set of strings that matches a bitmask. |
| [MATCH AGAINST](../match-against/index) | Perform a fulltext search on a fulltext index. |
| [Full-Text Index Stopwords](../full-text-index-stopwords/index) | Default list of full-text stopwords used by MATCH...AGAINST. |
| [MID](../mid/index) | Synonym for SUBSTRING(str,pos,len). |
| [NATURAL\_SORT\_KEY](../natural_sort_key/index) | Sorting that is closer to natural human sorting. |
| [NOT LIKE](../not-like/index) | Same as NOT(expr LIKE pat [ESCAPE 'escape\_char']). |
| [NOT REGEXP](../not-regexp/index) | Same as NOT (expr REGEXP pat). |
| [OCTET\_LENGTH](../octet_length/index) | Returns the length of the given string, in bytes. |
| [ORD](../ord/index) | Return ASCII or character code. |
| [POSITION](../position/index) | Returns the position of a substring in a string. |
| [QUOTE](../quote/index) | Returns quoted, properly escaped string. |
| [REPEAT Function](../repeat-function/index) | Returns a string repeated a number of times. |
| [REPLACE Function](../replace-function/index) | Replace occurrences of a string. |
| [REVERSE](../reverse/index) | Reverses the order of a string. |
| [RIGHT](../right/index) | Returns the rightmost N characters from a string. |
| [RPAD](../rpad/index) | Returns the string right-padded with another string to a given length. |
| [RTRIM](../rtrim/index) | Returns the string with trailing space characters removed. |
| [SFORMAT](../sformat/index) | Given a string and a formatting specification, returns a formatted string. |
| [SOUNDEX](../soundex/index) | Returns a string based on how the string sounds. |
| [SOUNDS LIKE](../sounds-like/index) | SOUNDEX(expr1) = SOUNDEX(expr2). |
| [SPACE](../space/index) | Returns a string of space characters. |
| [STRCMP](../strcmp/index) | Compares two strings in sort order. |
| [SUBSTR](../substr/index) | Returns a substring from string starting at a given position. |
| [SUBSTRING](../substring/index) | Returns a substring from string starting at a given position. |
| [SUBSTRING\_INDEX](../substring_index/index) | Returns the substring from string before count occurrences of a delimiter. |
| [TO\_BASE64](../to_base64/index) | Converts a string to its base-64 encoded form. |
| [TO\_CHAR](../to_char/index) | Converts a date/time/timestamp type expression to a string. |
| [TRIM](../trim/index) | Returns a string with all given prefixes or suffixes removed. |
| [TRIM\_ORACLE](../trim_oracle/index) | Synonym for the Oracle mode version of TRIM(). |
| [UCASE](../ucase/index) | Synonym for UPPER(). |
| [UNCOMPRESS](../uncompress/index) | Uncompresses string compressed with COMPRESS(). |
| [UNCOMPRESSED\_LENGTH](../uncompressed_length/index) | Returns length of a string before being compressed with COMPRESS(). |
| [UNHEX](../unhex/index) | Interprets pairs of hex digits as numbers and converts to the character represented by the number. |
| [UPDATEXML](../updatexml/index) | Replace XML. |
| [UPPER](../upper/index) | Changes string to uppercase. |
| [WEIGHT\_STRING](../weight_string/index) | Weight of the input string. |
| [Type Conversion](../type-conversion/index) | When implicit type conversion takes place. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InfiniDB Migration to ColumnStore InfiniDB Migration to ColumnStore
==================================
| Title | Description |
| --- | --- |
| [Migrating from InfiniDB 4.x to MariaDB ColumnStore](../migrating-from-infinidb-4x-to-mariadb-columnstore/index) | Migrating to ColumnStore on new servers from InfiniDB 4.6 |
| [Upgrade from InfiniDB 4.x to MariaDB ColumnStore](../upgrade-from-infinidb-4x-to-mariadb-columnstore/index) | Upgrade to MariaDB ColumnStore on the same server from InfiniDB 4.6 |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_CENTROID ST\_CENTROID
============
Syntax
------
```
ST_Centroid(mpoly)
Centroid(mpoly)
```
Description
-----------
Returns a point reflecting the mathematical centroid (geometric center) for the [MultiPolygon](../multipolygon/index) *mpoly*. The resulting point will not necessarily be on the MultiPolygon.
`ST_Centroid()` and `Centroid()` are synonyms.
Examples
--------
```
SET @poly = ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))');
SELECT ST_AsText(ST_Centroid(@poly)) AS center;
+--------------+
| center |
+--------------+
| POINT(10 10) |
+--------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ps_thread_id ps\_thread\_id
==============
Syntax
------
```
sys.ps_thread_id(connection_id)
```
Description
-----------
`ps_thread_id` is a [stored function](../stored-functions/index) available with the [Sys Schema](../sys-schema/index) that returns the thread\_id associated with the given *connection\_id*. If the *connection\_id* is NULL, returns the thread\_id for the current connection.
Examples
--------
```
SELECT * FROM performance_schema.threads\G
*************************** 13. row ***************************
THREAD_ID: 13
NAME: thread/sql/one_connection
TYPE: FOREGROUND
PROCESSLIST_ID: 3
PROCESSLIST_USER: msandbox
PROCESSLIST_HOST: localhost
PROCESSLIST_DB: test
PROCESSLIST_COMMAND: Query
PROCESSLIST_TIME: 0
PROCESSLIST_STATE: Sending data
PROCESSLIST_INFO: SELECT * FROM performance_schema.threads
PARENT_THREAD_ID: 1
ROLE: NULL
INSTRUMENTED: YES
HISTORY: YES
CONNECTION_TYPE: Socket
THREAD_OS_ID: 24379
SELECT sys.ps_thread_id(3);
+---------------------+
| sys.ps_thread_id(3) |
+---------------------+
| 13 |
+---------------------+
SELECT sys.ps_thread_id(NULL);
+------------------------+
| sys.ps_thread_id(NULL) |
+------------------------+
| 13 |
+------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysql-test Overview mysql-test Overview
===================
The Basics
----------
At its core, mysql-test is very simple. The client program `mysqltest` executes a *test file* and compares the produced output with the *result file*. If the files match, the test is passed; otherwise the test has failed. This approach can be used to test any SQL statement, as well as other executables (with the `exec` command).
The complete process of testing is governed and monitored by the *mysql-test-run.pl* driver script, or *mtr* for short (for convenience, `mtr` is created as a symbolic link to `mysql-test-run.pl`). The mtr script is responsible for preparing the test environment, creating a list of all tests to run, running them, and producing the report at the end. It can run many tests in parallel, execute tests in an order which minimizes server restarts (as they are slow), run tests in a debugger or under valgrind or strace, and so on.
Test files are located in *suites*. A *suite* is a directory which contains test files, result files, and optional configuration files. The mtr looks for suites in the `mysql-test/suite` directory, and in the `mysql-test` subdirectories of plugins and storage engine directories. For example, the following are all valid suite paths:
```
mysql-test/suite/rpl
```
```
mysql-test/suite/handler
```
```
storage/example/mysql-test/demo
```
```
plugin/auth_pam/mysql-test/pam
```
In almost all cases, the suite directory name is the suite name. A notable historical exception is the *main* suite, which is located directly in the `mysql-test` directory.
Test files have a `.test` extension and can be placed directly in the suite directory (for example, `mysql-test/suite/handler/interface.test`) or in the `t` subdirectory (e.g. `mysql-test/suite/rpl/t/rpl_alter.test` or `mysql-test/t/grant.test`). Similarly, result files have the `.result` extension and can be placed either in the suite directory or in the `r` subdirectory.
A test file can include other files (with the `source` command). These included files can have any name and may be placed anywhere, but customarily they have a `.inc` extension and are located either in the suite directory or in the `inc` or `include` subdirectories (for example, `mysql-test/suite/handler/init.inc` or `mysql-test/include/start_slave.inc`).
Other files which affect testing, while not being tests themselves, are:
* `disabled.def`
* `suite.opt`
* other `*.opt` files
* `my.cnf`
* other `*.cnf` files
* `combinations`
* other `*.combinations` files
* `suite.pm`
* `*.sh` files
* `*.require` files
* `*.rdiff` files
* `valgrind.supp`
See [Auxiliary files](../mtr-auxiliary-files/index) for details on these.
Overlays
--------
In addition to regular suite directories, mtr supports *overlays*. An *overlay* is a directory with the same name as an existing suite, but which is located in a storage engine or plugin directory. For example, `storage/myisam/mysql-test/rpl` could be a *myisam* overlay of the *rpl* suite in `mysql-test/suite/rpl`. And `plugin/daemon_example/mysql-test/demo` could be a *daemon\_example* overlay of the *demo* suite in `storage/example/mysql-test/demo`. As a special exception, an overlay of the main suite, should be called `main`, as in `storage/pbxt/mysql-test/main`.
An overlay is like a second transparent layer in a graphics editor. It can obscure, extend, or modify the background image. Also, one may notice that an overlay is very close to a *UnionFS*, but implemented in perl inside mtr.
An overlay can replace almost any file in the overlaid suite, or add new files. For example, if some overlay of the main suite contains a `include/have_innodb.inc` file, then all tests that include it will see and use the overlaid version. Or, an overlay can create a `t/create.opt` file (even though the main suite does not have such a file), and `create.test` will be executed with the specified additional options.
But adding an overlay never affects how the original suite is executed. That is, mtr always executes the original suite as if no overlay was present. And then, additionally, it executes a combined "union" of the overlay and the original suite. When doing that, mtr takes care to avoid re-executing tests that are not changed in the overlay. For example, creating `t/create.opt` in the overlay of the main suite will only cause `create.test` to be executed in the overlay. But creating `suite.opt` affects all tests — and it will cause all tests to be re-executed with the new options.
Combinations
------------
In certain cases it makes sense to run a specific test or a group of tests several times with different server settings. This can be done using so-called *combinations*. Combinations are groups of settings that are used alternatively. A combinations file defines these alternatives using `my.cnf` syntax, for example
```
[row]
binlog-format=row
[stmt]
binlog-format=statement
[mix]
binlog-format=mixed
```
And all tests where this combinations file applies will be run three times: once for the combination called "row", and `--binlog-format=row` on the server command line, once for the "stmt" combination, and once for the "mix" combination.
More than one combinations file may be applicable to a given test file. In this case, mtr will run the test for all possible combinations of the given combinations. A test that uses replication (three combinations as above) and innodb (two combinations - innodb and xtradb), will be run six times.
Sample Output
-------------
Typical mtr output looks like this
```
==============================================================================
TEST WORKER RESULT TIME (ms) or COMMENT
--------------------------------------------------------------------------
rpl.rpl_row_find_row_debug [ skipped ] Requires debug build
main-pbxt.connect [ skipped ] No PBXT engine
main-pbxt.mysqlbinlog_row [ disabled ] test expects a non-transactional engine
rpl.rpl_savepoint 'mix,xtradb' w2 [ pass ] 238
rpl.rpl_stm_innodb 'innodb_plugin,row' w1 [ skipped ] Neither MIXED nor STATEMENT binlog format
binlog.binlog_sf 'stmt' w2 [ pass ] 7
unit.dbug w2 [ pass ] 1
maria.small_blocksize w1 [ pass ] 23
sys_vars.autocommit_func3 'innodb_plugin' w1 [ pass ] 5
sys_vars.autocommit_func3 'xtradb' w1 [ pass ] 6
main.ipv6 w1 [ pass ] 131
...
```
Every test is printed as "suitename.testname", and a suite name may include an overlay name (like in `main-pbxt`). After the test name, mtr prints combinations that were applied to this test, if any.
A similar syntax can be used on the mtr command line to specify what tests to run:
| | |
| --- | --- |
| `$ ./mtr innodb` | search for *innodb* test in every suite from the default list, and run all that was found. |
| `$ ./mtr main.innodb` | run the *innodb* test from the *main* suite |
| `$ ./mtr main-pbxt.innodb` | run the *innodb* test from the *pbxt* overlay of the *main* suite |
| `$ ./mtr main-.innodb` | run the *innodb* test from the *main* suite and all its overlays. |
| `$ ./mtr main.innodb,xtradb` | run the *innodb* test from the *main* suite, only in the *xtradb* combination |
Plugin Support
--------------
The mtr driver has special support for MariaDB plugins.
First, on startup it copies or symlinks all dynamically-built plugins into `var/plugins`. This allows one to have many plugins loaded at the same time. For example, one can load Federated and InnoDB engines together. Also, mtr creates environment variables for every plugin with the corresponding plugin name. For example, if the InnoDB engine was built, `$HA_INNODB_SO` will be set to `ha_innodb.so` (or `ha_innodb.dll` on Windows). And the test can safely use the corresponding environment variable on all platforms to refer to a plugin file; it will always have the correct platform-dependent extension.
Second, when combining server command-line options (which may come from many different sources) into one long list before starting `mysqld`, mtr treats `--plugin-load` specially. Normal server semantics is to use the latest value of any particular option on the command line. If one starts the server with, for example, `--port=2000 --port=3000`, the server will use the last value for the port, that is 3000. To allow different `.opt` files to require different plugins, mtr goes through the assembled server command line, and joins all `--plugin-load` options into one. Additionally it removes all empty `--plugin-load` options. For example, suppose a test is affected by three `.opt` files which contain, respectively:
```
--plugin-load=$HA_INNODB_SO
```
```
--plugin-load=$AUTH_PAM_SO
```
```
--plugin-load=$HA_EXAMPLE_SO
```
...and, let's assume the Example engine was not built (`$HA_EXAMPLE_SO` is empty). Then the server will get:
```
--plugin-load=ha_innodb.so:auth_pam.so
```
instead of
```
--plugin-load=ha_innodb.so --plugin-load=auth_pam.so --plugin-load=
```
Third, to allow plugin sources to be simply copied into the `plugin/` or `storage/` directories, and still not affect existing tests (even if new plugins are statically linked into the server), mtr automatically disables all optional plugins on server startup. A plugin is optional if it can be disabled with the corresponding `--skip-XXX` server command-line option. Mandatory plugins, like MyISAM or MEMORY, do not have `--skip-XXX` options (e.g. there is no `--skip-myisam` option). This mtr behavior means that no plugin, statically or dynamically built, has any effect on the server unless it was explicitly enabled. A convenient way to enable a given plugin *XXX* for specific tests is to create a `have_XXX.opt` file which contains the necessary command-line options, and a `have_XXX.inc` file which checks whether a plugin was loaded. Then any test that needs this plugin can source the `have_XXX.inc` file and have the plugin loaded automatically.
mtr communication procedure
---------------------------
`mtr` is first creating the server socket (`master`).
After that, `workers` are created using `fork()`.
For each worker `run_worker()` function is called, which is executing the following:
* creates a new socket to connect to `server_port` obtained from the `master`
* initiate communication with the `master` using `START` command
* `master` sends first test from list of tests supplied by the user and immediately sends command `TESTCASE` to the `worker`
* `worker` gets command `TESTCASE` and processes test case, by calling `run_testcase()` function which starts(/restarts if needed) the server and sends `TESTRESULT` (in case of restart `WARNINGS` command is issued to the `master` in case some warnings/error logs are found)
* `master` accepts `TESTRESULT` command and run `mtr_report_test()` function which check does the test fail and also generates the new command `TESTCASE` if some new test case exist
* If there is no other test case `master` sends `BYE` command which gets accepted by the `worker` which is properly closing the connection.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Buildbot Setup for Virtual Machines - Ubuntu 9.04 amd64 Buildbot Setup for Virtual Machines - Ubuntu 9.04 amd64
=======================================================
Base install
------------
```
qemu-img create -f qcow2 vm-jaunty-amd64-serial.qcow2 8G
kvm -m 1024 -hda vm-jaunty-amd64-serial.qcow2 -cdrom /kvm/ubuntu-9.04-server-amd64.iso -redir tcp:2227::22 -boot d -smp 2 -cpu qemu64 -net nic,model=virtio -net user
```
Serial port and passwordless login/sudo
---------------------------------------
```
kvm -m 1024 -hda vm-jaunty-amd64-serial.qcow2 -cdrom /kvm/ubuntu-9.04-server-amd64.iso -redir tcp:2227::22 -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user
sudo apt-get install emacs22-nox
```
Add to /boot/grub/menu.lst:
```
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=3 serial console
```
also add in menu.lst to kernel line (after removing `quiet splash'):
```
console=tty0 console=ttyS0,115200n8
```
Create /etc/event.d/ttyS0:
```
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc2
start on stopped rc3
start on stopped rc4
start on stopped rc5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /sbin/getty 115200 ttyS0
```
Add account and allow passwordless sudo:
```
sudo adduser --disabled-password buildbot
sudo adduser buildbot sudo
sudo EDITOR=emacs visudo
# uncomment `%sudo ALL=NOPASSWD: ALL' line in `visudo`, and move to end.
sudo su -s /bin/bash - buildbot
mkdir .ssh
cat >.ssh/authorized_keys
# Paste public key for buildbot user on host system.
chmod -R go-rwx .ssh
# Do manual login from host to guest once, to make sure .ssh/known_hosts is updated.
```
VM for .deb building
--------------------
```
qemu-img create -b vm-jaunty-amd64-serial.qcow2 -f qcow2 vm-jaunty-amd64-build.qcow2
kvm -m 1024 -hda vm-jaunty-amd64-build.qcow2 -cdrom /kvm/ubuntu-9.04-server-amd64.iso -redir tcp:2227::22 -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
sudo apt-get build-dep mysql-server-5.1
```
VM for install testing
----------------------
```
qemu-img create -b vm-jaunty-amd64-serial.qcow2 -f qcow2 vm-jaunty-amd64-install.qcow2
kvm -m 1024 -hda vm-jaunty-amd64-install.qcow2 -cdrom /kvm/ubuntu-9.04-server-amd64.iso -redir tcp:2227::22 -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
sudo adduser --system --group mysql
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InnoDB Limitations InnoDB Limitations
==================
The [InnoDB storage engine](../innodb/index) has the following limitations.
Limitations on Schema
---------------------
* InnoDB tables can have a maximum of 1,017 columns. This includes [virtual generated columns](../generated-columns/index).
* InnoDB tables can have a maximum of 64 secondary indexes.
* A multicolumn index on InnoDB can use a maximum of 16 columns. If you attempt to create a multicolumn index that uses more than 16 columns, MariaDB returns an Error 1070.
Limitations on Size
-------------------
* With the exception of variable-length columns (that is, [VARBINARY](../varbinary/index), [VARCHAR](../varchar/index), [BLOB](../blob/index) and [TEXT](../text/index)), rows in InnoDB have a maximum length of roughly half the page size for 4KB, 8KB, 16KB and 32KB page sizes.
* The maximum size for [BLOB](../blob/index) and [TEXT](../text/index) columns is 4GB. This also applies to [LONGBLOB](../longblob/index) and [LONGTEXT](../longtext/index).
* MariaDB imposes a row-size limit of 65,535 bytes for the combined sizes of all columns. If the table contains [BLOB](../blob/index) or [TEXT](../text/index) columns, these only count for 9 - 12 bytes in this calculation, given that their content is stored separately.
* 32-bit operating systems have a maximum file size limit of 2GB. When working with large tables using this architecture, configure InnoDB to use smaller data files.
* The maximum size for the combined InnoDB log files is 512GB.
* With tablespaces, the minimum size is 10MB, the maximum varies depending on the InnoDB Page Size.
| InnoDB Page Size | Maximum Tablespace Size |
| --- | --- |
| 4KB | 16TB |
| 8KB | 32TB |
| 16KB | 64TB |
| 32KB | 128TB |
| 64KB | 256TB |
### Page Sizes
Using the [innodb\_page\_size](../innodb-system-variables/index#innodb_page_size) system variable, you can configure the size in bytes for InnoDB pages. Pages default to 16KB. There are certain limitations on how you use this variable.
* MariaDB instances using one page size cannot use data files or log files from an instance using a different page size.
* When using a Page Size of 4KB or 8KB, the maximum index key length is lowered proportionately.
| InnoDB Page Size | Index Key Length |
| --- | --- |
| 4KB | 768B |
| 8KB | 1536B |
| 16KB | 3072B |
### Large Prefix Size
Until [MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/), the [innodb\_large\_prefix](../innodb-system-variables/index#innodb_large_prefix) system variable enabled large prefix sizes. That is, when enabled (the default from [MariaDB 10.2](../what-is-mariadb-102/index)), InnoDB uses 3072B index key prefixes for `DYNAMIC` and `COMPRESSED` row formats. When disabled, it uses 787B key prefixes for tables of any row format. Using an index key that exceeds this limit throws an error.
From [MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/), InnoDB always uses large index key prefixes.
Limitations on Tables
---------------------
InnoDB has the following table-specific limitations.
* When you issue a [DELETE](../delete/index) statement, InnoDB doesn't regenerate the table, rather it deletes each row from the table one by one.
* When running MariaDB on Windows, InnoDB stores databases and tables in lowercase. When moving databases and tables in a binary format from Windows to a Unix-like system or from a Unix system to Windows, you need to rename these to use lowercase.
* When using cascading [foreign keys](../foreign-keys/index), operations in the cascade don't activate triggers.
### Table Analysis
MariaDB supports the use of the [ANALYZE TABLE](../analyze-table/index) SQL statement to analyze and store table key distribution. When MariaDB executes this statement, it calculates index cardinality through random dives on index trees. This makes it fast, but not always accurate as it does not check all rows. The data is only an estimate and repeated executions of this statement may return different results.
In situations where accurate data from [ANALYZE TABLE](../analyze-table/index) statements is important, enable the [innodb\_stats\_persistent](../innodb-system-variables/index#innodb_stats_persistent) system variable. Additionally, you can use the [innodb\_stats\_transient\_sample\_pages](../innodb-system-variables/index#innodb_stats_transient_sample_pages) system variable to change the number of random dives it performs.
When running [ANALYZE TABLE](../analyze-table/index) twice on a table in which statements or transactions are running, MariaDB blocks the second [ANALYZE TABLE](../analyze-table/index) until the statement or transaction is complete. This occurs because the statement or transaction blocks the second [ANALYZE TABLE](../analyze-table/index) statement from reloading the table definition, which it must do since the old one was marked as obsolete after the first statement.
### Table Status
Similar to the [ANALYZE TABLE](../analyze-table/index) statement, [SHOW TABLE STATUS](../show-table-status/index) statements do not provide accurate statistics for InnoDB, except for the physical table size.
The InnoDB storage engine does not maintain internal row counts. Transactions isolate writes, which means that concurrent transactions will not have the same row counts.
### Auto-incrementing Columns
* When defining an index on an auto-incrementing column, it must be defined in a way that allows the equivalent of `SELECT MAX(col)` lookups on the table.
* Restarting MariaDB may cause InnoDB to reuse old auto-increment values, such as in the case of a transaction that was rolled back.
* When auto-incrementing columns run out of values, [INSERT](../insert/index) statements generate duplicate-key errors.
Transactions and Locks
----------------------
* You can modify data on a maximum of 96 \* 1023 concurrent transactions that generate undo records.
* Of the 128 rollback segments, InnoDB assigns 32 to non-redo logs for transactions that modify temporary tables and related objects, reducing the maximum number of concurrent data-modifying transactions to 96,000, from 128.000.
* The limit is 32,000 concurrent transactions when all data-modifying transactions also modify temporary tables.
* Issuing a [LOCK TABLES](../lock-tables/index) statement sets two locks on each table when the [innodb\_table\_locks](../innodb-system-variables/index#innodb_table_locks) system variable is enabled (the default).
* When you commit or roll back a transaction, any locks set in the transaction are released. You don't need to issue [LOCK TABLES](../lock-tables/index) statements when the [autocommit](../server-system-variables/index#autocommit) variable is enabled, as InnoDB would immediately release the table locks.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Transaction Coordinator Log Overview Transaction Coordinator Log Overview
====================================
The transaction coordinator log (tc\_log) is used to coordinate transactions that affect multiple [XA-capable](../xa-transactions/index) [storage engines](../storage-engines/index). If you have two or more XA-capable storage engines enabled, then a transaction coordinator log must be available.
Types of Transaction Coordinator Logs
-------------------------------------
There are currently two implementations of the transaction coordinator log:
* Binary log-based transaction coordinator log
* Memory-mapped file-based transaction coordinator log
If the [binary log](../binary-log/index) is enabled on a server, then the server will use the binary log-based transaction coordinator log. Otherwise, it will use the memory-mapped file-based transaction coordinator log.
### Binary Log-Based Transaction Coordinator Log
This transaction coordinator uses the [binary log](../binary-log/index), which is enabled by the `[log\_bin](../replication-and-binary-log-system-variables/index#log_bin)` server option.
### Memory-Mapped File-Based Transaction Coordinator Log
This transaction coordinator uses the memory-mapped file defined by the `[--log-tc](../mysqld-options/index#-log-tc)` server option. The size is defined by the `[log\_tc\_size](../server-system-variables/index#log_tc_size)` system variable.
Some facts about this log:
* The log consists of a memory-mapped file that is divided into pages of 8KB size.
* The usable size of the first page is smaller because of the log header. There is a PAGE control structure for each page.
* Each page (or rather its PAGE control structure) can be in one of the three states - active, syncing, pool.
* There could be only one page in the active or syncing state, but many in the pool state - pool is a fifo queue.
* The usual lifecycle of a page is pool->active->syncing->pool.
* The "active" page is a page where new xid's are logged.
* The page stays active as long as the syncing slot is taken.
* The "syncing" page is being synced to disk. no new xid can be added to it.
* When the syncing is done the page is moved to a pool and an active page becomes "syncing".
The result of such an architecture is a natural "commit grouping" - If commits are coming faster than the system can sync, they do not stall. Instead, all commits that came since the last sync are logged to the same "active" page, and they all are synced with the next - one - sync. Thus, thought individual commits are delayed, throughput is not decreasing.
When an xid is added to an active page, the thread of this xid waits for a page's condition until the page is synced. When a syncing slot becomes vacant one of these waiters is awakened to take care of syncing. It syncs the page and signals all waiters that the page is synced. The waiters are counted, and a page may never become active again until waiters==0, which means that is all waiters from the previous sync have noticed that the sync was completed.
Note that a page becomes "dirty" and has to be synced only when a new xid is added into it. Removing a xid from a page does not make it dirty - we don't sync xid removals to disk.
#### Monitoring the Memory-Mapped File-Based Transaction Coordinator Log
The memory-mapped transaction coordinator log can be monitored with the following status variables:
* `[Tc\_log\_max\_pages\_used](../server-status-variables/index#tc_log_max_pages_used)`
* `[Tc\_log\_page\_size](../server-status-variables/index#tc_log_page_size)`
* `[Tc\_log\_page\_waits](../server-status-variables/index#tc_log_page_waits)`
Heuristic Recovery with the Transaction Coordinator Log
-------------------------------------------------------
One of the main purposes of the transaction coordinator log is in crash recovery. See [Heuristic Recovery with the Transaction Coordinator Log](../heuristic-recovery-with-the-transaction-coordinator-log/index) for more information about that.
Known Issues
------------
### You must enable exactly N storage engines
Prior to [MariaDB 10.1.10](https://mariadb.com/kb/en/mariadb-10110-release-notes/), if you were using the memory-mapped file-based transaction coordinator log, and then if the server crashed and you changed the number of XA-capable storage engines that it loaded, then you could see errors like the following:
```
2018-11-30 23:08:49 140046048638848 [Note] Recovering after a crash using tc.log
2018-11-30 23:08:49 140046048638848 [ERROR] Recovery failed! You must enable exactly 3 storage engines that support two-phase commit protocol
2018-11-30 23:08:49 140046048638848 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2018-11-30 23:08:49 140046048638848 [ERROR] Can't init tc log
2018-11-30 23:08:49 140046048638848 [ERROR] Aborting
```
To recover from this error, delete the file defined by the `[--log-tc](../mysqld-options/index#-log-tc)` server option, and then restart the server with the `[--tc-heuristic-recover](../mysqld-options/index#-tc-heuristic-recover)` option set.
See [MDEV-9214](https://jira.mariadb.org/browse/MDEV-9214) for more information.
### Bad magic header in tc log
If you are using the memory-mapped file-based transaction coordinator log, then it is possible to see errors like the following:
```
2018-09-19 4:29:31 0 [Note] Recovering after a crash using tc.log
2018-09-19 4:29:31 0 [ERROR] Bad magic header in tc log
2018-09-19 4:29:31 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2018-09-19 4:29:31 0 [ERROR] Can't init tc log
2018-09-19 4:29:31 0 [ERROR] Aborting
```
This means that the header of the memory-mapped file-based transaction coordinator log is corrupt. To recover from this error, delete the file defined by the `[--log-tc](../mysqld-options/index#-log-tc)` server option, and then restart the server with the `[--tc-heuristic-recover](../mysqld-options/index#-tc-heuristic-recover)` option set.
This issue is known to occur when using docker. In that case, the problem may be caused by using a MariaDB container version with a data directory from a different MariaDB or MySQL version. Therefore, some potential fixes are:
* Pinning the docker instance to a specific MariaDB version in the docker compose file, so that it consistently uses the same version.
* Running `[mysql\_upgrade](../mysql_upgrade/index)` to ensure that the data directory is upgraded to match the server version.
See [this docker issue](https://github.com/docker-library/mariadb/issues/201) for more information.
### MariaDB Galera Cluster
[MariaDB Galera Cluster](../galera-cluster/index) builds include a built-in plugin called `wsrep`. Prior to [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/), this plugin was internally considered an [XA-capable](../xa-transactions/index) [storage engine](../storage-engines/index). Consequently, these [MariaDB Galera Cluster](../galera-cluster/index) builds have multiple XA-capable storage engines by default, even if the only "real" storage engine that supports external [XA transactions](../xa-transactions/index) enabled on these builds by default is [InnoDB](../innodb/index). Therefore, when using one these builds MariaDB would be forced to use a transaction coordinator log by default, which could have performance implications.
For example, [MDEV-16509](https://jira.mariadb.org/browse/MDEV-16509) describes performance problems where [MariaDB Galera Cluster](../galera-cluster/index) actually performs better when the [binary log](../binary-log/index) is enabled. It is possible that this is caused by the fact that MariaDB is forced to use the memory-mapped file-based transaction coordinator log in this case, which may not perform as well.
This became a bigger issue in [MariaDB 10.1](../what-is-mariadb-101/index) when the [MySQL-wsrep](https://github.com/codership/mysql-wsrep) patch that powers [MariaDB Galera Cluster](../galera-cluster/index) was enabled on most MariaDB builds on Linux by default. Consequently, this built-in `wsrep` plugin would exist on those MariaDB builds on Linux by default. Therefore, MariaDB users might pay a performance penalty, even if they never actually intended to use the [MariaDB Galera Cluster](../galera-cluster/index) features included in [MariaDB 10.1](../what-is-mariadb-101/index).
In [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/) and later, the built-in `wsrep` plugin has been changed to a replication plugin. Therefore, it is no longer considered an [XA-capable](../xa-transactions/index) storage engine, so it no longer forces MariaDB to use a transaction coordinator log by default.
See [MDEV-16442](https://jira.mariadb.org/browse/MDEV-16442) for more information.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb What to Do if MariaDB Doesn't Start What to Do if MariaDB Doesn't Start
===================================
There could be many reasons that MariaDB fails to start. This page will help troubleshoot some of the more common reasons and provide solutions.
If you have tried everything here, and still need help, you can ask for help on IRC or on the forums - see [Where to find other MariaDB users and developers](../where-to-find-other-mariadb-users-and-developers/index) - or ask a question at the [Starting and Stopping MariaDB](../starting-and-stopping-mariadb/index) page.
The Error Log and the Data Directory
------------------------------------
The reason for the failure will almost certainly be written in the [error log](../error-log/index) and, if you are starting MariaDB manually, to the console. By default, the error log is named *host-name*.err and is written to the data directory.
Common Locations:
* /var/log/
* /var/log/mysql
* C:\Program Files\MariaDB x.y\data (x.y refers to the version number)
* C:\Program Files (x86)\MariaDB x.y\data (32bit version on 64bit Windows)
It's also possible that the error log has been explicitly written to another location. This is often done by changing the `[datadir](../server-system-variables/index#datadir)` or `[log\_error](../server-system-variables/index#log_error)` system variables in an [option file](../configuring-mariadb-with-option-files/index). See [Option Files](#option-files) below for more information about that.
A quick way to get the values of these system variables is to execute the following commands:
```
mysqld --help --verbose | grep 'log-error' | tail -1
mysqld --help --verbose | grep 'datadir' | tail -1
```
Option Files
------------
Another kind of file to consider when troubleshooting is [option files](../configuring-mariadb-with-option-files/index). The default option file is called `my.cnf`. Option files contain configuration options, such as the location of the data directory mentioned above. If you're unsure where the option file is located, see [Configuring MariaDB with Option Files: Default Option File Locations](../configuring-mariadb-with-option-files/index#default-option-file-locations) for information on the default locations.
You can check which configuration options MariaDB server will use from its option files by executing the following command:
```
mysqld --print-defaults
```
You can also check by executing the following command:
```
my_print_defaults --mysqld
```
See [Configuring MariaDB with Option Files: Checking Program Options](../configuring-mariadb-with-option-files/index#checking-program-options) for more information on checking configuration options.
### Invalid Option or Option Value
Another potential reason for a startup failure is that an [option file](../configuring-mariadb-with-option-files/index) contains an invalid option or an invalid option value. In those cases, the [error log](../error-log/index) should contain an error similar to this:
```
140514 12:19:37 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'option=value'
```
This is more likely to happen when you upgrade to a new version of MariaDB. In most cases the [option file](../configuring-mariadb-with-option-files/index) from the old version of MariaDB will work just fine with the new version. However, occasionally, options are removed in new versions of MariaDB, or the valid values for options are changed in new versions of MariaDB. Therefore, it's possible for an [option file](../configuring-mariadb-with-option-files/index) to stop working after an upgrade.
Also remember that option names are case sensitive.
Examine the specifics of the error. Possible fixes are usually one of the following:
* If the option is completely invalid, then remove it from the [option file](../configuring-mariadb-with-option-files/index).
* If the option's name has changed, then fix the name.
* If the option's valid values have changed, then change the option's value to a valid one.
* If the problem is caused by a simple typo, then fix the typo.
Can't Open Privilege Tables
---------------------------
It is possible to see errors similar to the following:
```
System error 1067 has occurred.
Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist
```
If errors like this occur, then critical [system tables](../system-tables/index) are either missing or are in the wrong location. The above error is quite common after an upgrade if the [option files](../configuring-mariadb-with-option-files/index) set the `[basedir](../server-system-variables/index#basedir)` or `[datadir](../server-system-variables/index#datadir)` to a non-standard location, but the new server is using the default location. Therefore, make sure that the `[basedir](../server-system-variables/index#basedir)` and `[datadir](../server-system-variables/index#datadir)` variables are correctly set.
If you're unsure where the option file is located, see [Configuring MariaDB with Option Files: Default Option File Locations](../configuring-mariadb-with-option-files/index#default-option-file-locations) for information on the default locations.
If the [system tables](../system-tables/index) really do not exist, then you may need to create them with `[mysql\_install\_db](../mysql_install_db/index)`. See [Installing System Tables (mysql\_install\_db)](../installing-system-tables-mysql_install_db/index) for more information.
Can't Create Test File
----------------------
One of the first tests on startup is to check whether MariaDB can write to the data directory. When this fails, it will log an error like this:
```
May 13 10:24:28 mariadb3 mysqld[19221]: 2019-05-13 10:24:28 0 [Warning] Can't create test file /usr/local/data/mariadb/mariadb3.lower-test
May 13 10:24:28 mariadb3 mysqld[19221]: 2019-05-13 10:24:28 0 [ERROR] Aborting
```
This is usually a permission error on the directory in which this file is being written. Ensure that the entire `[datadir](../server-system-variables/index#datadir)` is owned by the user running `mysqld`, usually `mysql`. Ensure that directories have the "x" (execute) directory permissions for the owner. Ensure that all the parent directories of the `[datadir](../server-system-variables/index#datadir)` upwards have "x" (execute) permissions for all (`user`, `group`, and `other`).
Once this is checked look at the [systemd](#systemd) and [selinux](#selinux) documentation below, or [apparmor](https://blogs.oracle.com/jsmyth/apparmor-and-mysql).
InnoDB
------
[InnoDB](../xtradb-and-innodb/index) is probably the MariaDB component that most frequently causes a crash. In the error log, lines containing InnoDB messages generally start with "InnoDB:".
### Cannot Allocate Memory for the InnoDB Buffer Pool
In a typical installation on a dedicated server, at least 70% of your memory should be assigned to [InnoDB buffer pool](../xtradbinnodb-buffer-pool/index); sometimes it can even reach 85%. But be very careful: don't assign to the buffer pool more memory than it can allocate. If it cannot allocate memory, InnoDB will use the disk's swap area, which is very bad for performance. If swapping is disabled or the swap area is not big enough, InnoDB will crash. In this case, MariaDB will probably try to restart several times, and each time it will log a message like this:
```
140124 17:29:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool
```
In that case, you will need to add more memory to your server/VM or decrease the value of the [innodb\_buffer\_pool\_size](../xtradbinnodb-server-system-variables/index#innodb_buffer_pool_size) variables.
Remember that the buffer pool will slightly exceed that limit. Also, remember that MariaDB also needs allocate memory for other storage engines and several per-connection buffers. The operating system also needs memory.
### InnoDB Table Corruption
By default, InnoDB deliberately crashes the server when it detects table corruption. The reason for this behavior is preventing corruption propagation. However, in some situations, server availability is more important than data integrity. For this reason, we can avoid these crashes by changing the value of [innodb\_corrupt\_table\_action](../xtradbinnodb-server-system-variables/index#innodb_corrupt_table_action) to 'warn'.
If InnoDB crashes the server after detecting data corruption, it writes a detailed message in the error log. The first lines are similar to the following:
```
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 7.
InnoDB: You may have to recover from a backup.
```
Generally, it is still possible to recover most of the corrupted data. To do so, restart the server in [InnoDB recovery mode](../xtradbinnodb-recovery-modes/index) and try to extract the data that you want to backup. You can save them in a CSV file or in a non-InnoDB table. Then, restart the server in normal mode and restore the data.
MyISAM
------
Most tables in the [mysql](../the-mysql-database-tables/index) database are MyISAM tables. These tables are necessary for MariaDB to properly work, or even start.
A MariaDB crash could cause system tables corruption. With the default settings, MariaDB will simply not start if the system tables are corrupted. With [myisam\_recover\_options](../myisam-system-variables/index#myisam_recover_options), we can force MyISAM to repair damaged tables.
systemd
-------
If you are using `[systemd](../systemd/index)`, then there are a few relevant notes about startup failures:
* If MariaDB is configured to access files under `/home`, `/root`, or `/run/user`, then the default systemd unit file will prevent access to these directories with a `Permission Denied` error. This happens because the unit file set `[ProtectHome=true](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#ProtectHome=)`. See [Systemd: Configuring Access to Home Directories](../systemd/index#configuring-access-to-home-directories) for information on how to work around this.
* The default systemd unit file also sets [ProtectSystem=full](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#ProtectSystem=), which places restrictions on writing to a few other directories. Overwriting this with `ProtectSystem=off` in the same way as above will restore access to these directories.
* If MariaDB takes longer than 90 seconds to start, then the default systemd unit file will cause it to fail with an error. This happens because the default value for the `[TimeoutStartSec](https://www.freedesktop.org/software/systemd/man/systemd.service.html#TimeoutStartSec=)` option is 90 seconds. See [Systemd: Configuring the Systemd Service Timeout](../systemd/index#configuring-the-systemd-service-timeout) for information on how to work around this.
* The systemd journal may also contain useful information about startup failures. See [Systemd: Systemd Journal](../systemd/index#systemd-journal) for more information.
See [systemd](../systemd/index) documentation for further information on systemd configuration.
SELinux
-------
[Security-Enhanced Linux (SELinux)](https://selinuxproject.org/page/Main_Page) is a Linux kernel module that provides a framework for configuring [mandatory access control (MAC)](https://en.wikipedia.org/wiki/Mandatory_access_control) system for many resources on the system. It is enabled by default on some Linux distributions, including RHEL, CentOS, Fedora, and other similar Linux distribution. SELinux prevents programs from accessing files, directories or ports unless it is configured to access those resources.
You might need to troubleshoot SELinux-related issues in cases, such as:
* MariaDB is using a non-default port.
* MariaDB is reading from or writing to some files (datadir, log files, option files, etc.) located at non-default paths.
* MariaDB is using a plugin that requires access to resources that default installations do not use.
Setting SELinux state to `permissive` is a common way to investigate what is going wrong while allowing MariaDB to function normally. `permissive` is supposed to produce a log entry every time it should block a resource access, without actually blocking it. However, [there are situations](https://danwalsh.livejournal.com/67855.html) when SELinux blocks resource accesses even in `permissive` mode.
See [SELinux](../selinux/index) for more information.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb CONNECT OCCUR Table Type CONNECT OCCUR Table Type
========================
Similarly to the `[XCOL](../connect-table-types-xcol-table-type/index)` table type, `OCCUR` is an extension to the `[PROXY](../connect-table-types-proxy-table-type/index)` type when referring to a table or view having several columns containing the same kind of data. It enables having a different view of the table where the data from these columns are put in a single column, eventually causing several rows to be generated from one row of the object table. For example, supposing we have a *pets* table:
| name | dog | cat | rabbit | bird | fish |
| --- | --- | --- | --- | --- | --- |
| John | 2 | 0 | 0 | 0 | 0 |
| Bill | 0 | 1 | 0 | 0 | 0 |
| Mary | 1 | 1 | 0 | 0 | 0 |
| Lisbeth | 0 | 0 | 2 | 0 | 0 |
| Kevin | 0 | 2 | 0 | 6 | 0 |
| Donald | 1 | 0 | 0 | 0 | 3 |
We can create an occur table by:
```
create table xpet (
name varchar(12) not null,
race char(6) not null,
number int not null)
engine=connect table_type=occur tabname=pets
option_list='OccurCol=number,RankCol=race'
Colist='dog,cat,rabbit,bird,fish';
```
When displaying it by
```
select * from xpet;
```
We will get the result:
| name | race | number |
| --- | --- | --- |
| John | dog | 2 |
| Bill | cat | 1 |
| Mary | dog | 1 |
| Mary | cat | 1 |
| Lisbeth | rabbit | 2 |
| Kevin | cat | 2 |
| Kevin | bird | 6 |
| Donald | dog | 1 |
| Donald | fish | 3 |
First of all, the values of the column listed in the Colist option have been put in a unique column whose name is given by the OccurCol option. When several columns have non null (or pseudo-null) values, several rows are generated, with the other normal columns values repeated.
In addition, an optional special column was added whose name is given by the RankCol option. This column contains the name of the source column from which the value of the OccurCol column comes from. It permits here to know the race of the pets whose number is given in *number*.
This table type permit to make queries that would be more complicated to make on the original tables. For instance to know who as more than 1 pet of a kind, you can simply ask:
```
select * from xpet where number > 1;
```
You will get the result:
| name | race | number |
| --- | --- | --- |
| John | dog | 2 |
| Lisbeth | rabbit | 2 |
| Kevin | cat | 2 |
| Kevin | bird | 6 |
| Donald | fish | 3 |
**Note 1:** Like for [XCOL tables](../connect-table-types-xcol-table-type/index), no row multiplication for queries not implying the Occur column.
**Note 2:** Because the OccurCol was declared "not null" no rows were generated for null or pseudo-null values of the column list. If the OccurCol is declared as nullable, rows are also generated for columns containing null or pseudo-null values.
Occur tables can be also defined from views or source definition. Also, CONNECT is able to generate the column definitions if not specified. For example:
```
create table ocsrc engine=connect table_type=occur
colist='january,february,march,april,may,june,july,august,september,
october,november,december' option_list='rankcol=month,occurcol=day'
srcdef='select ''Foo'' name, 8 january, 7 february, 2 march, 1 april,
8 may, 14 june, 25 july, 10 august, 13 september, 22 october, 28
november, 14 december';
```
This table is displayed as:
| name | month | day |
| --- | --- | --- |
| Foo | january | 8 |
| Foo | february | 7 |
| Foo | march | 2 |
| Foo | april | 1 |
| Foo | may | 8 |
| Foo | june | 14 |
| Foo | july | 25 |
| Foo | august | 10 |
| Foo | september | 13 |
| Foo | october | 22 |
| Foo | november | 28 |
| Foo | december | 14 |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Optimizer Trace Resources Optimizer Trace Resources
=========================
* Optimizer Trace Walkthrough talk at MariaDB Fest 2020: <https://mariadb.org/fest2020/optimizer-trace/>
* A tool for processing Optimizer Trace: <https://github.com/ogrovlen/opttrace> . Doesn't work with MariaDB at the moment but everyone is welcome to make it work.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Cassandra Status Variables Cassandra Status Variables
==========================
CassandraSE is no longer actively being developed and has been removed in [MariaDB 10.6](../what-is-mariadb-106/index). See [MDEV-23024](https://jira.mariadb.org/browse/MDEV-23024).
This page documents status variables related to the [Cassandra storage engine](../cassandra/index). See [Server Status Variables](../server-status-variables/index) for a complete list of status variables that can be viewed with [SHOW STATUS](../show-status/index).
#### `Cassandra_multiget_keys_scanned`
* **Description:** Number of keys we've made lookups for.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Cassandra_multiget_reads`
* **Description:** Number of read operations.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Cassandra_multiget_rows_read`
* **Description:** Number of rows actually read.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Cassandra_network_exceptions`
* **Description:** Number of network exceptions.
* **Scope:** Global, Session
* **Data Type:** `numeric`
* **Introduced:** `[MariaDB 10.0.3](https://mariadb.com/kb/en/mariadb-1003-release-notes/)`
---
#### `Cassandra_row_insert_batches`
* **Description:** Number of insert batches performed.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Cassandra_row_inserts`
* **Description:** Number of rows inserted.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Cassandra_timeout_exceptions`
* **Description:** Number of Timeout exceptions we got from Cassandra.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
#### `Cassandra_unavailable_exceptions`
* **Description:** Number of Unavailable exceptions we got from Cassandra.
* **Scope:** Global, Session
* **Data Type:** `numeric`
---
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb System Variables System Variables
=================
| Title | Description |
| --- | --- |
| [System and Status Variables Added By Major Release](../system-and-status-variables-added-by-major-release/index) | Lists of status and system variables added in MariaDB major release |
| [Full List of MariaDB Options, System and Status Variables](../full-list-of-mariadb-options-system-and-status-variables/index) | Complete alphabetical list of all MariaDB options as well as system and status variables. |
| [Server Status Variables](../server-status-variables/index) | List and description of the Server Status Variables. |
| [Server System Variables](../server-system-variables/index) | List of system variables. |
| [Aria Status Variables](../aria-status-variables/index) | Aria-related server status variables. |
| [Aria System Variables](../aria-system-variables/index) | Aria-related system variables. |
| [Cassandra Status Variables](../cassandra-status-variables/index) | Cassandra-related status variables |
| [Cassandra System Variables](../cassandra-system-variables/index) | Cassandra system variables |
| [CONNECT System Variables](../connect-system-variables/index) | System variables related to the CONNECT storage engine. |
| [Galera Cluster Status Variables](../galera-cluster-status-variables/index) | Galera Cluster Status Variables |
| [Galera Cluster System Variables](../galera-cluster-system-variables/index) | Listing and description of Galera Cluster system variables. |
| [InnoDB Server Status Variables](../innodb-status-variables/index) | List and description of InnoDB status variables. |
| [InnoDB System Variables](../innodb-system-variables/index) | List and description of InnoDB-related server system variables. |
| [MariaDB Audit Plugin Options and System Variables](../mariadb-audit-plugin-options-and-system-variables/index) | Description of Server\_Audit plugin options and system variables. |
| [MariaDB Audit Plugin - Status Variables](../mariadb-audit-plugin-status-variables/index) | Server Audit plugin status variables |
| [Mroonga Status Variables](../mroonga-status-variables/index) | Mroonga-related status variables. |
| [Mroonga System Variables](../mroonga-system-variables/index) | Mroonga-related system variables. |
| [MyISAM System Variables](../myisam-system-variables/index) | MyISAM system variables. |
| [MyRocks Status Variables](../myrocks-status-variables/index) | MyRocks-related status variables. |
| [MyRocks System Variables](../myrocks-system-variables/index) | MyRocks server system variables. |
| [OQGRAPH System and Status Variables](../oqgraph-system-and-status-variables/index) | List and description of OQGRAPH system and status variables. |
| [Performance Schema Status Variables](../performance-schema-status-variables/index) | Performance Schema status variables. |
| [Performance Schema System Variables](../performance-schema-system-variables/index) | Performance Schema system variables. |
| [Replication and Binary Log Status Variables](../replication-and-binary-log-status-variables/index) | Replication and binary log status variables. |
| [Replication and Binary Log System Variables](../replication-and-binary-log-system-variables/index) | Replication and binary log system variables. |
| [Semisynchronous Replication Plugin Status Variables](../semisynchronous-replication-plugin-status-variables/index) | Semisynchronous Replication plugin status variables |
| [Semisynchronous Replication](../semisynchronous-replication/index) | Semisynchronous replication. |
| [Sphinx Status Variables](../sphinx-status-variables/index) | Sphinx status variables. |
| [Spider Status Variables](../spider-status-variables/index) | Spider server status variables. |
| [Spider Server System Variables](../spider-server-system-variables/index) | System variables for the Spider storage engine. |
| [SQL\_ERROR\_LOG Plugin System Variables](../sql_error_log-plugin-system-variables/index) | SQL\_ERROR\_LOG plugin-related system variables. |
| [SSL/TLS Status Variables](../ssltls-status-variables/index) | List and description of Transport Layer Security (TLS)-related status variables. |
| [SSL/TLS System Variables](../ssltls-system-variables/index) | List and description of Transport Layer Security (TLS)-related system variables. |
| [Thread Pool System and Status Variables](../thread-pool-system-status-variables/index) | System and status variables related to the MariaDB thread pool. |
| [TokuDB Status Variables](../tokudb-status-variables/index) | TokuDB status variables |
| [TokuDB System Variables](../tokudb-system-variables/index) | TokuDB System Variables |
| [MariaDB Optimization for MySQL Users](../mariadb-optimization-for-mysql-users/index) | MariaDB contains many new options and optimizations which, for compatibilit... |
| [InnoDB Buffer Pool](../innodb-buffer-pool/index) | The most important memory buffer used by InnoDB. |
| [InnoDB Change Buffering](../innodb-change-buffering/index) | Buffering INSERT, UPDATE and DELETE statements for greater efficiency. |
| [Optimizing table\_open\_cache](../optimizing-table_open_cache/index) | Adjusting table\_open\_cache to improve performance. |
| [Optimizing key\_buffer\_size](../optimizing-key_buffer_size/index) | Optimizing index buffers with key\_buffer\_size |
| [Segmented Key Cache](../segmented-key-cache/index) | Collection of structures for regular MyISAM key caches |
| [Big Query Settings](../big-query-settings/index) | Recommended settings for large, IO-bound queries |
| [Sample my.cnf Files](../sample-mycnf-files/index) | Place holder for sample my.cnf files, customized for different memory size ... |
| [Handling Too Many Connections](../handling-too-many-connections/index) | Dealing with the 'Too many connections' error |
| [System Variable Differences between MariaDB and MySQL](../system-variable-differences-between-mariadb-and-mysql/index) | Comparison of variable differences between major versions of MariaDB and MySQL. |
| [MariaDB Memory Allocation](../mariadb-memory-allocation/index) | Basic issues in RAM allocation for MariaDB. |
| [Setting Innodb Buffer Pool Size Dynamically](../setting-innodb-buffer-pool-size-dynamically/index) | The InnoDB Buffer Pool size can be set dynamically from MariaDB 10.2.2. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Files Backed Up By Mariabackup Files Backed Up By Mariabackup
==============================
Files Included in Backup
------------------------
Mariabackup backs up the files listed below.
### InnoDB Data Files
Mariabackup backs up the following InnoDB data files:
* [InnoDB system tablespace](../innodb-system-tablespaces/index)
* [InnoDB file-per-table tablespaces](../innodb-file-per-table-tablespaces/index)
### MyRocks Data Files
Starting with [MariaDB 10.2.16](https://mariadb.com/kb/en/mariadb-10216-release-notes/) and [MariaDB 10.3.8](https://mariadb.com/kb/en/mariadb-1038-release-notes/), Mariabackup will back up tables that use the [MyRocks](../myrocks/index) storage engine. This data data is located in the directory defined by the `[rocksdb\_datadir](../myrocks-system-variables/index#rocksdb_datadir)` system variable. Mariabackup backs this data up by performing a checkpoint using the `[rocksdb\_create\_checkpoint](../myrocks-system-variables/index#rocksdb_create_checkpoint)` system variable.
Mariabackup does not currently support [partial backups](../partial-backup-and-restore-with-mariabackup/index) for MyRocks.
### Other Data Files
Mariabackup also backs up files with the following extensions:
* `frm`
* `isl`
* `MYD`
* `MYI`
* `MAD`
* `MAI`
* `MRG`
* `TRG`
* `TRN`
* `ARM`
* `ARZ`
* `CSM`
* `CSV`
* `opt`
* `par`
Files Excluded From Backup
--------------------------
Mariabackup does **not** back up the files listed below.
* [InnoDB Temporary Tablespaces](../innodb-temporary-tablespaces/index)
* [Binary logs](../binary-log/index)
* [Relay logs](../relay-log/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mariadb-secure-installation mariadb-secure-installation
===========================
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-secure-installation` is a symlink to `mysql_secure_installation`, the script for enabling you to improve the security of your MariaDB installation.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysql_secure_installation` is the symlink, and `mariadb-secure-installation` the binary name.
See [mysql\_secure\_installation](../mysql_secure_installation/index) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Replication Overview Replication Overview
====================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
Replication is a feature allowing the contents of one or more servers (called primaries) to be mirrored on one or more servers (called replicas).
You can exert control over which data to replicate. All databases, one or more databases, or tables within a database can each be selectively replicated.
The main mechanism used in replication is the [binary log](../binary-log/index). If binary logging is enabled, all updates to the database (data manipulation and data definition) are written into the binary log as binlog events. Replicas read the binary log from each primary in order to access the data to replicate. A [relay log](../relay-log/index) is created on the replica, using the same format as the binary log, and this is used to perform the replication. Old relay log files are removed when no longer needed.
A replica server keeps track of the position in the primary's binlog of the last event applied on the replica. This allows the replica server to re-connect and resume from where it left off after replication has been temporarily stopped. It also allows a replica to disconnect, be cloned and then have the new replica resume replication from the same primary.
Primaries and replicas do not need to be in constant communication with each other. It's quite possible to take servers offline or disconnect from the network, and when they come back, replication will continue where it left off.
Replication Uses
----------------
Replication is used in a number of common scenarios. Uses include:
* Scalability. By having one or more replicas, reads can be spread over multiple servers, reducing the load on the primary. The most common scenario for a high-read, low-write environment is to have one primary, where all the writes occur, replicating to multiple replicas, which handle most of the reads.
* Data analysis. Analyzing data may have too much of an impact on a primary server, and this can similarly be handled on a replica, while the primary continues unaffected by the extra load.
* Backup assistance. [Backups](../backing-up-and-restoring/index) can more easily be run if a server is not actively changing the data. A common scenario is to replicate the data to a replica, which is then disconnected from the primary with the data in a stable state. Backup is then performed from this server. See [Replication as a Backup Solution](../replication-as-a-backup-solution/index).
* Distribution of data. Instead of being connected to a remote primary, it's possible to replicate the data locally and work from this data instead.
Common Replication Setups
-------------------------
### Standard Replication
* Provides infinite read scale out.
* Provides high-availability by upgrading replica to primary.
### Ring Replication
* Provides read and write scaling.
* Doesn’t handle conflicts.
* If one primary fails, replication stops.
### Star Replication
* Provides read and write scaling.
* Doesn’t handle conflicts.
* Have to use replication filters to avoid duplication of data.
### Multi-Source Replication
* Allows you to combine data from different sources.
* Different domains executed independently in parallel on all replicas.
Cross-Version Replication Compatibility
---------------------------------------
The following table describes replication compatibility between different MariaDB Server versions:
| | Primary→ | MariaDB-10.2 | MariaDB-10.3 | MariaDB-10.4 | MariaDB-10.5 | MariaDB-10.6 |
| --- | --- | --- | --- | --- | --- | --- |
| Replica ↓ | | | | | | |
| MariaDB-10.2 | | ✅ | ⛔ | ⛔ | ⛔ | ⛔ |
| MariaDB-10.3 | | ✅ | ✅ | ⛔ | ⛔ | ⛔ |
| MariaDB-10.4 | | ✅ | ✅ | ✅ | ⛔ | ⛔ |
| MariaDB-10.5 | | ✅ | ✅ | ✅ | ✅ | ⛔ |
| MariaDB-10.6 | | ✅ | ✅ | ✅ | ✅ | ✅ |
* ✅: This combination is supported.
* ⛔: This combination is **not** supported.
For replication compatibility details between MariaDB and MySQL, see [MariaDB versus MySQL - Compatibility: Replication Compatibility](../mariadb-vs-mysql-compatibility/index#replication-compatibility).
See Also
--------
* [Setting Up Replication](../setting-up-replication/index)
* [MariaDB vs. MySQL Replication Compatibility](../mariadb-vs-mysql-compatibility/index#replication-compatibility)
* [MariaDB Galera Cluster and M/S replication](https://www.youtube.com/watch?v=Nd0nvltLPdQ) (video)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb LOG2 LOG2
====
Syntax
------
```
LOG2(X)
```
Description
-----------
Returns the base-2 logarithm of X.
Examples
--------
```
SELECT LOG2(4398046511104);
+---------------------+
| LOG2(4398046511104) |
+---------------------+
| 42 |
+---------------------+
SELECT LOG2(65536);
+-------------+
| LOG2(65536) |
+-------------+
| 16 |
+-------------+
SELECT LOG2(-100);
+------------+
| LOG2(-100) |
+------------+
| NULL |
+------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema WSREP_MEMBERSHIP Table Information Schema WSREP\_MEMBERSHIP Table
==========================================
The `WSREP_STATUS` table makes [Galera](../galera/index) node cluster membership information available through the [Information Schema](../information-schema/index). The same information can be returned using the [SHOW WSREP\_MEMBERSHIP](../show-wsrep_membership/index) statement. Only users with the [SUPER](../grant/index#super) can access information from this table.
The `WSREP_MEMBERSHIP` table is part of the [WSREP\_INFO plugin](../wsrep_info-plugin/index).
Example
-------
```
SELECT * FROM information_schema.WSREP_MEMBERSHIP;
+-------+--------------------------------------+-------+-----------------+
| INDEX | UUID | NAME | ADDRESS |
+-------+--------------------------------------+-------+-----------------+
| 0 | 46da96e3-6e9e-11e4-95a2-f609aa5444b3 | node1 | 10.0.2.15:16000 |
| 1 | 5f6bc72a-6e9e-11e4-84ed-57ec6780a3d3 | node2 | 10.0.2.15:16001 |
| 2 | 7473fd75-6e9e-11e4-91de-0b541ad91bd0 | node3 | 10.0.2.15:16002 |
+-------+--------------------------------------+-------+-----------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb PolygonFromWKB PolygonFromWKB
==============
A synonym for [ST\_PolyFromWKB](../st_polyfromwkb/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb < <
=
Syntax
------
```
<
```
Description
-----------
Less than operator. Evaluates both SQL expressions and returns 1 if the left value is less than the right value and 0 if it is not, or `NULL` if either expression is NULL. If the expressions return different data types, (for instance, a number and a string), performs type conversion.
When used in row comparisons these two queries return the same results:
```
SELECT (t1.a, t1.b) < (t2.x, t2.y)
FROM t1 INNER JOIN t2;
SELECT (t1.a < t2.x) OR ((t1.a = t2.x) AND (t1.b < t2.y))
FROM t1 INNER JOIN t2;
```
Examples
--------
```
SELECT 2 < 2;
+-------+
| 2 < 2 |
+-------+
| 0 |
+-------+
```
Type conversion:
```
SELECT 3<'4';
+-------+
| 3<'4' |
+-------+
| 1 |
+-------+
```
Case insensitivity - see [Character Sets and Collations](../data-types-character-sets-and-collations/index):
```
SELECT 'a'<'A';
+---------+
| 'a'<'A' |
+---------+
| 0 |
+---------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Upgrading from MariaDB Galera Cluster 10.0 to MariaDB 10.1 with Galera Cluster Upgrading from MariaDB Galera Cluster 10.0 to MariaDB 10.1 with Galera Cluster
==============================================================================
**MariaDB starting with [10.1](../what-is-mariadb-101/index)**Since [MariaDB 10.1](../what-is-mariadb-101/index), the [MySQL-wsrep](https://github.com/codership/mysql-wsrep) patch has been merged into MariaDB Server. Therefore, in [MariaDB 10.1](../what-is-mariadb-101/index) and above, the functionality of MariaDB Galera Cluster can be obtained by installing the standard MariaDB Server packages and the Galera wsrep provider library package.
Performing a Rolling Upgrade
----------------------------
The following steps can be used to perform a rolling upgrade from MariaDB Galera Cluster 10.0 to [MariaDB 10.1](../what-is-mariadb-101/index). In a rolling upgrade, each node is upgraded individually, so the cluster is always operational. There is no downtime from the application's perspective.
First, before you get started:
1. First, take a look at [Upgrading from MariaDB 10.0 to MariaDB 10.1](../upgrading-from-mariadb-100-to-101/index) to see what has changed between the major versions.
1. Check whether any system variables or options have been changed or removed. Make sure that your server's configuration is compatible with the new MariaDB version before upgrading.
2. Check whether replication has changed in the new MariaDB version in any way that could cause issues while the cluster contains upgraded and non-upgraded nodes.
3. Check whether any new features have been added to the new MariaDB version. If a new feature in the new MariaDB version cannot be replicated to the old MariaDB version, then do not use that feature until all cluster nodes have been upgrades to the new MariaDB version.
2. Next, make sure that the Galera version numbers are compatible.
1. If you are upgrading from the most recent MariaDB Galera Cluster 10.0 release to [MariaDB 10.1](../what-is-mariadb-101/index), then the versions will be compatible. The latest releases of MariaDB Galera Cluster 10.0 and all releases of [MariaDB 10.1](../what-is-mariadb-101/index) use Galera 3 (i.e. Galera wsrep provider versions 25.3.x), so they should be compatible.
2. If you are running an older MariaDB Galera Cluster 10.0 release that still uses Galera 2 (i.e. Galera wsrep provider versions 25.2.x), then it is recommended to first upgrade to the latest MariaDB Galera Cluster 10.0 release that uses Galera 3 (i.e. Galera wsrep provider versions 25.3.x).
3. See [What is MariaDB Galera Cluster?: Galera wsrep provider Versions](../what-is-mariadb-galera-cluster/index#galera-wsrep-provider-versions) for information on which MariaDB releases uses which Galera wsrep provider versions.
3. Ideally, you want to have a large enough gcache to avoid a [State Snapshot Transfer (SST)](../introduction-to-state-snapshot-transfers-ssts/index) during the rolling upgrade. The gcache size can be configured by setting `[gcache.size](../wsrep_provider_options/index#gcachesize)` For example:
`wsrep_provider_options="gcache.size=2G"`
Before you upgrade, it would be best to take a backup of your database. This is always a good idea to do before an upgrade. We would recommend [Percona XtraBackup](../backup-restore-and-import-clients-percona-xtrabackup/index).
Then, for each node, perform the following steps:
1. Modify the repository configuration, so the system's package manager installs [MariaDB 10.1](../what-is-mariadb-101/index). For example,
* On Debian, Ubuntu, and other similar Linux distributions, see [Updating the MariaDB APT repository to a New Major Release](../installing-mariadb-deb-files/index#updating-the-mariadb-apt-repository-to-a-new-major-release) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Updating the MariaDB YUM repository to a New Major Release](../yum/index#updating-the-mariadb-yum-repository-to-a-new-major-release) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Updating the MariaDB ZYpp repository to a New Major Release](../installing-mariadb-with-zypper/index#updating-the-mariadb-zypp-repository-to-a-new-major-release) for more information.
2. If you use a load balancing proxy such as MaxScale or HAProxy, make sure to drain the server from the pool so it does not receive any new connections.
3. Set `[innodb\_fast\_shutdown](../xtradbinnodb-server-system-variables/index#innodb_fast_shutdown)` to `0`. It can be changed dynamically with `[SET GLOBAL](../set/index#global-session)`. For example:
`SET GLOBAL innodb_fast_shutdown=0;`
4. [Stop MariaDB](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
5. Uninstall the old version of MariaDB and the Galera wsrep provider.
* On Debian, Ubuntu, and other similar Linux distributions, execute the following:
`sudo apt-get remove mariadb-galera-server galera`
* On RHEL, CentOS, Fedora, and other similar Linux distributions, execute the following:
`sudo yum remove MariaDB-Galera-server galera`
* On SLES, OpenSUSE, and other similar Linux distributions, execute the following:
`sudo zypper remove MariaDB-Galera-server galera`
6. Install the new version of MariaDB and the Galera wsrep provider.
* On Debian, Ubuntu, and other similar Linux distributions, see [Installing MariaDB Packages with APT](../installing-mariadb-deb-files/index#installing-mariadb-packages-with-apt) for more information.
* On RHEL, CentOS, Fedora, and other similar Linux distributions, see [Installing MariaDB Packages with YUM](../yum/index#installing-mariadb-packages-with-yum) for more information.
* On SLES, OpenSUSE, and other similar Linux distributions, see [Installing MariaDB Packages with ZYpp](../installing-mariadb-with-zypper/index#installing-mariadb-packages-with-zypp) for more information.
7. Make any desired changes to configuration options in [option files](../configuring-mariadb-with-option-files/index), such as `my.cnf`. This includes removing any system variables or options that are no longer supported.
* It is important to note that a new option is needed for Galera to be active in [MariaDB 10.1](../what-is-mariadb-101/index): you must set `[wsrep\_on=ON](../galera-cluster-system-variables/index#wsrep_on)`.
8. On Linux distributions that use `systemd` you may need to increase the service startup timeout as the default timeout of 90 seconds may not be sufficient. See [Systemd: Configuring the Systemd Service Timeout](../systemd/index#configuring-the-systemd-service-timeout) for more information.
9. [Start MariaDB](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index).
10. Run `[mysql\_upgrade](../mysql_upgrade/index)` with the `--skip-write-binlog` option.
* `mysql_upgrade` does two things:
1. Ensures that the system tables in the `[mysq](../the-mysql-database-tables/index)l` database are fully compatible with the new version.
2. Does a very quick check of all tables and marks them as compatible with the new version of MariaDB .
When this process is done for one node, move onto the next node.
Note that when upgrading the Galera wsrep provider, sometimes the Galera protocol version can change. The Galera wsrep provider should not start using the new protocol version until all cluster nodes have been upgraded to the new version, so this is not generally an issue during a rolling upgrade. However, this can cause issues if you restart a non-upgraded node in a cluster where the rest of the nodes have been upgraded.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Table Discovery Table Discovery
===============
In MariaDB it is not always necessary to run an explicit `CREATE TABLE` statement for a table to appear. Sometimes a table may already exist in the storage engine, but the server does not know about it, because there is no `.frm` file for this table. This can happen for various reasons; for example, for a cluster engine the table might have been created in the cluster by another MariaDB server node. Or for the engine that supports table shipping a table file might have been simply copied into the MariaDB data directory. But no matter what the reason is, there is a mechanism for an engine to tell the server that the table exists. This mechanism is called **table discovery** and if an engine wants the server to discover its tables, the engine should support the table discovery API.
There are two different kinds of table discovery — a fully automatic discovery and a user-assisted one. In the former, the engine can automatically discover the table whenever an SQL statement needs it. In MariaDB, the [Archive](../archive/index) and [Sequence](../sequence/index) engines support this kind of discovery. For example, one can copy a `t1.ARZ` file into the database directory and immediately start using it — the corresponding `.frm` file will be created automatically. Or one can select from say, the `seq_1_to_10` table without any explicit `CREATE TABLE` statement.
In the latter, user-assisted, discovery the engine does not have enough information to discover the table all on its own. But it can discover the table structure if the user provides certain additional information. In this case, an explicit `CREATE TABLE` statement is still necessary, but it should contain no table structure — only the table name and the table attributes. In MariaDB, the [FederatedX](../federatedx-storage-engine/index) storage engine supports this. When creating a table, one only needs to specify the `CONNECTION` attribute and the table structure — fields and indexes — will be provided automatically by the engine.
### Automatic Discovery
As far as automatic table discovery is concerned, the tables, from the server point of view, may appear, disappear, or change structure anytime. Thus the server needs to be able to ask whether a given table exists and what its structure is. It needs to be notified when a table structure changes outside of the server. And it needs to be able to get a list of all (unknown to the server) tables, for statements like `SHOW TABLES`. The server does all that by invoking specific methods of the `handlerton`:
```
const char **tablefile_extensions;
int (*discover_table_names)(handlerton *hton, LEX_STRING *db, MY_DIR *dir,
discovered_list *result);
int (*discover_table_existence)(handlerton *hton, const char *db,
const char *table_name);
int (*discover_table)(handlerton *hton, THD* thd, TABLE_SHARE *share);
```
#### handlerton::tablefile\_extensions
Engines that store tables in separate files (one table might occupy many files with different extensions, but having the same base file name) should store the list of possible extensions in the **tablefile\_extensions** member of the `handlerton` (earlier this list was returned by the `handler::bas_ext()` method). This will significantly simplify the discovery implementation for these engines, as you will see below.
#### handlerton::discover\_table\_names()
When a user asks for a list of tables in a specific database — for example, by using `SHOW TABLES` or by selecting from `INFORMATION_SCHEMA.TABLES` — the server invokes **discover\_table\_names()** method of the `handlerton`. For convenience this method, besides the database name in question, gets the list of all files in this database directory, so that the engine can look for table files without doing any filesystem i/o. All discovered tables should be added to the `result` collector object. It is defined as
```
class discovered_list
{
public:
bool add_table(const char *tname, size_t tlen);
bool add_file(const char *fname);
};
```
and the engine should call `result->add_table()` or `result->add_file()` for every discovered table (use `add_file()` if the name to add is in the MariaDB file name encoding, and `add_table()` if it's a true table name, as shown in `SHOW TABLES`).
If the engine is file-based, that is, it has non-empty list in the `tablefile_extensions`, this method is optional. For any file-based engine that does not implement `discover_table_names()`, MariaDB will automatically discover the list of all tables of this engine, by looking for files with the extension `tablefile_extensions[0]`.
#### handlerton::discover\_table\_existence()
In some rare cases MariaDB needs to know whether a given table exists, but does not particularly care about this table structure (for example, when executing a `DROP TABLE` statement). In these cases, the server uses the **discover\_table\_existence()** method to find out whether a table with the given name exists in the engine.
This method is optional. For the engine that does not implement it, MariaDB will look for files with the `tablefile_extensions[0]`, if possible. But if the engine is not file-based, MariaDB will use the `discover_table()` method to perform a full table discovery. While this will allow determining correctly whether a table exists, a full discovery is usually slower than the simple existence check. In other words, engines that are not file-based might want to support `discover_table_existence()` method as a useful optimization.
#### handlerton::discover\_table()
This is the main method of table discovery, the heart of it. The server invokes it when it wants to use the table. The **discover\_table()** method gets the `TABLE_SHARE` structure, which is not completely initialized — only the table and the database name (and a path to the table file) are filled in. It should initialize this `TABLE_SHARE` with the desired table structure.
MariaDB provides convenient and easy to use helpers that allow the engine to initialize the `TABLE_SHARE` with minimal efforts. They are the `TABLE_SHARE` methods `init_from_binary_frm_image()` and `init_from_sql_statement_string()`.
#### TABLE\_SHARE::init\_from\_binary\_frm\_image()
This method is used by engines that use "frm shipping" — such as [Archive](../archive/index) or NDB Cluster in MySQL. An frm shipping engine reads the frm file for a given table, exactly as it was generated by the server, and stores it internally. Later it can discover the table structure by using this very frm image. In this sense, a separate frm file in the database directory becomes redundant, because a copy of it is stored in the engine.
#### TABLE\_SHARE::init\_from\_sql\_statement\_string()
This method allows initializing the `TABLE_SHARE` using a conventional SQL `CREATE TABLE` syntax.
#### TABLE\_SHARE::read\_frm\_image()
Engines that use frm shipping need to get the frm image corresponding to a particular table (typically in the `handler::create()` method). They do it via the **read\_frm\_image()** method. It returns an allocated buffer with the binary frm image, that the engine can use the way it needs.
#### TABLE\_SHARE::free\_frm\_image()
The frm image that was returned by `read_frm_image()` must be freed with the **free\_frm\_image()**.
#### HA\_ERR\_TABLE\_DEF\_CHANGED
One of the consequences of automatic discovery is that the table definition might change when the server doesn't expect it to. Between two `SELECT` queries, for example. If this happens, if the engine detects that the server is using an outdated version of the table definition, it should return a **HA\_ERR\_TABLE\_DEF\_CHANGED** handler error. Depending on when in the query processing this error has happened, MariaDB will either re-discover the table and execute the query with the correct table structure, or abort the query and return an error message to the user.
#### TABLE\_SHARE::tabledef\_version
The previous paragraph doesn't cover one important question — how can the engine know that the server uses an outdated table definition? The answer is — by checking the **tabledef\_version**, the table definition version. Every table gets a unique `tabledef_version` value. Normally it is generated automatically when a table is created. When a table is discovered the engine can force it to have a specific `tabledef_version` value (simply by setting it in the `TABLE_SHARE` before calling the `init_from_binary_frm_image()` or `init_from_sql_statement_string()` methods).
Now the engine can compare the table definition version that the server is using (from any handler method it can be accessed as `this->table->s->tabledef_version`) with the version of the actual table definition. If they differ — it is `HA_ERR_TABLE_DEF_CHANGED`.
### Assisted discovery
Assisted discovery is a lot simpler from the server point of view, a lot more controlled. The table cannot appear or disappear at will, one still needs explicit DDL statements to manipulate it. There is only one new handlerton method that the server uses to discover the table structure when a user has issued an explicit `CREATE TABLE` statement without declaring any columns or indexes.
```
int (*discover_table_structure)(handlerton *hton, THD* thd,
TABLE_SHARE *share, HA_CREATE_INFO *info);
```
The assisted discovery API is pretty much independent from the automatic discovery API. An engine can implement either of them or both (or none); there is no requirement to support automatic discovery if only assisted discovery is needed.
#### handlerton::discover\_table\_structure()
Much like the `discover_table()` method, the **discover\_table\_structure()** handlerton method gets a partially initialized `TABLE_SHARE` with the table name, database name, and a path to table files filled in, but without a table structure. Unlike `discover_table()`, here the `TABLE_SHARE` has all the [engine-defined table attributes](../engine-defined-new-tablefieldindex-attributes/index) in the the `TABLE_SHARE::option_struct` structure. Based on the values of these attributes the `discover_table_structure()` method should initialize the `TABLE_SHARE` with the desired set of fields and keys. It can use `TABLE_SHARE` helper methods `init_from_binary_frm_image()` and `init_from_sql_statement_string()` for that.
### The role of `.frm` files
Before table discovery was introduced, MariaDB used `.frm` files to store the table definition. But now the engine can store the table definition (if the engine supports automatic discovery, of course), and `.frm` files become redundant. Still, the server *can* use `.frm` files for such an engine — but they are no longer the only source of the table definition. Now `.frm` files are merely a *cache* of the table definition, while the original authoritative table definition is stored in the engine. Like any cache, its purpose is to reduce discovery attempts for a table. The engine decides whether it makes sense to cache table definition in the `.frm` file or not (see the second argument for the `TABLE_SHARE::init_from_binary_frm_image()`). For example, the [Archive](../archive/index) engine uses `.frm` cache, while the [Sequence](../sequence/index) engine does not. In other words, MariaDB creates `.frm` files for [Archive](../archive/index) tables, but not for [Sequence](../sequence/index) tables.
The cache is completely transparent for a user; MariaDB makes sure that it always stores the actual table definition and invalidates the `.frm` file automatically when it becomes out of date. This can happen, for example, if a user copies a new [Archive](../archive/index) table into the datadir and forgets to delete the `.frm` file of the old table with the same name.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Cassandra Storage Engine Future Plans Cassandra Storage Engine Future Plans
=====================================
CassandraSE is no longer actively being developed and has been removed in [MariaDB 10.6](../what-is-mariadb-106/index). See [MDEV-23024](https://jira.mariadb.org/browse/MDEV-23024).
These are possible future directions for [Cassandra Storage Engine](../cassandra-storage-engine/index). **This is mostly brainstorming, nobody has committed to implementing this**.
Unlike MySQL/MariaDB, Cassandra is not suitable for transaction processing. (the only limited scenario that they handle well is append-only databases)
Instead, they focus on ability to deliver real-time analytics. This is achieved via the following combination:
1. Insert/update operations are reduced to inserting a newer version, their implementation (SSTree) allows to make lots of updates at a low cost
1. The data model is targeted at denormalized data, cassandra docs and user stories all mention the practice of creating/populating a dedicated column family (=table) for each type of query you're going to run.
In other words, Cassandra encourages creation/use of materialized VIEWs. Having lots of materialized VIEWs makes updates expensive, but their low cost and non-conflicting nature should offset that.
How does one use Cassandra together with an SQL database? I can think of these use cases:
use case 1
----------
1. The "OLTP as in SQL" is kept in the SQL database.
2. Data that's too big for SQL database (such as web views, or clicks) is stored in Cassandra, but can also be accessed from SQL.
As an example, one can think of a web shop, which provides real-time peeks into analytics data, like amazon's "people who looked at this item, also looked at ..." , or "\*today\*'s best sellers in this category are ...", etc
Generally, CQL (Cassandra Query Language) allows to query Cassandra's data in an SQL-like fashion.
Access through a storage engine will additionally allow:
1. to get all of the data from one point, instead of rwo
2. joins betwen SQL and Cassandra's data \*might\* be more efficent due to Batched Key Access (this remains to be seen)
3. ??
use case 2
----------
Suppose, all of the system's data is actually stored in an OLTP SQL database.
Cassandra is only used as an accelerator for analytical queries. Cassandra won't allow arbitrary, ad-hoc dss-type queries, it will require the DBA to create and maintain appropriate column families (however, it is supposed to give a nearly-instant answers to analytics-type questions).
Tasks that currently have no apparent solutions:
1. There is no way to replicate data from MySQL/MariaDB into Cassandra. It would be nice if one could update data in MySQL and that would cause appropriate inserts made into all relevant column families in Cassandra.
2. ...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LIKE LIKE
====
Syntax
------
```
expr LIKE pat [ESCAPE 'escape_char']
expr NOT LIKE pat [ESCAPE 'escape_char']
```
Description
-----------
Tests whether *expr* matches the pattern *pat*. Returns either 1 (`TRUE`) or 0 (`FALSE`). Both *expr* and *pat* may be any valid expression and are evaluated to strings. Patterns may use the following wildcard characters:
* `%` matches any number of characters, including zero.
* `_` matches any single character.
Use `NOT LIKE` to test if a string does not match a pattern. This is equivalent to using the `[NOT](../not/index)` operator on the entire `LIKE` expression.
If either the expression or the pattern is `NULL`, the result is `NULL`.
`LIKE` performs case-insensitive substring matches if the collation for the expression and pattern is case-insensitive. For case-sensitive matches, declare either argument to use a binary collation using `[COLLATE](collate)`, or coerce either of them to a `[BINARY](../binary/index)` string using `[CAST](../cast/index)`. Use `[SHOW COLLATION](../show-collation/index)` to get a list of available collations. Collations ending in `_bin` are case-sensitive.
Numeric arguments are coerced to binary strings.
The `_` wildcard matches a single character, not byte. It will only match a multi-byte character if it is valid in the expression's character set. For example, `_` will match `_utf8"€"`, but it will not match `_latin1"€"` because the Euro sign is not a valid latin1 character. If necessary, use `[CONVERT](../convert/index)` to use the expression in a different character set.
If you need to match the characters `_` or `%`, you must escape them. By default, you can prefix the wildcard characters the backslash character `\` to escape them. The backslash is used both to encode special characters like newlines when a string is parsed as well as to escape wildcards in a pattern after parsing. Thus, to match an actual backslash, you sometimes need to double-escape it as `"\``\``\``\"`.
To avoid difficulties with the backslash character, you can change the wildcard escape character using `ESCAPE` in a `LIKE` expression. The argument to `ESCAPE` must be a single-character string.
Examples
--------
Select the days that begin with "T":
```
CREATE TABLE t1 (d VARCHAR(16));
INSERT INTO t1 VALUES
("Monday"), ("Tuesday"), ("Wednesday"),
("Thursday"), ("Friday"), ("Saturday"), ("Sunday");
SELECT * FROM t1 WHERE d LIKE "T%";
```
```
SELECT * FROM t1 WHERE d LIKE "T%";
+----------+
| d |
+----------+
| Tuesday |
| Thursday |
+----------+
```
Select the days that contain the substring "es":
```
SELECT * FROM t1 WHERE d LIKE "%es%";
```
```
SELECT * FROM t1 WHERE d LIKE "%es%";
+-----------+
| d |
+-----------+
| Tuesday |
| Wednesday |
+-----------+
```
Select the six-character day names:
```
SELECT * FROM t1 WHERE d like "___day";
```
```
SELECT * FROM t1 WHERE d like "___day";
+---------+
| d |
+---------+
| Monday |
| Friday |
| Sunday |
+---------+
```
With the default collations, `LIKE` is case-insensitive:
```
SELECT * FROM t1 where d like "t%";
```
```
SELECT * FROM t1 where d like "t%";
+----------+
| d |
+----------+
| Tuesday |
| Thursday |
+----------+
```
Use `[COLLATE](collate)` to specify a binary collation, forcing case-sensitive matches:
```
SELECT * FROM t1 WHERE d like "t%" COLLATE latin1_bin;
```
```
SELECT * FROM t1 WHERE d like "t%" COLLATE latin1_bin;
Empty set (0.00 sec)
```
You can include functions and operators in the expression to match. Select dates based on their day name:
```
CREATE TABLE t2 (d DATETIME);
INSERT INTO t2 VALUES
("2007-01-30 21:31:07"),
("1983-10-15 06:42:51"),
("2011-04-21 12:34:56"),
("2011-10-30 06:31:41"),
("2011-01-30 14:03:25"),
("2004-10-07 11:19:34");
SELECT * FROM t2 WHERE DAYNAME(d) LIKE "T%";
```
```
SELECT * FROM t2 WHERE DAYNAME(d) LIKE "T%";
+------------------+
| d |
+------------------+
| 2007-01-30 21:31 |
| 2011-04-21 12:34 |
| 2004-10-07 11:19 |
+------------------+
3 rows in set, 7 warnings (0.00 sec)
```
Optimizing LIKE
---------------
* MariaDB can use indexes for LIKE on string columns in the case where the LIKE doesn't start with `%` or `_`.
* Starting from [MariaDB 10.0](../what-is-mariadb-100/index), one can set the [optimizer\_use\_condition\_selectivity](../server-system-variables/index#optimizer_use_condition_selectivity) variable to 5. If this is done, then the optimizer will read [optimizer\_selectivity\_sampling\_limit](../server-system-variables/index#optimizer_selectivity_sampling_limit) rows to calculate the selectivity of the LIKE expression before starting to calculate the query plan. This can help speed up some LIKE queries by providing the optimizer with more information about your data.
See Also
--------
* For searches on text columns, with results sorted by relevance, see [full-text](../full-text-indexes/index) indexes.
* For more complex searches and operations on strings, you can use [regular expressions](../regular-expressions-functions/index), which were enhanced in MariaDB 10 (see [PCRE Regular Expressions](../pcre-regular-expressions/index)).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb NTILE NTILE
=====
**MariaDB starting with [10.2](../what-is-mariadb-102/index)**The NTILE() function was first introduced with [window functions](../window-functions/index) in [MariaDB 10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/).
Syntax
------
```
NTILE (expr) OVER (
[ PARTITION BY partition_expression ]
[ ORDER BY order_list ]
)
```
Description
-----------
NTILE() is a [window function](../window-functions/index) that returns an integer indicating which group a given row falls into. The number of groups is specified in the argument (*expr*), starting at one. Ordered rows in the partition are divided into the specified number of groups with as equal a size as possible.
Examples
--------
```
create table t1 (
pk int primary key,
a int,
b int
);
insert into t1 values
(11 , 0, 10),
(12 , 0, 10),
(13 , 1, 10),
(14 , 1, 10),
(18 , 2, 10),
(15 , 2, 20),
(16 , 2, 20),
(17 , 2, 20),
(19 , 4, 20),
(20 , 4, 20);
select pk, a, b,
ntile(1) over (order by pk)
from t1;
+----+------+------+-----------------------------+
| pk | a | b | ntile(1) over (order by pk) |
+----+------+------+-----------------------------+
| 11 | 0 | 10 | 1 |
| 12 | 0 | 10 | 1 |
| 13 | 1 | 10 | 1 |
| 14 | 1 | 10 | 1 |
| 15 | 2 | 20 | 1 |
| 16 | 2 | 20 | 1 |
| 17 | 2 | 20 | 1 |
| 18 | 2 | 10 | 1 |
| 19 | 4 | 20 | 1 |
| 20 | 4 | 20 | 1 |
+----+------+------+-----------------------------+
select pk, a, b,
ntile(4) over (order by pk)
from t1;
+----+------+------+-----------------------------+
| pk | a | b | ntile(4) over (order by pk) |
+----+------+------+-----------------------------+
| 11 | 0 | 10 | 1 |
| 12 | 0 | 10 | 1 |
| 13 | 1 | 10 | 1 |
| 14 | 1 | 10 | 2 |
| 15 | 2 | 20 | 2 |
| 16 | 2 | 20 | 2 |
| 17 | 2 | 20 | 3 |
| 18 | 2 | 10 | 3 |
| 19 | 4 | 20 | 4 |
| 20 | 4 | 20 | 4 |
+----+------+------+-----------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Advanced MariaDB Articles Advanced MariaDB Articles
==========================
Tutorial articles for advanced MariaDB developers and administrators.
| Title | Description |
| --- | --- |
| [Development Articles](../development-articles/index) | Articles of interest to MariaDB developers. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CHAR_LENGTH CHAR\_LENGTH
============
Syntax
------
```
CHAR_LENGTH(str)
CHARACTER_LENGTH(str)
```
Description
-----------
Returns the length of the given string argument, measured in characters. A multi-byte character counts as a single character. This means that for a string containing five two-byte characters, [LENGTH()](../length/index) (or [OCTET\_LENGTH()](../octet_length/index) in [Oracle mode](../sql_modeoracle/index)) returns 10, whereas `CHAR_LENGTH()` returns 5. If the argument is `NULL`, it returns `NULL`.
If the argument is not a string value, it is converted into a string.
It is synonymous with the `CHARACTER_LENGTH()` function.
Examples
--------
```
SELECT CHAR_LENGTH('MariaDB');
+------------------------+
| CHAR_LENGTH('MariaDB') |
+------------------------+
| 7 |
+------------------------+
```
When [Oracle mode](../sql_modeoracle/index) from [MariaDB 10.3](../what-is-mariadb-103/index) is not set:
```
SELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');
+-------------------+--------------+---------------+--------------------+
| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |
+-------------------+--------------+---------------+--------------------+
| 1 | 2 | 2 | 2 |
+-------------------+--------------+---------------+--------------------+
```
In [Oracle mode from MariaDB 10.3](../sql_modeoracle/index#functions):
```
SELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');
+-------------------+--------------+---------------+--------------------+
| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |
+-------------------+--------------+---------------+--------------------+
| 1 | 1 | 2 | 2 |
+-------------------+--------------+---------------+--------------------+
```
See Also
--------
* [LENGTH()](../length/index)
* [LENGTHB()](../lengthb/index)
* [OCTET\_LENGTH()](../octet_length/index)
* [Oracle mode from MariaDB 10.3](../sql_modeoracle/index#simple-syntax-compatibility)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Using CONNECT Using CONNECT
==============
| Title | Description |
| --- | --- |
| [Using CONNECT - General Information](../using-connect-general-information/index) | Using CONNECT - General Information. |
| [Using CONNECT - Virtual and Special Columns](../using-connect-virtual-and-special-columns/index) | Virtual and special columns example usage |
| [Using CONNECT - Importing File Data Into MariaDB Tables](../using-connect-importing-file-data-into-mariadb-tables/index) | Directly using external (file) data has many advantages |
| [Using CONNECT - Exporting Data From MariaDB](../using-connect-exporting-data-from-mariadb/index) | Exporting data from MariaDB with CONNECT |
| [Using CONNECT - Indexing](../using-connect-indexing/index) | Indexing with the CONNECT handler |
| [Using CONNECT - Condition Pushdown](../using-connect-condition-pushdown/index) | Using CONNECT - Condition Pushdown. |
| [USING CONNECT - Offline Documentation](../using-connect-offline-documentation/index) | CONNECT Plugin User Manual. |
| [Using CONNECT - Partitioning and Sharding](../using-connect-partitioning-and-sharding/index) | Partitioning and Sharding with CONNECT |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb About Mroonga About Mroonga
=============
| Mroonga Version | Introduced | Maturity |
| --- | --- | --- |
| 7.07 | [MariaDB 10.2.11](https://mariadb.com/kb/en/mariadb-10211-release-notes/), [MariaDB 10.1.29](https://mariadb.com/kb/en/mariadb-10129-release-notes/) | Stable |
| 5.04 | [MariaDB 10.1.6](https://mariadb.com/kb/en/mariadb-1016-release-notes/) | Stable |
| 5.02 | [MariaDB 10.0.18](https://mariadb.com/kb/en/mariadb-10018-release-notes/), [MariaDB 10.1.5](https://mariadb.com/kb/en/mariadb-1015-release-notes/) | Stable |
| 5.0 | [MariaDB 10.0.17](https://mariadb.com/kb/en/mariadb-10017-release-notes/) | Stable |
| 4.06 | [MariaDB 10.0.15](https://mariadb.com/kb/en/mariadb-10015-release-notes/) | Stable |
Mroonga is a full text search storage engine based on Groonga, which is an open-source CJK-ready (Chinese, Japanese, and Korean) fulltext search engine using column base. See <http://groonga.org> for more.
With Mroonga, you can have a CJK-ready full text search feature, and it is faster than the [MyISAM](../myisam/index) and [InnoDB](../innodb/index) [full text search](../full-text-indexes/index) for both updating and searching.
Mroonga also supports Groonga's fast geolocation search by using MariaDB's geolocation SQL syntax.
Mroonga currently only supports Linux x86\_64 (Intel64/AMD64).
How to Install
--------------
Enable Mroonga with the following statement:
```
INSTALL SONAME 'ha_mroonga';
```
On Debian and Ubuntu mroonga engine will be installed with
```
sudo apt-get install mariadb-plugin-mroonga
```
See [Plugin overview](../plugin-overview/index) for details on installing and uninstalling plugins.
[SHOW ENGINES](../show-engines/index) can be used to check whether Mroonga is installed correctly:
```
SHOW ENGINES;
...
*************************** 8. row ***************************
Engine: Mroonga
Support: YES
Comment: CJK-ready fulltext search, column store
Transactions: NO
XA: NO
Savepoints: NO
...
```
Once the plugin is installed, add a UDF (User-Defined Function) named "last\_insert\_grn\_id", that returns the record ID assigned by groonga in INSERT, by the following SQL.
```
mysql> CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME 'ha_mroonga.so';
```
Limitations
-----------
* The maximum size of a single key is 4096 bytes.
* The maximum size of all keys is 4GB.
* The maximum number of records in a fulltext index is 268,435,455
* The maximum number of distinct terms in a fulltext index is 268,435,455
* The maximum size of a fulltext index is 256GB
Note that the maximum sizes are not hard limits, and may vary according to circumstance.
For more details, see <http://mroonga.org/docs/reference/limitations.html>.
Available Character Sets
------------------------
Mroonga supports a limited number of [character sets](../data-types-character-sets-and-collations/index). These include:
* ASCII
* BINARY
* CP932
* EUCJPMS
* KOI8R
* LATIN1
* SJIS
* UJIS
* UTF8
* UTF8MB4
More Information
----------------
Further documentation for Mroonga can be found at <http://mroonga.org/docs/>
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Date and Time Data Types Date and Time Data Types
=========================
| Title | Description |
| --- | --- |
| [DATE](../date/index) | The date type YYYY-MM-DD. |
| [TIME](../time/index) | Time format HH:MM:SS.ssssss |
| [DATETIME](../datetime/index) | Date and time combination displayed as YYYY-MM-DD HH:MM:SS. |
| [TIMESTAMP](../timestamp/index) | YYYY-MM-DD HH:MM:SS |
| [YEAR Data Type](../year-data-type/index) | A four-digit year. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb ST_NUMGEOMETRIES ST\_NUMGEOMETRIES
=================
Syntax
------
```
ST_NumGeometries(gc)
NumGeometries(gc)
```
Description
-----------
Returns the number of geometries in the GeometryCollection `gc`.
`ST_NumGeometries()` and `NumGeometries()` are synonyms.
Example
-------
```
SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
SELECT NUMGEOMETRIES(GeomFromText(@gc));
+----------------------------------+
| NUMGEOMETRIES(GeomFromText(@gc)) |
+----------------------------------+
| 2 |
+----------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb TIMESTAMP FUNCTION TIMESTAMP FUNCTION
==================
Syntax
------
```
TIMESTAMP(expr), TIMESTAMP(expr1,expr2)
```
Description
-----------
With a single argument, this function returns the date or datetime expression `expr` as a datetime value. With two arguments, it adds the time expression `expr2` to the date or datetime expression `expr1` and returns the result as a datetime value.
Examples
--------
```
SELECT TIMESTAMP('2003-12-31');
+-------------------------+
| TIMESTAMP('2003-12-31') |
+-------------------------+
| 2003-12-31 00:00:00 |
+-------------------------+
SELECT TIMESTAMP('2003-12-31 12:00:00','6:30:00');
+--------------------------------------------+
| TIMESTAMP('2003-12-31 12:00:00','6:30:00') |
+--------------------------------------------+
| 2003-12-31 18:30:00 |
+--------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb QA Metrics QA Metrics
==========
Code coverage
-------------
The gcov/lcov reports are run by BuildBot and can be viewed [here](http://i7.askmonty.org/lcov/). The tests that are run to obtain the coverage percentage are listed under the f\_gcov Factory in the BuildBot configuration file.
Bugs
----
The list of MariaDB bugs is available on [JIRA](https://jira.mariadb.org).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Read-Only Replicas Read-Only Replicas
==================
A common [replication](../standard-replication/index) setup is to have the replicas [read-only](../server-system-variables/index#read_only) to ensure that no one accidentally updates them. If the replica has [binary logging enabled](../setting-up-replication/index) and [gtid\_strict\_mode](../gtid/index#gtid_strict_mode) is used, then any update that causes changes to the [binary log](../binary-log/index) will stop replication.
When the variable `read_only` is set to 1, no updates are permitted except from users with the [SUPER](../grant/index#super) privilege (<= [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)) or [READ ONLY ADMIN](../grant/index#read_only-admin) privilege (>= [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)) or replica servers updating from a primary. Inserting rows to log tables, updates to temporary tables and [OPTIMIZE TABLE](../optimize-table/index) or [ANALYZE TABLE](../analyze-table/index) statements on temporary tables are excluded from this limitation.
If read\_only is set to 1, then the [SET PASSWORD](../set-password/index) statement is limited only to users with the [SUPER](../grant/index#super) privilege (<= [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)) or [READ ONLY ADMIN](../grant/index#read_only-admin) privilege (>= [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)).
Attempting to set the `read_only` variable to 1 will fail if the current session has table locks or transactions pending.
The statement will wait for other sessions that hold table locks. While the attempt to set read\_only is waiting, other requests for table locks or transactions will also wait until read\_only has been set.
From [MariaDB 10.3.19](https://mariadb.com/kb/en/mariadb-10319-release-notes/), some issues related to read only replicas are fixed:
* [CREATE](../create-table/index), [DROP](../drop-table/index), [ALTER](../alter-table/index), [INSERT](../insert/index) and [DELETE](../delete/index) of temporary tables are not logged to binary log, even in [statement](../binary-log-formats/index#statement-based-logging) or [mixed](../binary-log-formats/index#mixed-logging) mode. With earlier MariaDB versions, one can avoid the problem with temporary tables by using [binlog\_format=ROW](../binary-log-formats/index#row-based-logging) in which cases temporary tables are never logged.
* Changes to temporary tables created during `read_only` will not be logged even after `read_only` mode is disabled (for example if the replica is promoted to a primary).
* The admin statements [ANALYZE](../analyze-table/index), [CHECK](../check-table/index), [OPTIMIZE](../optimize-table/index) and [REPAIR](../repair-table/index) will not be logged to the binary log under read-only.
### Older MariaDB Versions
If you are using an older MariaDB version with read-only replicas and binary logging enabled on the replica, and you need to do some changes but don't want to have them logged to the binary log, the easiest way to avoid the logging is to [disable binary logging](../activating-the-binary-log/index) while running as root during maintenance:
```
set sql_log_bin=0;
alter table test engine=rocksdb;
```
The above changes the test table on the replica to rocksdb without registering the change in the binary log.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema ROCKSDB_PERF_CONTEXT_GLOBAL Table Information Schema ROCKSDB\_PERF\_CONTEXT\_GLOBAL Table
=======================================================
The [Information Schema](../information_schema/index) `ROCKSDB_PERF_CONTEXT_GLOBAL` table is included as part of the [MyRocks](../myrocks/index) storage engine and includes global counter information.
The `PROCESS` [privilege](../grant/index) is required to view the table.
It contains the following columns:
| Column | Description |
| --- | --- |
| `STAT_TYPE` | |
| `VALUE` | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InnoDB Lock Modes InnoDB Lock Modes
=================
Locks are acquired by a transaction to prevent concurrent transactions from modifying, or even reading, some rows or ranges of rows. This is done to make sure that concurrent write operations never collide.
[InnoDB](../innodb/index) supports a number of lock modes.
Shared and Exclusive Locks
--------------------------
The two standard row-level locks are *share locks*(S) and *exclusive locks*(X).
A shared lock is obtained to read a row, and allows other transactions to read the locked row, but not to write to the locked row. Other transactions may also acquire their own shared locks.
An exclusive lock is obtained to write to a row, and stops other transactions from locking the same row. It's specific behavior depends on the [isolation level](../set-transaction-isolation-level/index#isolation-level); the default (REPEATABLE READ), allows other transactions to read from the exclusively locked row.
Intention Locks
---------------
InnoDB also permits table locking, and to allow locking at both table and row level to co-exist gracefully, a series of locks called *intention locks* exist.
An *intention shared lock*(IS) indicates that a transaction intends to set a shared lock.
An *intention exclusive lock*(IX) indicates that a transaction intends to set an exclusive lock.
Whether a lock is granted or not can be summarised as follows:
* An X lock is not granted if any other lock (X, S, IX, IS) is held.
* An S lock is not granted if an X or IX lock is held. It is granted if an S or IS lock is held.
* An IX lock is not granted if in X or S lock is held. It is granted if an IX or IS lock is held.
* An IS lock is not granted if an X lock is held. It is granted if an S, IX or IS lock is held.
AUTO\_INCREMENT Locks
---------------------
Locks are also required for auto-increments - see [AUTO\_INCREMENT handling in InnoDB](../auto_increment-handling-in-innodb/index).
Gap Locks
---------
With the default [isolation level](../set-transaction-isolation-level/index#isolation-level), `REPEATABLE READ`, and, until [MariaDB 10.4](../what-is-mariadb-104/index), the default setting of the [innodb\_locks\_unsafe\_for\_binlog](../innodb-system-variables/index#innodb_locks_unsafe_for_binlog) variable, a method called gap locking is used. When InnoDB sets a shared or exclusive lock on a record, it's actually on the index record. Records will have an internal InnoDB index even if they don't have a unique index defined. At the same time, a lock is held on the gap before the index record, so that another transaction cannot insert a new index record in the gap between the record and the preceding record.
The gap can be a single index value, multiple index values, or not exist at all depending on the contents of the index.
If a statement uses all the columns of a unique index to search for unique row, gap locking is not used.
Similar to the shared and exclusive intention locks described above, there can be a number of types of gap locks. These include the shared gap lock, exclusive gap lock, intention shared gap lock and intention exclusive gap lock.
Gap locks are disabled if the [innodb\_locks\_unsafe\_for\_binlog](../innodb-system-variables/index#innodb_locks_unsafe_for_binlog) system variable is set (until [MariaDB 10.4](../what-is-mariadb-104/index)), or the [isolation level](../set-transaction-isolation-level/index#isolation-level) is set to `READ COMMITTED`.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ColumnStore Non-Distributed Post-Processed Functions ColumnStore Non-Distributed Post-Processed Functions
====================================================
ColumnStore supports all MariaDB functions that can be used in a post-processing manner where data is returned by ColumnStore first and then MariaDB executes the function on the data returned. The functions are currently supported only in the projection (SELECT) and ORDER BY portions of the SQL statement.
See also
--------
* [ColumnStore Distributed Functions](../columnstore-distributed-functions/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Orchestrator Overview Orchestrator Overview
=====================
Orchestrator is a MySQL and MariaDB high availability and replication management tool. It is released by Shlomi Noach under the terms of the Apache License, version 2.0.
Orchestrator provides automation for MariaDB replication in the following ways:
* It can be used to perform certain operations, like repairing broken replication or moving a replica from one master to another. These operations can be requested using CLI commands, or via the GUI provided with Orchestrator. The actual commands sent to MariaDB are automated by Orchestrator, and the user doesn't have to worry about the details.
* Orchestrator can also automatically perform a failover in case a master crashes or is unreachable by its replicas. If that is the case, Orchestrator will promote one of the replicas to a master. The replica to promote is chosen based on several criteria, like the server versions, the [binary log](../binary-log/index) formats in use and the datacenters locations.
Note that, if we don't want to use Orchestrator to automate operations, we can still use it as a dynamic inventory. Other tools can use it to obtain a list of existing MariaDB servers via its REST API or CLI commands.
Orchestrator has several big users, listed in the documentation [Users](https://github.com/openark/orchestrator/blob/master/docs/users.md) page. It is also included in the PMM monitoring solution.
To install Orchestrator, see:
* The [install.md](https://github.com/openark/orchestrator/blob/master/docs/install.md) for a manual installation;
* The links in [README.md](https://github.com/openark/orchestrator/blob/master/README.md), to install Orchestrator using automation tools.
Supported Topologies
--------------------
Currently, Orchestrator fully supports MariaDB [GTID](../gtid/index), [replication](../replication/index), and [semi-synchronous replication](../semisynchronous-replication/index). While Orchestrator does not support Galera specific logic, it works with Galera clusters. For details, see [Supported Topologies and Versions](https://github.com/openark/orchestrator/blob/master/docs/supported-topologies-and-versions.md) in Orchestrator documentation.
Architecture
------------
Orchestrator consists of a single executable called `orchestrator`. This is a process that periodically connects to the target servers. It will run SQL queries against target servers, so it needs a user with proper permissions. When the process is running, a GUI is available via a web browser, at the URL '[https://localhost:3000'](#). It also exposes a REST API (see [Using the web API](https://github.com/openark/orchestrator/blob/master/docs/using-the-web-api.md) in the Orchestrator documentation).
Orchestrator expects to find a JSON configuration file called `orchestrator.conf.json`, in `/etc`.
A database is used to store the configuration and the state of the target servers. By default, this is done using built-in SQLite. However, it is possible to use an external MariaDB or MySQL server instance.
If a cluster of Orchestrator instances is running, only one central database is used. One Orchestrator node is active, while the others are passive and are only used for failover. If the active node crashes or becomes unreachable, one of the other nodes becomes the active instance. The `active_node` table shows which node is active. Nodes communicate between them using the Raft protocol.
CLI Examples
------------
As mentioned, Orchestrator can be used from the command-line. Here you can find some examples.
List clusters:
```
orchestrator -c clusters
```
Discover a specified instance and add it to the known topology:
```
orchestrator -c discover -i <host>:<port>
```
Forget about an instance:
```
orchestrator -c topology -i <host>:<port>
```
Move a replica to a different master:
```
orchestrator -c move-up -i <replica-host>:<replica-port> -d <master-host>:<master-port>
```
Move a replica up, so that it becomes a "sibling" of its master:
```
orchestrator -c move-up -i <replica-host>:<replica-port>
```
Move a replica down, so that it becomes a replica of its"sibling":
```
orchestrator -c move-below -i <replica-host>:<replica-port> -d <master-host>:<master-port>
```
Make a node read-only:
```
orchestrator -c set-read-only -i <host>:<port>
```
Make a node writeable:
```
orchestrator -c set-writeable -i <host>:<port>
```
The `--debug` and `--stack` options can be added to the above commands to make them more verbose.
Orchestrator Resources and References
-------------------------------------
* [Orchestrator on GitHub](https://github.com/openark/orchestrator).
* [Documentation](https://github.com/openark/orchestrator/tree/master/docs).
* [Raft consensus protocol website](https://raft.github.io/).
The [README.md](https://github.com/openark/orchestrator/blob/master/README.md) file lists some related community projects, including modules to automate Orchestrator with [Puppet](../automated-mariadb-deployment-and-administration-puppet-and-mariadb/index) and other technologies.
On GitHub you can also find links to projects that allow the use of automation software to deploy and manage Orchestrator.
---
Content initially contributed by [Vettabase Ltd](https://vettabase.com/).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ALTER SERVER ALTER SERVER
============
Syntax
------
```
ALTER SERVER server_name
OPTIONS (option [, option] ...)
```
Description
-----------
Alters the server information for *server\_name*, adjusting the specified options as per the [CREATE SERVER](../create-server/index) command. The corresponding fields in the [mysql.servers table](../mysqlservers-table/index) are updated accordingly. This statement requires the [SUPER](../grant/index#super) privilege or, from [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), the [FEDERATED ADMIN](../grant/index#federated-admin) privilege.
ALTER SERVER is not written to the [binary log](../binary-log/index), irrespective of the [binary log format](../binary-log-formats/index) being used. From [MariaDB 10.1.13](https://mariadb.com/kb/en/mariadb-10113-release-notes/), [Galera](../galera/index) replicates the [CREATE SERVER](../create-server/index), ALTER SERVER and [DROP SERVER](../drop-server/index) statements.
Examples
--------
```
ALTER SERVER s OPTIONS (USER 'sally');
```
See Also
--------
* [CREATE SERVER](../create-server/index)
* [DROP SERVER](../drop-server/index)
* [Spider Storage Engine](../spider/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb EXAMPLE Storage Engine EXAMPLE Storage Engine
======================
The EXAMPLE storage engine was designed as a stub with no functionality primarily to assist developers with the source code for writing new MySQL storage engines.
It is no longer included in MariaDB.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb JSON_CONTAINS_PATH JSON\_CONTAINS\_PATH
====================
**MariaDB starting with [10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/)**JSON functions were added in [MariaDB 10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/).
Syntax
------
```
JSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)
```
Description
-----------
Indicates whether the given JSON document contains data at the specified path or paths. Returns `1` if it does, `0` if not and NULL if any of the arguments are null.
The *return\_arg* can be `one` or `all`:
* `one` - Returns `1` if at least one path exists within the JSON document.
* `all` - Returns `1` only if all paths exist within the JSON document.
Examples
--------
```
SET @json = '{"A": 1, "B": [2], "C": [3, 4]}';
SELECT JSON_CONTAINS_PATH(@json, 'one', '$.A', '$.D');
+------------------------------------------------+
| JSON_CONTAINS_PATH(@json, 'one', '$.A', '$.D') |
+------------------------------------------------+
| 1 |
+------------------------------------------------+
1 row in set (0.00 sec)
SELECT JSON_CONTAINS_PATH(@json, 'all', '$.A', '$.D');
+------------------------------------------------+
| JSON_CONTAINS_PATH(@json, 'all', '$.A', '$.D') |
+------------------------------------------------+
| 0 |
+------------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb MariaDB Source Code Internals MariaDB Source Code Internals
==============================
Articles about MariaDB source code and related internals.
| Title | Description |
| --- | --- |
| [MariaDB Memory Usage](../mariadb-memory-usage/index) | How MariaDB uses memory. |
| [Stored Procedure Internals](../stored-procedure-internals/index) | Internal implementation of MariaDB stored procedures. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb STOP SLAVE STOP SLAVE
==========
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
Syntax
------
```
STOP SLAVE ["connection_name"] [thread_type [, thread_type] ... ] [FOR CHANNEL "connection_name"]
STOP ALL SLAVES [thread_type [, thread_type]]
STOP REPLICA ["connection_name"] [thread_type [, thread_type] ... ] -- from 10.5.1
STOP ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1
thread_type: IO_THREAD | SQL_THREAD
```
Description
-----------
Stops the replica threads. `STOP SLAVE` requires the [SUPER](../grant/index#super) privilege, or, from [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), the [REPLICATION SLAVE ADMIN](../grant/index#replication-slave-admin) privilege.
Like [START SLAVE](../start-slave/index), this statement may be used with the `IO_THREAD` and `SQL_THREAD` options to name the thread or threads to be stopped. In almost all cases, one never need to use the `thread_type` options.
`STOP SLAVE` waits until any current replication event group affecting one or more non-transactional tables has finished executing (if there is any such replication group), or until the user issues a [KILL QUERY](../kill-connection-query/index) or [KILL CONNECTION](../kill-connection-query/index) statement.
Note that `STOP SLAVE` doesn't delete the connection permanently. Next time you execute [START SLAVE](../start-slave/index) or the MariaDB server restarts, the replica connection is restored with it's [original arguments](../change-master-to/index). If you want to delete a connection, you should execute [RESET SLAVE](../reset-slave/index).
#### STOP ALL SLAVES
`STOP ALL SLAVES` stops all your running replicas. It will give you a `note` for every stopped connection. You can check the notes with [SHOW WARNINGS](../show-warnings/index).
#### connection\_name
The `connection_name` option is used for [multi-source replication](../multi-source-replication/index).
If there is only one nameless master, or the default master (as specified by the [default\_master\_connection](../replication-and-binary-log-server-system-variables/index#default_master_connection) system variable) is intended, `connection_name` can be omitted. If provided, the `STOP SLAVE` statement will apply to the specified master. `connection_name` is case-insensitive.
**MariaDB starting with [10.7.0](https://mariadb.com/kb/en/mariadb-1070-release-notes/)**The `FOR CHANNEL` keyword was added for MySQL compatibility. This is identical as using the channel\_name directly after `STOP SLAVE`.
#### STOP REPLICA
**MariaDB starting with [10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)**`STOP REPLICA` is an alias for `STOP SLAVE` from [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/).
See Also
--------
* [CHANGE MASTER TO](../change-master-to/index) is used to create and change connections.
* [START SLAVE](../start-slave/index) is used to start a predefined connection.
* [RESET SLAVE](../reset-slave/index) is used to reset parameters for a connection and also to permanently delete a master connection.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Inserting & Loading Data Inserting & Loading Data
=========================
The `INSERT` statement is the primary SQL statement for adding data into a table in MariaDB.
| Title | Description |
| --- | --- |
| [INSERT](../insert/index) | Insert rows into a table. |
| [INSERT DELAYED](../insert-delayed/index) | Queue row to be inserted when thread is free. |
| [INSERT SELECT](../insert-select/index) | Insert the rows returned by a SELECT into a table |
| [LOAD Data into Tables or Index](../load-data-into-tables-or-index/index) | Loading data quickly into MariaDB |
| [Concurrent Inserts](../concurrent-inserts/index) | Under some circumstances, MyISAM allows INSERTs and SELECTs to be executed concurrently. |
| [HIGH\_PRIORITY and LOW\_PRIORITY](../high_priority-and-low_priority/index) | Modifying statement priority in storage engines supporting table-level locks. |
| [IGNORE](../ignore/index) | Suppress errors while trying to violate a UNIQUE constraint. |
| [INSERT - Default & Duplicate Values](../insert-default-duplicate-values/index) | Default and duplicate values when inserting. |
| [INSERT IGNORE](../insert-ignore/index) | Convert errors to warnings, permitting inserts of additional rows to continue. |
| [INSERT ON DUPLICATE KEY UPDATE](../insert-on-duplicate-key-update/index) | INSERT if no duplicate key is found, otherwise UPDATE. |
| [INSERT...RETURNING](../insertreturning/index) | Returns a resultset of the inserted rows. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CONVERT_TZ CONVERT\_TZ
===========
Syntax
------
```
CONVERT_TZ(dt,from_tz,to_tz)
```
Description
-----------
CONVERT\_TZ() converts a datetime value *dt* from the [time zone](../time-zones/index) given by *from\_tz* to the time zone given by *to\_tz* and returns the resulting value.
In order to use named time zones, such as GMT, MET or Africa/Johannesburg, the time\_zone tables must be loaded (see [mysql\_tzinfo\_to\_sql](../mysql_tzinfo_to_sql/index)).
No conversion will take place if the value falls outside of the supported TIMESTAMP range ('1970-01-01 00:00:01' to '2038-01-19 05:14:07' UTC) when converted from *from\_tz* to UTC.
This function returns NULL if the arguments are invalid (or named time zones have not been loaded).
See [time zones](../time-zones/index) for more information.
Examples
--------
```
SELECT CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00');
+-----------------------------------------------------+
| CONVERT_TZ('2016-01-01 12:00:00','+00:00','+10:00') |
+-----------------------------------------------------+
| 2016-01-01 22:00:00 |
+-----------------------------------------------------+
```
Using named time zones (with the time zone tables loaded):
```
SELECT CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg');
+---------------------------------------------------------------+
| CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg') |
+---------------------------------------------------------------+
| 2016-01-01 14:00:00 |
+---------------------------------------------------------------+
```
The value is out of the TIMESTAMP range, so no conversion takes place:
```
SELECT CONVERT_TZ('1969-12-31 22:00:00','+00:00','+10:00');
+-----------------------------------------------------+
| CONVERT_TZ('1969-12-31 22:00:00','+00:00','+10:00') |
+-----------------------------------------------------+
| 1969-12-31 22:00:00 |
+-----------------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Optimizing Tables Optimizing Tables
==================
Different ways to optimize tables and data on disk
| Title | Description |
| --- | --- |
| [OPTIMIZE TABLE](../optimize-table/index) | Reclaim unused space and defragment data. |
| [ANALYZE TABLE](../analyze-table/index) | Store key distributions for a table. |
| [Choosing the Right Storage Engine](../choosing-the-right-storage-engine/index) | Quickly choose the most suitable storage engine for your needs. |
| [Converting Tables from MyISAM to InnoDB](../converting-tables-from-myisam-to-innodb/index) | Issues when converting tables from MyISAM to InnoDB. |
| [Histogram-Based Statistics](../histogram-based-statistics/index) | Histogram-based statistics can improve the optimizer query plan in certain situations. |
| [Defragmenting InnoDB Tablespaces](../defragmenting-innodb-tablespaces/index) | MariaDB 10.1.1 introduced a feature to defragment InnoDB tablespaces. |
| [Entity-Attribute-Value Implementation](../entity-attribute-value-implementation/index) | A common, poorly performing, design pattern (EAV); plus an alternative |
| [IP Range Table Performance](../ip-range-table-performance/index) | IP Range Table Performance Improvements |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema GLOBAL_VARIABLES and SESSION_VARIABLES Tables Information Schema GLOBAL\_VARIABLES and SESSION\_VARIABLES Tables
==================================================================
The [Information Schema](../information_schema/index) `GLOBAL_VARIABLES` and `SESSION_VARIABLES` tables stores a record of all [system variables](../server-system-variables/index) and their global and session values respectively. This is the same information as displayed by the `[SHOW VARIABLES](../show-variables/index)` commands `SHOW GLOBAL VARIABLES` and `SHOW SESSION VARIABLES`.
It contains the following columns:
| Column | Description |
| --- | --- |
| `VARIABLE_NAME` | System variable name. |
| `VARIABLE_VALUE` | Global or session value. |
Example
-------
```
SELECT * FROM information_schema.GLOBAL_VARIABLES ORDER BY VARIABLE_NAME\G
*************************** 1. row *****************************
VARIABLE_NAME: ARIA_BLOCK_SIZE
VARIABLE_VALUE: 8192
*************************** 2. row *****************************
VARIABLE_NAME: ARIA_CHECKPOINT_LOG_ACTIVITY
VARIABLE_VALUE: 1048576
*************************** 3. row *****************************
VARIABLE_NAME: ARIA_CHECKPOINT_INTERVAL
VARIABLE_VALUE: 30
...
*************************** 455. row ***************************
VARIABLE_NAME: VERSION_COMPILE_MACHINE
VARIABLE_VALUE: x86_64
*************************** 456. row ***************************
VARIABLE_NAME: VERSION_COMPILE_OS
VARIABLE_VALUE: debian-linux-gnu
*************************** 457. row ***************************
VARIABLE_NAME: WAIT_TIMEOUT
VARIABLE_VALUE: 600
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema INNODB_BUFFER_POOL_PAGES_INDEX Table Information Schema INNODB\_BUFFER\_POOL\_PAGES\_INDEX Table
===========================================================
The [Information Schema](../information_schema/index) `INNODB_BUFFER_POOL_PAGES` table is a Percona enhancement, and is only available for XtraDB, not InnoDB (see [XtraDB and InnoDB](../xtradb-and-innodb/index)). It contains information about [buffer pool](../xtradbinnodb-memory-buffer/index) index pages.
It has the following columns:
| Column | Description |
| --- | --- |
| `INDEX_ID` | Index name |
| `SPACE_ID` | Tablespace ID |
| `PAGE_NO` | Page offset within tablespace. |
| `N_RECS` | Number of user records on the page. |
| `DATA_SIZE` | Total data size in bytes of records in the page. |
| `HASHED` | `1` if the block is in the adaptive hash index, `0` if not. |
| `ACCESS_TIME` | Page's last access time. |
| `MODIFIED` | `1` if the page has been modified since being loaded, `0` if not. |
| `DIRTY` | `1` if the page has been modified since it was last flushed, `0` if not |
| `OLD` | `1` if the page in the in the *old* blocks of the LRU (least-recently-used) list, `0` if not. |
| `LRU_POSITION` | Position in the LRU (least-recently-used) list. |
| `FIX_COUNT` | Page reference count, incremented each time the page is accessed. `0` if the page is not currently being accessed. |
| `FLUSH_TYPE` | Flush type of the most recent flush.`0` (LRU), `2` (flush\_list) |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb AsText AsText
======
A synonym for [ST\_AsText()](../st_astext/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Buildbot Setup for Virtual Machines - Debian 5 amd64 Buildbot Setup for Virtual Machines - Debian 5 amd64
=====================================================
Download netinst CD image debian-503-amd64-netinst.iso
```
cd /kvm/vms
qemu-img create -f qcow2 vm-debian5-amd64-serial.qcow2 8G
kvm -m 2047 -hda /kvm/vms/vm-debian5-amd64-serial.qcow2 -cdrom /kvm/debian-503-amd64-netinst.iso -redir 'tcp:2234::22' -boot d -smp 2 -cpu qemu64 -net nic,model=virtio -net user
```
Serial console and account setup
--------------------------------
From base install, setup for serial port, and setup accounts for passwordless ssh login and sudo:
```
kvm -m 2047 -hda /kvm/vms/vm-debian5-amd64-serial.qcow2 -redir 'tcp:2234::22' -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user
su
apt-get install sudo openssh-server
visudo
# uncomment %sudo ALL=NOPASSWD: ALL
# add user account to group sudo `addgroup <USER> sudo`.
# Copy in public ssh key.
# Add in /etc/inittab:
S0:2345:respawn:/sbin/getty -L ttyS0 19200 vt100
```
Add to /boot/grub/menu.lst:
```
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=3 serial console
```
also add in menu.lst to kernel line (after removing `quiet splash'):
```
console=tty0 console=ttyS0,115200n8
```
Add user buildbot, with disabled password. Add as sudo, and add ssh key.
```
sudo adduser --disabled-password buildbot
sudo adduser buildbot sudo
sudo su - buildbot
mkdir .ssh
# Add all necessary keys.
cat >.ssh/authorized_keys
chmod -R go-rwx .ssh
```
VM for building .deb
--------------------
```
qemu-img create -b vm-debian5-amd64-serial.qcow2 -f qcow2 vm-debian5-amd64-build.qcow2
kvm -m 2047 -hda /kvm/vms/vm-debian5-amd64-build.qcow2 -redir 'tcp:2234::22' -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
sudo apt-get build-dep mysql-server-5.0
sudo apt-get install devscripts hardening-wrapper doxygen texlive-latex-base ghostscript libevent-dev libssl-dev zlib1g-dev libreadline5-dev
```
VM for install testing
----------------------
```
qemu-img create -b vm-debian5-amd64-serial.qcow2 -f qcow2 vm-debian5-amd64-install.qcow2
kvm -m 2047 -hda /kvm/vms/vm-debian5-amd64-install.qcow2 -redir 'tcp:2234::22' -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
# No packages mostly!
sudo apt-get install debconf-utils
cat >>/etc/apt/sources.list <<END
deb file:///home/buildbot/buildbot/debs binary/
deb-src file:///home/buildbot/buildbot/debs source/
END
sudo debconf-set-selections /tmp/my.seed
```
See the [General Principles](../buildbot-setup-for-virtual-machines-general-principles/index) article for how to make the '`my.seed`' file.
VM for upgrade testing
----------------------
```
qemu-img create -b vm-debian5-amd64-install.qcow2 -f qcow2 vm-debian5-amd64-upgrade.qcow2
kvm -m 2047 -hda /kvm/vms/vm-debian5-amd64-upgrade.qcow2 -redir 'tcp:2234::22' -boot c -smp 2 -cpu qemu64 -net nic,model=virtio -net user -nographic
sudo apt-get install mysql-server-5.0
mysql -uroot -prootpass -e "create database mytest; use mytest; create table t(a int primary key); insert into t values (1); select * from t"
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema COLUMN_PRIVILEGES Table Information Schema COLUMN\_PRIVILEGES Table
===========================================
The [Information Schema](../information_schema/index) `COLUMN_PRIVILEGES` table contains column privilege information derived from the `[mysql.columns\_priv](../mysqlcolumns_priv-table/index)` grant table.
It has the following columns:
| Column | Description |
| --- | --- |
| `GRANTEE` | In the format `user_name@host_name`. |
| `TABLE_CATALOG` | Always `def`. |
| `TABLE_SCHEMA` | Database name. |
| `TABLE_NAME` | Table name. |
| `COLUMN_NAME` | Column name. |
| `PRIVILEGE_TYPE` | One of `SELECT`, `INSERT`, `UPDATE` or `REFERENCES`. |
| `IS_GRANTABLE` | Whether the user has the `[GRANT OPTION](../grant/index#the-grant-option-privilege)` for this privilege. |
Similar information can be accessed with the `[SHOW FULL COLUMNS](../show-columns/index)` and `[SHOW GRANTS](../show-grants/index)` statements. See the `[GRANT](../grant/index)` article for more about privileges.
This information is also stored in the `[columns\_priv](../mysqlcolumns_priv-table/index)` table, in the `mysql` system database.
For a description of the privileges that are shown in this table, see [column privileges](../grant/index#column-privileges).
Example
-------
In the following example, no column-level privilege has been explicitly assigned:
```
SELECT * FROM information_schema.COLUMN_PRIVILEGES;
Empty set
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb optimizer_switch optimizer\_switch
=================
[optimizer\_switch](../server-system-variables/index#optimizer_switch) is a server variable that one can use to enable/disable specific optimizations.
### Syntax
To set or unset the various optimizations, use the following syntax:
```
SET [GLOBAL|SESSION] optimizer_switch='cmd[,cmd]...';
```
The *cmd* takes the following format:
| Syntax | Description |
| --- | --- |
| default | Reset all optimizations to their default values. |
| optimization\_name=default | Set the specified optimization to its default value. |
| optimization\_name=on | Enable the specified optimization. |
| optimization\_name=off | Disable the specified optimization. |
There is no need to list all flags - only those that are specified in the command will be affected.
### Available Flags
Below is a list of all *optimizer\_switch* flags available in MariaDB:
| Flag and MariaDB default | Supported in MariaDB since | Supported in MySQL since |
| --- | --- | --- |
| condition\_pushdown\_for\_derived=on | [MariaDB 10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/) | - |
| [condition\_pushdown\_for\_subquery=on](../condition-pushdown-into-in-subqueries/index) | [MariaDB 10.4.0](https://mariadb.com/kb/en/mariadb-1040-release-notes/) | - |
| condition\_pushdown\_from\_having=on | [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/) | - |
| [derived\_merge=on](../derived-table-merge-optimization/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.7 |
| [derived\_with\_keys](../derived-table-with-key-optimization/index)=on | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| default | [MariaDB 5.1](../what-is-mariadb-51/index) | MySQL 5.1 |
| engine\_condition\_pushdown=off | [MariaDB 5.5](../what-is-mariadb-55/index) (deprecated in 10.1) | MySQL 5.5 |
| [exists\_to\_in=on](../exists-to-in-optimization/index) | [MariaDB 10.0](../what-is-mariadb-100/index) | - |
| [extended\_keys=on](../extended-keys/index) | [MariaDB 5.5.21](https://mariadb.com/kb/en/mariadb-5521-release-notes/) | - |
| [firstmatch=on](../firstmatch-strategy/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| [index\_condition\_pushdown=on](../index-condition-pushdown/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| index\_merge=on | [MariaDB 5.1](../what-is-mariadb-51/index) | MySQL 5.1 |
| index\_merge\_intersection=on | [MariaDB 5.1](../what-is-mariadb-51/index) | MySQL 5.1 |
| [index\_merge\_sort\_intersection=off](../index_merge_sort_intersection/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| index\_merge\_sort\_union=on | [MariaDB 5.1](../what-is-mariadb-51/index) | MySQL 5.1 |
| index\_merge\_union=on# | [MariaDB 5.1](../what-is-mariadb-51/index) | MySQL 5.1 |
| [in\_to\_exists=on](../non-semi-join-subquery-optimizations/index#the-in-to-exists-transformation) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [join\_cache\_bka=on](../block-based-join-algorithms/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [join\_cache\_hashed=on](../block-based-join-algorithms/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [join\_cache\_incremental=on](../block-based-join-algorithms/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [loosescan=on](../loosescan-strategy/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| materialization=on ([semi-join](../semi-join-materialization-strategy/index), [non-semi-join](../non-semi-join-subquery-optimizations/index#materialization-for-non-correlated-in-subqueries)) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| [mrr=off](../multi-range-read-optimization/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| [mrr\_cost\_based=off](../multi-range-read-optimization/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| [mrr\_sort\_keys=off](../multi-range-read-optimization/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [not\_null\_range\_scan=off](../not_null_range_scan-optimization/index) | [MariaDB 10.5](../what-is-mariadb-105/index) | - |
| [optimize\_join\_buffer\_size=on](../block-based-join-algorithms/index) | [MariaDB 5.3](../what-is-mariadb-53/index), Defaults to ON from [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/) | - |
| [orderby\_uses\_equalities=on](../improvements-to-order-by/index) | [MariaDB 10.1.15](https://mariadb.com/kb/en/mariadb-10115-release-notes/) | - |
| [outer\_join\_with\_cache=on](../block-based-join-algorithms/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [partial\_match\_rowid\_merge=on](../non-semi-join-subquery-optimizations/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [partial\_match\_table\_scan=on](../non-semi-join-subquery-optimizations/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| reorder | [MariaDB 10.7](../what-is-mariadb-107/index) | - |
| [rowid\_filter=on](../rowid-filtering-optimization/index) | [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/) | - |
| [semijoin=on](../semi-join-subquery-optimizations/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | MySQL 5.6 |
| [semijoin\_with\_cache=on](../block-based-join-algorithms/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [split\_materialized=on](https://jira.mariadb.org/browse/MDEV-13369)[[1](#_note-0)] | [MariaDB 10.3.4](https://mariadb.com/kb/en/mariadb-1034-release-notes/) | - |
| [subquery\_cache=on](../subquery-cache/index) | [MariaDB 5.3](../what-is-mariadb-53/index) | - |
| [table\_elimination=on](../table-elimination-user-interface/index) | [MariaDB 5.1](../what-is-mariadb-51/index) | - |
1. [↑](#_ref-0) replaced [split\_grouping\_derived](https://github.com/MariaDB/server/commit/b14e2b044b), introduced in [MariaDB 10.3.1](https://mariadb.com/kb/en/mariadb-1031-release-notes/)
### Defaults
| From version | Default optimizer\_switch setting |
| --- | --- |
| [MariaDB 10.5.0](https://mariadb.com/kb/en/mariadb-1050-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=on, table\_elimination=on, extended\_keys=on, exists\_to\_in=on, orderby\_uses\_equalities=on, condition\_pushdown\_for\_derived=on, split\_materialized=on, condition\_pushdown\_for\_subquery=on, rowid\_filter=on,condition\_pushdown\_from\_having=on, not\_null\_range\_scan=off |
| [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=on, table\_elimination=on, extended\_keys=on, exists\_to\_in=on, orderby\_uses\_equalities=on, condition\_pushdown\_for\_derived=on, split\_materialized=on, condition\_pushdown\_for\_subquery=on, rowid\_filter=on,condition\_pushdown\_from\_having=on |
| [MariaDB 10.4.0](https://mariadb.com/kb/en/mariadb-1040-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=on, exists\_to\_in=on, orderby\_uses\_equalities=on, condition\_pushdown\_for\_derived=on, split\_materialized=on, condition\_pushdown\_for\_subquery=on |
| [MariaDB 10.3.4](https://mariadb.com/kb/en/mariadb-1034-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=on, exists\_to\_in=on, orderby\_uses\_equalities=on, condition\_pushdown\_for\_derived=on, split\_materialized=on |
| [MariaDB 10.2.2](https://mariadb.com/kb/en/mariadb-1022-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=on, exists\_to\_in=on, orderby\_uses\_equalities=on, condition\_pushdown\_for\_derived=on |
| [MariaDB 10.1.15](https://mariadb.com/kb/en/mariadb-10115-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=on, exists\_to\_in=on, orderby\_uses\_equalities=off |
| [MariaDB 10.0.12](https://mariadb.com/kb/en/mariadb-10012-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=on, exists\_to\_in=on |
| [MariaDB 10.0.9](https://mariadb.com/kb/en/mariadb-1009-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=on, exists\_to\_in=off |
| [MariaDB 10.0.2](https://mariadb.com/kb/en/mariadb-1002-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=off, exists\_to\_in=off |
| [MariaDB 5.5.21](https://mariadb.com/kb/en/mariadb-5521-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on, extended\_keys=off |
| [MariaDB 5.5.20](https://mariadb.com/kb/en/mariadb-5520-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, engine\_condition\_pushdown=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on |
| [MariaDB 5.3.3](https://mariadb.com/kb/en/mariadb-533-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, index\_condition\_pushdown=on, derived\_merge=on, derived\_with\_keys=on, firstmatch=on, loosescan=on, materialization=on, in\_to\_exists=on, semijoin=on, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=on, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=on, semijoin\_with\_cache=on, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on |
| [MariaDB 5.3.0](https://mariadb.com/kb/en/mariadb-530-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on, index\_merge\_sort\_intersection=off, index\_condition\_pushdown=off, derived\_merge=off, derived\_with\_keys=off, firstmatch=off, loosescan=off, materialization=off, in\_to\_exists=on, semijoin=off, partial\_match\_rowid\_merge=on, partial\_match\_table\_scan=on, subquery\_cache=off, mrr=off, mrr\_cost\_based=off, mrr\_sort\_keys=off, outer\_join\_with\_cache=off, semijoin\_with\_cache=off, join\_cache\_incremental=on, join\_cache\_hashed=on, join\_cache\_bka=on, optimize\_join\_buffer\_size=off, table\_elimination=on |
| < [MariaDB 5.3.0](https://mariadb.com/kb/en/mariadb-530-release-notes/) | index\_merge=on, index\_merge\_union=on, index\_merge\_sort\_union=on, index\_merge\_intersection=on |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Performance Schema events_waits_summary_by_host_by_event_name Table Performance Schema events\_waits\_summary\_by\_host\_by\_event\_name Table
==========================================================================
The [Performance Schema](../performance-schema/index) `events_waits_summary_by_host_by_event_name` table contains wait events summarized by host and event name. It contains the following columns:
| Column | Description |
| --- | --- |
| `HOST` | Host. Used together with `EVENT_NAME` for grouping events. |
| `EVENT_NAME` | Event name. Used together with `USER` and `HOST` for grouping events. |
| `COUNT_STAR` | Number of summarized events |
| `SUM_TIMER_WAIT` | Total wait time of the summarized events that are timed. |
| `MIN_TIMER_WAIT` | Minimum wait time of the summarized events that are timed. |
| `AVG_TIMER_WAIT` | Average wait time of the summarized events that are timed. |
| `MAX_TIMER_WAIT` | Maximum wait time of the summarized events that are timed. |
The `*_TIMER_WAIT` columns only calculate results for timed events, as non-timed events have a `NULL` wait time.
Example
-------
```
SELECT * FROM events_waits_summary_by_host_by_event_name\G
...
*************************** 610. row ***************************
HOST: NULL
EVENT_NAME: wait/io/socket/sql/server_unix_socket
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 611. row ***************************
HOST: NULL
EVENT_NAME: wait/io/socket/sql/client_connection
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
*************************** 612. row ***************************
HOST: NULL
EVENT_NAME: idle
COUNT_STAR: 0
SUM_TIMER_WAIT: 0
MIN_TIMER_WAIT: 0
AVG_TIMER_WAIT: 0
MAX_TIMER_WAIT: 0
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb GIS features in 5.3.3 GIS features in 5.3.3
=====================
Basic information about the existing spatial features can be found in the [Geographic Features](../geographic-features/index) section of the Knowlegebase. The [Spatial Extensions page of the MySQL manual](http://dev.mysql.com/doc/refman/5.6/en/spatial-extensions.html) also applies to MariaDB.
The [MariaDB 5.3.3](https://mariadb.com/kb/en/mariadb-533-release-notes/) release , contains code improving the spatial functionality in MariaDB.
MySQL operates on spatial data based on the OpenGIS standards, particularly the [OpenGIS SFS](http://www.opengeospatial.org/standards/sfs) (Simple feature access, SQL option).
Initial support was based on version 05-134 of the standard. MariaDB implements a subset of the 'SQL with Geometry Types' environment proposed by the OGC. And the SQL environment was extended with a set of geometry types.
MariaDB supports spatial extensions to operate on spatial features. These features are available for [Aria](../aria/index), [MyISAM](../myisam/index), [InnoDB](../innodb/index), NDB, and [ARCHIVE](../archive/index) tables.
For spatial columns, Aria and MyISAM supports both [SPATIAL](../spatial-indexes/index) and non-SPATIAL indexes. Other storage engines support non-SPATIAL indexes.
The most recent changes in the code are aimed at meeting the OpenGIS requirements. One thing missed in previous versions is that the functions which check spatial relations didn't consider the actual shape of an object, instead they operate only on their bounding rectangles. These legacy functions have been left as they are and new, properly-working functions are named with an '`ST_`' prefix, in accordance with the latest OpenGIS requirements. Also, operations over geometry features were added.
The list of new functions:
Spatial operators. They produce new geometries.
| Name | Description |
| --- | --- |
| [ST\_UNION(A, B)](../st_union/index) | union of A and B |
| [ST\_INTERSECTION(A, B)](../st_intersection/index) | intersection of A and B |
| [ST\_SYMDIFFERENCE(A, B)](../st_symdifference/index) | symdifference, notintersecting parts of A and B |
| [ST\_BUFFER(A, radius)](../st_buffer/index) | returns the shape of the area that lies in 'radius' distance from the shape A. |
Predicates, return boolean result of the relationship
| Name | Description |
| --- | --- |
| [ST\_INTERSECTS(A, B)](../st_intersects/index) | if A and B have an intersection |
| [ST\_CROSSES(A, B)](../st_crosses/index) | if A and B cross |
| [ST\_EQUALS(A, B)](../st_equals/index) | if A and B are equal |
| [ST\_WITHIN(A, B)](../st_within/index) | if A lies within B |
| [ST\_CONTAINS(A,B)](../st_contains/index) | if B lies within A |
| [ST\_DISJOINT(A,B)](../st_disjoint/index) | if A and B have no intersection |
| [ST\_TOUCHES(A,B)](../st_touches/index) | if A touches B |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema replication_applier_status_by_worker Table Performance Schema replication\_applier\_status\_by\_worker Table
=================================================================
**MariaDB starting with [10.6.0](https://mariadb.com/kb/en/mariadb-1060-release-notes/)**The `replication_applier_status_by_worker` table was added in [MariaDB 10.6.0](https://mariadb.com/kb/en/mariadb-1060-release-notes/).
The [Performance Schema](../performance-schema/index) replication\_applier\_status\_by\_worker table displays replica worker thread specific information.
It contains the following fields.
| Column | Description |
| --- | --- |
| CHANNEL\_NAME | Name of replication channel through which the transaction is received. |
| THREAD\_ID | Thread\_Id as displayed in the [performance\_schema.threads](../performance-schema-threads-table/index) table for thread with name 'thread/sql/rpl\_parallel\_thread'. THREAD\_ID will be NULL when worker threads are stopped due to error/force stop. |
| SERVICE\_STATE | Whether or not the thread is running. |
| LAST\_SEEN\_TRANSACTION | Last GTID executed by worker |
| LAST\_ERROR\_NUMBER | Last Error that occurred on a particular worker. |
| LAST\_ERROR\_MESSAGE | Last error specific message. |
| LAST\_ERROR\_TIMESTAMP | Time stamp of last error. |
| WORKER\_IDLE\_TIME | Total idle time in seconds that the worker thread has spent waiting for work from SQL thread. |
| LAST\_TRANS\_RETRY\_COUNT | Total number of retries attempted by last transaction. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LINESTRING LINESTRING
==========
Syntax
------
```
LineString(pt1,pt2,...)
```
Description
-----------
Constructs a [WKB](../wkb/index) LineString value from a number of WKB [Point](../point/index) arguments. If any argument is not a WKB Point, the return value is `NULL`. If the number of [Point](../point/index) arguments is less than two, the return value is `NULL`.
Examples
--------
```
SET @ls = 'LineString(1 1,2 2,3 3)';
SELECT AsText(EndPoint(GeomFromText(@ls)));
+-------------------------------------+
| AsText(EndPoint(GeomFromText(@ls))) |
+-------------------------------------+
| POINT(3 3) |
+-------------------------------------+
CREATE TABLE gis_line (g LINESTRING);
INSERT INTO gis_line VALUES
(LineFromText('LINESTRING(0 0,0 10,10 0)')),
(LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_UNION ST\_UNION
=========
Syntax
------
```
ST_UNION(g1,g2)
```
Description
-----------
Returns a geometry that is the union of the geometry *`g1`* and geometry *`g2`*.
Examples
--------
```
SET @g1 = GEOMFROMTEXT('POINT (0 2)');
SET @g2 = GEOMFROMTEXT('POINT (2 0)');
SELECT ASTEXT(ST_UNION(@g1,@g2));
+---------------------------+
| ASTEXT(ST_UNION(@g1,@g2)) |
+---------------------------+
| MULTIPOINT(2 0,0 2) |
+---------------------------+
```
```
SET @g1 = GEOMFROMTEXT('POLYGON((0 0,0 3,3 3,3 0,0 0))');
SET @g2 = GEOMFROMTEXT('POLYGON((2 2,4 2,4 4,2 4,2 2))');
SELECT ASTEXT(ST_UNION(@g1,@g2));
+------------------------------------------------+
| ASTEXT(ST_UNION(@g1,@g2)) |
+------------------------------------------------+
| POLYGON((0 0,0 3,2 3,2 4,4 4,4 2,3 2,3 0,0 0)) |
+------------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Exploring Early Database Models Exploring Early Database Models
===============================
Before the advent of databases, the only way to store data was from unrelated files. Programmers had to go to great lengths to extract the data, and their programs had to perform complex parsing and relating.
Languages such as Perl, with its powerful regular expressions ideal for processing text, have made the job a lot easier than before; however, accessing the data from files is still a challenging task. Without a standard way to access data, systems are more prone to errors, are slower to develop, and are more difficult to maintain. Data redundancy (where data is duplicated unnecessarily) and poor data integrity (where data is not changed in all locations, leading to wrong or outdated data being supplied) are frequent consequences of the file access method of data storage. For these reasons, database management systems (DBMSs) were developed to provide a standard and reliable way to access and update data. They provide an intermediary layer between the application and the data, and the programmer is able to concentrate on developing the application, rather than worrying about data access issues.
A *database model* is a logical model concerned with how the data is represented. Instead of database designers worrying about the physical storage of data, the database model allows them to look at a higher, more conceptual level, reducing the gap between the real-world problem for which the application is being developed and the technical implementation.
There are a number of database models. The next two articles cover two common models; the [hierarchical database model](../understanding-the-hierarchical-database-model/index) and the [network database model](../understanding-the-network-database-model/index). After that comes the one MariaDB, along with most modern DBMSs uses, the relational model.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Condition Pushdown Into IN subqueries Condition Pushdown Into IN subqueries
=====================================
This article describes Condition Pushdown into IN subqueries as implemented in [MDEV-12387](https://jira.mariadb.org/browse/MDEV-12387).
[optimizer\_switch](../optimizer-switch/index) flag name: `condition_pushdown_for_subquery`.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb InnoDB Online DDL Overview InnoDB Online DDL Overview
==========================
InnoDB tables support online DDL, which permits concurrent DML and uses optimizations to avoid unnecessary table copying.
The [ALTER TABLE](../alter-table/index) statement supports two clauses that are used to implement online DDL:
* [ALGORITHM](../alter-table/index#algorithm) - This clause controls how the DDL operation is performed.
* [LOCK](../alter-table/index#lock) - This clause controls how much concurrency is allowed while the DDL operation is being performed.
Alter Algorithms
----------------
InnoDB supports multiple algorithms for performing DDL operations. This offers a significant performance improvement over previous versions. The supported algorithms are:
* `DEFAULT` - This implies the default behavior for the specific operation.
* `COPY`
* `INPLACE`
* `NOCOPY` - This was added in [MariaDB 10.3.7](https://mariadb.com/kb/en/mariadb-1037-release-notes/).
* `INSTANT` - This was added in [MariaDB 10.3.7](https://mariadb.com/kb/en/mariadb-1037-release-notes/).
Specifying an Alter Algorithm
-----------------------------
The set of alter algorithms can be considered as a hierarchy. The hierarchy is ranked in the following order, with *least efficient* algorithm at the top, and *most efficient* algorithm at the bottom:
* `COPY`
* `INPLACE`
* `NOCOPY`
* `INSTANT`
When a user specifies an alter algorithm for a DDL operation, MariaDB does not necessarily use that specific algorithm for the operation. It interprets the choice in the following way:
* If the user specifies `COPY`, then InnoDB uses the `COPY` algorithm.
* If the user specifies any other algorithm, then InnoDB interprets that choice as the *least efficient* algorithm that the user is willing to accept. This means that if the user specifies `INPLACE`, then InnoDB will use the *most efficient* algorithm supported by the specific operation from the set (`INPLACE`, `NOCOPY`, `INSTANT`). Likewise, if the user specifies `NOCOPY`, then InnoDB will use the *most efficient* algorithm supported by the specific operation from the set (`NOCOPY`, `INSTANT`).
There is also a special value that can be specified:
* If the user specifies `DEFAULT`, then InnoDB uses its default choice for the operation. The default choice is to use the most efficient algorithm supported by the operation. The default choice will also be used if no algorithm is specified. Therefore, if you want InnoDB to use the most efficient algorithm supported by an operation, then you usually do not have to explicitly specify any algorithm at all.
### Specifying an Alter Algorithm Using the ALGORITHM Clause
InnoDB supports the [ALGORITHM](../alter-table/index#algorithm) clause.
The [ALGORITHM](../alter-table/index#algorithm) clause can be used to specify the *least efficient* algorithm that the user is willing to accept. It is supported by the [ALTER TABLE](../alter-table/index) and [CREATE INDEX](../create-index/index) statements.
For example, if a user wanted to add a column to a table, but only if the operation used an algorithm that is at least as efficient as the `INPLACE`, then they could execute the following:
```
CREATE OR REPLACE TABLE tab (
a int PRIMARY KEY,
b varchar(50)
);
ALTER TABLE tab ADD COLUMN c varchar(50), ALGORITHM=INPLACE;
```
In [MariaDB 10.3](../what-is-mariadb-103/index) and later, the above operation would actually use the `INSTANT` algorithm, because the `ADD COLUMN` operation supports the `INSTANT` algorithm, and the `INSTANT` algorithm is more efficient than the `INPLACE` algorithm.
### Specifying an Alter Algorithm Using System Variables
**MariaDB starting with [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and later, the [alter\_algorithm](../server-system-variables/index#alter_algorithm) system variable can be used to pick the *least efficient* algorithm that the user is willing to accept.
For example, if a user wanted to add a column to a table, but only if the operation used an algorithm that is at least as efficient as the `INPLACE`, then they could execute the following:
```
CREATE OR REPLACE TABLE tab (
a int PRIMARY KEY,
b varchar(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD COLUMN c varchar(50);
```
In [MariaDB 10.3](../what-is-mariadb-103/index) and later, the above operation would actually use the `INSTANT` algorithm, because the `ADD COLUMN` operation supports the `INSTANT` algorithm, and the `INSTANT` algorithm is more efficient than the `INPLACE` algorithm.
**MariaDB until [10.2](../what-is-mariadb-102/index)**In [MariaDB 10.2](../what-is-mariadb-102/index) and before, the [old\_alter\_table](../server-system-variables/index#old_alter_table) system variable can be used to specify whether the `COPY` algorithm should be used.
For example, if a user wanted to add a column to a table, but they wanted to use the `COPY` algorithm instead of the default algorithm for the operation, then they could execute the following:
```
CREATE OR REPLACE TABLE tab (
a int PRIMARY KEY,
b varchar(50)
);
SET SESSION old_alter_table=1;
ALTER TABLE tab ADD COLUMN c varchar(50);
```
Supported Alter Algorithms
--------------------------
The supported algorithms are described in more details below.
### DEFAULT Algorithm
The default behavior, which occurs if `ALGORITHM=DEFAULT` is specified, or if `ALGORITHM` is not specified at all, usually only makes a copy if the operation doesn't support being done in-place at all. In this case, the *most efficient* available algorithm will usually be used.
This means that, if an operation supports the `INSTANT` algorithm, then it will use that algorithm by default. If an operation does not support the `INSTANT` algorithm, but it does support the `NOCOPY` algorithm, then it will use that algorithm by default. If an operation does not support the `NOCOPY` algorithm, but it does support the `INPLACE` algorithm, then it will use that algorithm by default.
### COPY Algorithm
The `COPY` algorithm refers to the original [ALTER TABLE](../alter-table/index) algorithm.
When the `COPY` algorithm is used, MariaDB essentially does the following operations:
```
-- Create a temporary table with the new definition
CREATE TEMPORARY TABLE tmp_tab (
...
);
-- Copy the data from the original table
INSERT INTO tmp_tab
SELECT * FROM original_tab;
-- Drop the original table
DROP TABLE original_tab;
-- Rename the temporary table, so that it replaces the original one
RENAME TABLE tmp_tab TO original_tab;
```
This algorithm is very inefficient, but it is generic, so it works for all storage engines.
If the `COPY` algorithm is specified with the [ALGORITHM](../alter-table/index#algorithm) clause or with the [alter\_algorithm](../server-system-variables/index#alter_algorithm) system variable, then the `COPY` algorithm will be used even if it is not necessary. This can result in a lengthy table copy. If multiple [ALTER TABLE](../alter-table/index) operations are required that each require the table to be rebuilt, then it is best to specify all operations in a single [ALTER TABLE](../alter-table/index) statement, so that the table is only rebuilt once.
#### Using the COPY Algorithm with InnoDB
If the `COPY` algorithm is used with an [InnoDB](../innodb/index) table, then the following statements apply:
* The table will be rebuilt using the current values of the [innodb\_file\_per\_table](../innodb-system-variables/index#innodb_file_per_table), [innodb\_file\_format](../innodb-system-variables/index#innodb_file_format), and [innodb\_default\_row\_format](../innodb-system-variables/index#innodb_default_row_format) system variables.
* The operation will have to create a temporary table to perform the the table copy. This temporary table will be in the same directory as the original table, and it's file name will be in the format ``#`sql${PID}_${THREAD_ID}_${TMP_TABLE_COUNT}`, where `${PID}` is the process ID of `mysqld`, `${THREAD_ID}` is the connection ID, and `${TMP_TABLE_COUNT}` is the number of temporary tables that the connection has open. Therefore, the [datadir](../server-system-variables/index#datadir) may contain files with file names like ``#`sql1234_12_1.ibd`.
* The operation inserts one record at a time into each index, which is very inefficient.
* InnoDB does not use a sort buffer.
* In [MariaDB 10.2.13](https://mariadb.com/kb/en/mariadb-10213-release-notes/), [MariaDB 10.3.5](https://mariadb.com/kb/en/mariadb-1035-release-notes/) and later, the table copy operation creates a lot fewer [InnoDB undo log](../xtradbinnodb-undo-log/index) writes. See [MDEV-11415](https://jira.mariadb.org/browse/MDEV-11415) for more information.
* The table copy operation creates a lot of [InnoDB redo log](../innodb-redo-log/index) writes.
### INPLACE Algorithm
The `COPY` algorithm can be incredibly slow, because the whole table has to be copied and rebuilt. The `INPLACE` algorithm was introduced as a way to avoid this by performing operations in-place and avoiding the table copy and rebuild, when possible.
When the `INPLACE` algorithm is used, the underlying storage engine uses optimizations to perform the operation while avoiding the table copy and rebuild. However, `INPLACE` is a bit of a misnomer, since some operations may still require the table to be rebuilt for some storage engines. Regardless, several operations can be performed without a full copy of the table for some storage engines.
A more accurate name for the algorithm would have been the `ENGINE` algorithm, since the [storage engine](../storage-engines/index) decides how to implement the algorithm.
If an [ALTER TABLE](../alter-table/index) operation supports the `INPLACE` algorithm, then it can be performed using optimizations by the underlying storage engine, but it may rebuilt.
If the `INPLACE` algorithm is specified with the [ALGORITHM](../alter-table/index#algorithm) clause or with the [alter\_algorithm](../server-system-variables/index#alter_algorithm) system variable and if the [ALTER TABLE](../alter-table/index) operation does not support the `INPLACE` algorithm, then an error will be raised. For example:
```
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c int;
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY
```
In this case, raising an error is preferable, if the alternative is for the operation to make a copy of the table, and perform unexpectedly slowly.
#### Using the INPLACE Algorithm with InnoDB
If the `INPLACE` algorithm is used with an [InnoDB](../innodb/index) table, then the following statements apply:
* The operation might have to write sort files in the directory defined by the [innodb\_tmpdir](../innodb-system-variables/index#innodb_tmpdir) system variable.
* The operation might also have to write a temporary log file to track data changes by [DML queries](../data-manipulation/index) executed during the operation. The maximum size for this log file is configured by the [innodb\_online\_alter\_log\_max\_size](../innodb-system-variables/index#innodb_online_alter_log_max_size) system variable.
* Some operations require the table to be rebuilt, even though the algorithm is inaccurately called "in-place". This includes operations such as adding or dropping columns, adding a primary key, changing a column to [NULL](null-and-not-null), etc.
* If the operation requires the table to be rebuilt, then the operation might have to create temporary tables.
+ It may have to create a temporary intermediate table for the actual table rebuild operation.
- In [MariaDB 10.2.19](https://mariadb.com/kb/en/mariadb-10219-release-notes/) and later, this temporary table will be in the same directory as the original table, and it's file name will be in the format ``#`sql${PID}_${THREAD_ID}_${TMP_TABLE_COUNT}`, where `${PID}` is the process ID of `mysqld`, `${THREAD_ID}` is the connection ID, and `${TMP_TABLE_COUNT}` is the number of temporary tables that the connection has open. Therefore, the [datadir](../server-system-variables/index#datadir) may contain files with file names like ``#`sql1234_12_1.ibd`.
- In [MariaDB 10.2.18](https://mariadb.com/kb/en/mariadb-10218-release-notes/) and before, this temporary table will be in the same directory as the original table, and it's file name will be in the format ``#`sql-ib${TABLESPACE_ID}-${RAND}`, where `${TABLESPACE_ID}` is the table's tablespace ID within InnoDB and `${RAND}` is a randomly initialized number. Therefore, the [datadir](../server-system-variables/index#datadir) may contain files with file names like ``#`sql-ib230291-1363966925.ibd`.
+ When it replaces the original table with the rebuilt table, it may also have to rename the original table using a temporary table name.
- If the server is [MariaDB 10.3](../what-is-mariadb-103/index) or later or if it is running [MariaDB 10.2](../what-is-mariadb-102/index) and the [innodb\_safe\_truncate](../innodb-system-variables/index#innodb_safe_truncate) system variable is set to `OFF`, then the format will actually be ``#`sql-ib${TABLESPACE_ID}-${RAND}`, where `${TABLESPACE_ID}` is the table's tablespace ID within InnoDB and `${RAND}` is a randomly initialized number. Therefore, the [datadir](../server-system-variables/index#datadir) may contain files with file names like ``#`sql-ib230291-1363966925.ibd`.
- If the server is running [MariaDB 10.1](../what-is-mariadb-101/index) or before or if it is running [MariaDB 10.2](../what-is-mariadb-102/index) and the [innodb\_safe\_truncate](../innodb-system-variables/index#innodb_safe_truncate) system variable is set to `ON`, then the renamed table will have a temporary table name in the format ``#`sql-ib${TABLESPACE_ID}`, where `${TABLESPACE_ID}` is the table's tablespace ID within InnoDB. Therefore, the [datadir](../server-system-variables/index#datadir) may contain files with file names like ``#`sql-ib230291.ibd`.
* The storage needed for the above items can add up to the size of the original table, or more in some cases.
* Some operations are instantaneous, if they only require the table's metadata to be changed. This includes operations such as renaming a column, changing a column's [DEFAULT](../create-table/index#default-column-option) value, etc.
#### Operations Supported by InnoDB with the `INPLACE` Algorithm
With respect to the allowed operations, the `INPLACE` algorithm supports a subset of the operations supported by the `COPY` algorithm, and it supports a superset of the operations supported by the `NOCOPY` algorithm.
See [InnoDB Online DDL Operations with ALGORITHM=INPLACE](../innodb-online-ddl-operations-with-algorithminplace/index) for more information.
### NOCOPY Algorithm
**MariaDB starting with [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and later, the `NOCOPY` algorithm is supported.
The `INPLACE` algorithm can sometimes be surprisingly slow in instances where it has to rebuild the clustered index, because when the clustered index has to be rebuilt, the whole table has to be rebuilt. The `NOCOPY` algorithm was introduced as a way to avoid this.
If an [ALTER TABLE](../alter-table/index) operation supports the `NOCOPY` algorithm, then it can be performed without rebuilding the clustered index.
If the `NOCOPY` algorithm is specified with the [ALGORITHM](../alter-table/index#algorithm) clause or with the [alter\_algorithm](../server-system-variables/index#alter_algorithm) system variable and if the [ALTER TABLE](../alter-table/index) operation does not support the `NOCOPY` algorithm, then an error will be raised. For example:
```
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab MODIFY COLUMN c int;
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY
```
In this case, raising an error is preferable, if the alternative is for the operation to rebuild the clustered index, and perform unexpectedly slowly.
#### Operations Supported by InnoDB with the `NOCOPY` Algorithm
With respect to the allowed operations, the `NOCOPY` algorithm supports a subset of the operations supported by the `INPLACE` algorithm, and it supports a superset of the operations supported by the `INSTANT` algorithm.
See [InnoDB Online DDL Operations with ALGORITHM=NOCOPY](../innodb-online-ddl-operations-with-algorithmnocopy/index) for more information.
### INSTANT Algorithm
**MariaDB starting with [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and later, the `INSTANT` algorithm is supported.
The `INPLACE` algorithm can sometimes be surprisingly slow in instances where it has to modify data files. The `INSTANT` algorithm was introduced as a way to avoid this.
If an [ALTER TABLE](../alter-table/index) operation supports the `INSTANT` algorithm, then it can be performed without modifying any data files.
If the `INSTANT` algorithm is specified with the [ALGORITHM](../alter-table/index#algorithm) clause or with the [alter\_algorithm](../server-system-variables/index#alter_algorithm) system variable and if the [ALTER TABLE](../alter-table/index) operation does not support the `INSTANT` algorithm, then an error will be raised. For example:
```
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c int;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY
```
In this case, raising an error is preferable, if the alternative is for the operation to modify data files, and perform unexpectedly slowly.
#### Operations Supported by InnoDB with the INSTANT Algorithm
With respect to the allowed operations, the `INSTANT` algorithm supports a subset of the operations supported by the `NOCOPY` algorithm.
See [InnoDB Online DDL Operations with ALGORITHM=INSTANT](../innodb-online-ddl-operations-with-algorithminstant/index) for more information.
Alter Locking Strategies
------------------------
InnoDB supports multiple locking strategies for performing DDL operations. This offers a significant performance improvement over previous versions. The supported locking strategies are:
* `DEFAULT` - This implies the default behavior for the specific operation.
* `NONE`
* `SHARED`
* `EXCLUSIVE`
Regardless of which locking strategy is used to perform a DDL operation, InnoDB will have to exclusively lock the table for a short time at the start and end of the operation's execution. This means that any active transactions that may have accessed the table must be committed or aborted for the operation to continue. This applies to most DDL statements, such as [ALTER TABLE](../alter-table/index), [CREATE INDEX](../create-index/index), [DROP INDEX](../drop-index/index), [OPTIMIZE TABLE](../optimize-table/index), [RENAME TABLE](../rename-table/index), etc.
Specifying an Alter Locking Strategy
------------------------------------
### Specifying an Alter Locking Strategy Using the `LOCK` Clause
The [ALTER TABLE](../alter-table/index) statement supports the [LOCK](../alter-table/index#lock) clause.
The [LOCK](../alter-table/index#lock) clause can be used to specify the locking strategy that the user is willing to accept. It is supported by the [ALTER TABLE](../alter-table/index) and [CREATE INDEX](../create-index/index) statements.
For example, if a user wanted to add a column to a table, but only if the operation is non-locking, then they could execute the following:
```
CREATE OR REPLACE TABLE tab (
a int PRIMARY KEY,
b varchar(50)
);
ALTER TABLE tab ADD COLUMN c varchar(50), ALGORITHM=INPLACE, LOCK=NONE;
```
If the [LOCK](../alter-table/index#lock) clause is not explicitly set, then the operation uses `LOCK=DEFAULT`.
### Specifying an Alter Locking Strategy Using `ALTER ONLINE TABLE`
[ALTER ONLINE TABLE](../alter-table/index#alter-online-table) is equivalent to `LOCK=NONE`. Therefore, the [ALTER ONLINE TABLE](alter-online-table) statement can be used to ensure that your [ALTER TABLE](../alter-table/index) operation allows all concurrent DML.
Supported Alter Locking Strategies
----------------------------------
The supported algorithms are described in more details below.
To see which locking strategies InnoDB supports for each operation, see the pages that describe which operations are supported for each algorithm:
* [InnoDB Online DDL Operations with ALGORITHM=INPLACE](../innodb-online-ddl-operations-with-algorithminplace/index)
* [InnoDB Online DDL Operations with ALGORITHM=NOCOPY](../innodb-online-ddl-operations-with-algorithmnocopy/index)
* [InnoDB Online DDL Operations with ALGORITHM=INSTANT](../innodb-online-ddl-operations-with-algorithminstant/index)
### DEFAULT Locking Strategy
The default behavior, which occurs if `LOCK=DEFAULT` is specified, or if `LOCK` is not specified at all, acquire the least restrictive lock on the table that is supported for the specific operation. This permits the maximum amount of concurrency that is supported for the specific operation.
### NONE Locking Strategy
The `NONE` locking strategy performs the operation without acquiring any lock on the table. This permits **all** concurrent DML.
If this locking strategy is not permitted for an operation, then an error is raised.
### SHARED Locking Strategy
The `SHARED` locking strategy performs the operation after acquiring a read lock on the table. This permit **read-only** concurrent DML.
If this locking strategy is not permitted for an operation, then an error is raised.
### EXCLUSIVE Locking Strategy
The `EXCLUSIVE` locking strategy performs the operation after acquiring a write lock on the table. This does **not** permit concurrent DML.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb mariadb-show mariadb-show
============
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-show` is a symlink to `mysqlshow`, the script showing the structure of a MariaDB database.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysqlshow` is the symlink, and `mariadb-show` the binary name.
See [mysqlshow](../mysqlshow/index) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Managing ColumnStore Module Configurations Managing ColumnStore Module Configurations
==========================================
Configuring modules
===================
A Module ([UM](../columnstore-user-module/index) or [PM](../columnstore-performance-module/index)) can be added or removed from MariaDB ColumnStore.
Before adding modules or DBRoots
--------------------------------
* Ensure you have the user password or ssh-key for all servers that will be added.
* All the dependent packages have been installed.
* The server has the same OS and 'locale' as the current servers
* All Database Updates commands like DDL/DML and cpimports are suspend until the module or DBRoot is successfully added
### ColumnStore Cluster Test Tool
This tool can be running before doing installation on a single-server or multi-node installs. It will verify the setup of all servers that are going to be used in the Columnstore System.
[https://mariadb.com/kb/en/mariadb/mariadb-columnstore-cluster-test-tool](../mariadb/mariadb-columnstore-cluster-test-tool)
### Module IDs
Modules in the system are identified by the "um" or "pm" followed by a unique number - such as um1, pm1, pm2, pm3 etc.
The system assigns the module id as they are added
Adding DBRoots
--------------
To add dbroots (storage files) into your system requires two operations: creating the physical dbroots and assigning them to a [Performance Module](../columnstore-performance-module/index).
NOTE: Anytime you add a DBRoot to an existing system, its recommended that you run the Redistribute Data command. This will re-balance the data onto the new DBRoot.
[https://mariadb.com/kb/en/mariadb/columnstore-redistribute-data/](../mariadb/columnstore-redistribute-data/index)
### Creating the physical dbroot
The OAM addDbRoot command is used to create the physical storage (dbroot):
```
# mcsadmin addDbroot numRoots
```
where numRoots is the total number of new dbroots to be added. The command will return the dbroot id’s created.
Example to add 2 additional dbroots to an already existing 2 dbroot system:
```
# mcsadmin adddbroot 2
adddbroot Mon Aug 26 15:00:38 2013
New DBRoot IDs added = 3, 4
```
After the *addDbroot* command, dbroots 3 and 4 have been created. You can see that they have been created by using the *getStorageConfig* command. Along with other information, towards the bottom of the output you will see information that reflects the additional, unassigned dbroots.
```
# mcsadmin getstorageconfig
:
System Assigned DBRoot Count = 2
DBRoot IDs assigned to 'pm1' = 1
DBRoot IDs assigned to 'pm2' = 2
DBRoot IDs unassigned = 3, 4
:
```
### Assign DBRoots to Performance Module
After adding a DBRoot, it must be assigned to a [Performance Module](../columnstore-performance-module/index) before it can be used. Use the `mcsadmin assignDbrootPmConfig` command to do so. Note: The [Performance Module](../columnstore-performance-module/index) that the DBRoot is being assigned to must to Manually Offline. The system must be in a STOPPED state
#### Syntax
```
# mcsadmin assignDbrootPmConfig dbrootid perfmod
```
where dbrootid is the unassigned dbroot(s) to be assigned. You can assign multiple dbroots to a single Performance module with a comma separated list. perfmoed is the Performance Module being assigned the dbroots.
Example #1 of assigning the 2 new dbroots to 2 separate PMs:
```
# mcsadmin assignDbrootPmConfig 3 pm1
assigndbrootpmconfig Tue Aug 19 18:03:15 2015
DBRoot IDs assigned to 'pm1' = 1
Changes being applied
DBRoot IDs assigned to 'pm1' = 1, 3
Successfully Assigned DBRoots
REMINDER: Update the /etc/fstab on pm1 to include these dbroot mounts
# mcsadmin assignDbrootPmConfig 4 pm2
assigndbrootpmconfig Tue Aug 19 18:03:18 2015
DBRoot IDs assigned to 'pm2' = 2
Changes being applied
DBRoot IDs assigned to 'pm2' = 2, 4
Successfully Assigned DBRoots
REMINDER: Update the /etc/fstab on pm2 to include these dbroot mounts
```
Example #2 of assigning the 2 new dbroots to 1 PM:
```
# mcsadmin assignDbrootPmConfig 3,4 pm2
assigndbrootpmconfig Tue Aug 19 18:17:46 2015
DBRoot IDs assigned to 'pm2' = 2
Changes being applied
DBRoot IDs assigned to 'pm2' = 2, 3, 4
Successfully Assigned DBRoots
REMINDER: Update the /etc/fstab on pm2 to include these dbroot mounts
```
Once completed, start the system back up with the [startsystem](../mariadb/mariadb-columnstore-system-operations/index#starting-the-system-or-modules) command.
### Unassign DBRoots to Performance Module
You can also unassign DBRoot from a [Performance Module](../columnstore-performance-module/index). Use the `mcsadmin unassignDbrootPmConfig` command to do so.
Note: The [Performance Module](../columnstore-performance-module/index) that the DBRoot is being unassigned from must to Manually Offline. The system must be in a STOPPED state
Note: You can't unassigned DBROOT #1. It always has to be assigned to the Active Parent [Performance Module](../columnstore-performance-module/index).
#### Syntax
```
# mcsadmin unassignDbrootPmConfig dbrootid perfmod
```
Moving DBRoots
--------------
Before moving a DBRoot from 1 module to another, the system must be in a STOPPED state. DBRoots cannot be moved while the system is active.
Only DBRoots that are configured as external or glusterFS can be moved from 1 pm to another.
NOTE: DBRoot #1 cant be moved from its assigned PM. It always needs to be assigned to the Active Parent OAM Module. The DBRM Controller Node Process runs on this module and it makes updates the DBRM Data on DBRoot #1.
### Syntax
```
#mcsadmin movePMDbrootConfig [fromPM] [DBRoot] [toPM] and press Enter.
```
Example: This example moves DBRoot 6 from PM6 to PM 5
```
# mcsadmin movePmDbrootConfig pm6 6 pm5
movepmdbrootconfig Wed Mar 28 11:22:22 2015
DBRoot IDs currently assigned to 'pm6' = 6
DBRoot IDs currently assigned to 'pm5' = 5
DBroot IDs being moved, please wait...
DBRoot IDs newly assigned to 'pm6' =
DBRoot IDs newly assigned to 'pm5' = 5, 6
```
Here is an example of moving dbroot 2 from pm2 to pm1. Run this command from the Parent OAM module. If these leaves pm2 without a dbroot assigned, that module will need to be disabled. System will not start up if there is a pm without a dbroot assigned to it.
```
# mcsadmin
stopsystem y
movePmDbrootConfig pm2 2 pm1
altersystem-disablemodule pm2 y
startsystem
```
Adding modules
--------------
Before a modules can be added, the system must be ACTIVE or OFFLINE. Once added, they can be placed in-service with the *alterSystem-Enable* command.
### addModule command
```
mcsadmin addModule module_type number_of_modules IP_address_or_host_name (separated by commas) user_password
```
For example, to add two Performance Modules with host names MYHST1 and MYHST2:
```
mcsadmin addModule pm 2 MYHST1,MYHST2 mypwd
```
ColumnStore.xml is updated to add new modules and the appropriate files are installed to the new modules. If the module addition fails, the mcsadmin displays an error message. Additional details are located in the MariaDB ColumnStore log files on the Performance Module #1.
NOTE: When adding Performance Modules with multiple NICs, you must add the host name for all NICs. If you do not, the add module process will fail with invalid parameters.
This example will add 1 [User Module](../columnstore-performance-module/index) into the system and will assign the ID to be the next available ID. So if you system has a um1 and um2, the new module will be 'um3'.
```
# mcsadmin addModule um 1 hosthameUm3 'password'
```
This example will add um3 into the system. So you can also specify the name of the module to be added
```
# mcsadmin addModule um3 hosthameUm3 'password'
```
This example will add 2 [Performance Modules](../columnstore-performance-module/index) into the system and will assign the ID to be the next available ID. So if you system has a pm1 and pm2, the new modules will be 'pm3' and 'pm4'
```
# mcsadmin addModule pm 2 hosthamePm3,hosthamePm4 'password'
```
Once a module is added, it will be in a MAN\_DISABLE state. This means its not part of the functional system at this time.
Enabling Modules
----------------
If a new module has been added or if a module was previously disable, use this command to enable the module. The command alterSystem-EnableModule will restart the system as part of its functionality to bring the new module into use. So there will be some down time during this process.
```
#mcsadmin alterSystem-EnableModule pm3
```
NOTE: Enabling a [User Module](../columnstore-performance-module/index) will automatically bring it Active and it will be part of the running system. NOTE: Enabling a [Permorance Module](../columnstore-performance-module/index) will ONLY be automatically brought into the system if it has a DBRoot assigned to it. If it doesn't, it will be in the MAN\_OFFLINE state. So at this point, user would need to move or assign a DBRoot to it. Then it could be made ACTIVE with the startSystem command.
### Adding module to AWS EC2 instances.
To add a module to the system on an Amazon EC2 system, perform one of the following:
* To accept default module IDs, add multiple modules and have it automatically create the instances:
```
addModule module_type number_of_modules
```
An example to add two Performance Modules with defaulted instance names, type the following:
```
addModule pm 2
```
* To accept default module IDs, add multiple modules and have it install on existing Instances:
```
addModule module_type number_of_modules instance-ids
```
An example to add two Performance Modules with instance names id-1234890 and id-9876598
```
addModule pm 2 id-1234890,id-9876598
```
* To create IDs manually one at a time and have it automatically create the Instance
```
addModule module_ID
```
For example to add one Performance Module with a default instance name, type the following:
```
addModule pm2
```
* To create IDs manually one at a time and have it install on existing Instance addModule module\_ID instance-i For example to add one User Module number 2 with instance name id-100, type the following:
```
addModule um2 id-100
```
Removing modules
----------------
Modules can be removed from the system when they are no longer needed or in the event that they need to be taken offline for hardware updates. A module can be removed if it is [disabled](../mariadb-columnstore-system-operations/index#disabling-system-modules) or if the system is [stopped](../mariadb-columnstore-system-operations/index#stopping-the-system)
NOTE: You cannot remove the last um or pm module. To remove a module
* To remove the last modules added to the system,
```
#mcsadmin removeModule module_type number_of_modules
```
For example, to remove two Performance Modules:
```
#mcsadmin removeModule pm 2
```
* To remove a specific module,
```
#mcsadmin removeModule module_ID
```
For example to remove one User Module with module ID UM1285
```
#mcsadmin removeModule um1285
```
NOTE: There is a known issue with the Delete User Module or Delete Combination Performance Module that leaves the MariaDB ColumnStore config file in a bad configuration to where the file needs to be edited. This is documented in the Troubleshooting guide.
[https://mariadb.com/kb/en/library/system-troubleshooting-mariadb-columnstore/#query-failure-messagequeueclient-setup-unknown-name-or-service](../library/system-troubleshooting-mariadb-columnstore/index#query-failure-messagequeueclient-setup-unknown-name-or-service)
Example command to add a Performance Module and DBRoot to a Active system
-------------------------------------------------------------------------
This is assuming PM3 and DBRoot #3 were added
```
#mcsadmin stopSystem
#mcsadmin addModule pm 1 hostnamePm3 'password'
#mcsadmin addDBroot 1
#mcsadmin alterSystem-EnableModule pm3
#mcsadmin assignDbrootPmConfig 3 pm3
#mcsadmin startSystem
```
If you decide you want to roll this back:
```
#mcsadmin stopSystem y
#mcsadmin unassignDBRootPMConfig 2 pm2
#mcsadmin removeModule pm2 y
#mcsadmin startSystem
#mcsadmin removeDBRoot 2
```
The above example requires a stopSystem to unassign the db root from the pm server. RemoveDBRoot can only be performed on a started system as it checks whether the db root has data or not. Many other permutations of commands are of course possible including moving a db root to another pm server.
Example command to add a User Module a Active system
----------------------------------------------------
```
#mcsadmin addModule um 1 hostnameUm2 'password'
#mcsadmin alterSystem-EnableModule um2
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Performance Schema memory_summary_by_thread_by_event_name Table Performance Schema memory\_summary\_by\_thread\_by\_event\_name Table
=====================================================================
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**The memory\_summary\_by\_thread\_by\_event\_name table was introduced in [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/).
There are five memory summary tables in the Performance Schema that share a number of fields in common. These include:
* [memory\_summary\_by\_account\_by\_event\_name](../performance-schema-memory_summary_by_account_by_event_name-table/index)
* [memory\_summary\_by\_host\_by\_event\_name](../performance-schema-memory_summary_by_host_by_event_name-table/index)
* memory\_summary\_by\_thread\_by\_event\_name
* [memory\_summary\_by\_user\_by\_event\_name](../performance-schema-memory_summary_by_user_by_event_name-table/index)
* [memory\_global\_by\_event\_name](../performance-schema-memory_global_by_event_name-table/index)
The `memory_summary_by_thread_by_event_name` table contains memory usage statistics aggregated by thread and event.
The table contains the following columns:
| Field | Type | Null | Default | Description |
| --- | --- | --- | --- | --- |
| THREAD\_ID | bigint(20) unsigned | NO | NULL | Thread id. |
| EVENT\_NAME | varchar(128) | NO | NULL | Event name. |
| COUNT\_ALLOC | bigint(20) unsigned | NO | NULL | Total number of allocations to memory. |
| COUNT\_FREE | bigint(20) unsigned | NO | NULL | Total number of attempts to free the allocated memory. |
| SUM\_NUMBER\_OF\_BYTES\_ALLOC | bigint(20) unsigned | NO | NULL | Total number of bytes allocated. |
| SUM\_NUMBER\_OF\_BYTES\_FREE | bigint(20) unsigned | NO | NULL | Total number of bytes freed |
| LOW\_COUNT\_USED | bigint(20) | NO | NULL | Lowest number of allocated blocks (lowest value of CURRENT\_COUNT\_USED). |
| CURRENT\_COUNT\_USED | bigint(20) | NO | NULL | Currently allocated blocks that have not been freed (COUNT\_ALLOC minus COUNT\_FREE). |
| HIGH\_COUNT\_USED | bigint(20) | NO | NULL | Highest number of allocated blocks (highest value of CURRENT\_COUNT\_USED). |
| LOW\_NUMBER\_OF\_BYTES\_USED | bigint(20) | NO | NULL | Lowest number of bytes used. |
| CURRENT\_NUMBER\_OF\_BYTES\_USED | bigint(20) | NO | NULL | Current number of bytes used (total allocated minus total freed). |
| HIGH\_NUMBER\_OF\_BYTES\_USED | bigint(20) | NO | NULL | Highest number of bytes used. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Cracklib Password Check Plugin Cracklib Password Check Plugin
==============================
`cracklib_password_check` is a [password validation](../password-validation-plugin-api/index) plugin. It uses the [CrackLib](https://github.com/cracklib/cracklib) library to check the strength of new passwords. CrackLib is installed by default in many Linux distributions, since the system's [Pluggable Authentication Module (PAM)](https://en.wikipedia.org/wiki/Pluggable_authentication_module) authentication framework is usually configured to check the strength of new passwords with the `[pam\_cracklib](https://linux.die.net/man/8/pam_cracklib)` PAM module.
Note that passwords can be directly set as a hash, bypassing the password validation, if the [strict\_password\_validation](../server-system-variables/index#strict_password_validation) variable is `OFF` (it is `ON` by default).
The plugin requires at least cracklib 2.9.0, so it is not available on Debian/Ubuntu builds before Debian 8 Jessie/Ubuntu 14.04 Trusty, RedHat Enterprise Linux / CentOS 6.
Installing the Plugin's Package
-------------------------------
The `cracklib_password_check` plugin's shared library is included in MariaDB packages as the `cracklib_password_check.so` or `cracklib_password_check.dll` shared library on systems where it can be built.
### Installing on Linux
The `cracklib_password_check` plugin is included in `systemd` [binary tarballs](../installing-mariadb-binary-tarballs/index) on Linux, but not in the older generic and `glibc_214` tarballs.
#### Installing with a Package Manager
The `cracklib_password_check` plugin can also be installed via a package manager on Linux. In order to do so, your system needs to be configured to install from one of the MariaDB repositories.
You can configure your package manager to install it from MariaDB Corporation's MariaDB Package Repository by using the [MariaDB Package Repository setup script](../mariadb-package-repository-setup-and-usage/index).
You can also configure your package manager to install it from MariaDB Foundation's MariaDB Repository by using the [MariaDB Repository Configuration Tool](https://downloads.mariadb.org/mariadb/repositories/).
##### Installing with yum/dnf
On RHEL, CentOS, Fedora, and other similar Linux distributions, it is highly recommended to install the relevant [RPM package](../rpm/index) from MariaDB's repository using `[yum](../yum/index)` or `[dnf](https://en.wikipedia.org/wiki/DNF_(software))`. Starting with RHEL 8 and Fedora 22, `yum` has been replaced by `dnf`, which is the next major version of `yum`. However, `yum` commands still work on many systems that use `dnf`. For example:
```
sudo yum install MariaDB-cracklib-password-check
```
##### Installing with apt-get
On Debian, Ubuntu, and other similar Linux distributions, it is highly recommended to install the relevant [DEB package](../installing-mariadb-deb-files/index) from MariaDB's repository using `[apt-get](https://wiki.debian.org/apt-get)`. For example:
```
sudo apt-get install mariadb-plugin-cracklib-password-check
```
##### Installing with zypper
On SLES, OpenSUSE, and other similar Linux distributions, it is highly recommended to install the relevant [RPM package](../rpm/index) from MariaDB's repository using `[zypper](../installing-mariadb-with-zypper/index)`. For example:
```
sudo zypper install MariaDB-cracklib-password-check
```
Installing the Plugin
---------------------
Once the shared library is in place, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.
The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing `[INSTALL SONAME](../install-soname/index)` or `[INSTALL PLUGIN](../install-plugin/index)`. For example:
```
INSTALL SONAME 'cracklib_password_check';
```
The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options. This can be specified as a command-line argument to `[mysqld](../mysqld-options/index)` or it can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
plugin_load_add = cracklib_password_check
```
Uninstalling the Plugin
-----------------------
You can uninstall the plugin dynamically by executing `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)`. For example:
```
UNINSTALL SONAME 'cracklib_password_check';
```
If you installed the plugin by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index), then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
Viewing CrackLib Errors
-----------------------
If password validation fails, then the original CrackLib error message can be viewed by executing `[SHOW WARNINGS](../show-warnings/index)`.
Example
-------
When creating a new password, if the criteria are not met, the following error is returned:
```
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('abc');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
```
Known Issues
------------
### Issues with PAM Authentication Plugin
Prior to [MariaDB 10.4.0](https://mariadb.com/kb/en/mariadb-1040-release-notes/), all [password validation plugins](../password-validation-plugins/index) are incompatible with the `[pam](../pam-authentication-plugin/index)` authentication plugin. See [Authentication Plugin - PAM: Conflicts with Password Validation](../authentication-plugin-pam/index#conflicts-with-password-validation) for more information.
### SELinux
When using the standard [SELinux](../selinux/index) policy with the [mode](../selinux/index#changing-selinuxs-mode) set to `enforcing`, `mysqld` does not have access to `/usr/share/cracklib`, and you may see the following error when attempting to use the `cracklib_password_check` plugin:
```
CREATE USER `user`@`hostname` IDENTIFIED BY 's0mePwd123.';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
SHOW WARNINGS;
+---------+------+----------------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------------+
| Warning | 1819 | cracklib: error loading dictionary |
| Error | 1819 | Your password does not satisfy the current policy requirements |
| Error | 1396 | Operation CREATE USER failed for 'user'@'hostname' |
+---------+------+----------------------------------------------------------------+
```
And the SELinux `audit.log` will contain errors like the following:
```
type=AVC msg=audit(1548371977.821:66): avc: denied { read } for pid=3537 comm="mysqld" name="pw_dict.pwd" dev="xvda2" ino=564747 scontext=system_u:system_r:mysqld_t:s0 tcontext=system_u:object_r:crack_db_t:s0 tclass=file
type=SYSCALL msg=audit(1548371977.821:66): arch=c000003e syscall=2 success=no exit=-13 a0=7fdd2a674580 a1=0 a2=1b6 a3=1b items=0 ppid=1 pid=3537 auid=4294967295 uid=995 gid=992 euid=995 suid=995 fsuid=995 egid=992 sgid=992 fsgid=992 tty=(none) ses=4294967295 comm="mysqld" exe="/usr/sbin/mysqld" subj=system_u:system_r:mysqld_t:s0 key=(null)
```
This can be fixed by creating an SELinux policy that allows `mysqld` to load the CrackLib dictionary. For example:
```
cd /usr/share/mysql/policy/selinux/
tee ./mariadb-plugin-cracklib-password-check.te <<EOF
module mariadb-plugin-cracklib-password-check 1.0;
require {
type mysqld_t;
type crack_db_t;
class file { execute setattr read create getattr execute_no_trans write ioctl open append unlink };
class dir { write search getattr add_name read remove_name open };
}
allow mysqld_t crack_db_t:dir { search read open };
allow mysqld_t crack_db_t:file { getattr read open };
EOF
sudo yum install selinux-policy-devel
make -f /usr/share/selinux/devel/Makefile mariadb-plugin-cracklib-password-check.pp
sudo semodule -i mariadb-plugin-cracklib-password-check.pp
```
See [MDEV-18374](https://jira.mariadb.org/browse/MDEV-18374) for more information.
Versions
--------
| Version | Status | Introduced |
| --- | --- | --- |
| 1.0 | Stable | [MariaDB 10.1.18](https://mariadb.com/kb/en/mariadb-10118-release-notes/) |
| 1.0 | Gamma | [MariaDB 10.1.13](https://mariadb.com/kb/en/mariadb-10113-release-notes/) |
| 1.0 | Alpha | [MariaDB 10.1.2](https://mariadb.com/kb/en/mariadb-1012-release-notes/) |
System Variables
----------------
#### `cracklib_password_check_dictionary`
* **Description:** Sets the path to the CrackLib dictionary. If not set, the default CrackLib dictionary path is used. The parameter expects the base name of a cracklib dictionary (a set of three files with endings `.hwm`, `.pwd`, `.pwi`), not a directory path.
* **Commandline:** `--cracklib-password-check-dictionary=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:** Depends on the system. Often `/usr/share/cracklib/pw_dict`
---
Options
-------
#### `cracklib_password_check`
* **Description:** Controls how the server should treat the plugin when the server starts up.
+ Valid values are:
- `OFF` - Disables the plugin without removing it from the `[mysql.plugins](../mysqlplugin-table/index)` table.
- `ON` - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.
- `FORCE` - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.
- `FORCE_PLUS_PERMANENT` - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)` while the server is running.
+ See [Plugin Overview: Configuring Plugin Activation at Server Startup](../plugin-overview/index#configuring-plugin-activation-at-server-startup) for more information.
* **Commandline:** `--cracklib-password-check=value`
* **Data Type:** `enumerated`
* **Default Value:** `ON`
* **Valid Values:** `OFF`, `ON`, `FORCE`, `FORCE_PLUS_PERMANENT`
---
See Also
--------
* [Password Validation](../password-validation/index)
* [simple\_password\_check plugin](../simple_password_check/index) - permits the setting of basic criteria for passwords
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb COLUMN_CREATE COLUMN\_CREATE
==============
Syntax
------
```
COLUMN_CREATE(column_nr, value [as type], [column_nr, value [as type]]...);
COLUMN_CREATE(column_name, value [as type], [column_name, value [as type]]...);
```
Description
-----------
Returns a [dynamic columns](../dynamic-columns/index) blob that stores the specified columns with values.
The return value is suitable for
* storing in a table
* further modification with other dynamic columns functions
The **`as type`** part allows one to specify the value type. In most cases, this is redundant because MariaDB will be able to deduce the type of the value. Explicit type specification may be needed when the type of the value is not apparent. For example, a literal `'2012-12-01'` has a CHAR type by default, one will need to specify `'2012-12-01' AS DATE` to have it stored as a date. See [Dynamic Columns:Datatypes](../dynamic-columns/index#datatypes) for further details.
Examples
--------
```
INSERT INTO tbl SET dyncol_blob=COLUMN_CREATE("column_name", "value");
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ANALYZE FORMAT=JSON Examples ANALYZE FORMAT=JSON Examples
============================
Example #1
----------
Customers who have ordered more than 1M goods.
```
ANALYZE FORMAT=JSON
SELECT COUNT(*)
FROM customer
WHERE
(SELECT SUM(o_totalprice) FROM orders WHERE o_custkey=c_custkey) > 1000*1000;
```
The query takes 40 seconds over cold cache
```
EXPLAIN: {
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 39872,
"table": {
"table_name": "customer",
"access_type": "index",
"key": "i_c_nationkey",
"key_length": "5",
"used_key_parts": ["c_nationkey"],
"r_loops": 1,
"rows": 150303,
"r_rows": 150000,
"r_total_time_ms": 270.3,
"filtered": 100,
"r_filtered": 60.691,
"attached_condition": "((subquery#2) > <cache>((1000 * 1000)))",
"using_index": true
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"r_loops": 150000,
"r_total_time_ms": 39531,
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["i_o_custkey"],
"key": "i_o_custkey",
"key_length": "5",
"used_key_parts": ["o_custkey"],
"ref": ["dbt3sf1.customer.c_custkey"],
"r_loops": 150000,
"rows": 7,
"r_rows": 10,
"r_total_time_ms": 39208,
"filtered": 100,
"r_filtered": 100
}
}
}
]
}
}
```
`ANALYZE` shows that 39.2 seconds were spent in the subquery, which was executed 150K times (for every row of outer table).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Storage Engines Storage Engines
================
Information on storage engines available for MariaDB.
| Title | Description |
| --- | --- |
| [Choosing the Right Storage Engine](../choosing-the-right-storage-engine/index) | Quickly choose the most suitable storage engine for your needs. |
| [InnoDB](../innodb/index) | The general-purpose InnoDB storage engine. |
| [MariaDB ColumnStore](../mariadb-columnstore/index) | Uses a massively parallel architecture, ideal for systems that scale to petabytes of data. |
| [Aria](../aria/index) | Aria is a crash safe MyISAM and more. |
| [Archive](../archive/index) | Stores data in compressed (gzip) format. |
| [BLACKHOLE](../blackhole/index) | Storage engine that accepts data without storing it. |
| [CONNECT](../connect/index) | The CONNECT storage engine enables MariaDB to access external local or remote data. |
| [CSV](../csv/index) | Works with files stored in CSV (comma-separated-values) format. |
| [FederatedX](../federatedx-storage-engine/index) | Allows you to access tables in other MariaDB or MySQL servers. |
| [MEMORY Storage Engine](../memory-storage-engine/index) | Storage engine stored in memory rather than on disk. |
| [MERGE](../merge/index) | Allows you to access a collection of identical MyISAM tables as one. |
| [Mroonga](../mroonga/index) | Provides fast CJK-ready full text searching using column store. |
| [MyISAM](../myisam-storage-engine/index) | Non-transactional storage engine with good performance and small data footprint. |
| [MyRocks](../myrocks/index) | Adds RocksDB, an LSM database with a great compression ratio that is optimized for flash storage. |
| [OQGRAPH](../oqgraph-storage-engine/index) | Open Query GRAPH computation engine for handling hierarchies (tree structures) and complex graphs. |
| [S3 Storage Engine](../s3-storage-engine/index) | A read-only storage engine that stores its data in Amazon S3. |
| [Sequence Storage Engine](../sequence-storage-engine/index) | Allows ascending or descending sequences of numbers. |
| [SphinxSE](../sphinx-storage-engine/index) | Storage engine that talks to searchd to enable text searching. |
| [Spider](../spider/index) | Supports partitioning and xa transactions and allows tables of different in... |
| [TokuDB](../tokudb/index) | For use in high-performance and write-intensive environments. |
| [Information Schema ENGINES Table](../information-schema-engines-table/index) | Storage engine information. |
| [PERFORMANCE\_SCHEMA Storage Engine](../performance_schema-storage-engine/index) | PERFORMANCE\_SCHEMA storage engine, a mechanism for implementing the feature. |
| [Legacy Storage Engines](../legacy-storage-engines/index) | Storage engines that are no longer maintained. |
| [Storage Engine Development](../storage-engines-storage-engine-development/index) | Storage Engine Development. |
| [Converting Tables from MyISAM to InnoDB](../converting-tables-from-myisam-to-innodb/index) | Issues when converting tables from MyISAM to InnoDB. |
| [Machine Learning with MindsDB](../machine-learning-with-mindsdb/index) | A 3rd-party tool interfacing with MariaDB Server to provide Machine Learning capabilities. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb LooseScan Strategy LooseScan Strategy
==================
LooseScan is an execution strategy for [Semi-join subqueries](../semi-join-subquery-optimizations/index).
The idea
--------
We will demonstrate the `LooseScan` strategy by example. Suppose, we're looking for countries that have satellites. We can get them using the following query (for the sake of simplicity we ignore satellites that are owned by consortiums of multiple countries):
```
select * from Country
where
Country.code in (select country_code from Satellite)
```
Suppose, there is an index on `Satellite.country_code`. If we use that index, we will get satellites in the order of their owner country:
The `LooseScan` strategy doesn't really need ordering, what it needs is grouping. In the above figure, satellites are grouped by country. For instance, all satellites owned by Australia come together, without being mixed with satellites of other countries. This makes it easy to select just one satellite from each group, which you can join with its country and get a list of countries without duplicates:
LooseScan in action
-------------------
The `EXPLAIN` output for the above query looks as follows:
```
MariaDB [world]> explain select * from Country where Country.code in
(select country_code from Satellite);
+----+-------------+-----------+--------+---------------+--------------+---------+------------------------------+------+-------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+--------+---------------+--------------+---------+------------------------------+------+-------------------------------------+
| 1 | PRIMARY | Satellite | index | country_code | country_code | 9 | NULL | 932 | Using where; Using index; LooseScan |
| 1 | PRIMARY | Country | eq_ref | PRIMARY | PRIMARY | 3 | world.Satellite.country_code | 1 | Using index condition |
+----+-------------+-----------+--------+---------------+--------------+---------+------------------------------+------+-------------------------------------+
```
Factsheet
---------
* LooseScan avoids the production of duplicate record combinations by putting the subquery table first and using its index to select one record from multiple duplicates
* Hence, in order for LooseScan to be applicable, the subquery should look like:
```
expr IN (SELECT tbl.keypart1 FROM tbl ...)
```
or
```
expr IN (SELECT tbl.keypart2 FROM tbl WHERE tbl.keypart1=const AND ...)
```
* LooseScan can handle correlated subqueries
* LooseScan can be switched off by setting the `loosescan=off` flag in the [optimizer\_switch](../server-system-variables/index#optimizer_switch) variable.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Table Elimination Table Elimination
==================
Articles about Table Elimination, the idea that it is sometimes possible to resolve a query without accessing some of the tables the query refers to.
| Title | Description |
| --- | --- |
| [What is Table Elimination?](../what-is-table-elimination/index) | Resolving a query without accessing some of the tables that the query refers to. |
| [Table Elimination in MariaDB](../table-elimination-in-mariadb/index) | Table elimination in the MariaDB optimizer. |
| [Table Elimination User Interface](../table-elimination-user-interface/index) | Table Elimination User Interface and EXPLAIN. |
| [Table Elimination in Other Databases](../table-elimination-in-other-databases/index) | Table Elimination in SQL Server and Oracle. |
| [Table Elimination External Resources](../table-elimination-external-resources/index) | an example of how to do this in MariaDB |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb >> >>
==
Syntax
------
```
value1 >> value2
```
Description
-----------
Converts a longlong ([BIGINT](../bigint/index)) number (*value1*) to binary and shifts *value2* units to the right.
Examples
--------
```
SELECT 4 >> 2;
+--------+
| 4 >> 2 |
+--------+
| 1 |
+--------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Built-in Functions Built-in Functions
===================
Functions and procedures in MariaDB
| Title | Description |
| --- | --- |
| [Function and Operator Reference](../function-and-operator-reference/index) | A complete list of MariaDB functions and operators in alphabetical order. |
| [String Functions](../string-functions/index) | Built-In functions for the handling of strings and columns containing string values. |
| [Date & Time Functions](../date-time-functions/index) | Built-In functions for the handling of dates and times. |
| [Aggregate Functions](../aggregate-functions/index) | Aggregate functions used with GROUP BY clauses. |
| [Numeric Functions](../numeric-functions/index) | Numeric and arithmetic related functions in MariaDB. |
| [Control Flow Functions](../control-flow-functions/index) | Built-In functions for assessing data to determine what results to return. |
| [Pseudo Columns](../pseudo-columns/index) | MariaDB has pseudo columns that can be used for different purposes. |
### [Secondary Functions](../secondary-functions/index)
| Title | Description |
| --- | --- |
| [Bit Functions and Operators](../bit-functions-and-operators/index) | Operators for comparison and setting of values, and related functions. |
| [Encryption, Hashing and Compression Functions](../encryption-hashing-and-compression-functions/index) | Functions used for encryption, hashing and compression. |
| [Information Functions](../information-functions/index) | Functions which return information on the server, the user, or a given query. |
| [Miscellaneous Functions](../miscellaneous-functions/index) | Functions for very singular and specific needs. |
### [Special Functions](../special-functions/index)
| Title | Description |
| --- | --- |
| [Dynamic Columns Functions](../dynamic-columns-functions/index) | Functions for storing key/value pairs of data within a column. |
| [Galera Functions](../galera-functions/index) | Built-in functions related to Galera. |
| [Geographic Functions](../geographic-functions/index) | Geographic, as well as geometric functions. |
| [JSON Functions](../json-functions/index) | Built-in functions related to JSON. |
| [SEQUENCE Functions](../sequence-functions/index) | Functions that can be used on SEQUENCEs. |
| [Spider Functions](../spider-functions/index) | User-defined functions available with the Spider storage engine. |
| [Window Functions](../window-functions/index) | Window functions for performing calculations on a set of rows related to the current row. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Optimizing Data Structure Optimizing Data Structure
==========================
Good database design is an important part of a well-run system. This section looks at some of the elements to consider.
| Title | Description |
| --- | --- |
| [Numeric vs String Fields](../numeric-vs-string-fields/index) | Choosing numeric over string fields |
| [Optimizing MEMORY Tables](../optimizing-memory-tables/index) | MEMORY tables are a good choice for data that needs to be accessed often, a... |
| [Optimizing String and Character Fields](../optimizing-string-and-character-fields/index) | Optimizations when comparing string columns and VARCHAR vs BLOB |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb PASSWORD PASSWORD
========
Syntax
------
```
PASSWORD(str)
```
Description
-----------
The PASSWORD() function is used for hashing passwords for use in authentication by the MariaDB server. It is not intended for use in other applications.
Calculates and returns a hashed password string from the plaintext password *str*. Returns an empty string (>= [MariaDB 10.0.4](https://mariadb.com/kb/en/mariadb-1004-release-notes/)) if the argument was NULL.
The return value is a nonbinary string in the connection [character set and collation](../data-types-character-sets-and-collations/index), determined by the values of the [character\_set\_connection](../server-system-variables/index#character_set_connection) and [collation\_connection](../server-system-variables/index#collation_connection) system variables.
This is the function that is used for hashing MariaDB passwords for storage in the Password column of the [user table](../mysqluser-table/index) (see [privileges](../grant/index)), usually used with the [SET PASSWORD](../set-password/index) statement. It is not intended for use in other applications.
Until [MariaDB 10.3](../what-is-mariadb-103/index), the return value is 41-bytes in length, and the first character is always '\*'. From [MariaDB 10.4](../what-is-mariadb-104/index), the function takes into account the authentication plugin where applicable (A [CREATE USER](../create-user/index) or [SET PASSWORD](../set-password/index) statement). For example, when used in conjunction with a user authenticated by the [ed25519 plugin](../authentication-plugin-ed25519/index), the statement will create a longer hash:
```
CREATE USER edtest@localhost IDENTIFIED VIA ed25519 USING PASSWORD('secret');
CREATE USER edtest2@localhost IDENTIFIED BY 'secret';
SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv
WHERE user LIKE 'edtest%'\G
*************************** 1. row ***************************
CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): edtest@localhost => {
...
"plugin": "ed25519",
"authentication_string": "ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY",
...
}
*************************** 2. row ***************************
CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): edtest2@localhost => {
...
"plugin": "mysql_native_password",
"authentication_string": "*14E65567ABDB5135D0CFD9A70B3032C179A49EE7",
...
}
```
The behavior of this function is affected by the value of the [old\_passwords](../server-system-variables/index#old_passwords) system variable. If this is set to `1` (`0` is default), MariaDB reverts to using the [mysql\_old\_password authentication plugin](../authentication-plugin-mysql_old_password/index) by default for newly created users and passwords.
Examples
--------
```
SELECT PASSWORD('notagoodpwd');
+-------------------------------------------+
| PASSWORD('notagoodpwd') |
+-------------------------------------------+
| *3A70EE9FC6594F88CE9E959CD51C5A1C002DC937 |
+-------------------------------------------+
```
```
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
```
See Also
--------
* [Password Validation Plugins](../password-validation-plugins/index) - permits the setting of basic criteria for passwords
* [OLD\_PASSWORD()](../old_password/index) - pre-MySQL 4.1 password function
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb GeometryFromText GeometryFromText
================
A synonym for [ST\_GeomFromText](../st_geomfromtext/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb JSON_OVERLAPS JSON\_OVERLAPS
==============
**MariaDB starting with [10.9](../what-is-mariadb-109/index)**JSON\_OVERLAPS is added in MariaDB starting from 10.9.
Syntax
------
```
JSON_OVERLAPS(json_doc1, json_doc2)
```
Description
-----------
JSON\_OVERLAPS() compares two json documents and returns true if they have at least one common key-value pair between two objects, array element common between two arrays, or array element common with scalar if one of the arguments is a scalar and other is an array. If two json documents are scalars, it returns true if they have same type and value.
If none of the above conditions are satisfied then it returns false.
Examples
--------
```
SELECT JSON_OVERLAPS('false', 'false');
+---------------------------------+
| JSON_OVERLAPS('false', 'false') |
+---------------------------------+
| 1 |
+---------------------------------+
SELECT JSON_OVERLAPS('true', '["abc", 1, 2, true, false]');
+----------------------------------------------------+
| JSON_OVERLAPS('true','["abc", 1, 2, true, false]') |
+----------------------------------------------------+
| 1 |
+----------------------------------------------------+
SELECT JSON_OVERLAPS('{"A": 1, "B": {"C":2}}', '{"A": 2, "B": {"C":2}}') AS is_overlap;
+---------------------+
| is_overlap |
+---------------------+
| 1 |
+---------------------+
```
Partial match is considered as no-match.
Examples
--------
```
SELECT JSON_OVERLAPS('[1, 2, true, false, null]', '[3, 4, [1]]') AS is_overlap;
+--------------------- +
| is_overlap |
+----------------------+
| 0 |
+----------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb COLUMN_JSON COLUMN\_JSON
============
Syntax
------
```
COLUMN_JSON(dyncol_blob)
```
Description
-----------
Returns a JSON representation of data in `dyncol_blob`. Can also be used to display nested columns. See [dynamic columns](../dynamic-columns/index) for more information.
Example
-------
```
select item_name, COLUMN_JSON(dynamic_cols) from assets;
+-----------------+----------------------------------------+
| item_name | COLUMN_JSON(dynamic_cols) |
+-----------------+----------------------------------------+
| MariaDB T-shirt | {"size":"XL","color":"blue"} |
| Thinkpad Laptop | {"color":"black","warranty":"3 years"} |
+-----------------+----------------------------------------+
```
Limitation: `COLUMN_JSON` will decode nested dynamic columns at a nesting level of not more than 10 levels deep. Dynamic columns that are nested deeper than 10 levels will be shown as BINARY string, without encoding.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore 1.2 Upgrades MariaDB ColumnStore 1.2 Upgrades
=================================
| Title | Description |
| --- | --- |
| [MariaDB ColumnStore software upgrade 1.1.6 GA to 1.2.0 Alpha](../mariadb-columnstore-software-upgrade-116-ga-to-120-alpha/index) | MariaDB ColumnStore software upgrade 1.1.6 GA to 1.2.0 Alpha One change th... |
| [MariaDB ColumnStore software upgrade 1.1.6 GA to 1.2.1 Beta](../mariadb-columnstore-software-upgrade-116-ga-to-121-beta/index) | MariaDB ColumnStore software upgrade 1.1.6 GA to 1.2.1 Beta This upgrade a... |
| [MariaDB ColumnStore software upgrade 1.1.6 GA to 1.2.2 GA](../mariadb-columnstore-software-upgrade-116-ga-to-122-ga/index) | MariaDB ColumnStore software upgrade 1.1.6 GA to 1.2.2 GA This upgrade als... |
| [MariaDB ColumnStore software upgrade 1.1.7 GA to 1.2.3 GA](../mariadb-columnstore-software-upgrade-117-ga-to-123-ga/index) | MariaDB ColumnStore software upgrade 1.1.7 GA to 1.2.3 GA This upgrade als... |
| [MariaDB ColumnStore software upgrade 1.1.7 GA to 1.2.4 GA](../mariadb-columnstore-software-upgrade-117-ga-to-124-ga/index) | MariaDB ColumnStore software upgrade 1.1.7 GA to 1.2.4 GA This upgrade als... |
| [MariaDB ColumnStore software upgrade 1.1.7 GA to 1.2.5 GA](../mariadb-columnstore-software-upgrade-117-ga-to-125-ga/index) | MariaDB ColumnStore software upgrade 1.1.7 GA to 1.2.5 GA This upgrade als... |
| [MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.4 GA](../mariadb-columnstore-software-upgrade-12x-ga-to-124-ga/index) | MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.4 GA Changes in 1.2.1... |
| [MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.5 GA](../mariadb-columnstore-software-upgrade-12x-ga-to-125-ga/index) | MariaDB ColumnStore software upgrade 1.2.x GA to 1.2.5 GA Changes in 1.2.1... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb WAIT and NOWAIT WAIT and NOWAIT
===============
**MariaDB starting with [10.3.0](https://mariadb.com/kb/en/mariadb-1030-release-notes/)**[MariaDB 10.3.0](https://mariadb.com/kb/en/mariadb-1030-release-notes/) introduced extended syntax so that it is possible to set [innodb\_lock\_wait\_timeout](../xtradbinnodb-server-system-variables/index#innodb_lock_wait_timeout) and [lock\_wait\_timeout](../server-system-variables/index#lock_wait_timeout) for the following statements:
Syntax
------
```
ALTER TABLE tbl_name [WAIT n|NOWAIT] ...
CREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT n|NOWAIT] ...
DROP INDEX ... [WAIT n|NOWAIT]
DROP TABLE tbl_name [WAIT n|NOWAIT] ...
LOCK TABLE ... [WAIT n|NOWAIT]
OPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]
RENAME TABLE tbl_name [WAIT n|NOWAIT] ...
SELECT ... FOR UPDATE [WAIT n|NOWAIT]
SELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]
TRUNCATE TABLE tbl_name [WAIT n|NOWAIT]
```
Description
-----------
The lock wait timeout can be explicitly set in the statement by using either `WAIT n` (to set the wait in seconds) or `NOWAIT`, in which case the statement will immediately fail if the lock cannot be obtained. `WAIT 0` is equivalent to `NOWAIT`.
See Also
--------
* [Query Limits and Timeouts](../query-limits-and-timeouts/index)
* [ALTER TABLE](../alter-table/index)
* [CREATE INDEX](../create-index/index)
* [DROP INDEX](../drop-index/index)
* [DROP TABLE](../drop-table/index)
* [LOCK TABLES and UNLOCK TABLES](../lock-tables-and-unlock-tables/index)
* [OPTIMIZE TABLE](../optimize-table/index)
* [RENAME TABLE](../rename-table/index)
* [SELECT](../select/index)
* [TRUNCATE TABLE](../truncate-table/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ColumnStore Getting Started ColumnStore Getting Started
============================
Documentation for the latest release of Columnstore is not available on the Knowledge Base. Instead, see:
* [Release Notes](https://mariadb.com/docs/release-notes/mariadb-columnstore-1-5-2-release-notes/)
* [Deployment Instructions](https://mariadb.com/docs/deploy/community-single-columnstore/)
This section contains a quick summary of steps needed to perform an install of MariaDB ColumnStore.
| Title | Description |
| --- | --- |
| [ColumnStore Minimum Hardware Specification](../columnstore-minimum-hardware-specification/index) | The following table outlines the minimum recommended production server spec... |
| [Installing MariaDB ColumnStore 5](../installing-mariadb-columnstore-5/index) | How to install MariaDB ColumnStore 1.5. |
| [Installing MariaDB ColumnStore 1.4](../installing-mariadb-columnstore-14/index) | How to install MariaDB ColumnStore 1.4. |
| [Preparing and Installing MariaDB ColumnStore 1.2.X](../preparing-and-installing-mariadb-columnstore-12x/index) | |
| [Preparing and Installing MariaDB ColumnStore 1.1.x](../preparing-and-installing-mariadb-columnstore-11x/index) | |
| [Preparing and Installing MariaDB ColumnStore 1.0.X](../preparing-and-installing-mariadb-columnstore-10x/index) | |
| [Installing MariaDB AX / MariaDB ColumnStore from the Package Repositories - 1.1.X](../installing-mariadb-ax-mariadb-columnstore-from-the-package-repositories-11x/index) | Introduction Installing MariaDB AX and MariaDB ColumnStore individual pack... |
| [Installing and Configuring a ColumnStore System using the Amazon AMI](../installing-and-configuring-a-columnstore-system-using-the-amazon-ami/index) | MariaDB ColumnStore AMI The MariaDB ColumnStore AMI is CentOS 7 based with... |
| [Running MariaDB ColumnStore Docker containers on Linux, Windows and MacOS](../running-mariadb-columnstore-docker-containers-on-linux-windows-and-macos/index) | Docker allows for a simple setup of a ColumnStore single server instance for evaluation purposes |
| [Installing and Configuring a ColumnStore System using the Google Cloud](../installing-and-configuring-a-columnstore-system-using-the-google-cloud/index) | Introduction MariaDB ColumnStore can be used a Single Node or a Multi-Node... |
| [Installing MariaDB ColumnStore from the MariaDB Download](../installing-mariadb-columnstore-from-the-mariadb-download/index) | Introduction MariaDB ColumnStore packages can be downloaded from the Maria... |
| [Installing MariaDB ColumnStore from the Development Buildbot Package Repositories](../7758/index) | NOTE: Document for internal use only Introduction Installing Latest MariaD... |
| [MariaDB ColumnStore System Usage](../mariadb-columnstore-system-usage/index) | Once the MariaDB ColumnStore system installation has been completed, these... |
| [Installing MariaDB AX / MariaDB ColumnStore from the Package Repositories - 1.2.X](../installing-mariadb-ax-mariadb-columnstore-from-the-package-repositories-12x/index) | Introduction Installing MariaDB AX and MariaDB ColumnStore individual pack... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Cross-compiling MariaDB Cross-compiling MariaDB
=======================
Buildroot
---------
[Buildroot](https://buildroot.org/downloads/manual/manual.html#_user_guide) is a way to cross compile MariaDB and other packages into a root filesystem. In the menuconfig you need to enable "Enable C++ Support" first under "Toolchain". After C++ is enabled MariaDB is an option under "Target Packages" ->"Libraries" -> "Databases" -> "mysql support" -> "mysql variant" -> "mariadb". Also enable the "mariadb server" below the "mysql support" option.
Details
-------
To cross-compile with cmake you will need a toolchain file. See, for example, [here](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html?highlight=linker#cross-compiling-for-linux). Besides cmake specific variables it should have, at least
```
SET(STACK_DIRECTION -1)
SET(HAVE_IB_GCC_ATOMIC_BUILTINS 1)
```
with appropriate values for your target architecture. Normally these MariaDB configuration settings are detected by running a small test program, and it cannot be done when cross-compiling.
Note that during the build few helper tools are compiled and then immediately used to generate more source files for this very build. When cross-compiling these tools naturally should be built for the host architecture, not for the target architecture. Do it like this (assuming you're in the mariadb source tree):
```
$ mkdir host
$ cd host
$ cmake ..
$ make import_executables
$ cd ..
```
Now the helpers are built and you can cross-compile:
```
$ mkdir target
$ cd target
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain/file.cmake -DIMPORT_EXECUTABLES=../host/import_executables.cmake
$ make
```
Here you invoke cmake, specifying the path to your toolchain file and the path to the `import_executables.cmake` that you have just built on the previous step. Of course, you can also specify any other cmake parameters that could be necessary for this build, for example, enable or disable specific storage engines.
See also <https://lists.launchpad.net/maria-discuss/msg02911.html>
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb REPEAT Function REPEAT Function
===============
Syntax
------
```
REPEAT(str,count)
```
Description
-----------
Returns a string consisting of the string `str` repeated `count` times. If `count` is less than 1, returns an empty string. Returns NULL if `str` or `count` are NULL.
Examples
--------
```
SELECT QUOTE(REPEAT('MariaDB ',4));
+------------------------------------+
| QUOTE(REPEAT('MariaDB ',4)) |
+------------------------------------+
| 'MariaDB MariaDB MariaDB MariaDB ' |
+------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Using Buffer UPDATE Algorithm Using Buffer UPDATE Algorithm
=============================
This article explains the [UPDATE](../update/index) statement's *Using Buffer* algorithm.
Take the following table and query:
| Name | Salary |
| --- | --- |
| Babatunde | 1000 |
| Jolana | 1050 |
| Pankaja | 1300 |
```
UPDATE employees SET salary = salary+100 WHERE salary < 2000;
```
Suppose the *employees* table has an index on the *salary* column, and the optimizer decides to use a range scan on that index.
The optimizer starts a range scan on the *salary* index. We find the first record *Babatunde, 1000*. If we do an on-the-fly update, we immediately instruct the storage engine to change this record to be *Babatunde, 1000+100=1100*.
Then we proceed to search for the next record, and find *Jolana, 1050*. We instruct the storage engine to update it to be *Jolana, 1050+100=1150*.
Then we proceed to search for the next record ... and what happens next depends on the storage engine. In some storage engines, data changes are visible immediately, so we will find find the *Babatunde, 1100* record that we wrote at the first step, modifying it again, giving Babatunde an undeserved raise. Then we will see Babatunde again and again, looping continually.
In order to prevent such situations, the optimizer checks whether the UPDATE statement is going to change key values for the keys it is using. In that case, it will use a different algorithm:
1. Scan everyone with "salary<2000", remembering the rowids of the rows in a buffer.
2. Read the buffer and apply the updates.
This way, each row will be updated only once.
The `Using buffer` [EXPLAIN](../explain/index) output indicates that the buffer as described above will be used.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Building MariaDB from a Source RPM Building MariaDB from a Source RPM
==================================
For some distributions you can build MariaDB from a source RPM. (See also [Why Source RPMs (SRPMs) Aren't Packaged For Some Platforms](../why-source-rpms-srpms-arent-packaged-for-some-platforms/index)).
You can build it as follows:
### using dnf
On RHEL8 you might need to start with:
```
sudo dnf config-manager --set-enabled codeready-builder-beta-for-rhel-8-x86_64-rpms
```
Then, on all dnf distributions:
```
sudo dnf install rpm-build perl-generators
dnf download --source MariaDB
sudo dnf builddep MariaDB-*.src.rpm
rpmbuild --rebuild MariaDB-*.src.rpm
```
### using yum
```
sudo yum install rpm-build yum-utils
yumdownloader --source MariaDB
sudo yum-builddep MariaDB-*.src.rpm
rpmbuild --rebuild MariaDB-*.src.rpm
```
### using zypper
```
sudo zypper in rpm-build
sudo zypper si MariaDB
sudo rpmbuild -bb /usr/src/packages/SPECS/MariaDB.spec
```
Or (to avoid building as root):
```
sudo zypper in rpm-build
sudo zypper si -d MariaDB
zypper --pkg-cache-dir=`pwd` si --download-only MariaDB
rpmbuild --rebuild mariadb/srpms/MariaDB-*.src.rpm
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Optimizer Debugging With GDB Optimizer Debugging With GDB
============================
Some useful things for debugging optimizer code with gdb.
Useful print functions
----------------------
* `dbug_print_item()` prints the contents of an `Item` object into a buffer and returns pointer to it.
* `dbug_print_sel_arg()` prints an individual `SEL_ARG` object (NOT the whole graph or tree) and returns pointer to the buffer holding the printout.
* `dbug_print_table_row` prints the current row buffer of the given table.
* There are more `dbug_print_XX` functions for various data structures
Printing the Optimizer Trace
----------------------------
The optimizer trace is collected as plain text. One can print the contents of the trace collected so far as follows:
```
printf "%s\n", thd->opt_trace->current_trace->current_json->output.str.Ptr
```
Printing Current Partial Join Prefix
------------------------------------
`best_access_path()` is a function that adds another table to the join prefix.
When in or around that function, the following can be useful:
A macro to print the join prefix already constructed:
```
define bap_print_prefix
set $i=0
while ($i < idx)
p join->positions[$i++].table->table->alias.Ptr
end
end
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Pagination Optimization Pagination Optimization
=======================
The Desire
----------
You have a website with news articles, or a blog, or some other thing with a list of things that might be too long for a single page. So, you decide to break it into chunks of, say, 10 items and provide a [Next] button to go the next "page".
You spot [OFFSET and LIMIT](../limit/index) in MariaDB and decide that is the obvious way to do it.
```
SELECT *
FROM items
WHERE messy_filtering
ORDER BY date DESC
OFFSET $M LIMIT $N
```
Note that the problem requirement needs a [Next] link on each page so that the user can 'page' through the data. He does not really need "GoTo Page #". Jump to the [First] or [Last] page may be useful.
The Problem
-----------
All is well -- until you have 50,000 items in a list. And someone tries to walk through all 5000 pages. That 'someone' could be a search engine crawler.
Where's the problem? Performance. Your web page is doing "SELECT ... OFFSET 49990 LIMIT 10" (or the equivalent "LIMIT 49990,10"). MariaDB has to find all 50,000 rows, step over the first 49,990, then deliver the 10 for that distant page.
If it is a crawler ('spider') that read all the pages, then it actually touched about 125,000,000 items to read all 5,000 pages.
Reading the entire table, just to get a distant page, can be so much I/O that it can cause timeouts on the web page. Or it can interfere with other activity, causing other things to be slow.
Other Bugs
----------
In addition to a performance problem, ...
* If an item is inserted or deleted between the time you look at one page and the next, you could miss an item, or see an item duplicated.
* The pages are not easily bookmarked or sent to someone else because the contents shift over time.
* The WHERE clause and the [ORDER BY](../order-by/index) may even make it so that all 50,000 items have to be read, just to find the 10 items for page 1!
What to Do?
-----------
Hardware? No, that's just a bandaid. The data will continue to grow and even the new hardware won't handle it.
Better INDEX? No. You must get away from reading the entire table to get the 5000th page.
Build another table saying where the pages start? Get real! That would be a maintenance nightmare, and expensive.
Bottom line: Don't use OFFSET; instead remember where you "left off".
```
First page (latest 10 items):
SELECT ... WHERE ... ORDER BY id DESC LIMIT 10
Next page (second 10):
SELECT ... WHERE ... AND id < $left_off ORDER BY id DESC LIMIT 10
```
With INDEX(id), this suddenly becomes very efficient.
Implementation -- Getting Rid of OFFSET
---------------------------------------
You are probably doing this now: [ORDER BY](../order-by/index) datetime DESC LIMIT 49990,10 You probably have some unique id on the table. This can probably be used for "left off".
Currently, the [Next] button probably has a url something like ?topic=xyz&page=4999&limit=10 The 'topic' (or 'tag' or 'provider' or 'user' or etc) says which set of items are being displayed. The product of page\*limit gives the OFFSET. (The "limit=10" might be in the url, or might be hard-coded; this choice is not relevant to this discussion.)
The new variant would be ?topic=xyz&id=12345&limit=10. (Note: the 12345 is not computable from 4999.) By using INDEX(topic, id) you can efficiently say
```
WHERE topic = 'xyz'
AND id >= 1234
ORDER BY id
LIMIT 10
```
That will hit only 10 rows. This is a huge improvement for later pages. Now for more details.
Implementation -- "Left Off"
----------------------------
What if there are exactly 10 rows left when you display the current page? It would make the UI nice if you grayed out the [Next] button, wouldn't it. (Or you could suppress the button all together.)
How to do that? Instead of LIMIT 10, use LIMIT 11. That will give you the 10 items needed for the current page, plus an indication of whether there is another page. And the id for that page.
So, take the 11th id for the [Next] button: <a href=?topic=xyz&id=$id11&limit=10>Next</a>
Implementation -- Links Beyond [Next]
-------------------------------------
Let's extend the 11 trick to also find the next 5 pages and build links for them.
Plan A is to say LIMIT 51. If you are on page 12, that would give you links for pages 13 (using 11th id) through pages 17 (51st).
Plan B is to do two queries, one to get the 10 items for the current page, the other to get the next 41 ids (LIMIT 10, 41) for the next 5 pages.
Which plan to pick? It depends on many things, so benchmark.
A Reasonable Set of Links
-------------------------
Reaching forward and backward by 5 pages is not too much work. It would take two separate queries to find the ids in both directions. Also, having links that take you to the First and Last pages would be easy to do. No id is needed; they can be something like
```
<a href=?topic=xyz&id=FIRST&limit=10>First</a>
<a href=?topic=xyz&id=LAST&limit=10>Last</a>
```
The UI would recognize those, then generate a SELECT with something like
```
WHERE topic = 'xyz'
ORDER BY id ASC -- ASC for First; DESC for Last
LIMIT 10
```
The last items would be delivered in reverse order. Either deal with that in the UI, or make the SELECT more complex:
```
( SELECT ...
WHERE topic = 'xyz'
ORDER BY id DESC
LIMIT 10
) ORDER BY id ASC
```
Let's say you are on page 12 of lots of pages. It could show these links:
```
[First] ... [7] [8] [9] [10] [11] 12 [13] [14] [15] [16] [17] ... [Last]
```
where the ellipsis is really used. Some end cases:
```
Page one of three:
First [2] [3]
Page one of many:
First [2] [3] [4] [5] ... [Last]
Page two of many:
[First] 2 [3] [4] [5] ... [Last]
If you jump to the Last page, you don't know what page number it is.
So, the best you can do is perhaps:
[First] ... [Prev] Last
```
Why it Works
------------
The goal is to touch only the relevant rows, not all the rows leading up to the desired rows. This is nicely achieved, except for building links to the "next 5 pages". That may (or may not) be efficiently resolved by the simple SELECT id, discussed above. The reason that may not be efficient deals with the WHERE clause.
Let's discuss the optimal and suboptimal indexes.
For this discussion, I am assuming
* The datetime field might have duplicates -- this can cause troubles
* The id field is unique
* The id field is close enough to datetime-ordered to be used instead of datetime.
Very efficient -- it does all the work in the index:
```
INDEX(topic, id)
WHERE topic = 'xyz'
AND id >= 876
ORDER BY id ASC
LIMIT 10,41
<</code??
That will hit 51 consecutive index entries, 0 data rows.
Inefficient -- it must reach into the data:
<<code>>
INDEX(topic, id)
WHERE topic = 'xyz'
AND id >= 876
AND is_deleted = 0
ORDER BY id ASC
LIMIT 10,41
```
That will hit at least 51 consecutive index entries, plus at least 51 \_randomly\_ located data rows.
Efficient -- back to the previous degree of efficiency:
```
INDEX(topic, is_deleted, id)
WHERE topic = 'xyz'
AND id >= 876
AND is_deleted = 0
ORDER BY id ASC
LIMIT 10,41
```
Note how all the '=' parts of the WHERE come first; then comes both the '>=' and 'ORDER BY', both on id. This means that the INDEX can be used for all the WHERE, plus the ORDER BY.
"Items 11-20 Out of 12345"
--------------------------
You lose the "out of" except when the count is small. Instead, say something like
```
Items 11-20 out of Many
```
Alternatively... Only a few searches will have too many items to count. Keep another table with the search criteria and a count. This count can be computed daily (or hourly) by some background script. When discovering that the topic is a busy one, look it up in the table to get
```
Items 11-20 out of about 49,000
```
The background script would round the count off.
The quick way to get an \_estimated\_ number of rows for an InnoDB table is
```
SELECT table_rows
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'database_name'
AND TABLE_NAME = 'table_name'
```
However, it does not allow for the WHERE clause that you probably have.
Complex WHERE, or JOIN
----------------------
If the search criteria cannot be confined to an INDEX in a single table, this technique is doomed. I have another paper that discusses "Lists", which solves that (which extra development work), and even improves on what is discussed here.
How Much Faster?
----------------
This depends on
* How many rows (total)
* Whether the WHERE clause prevented the efficient use of the ORDER BY
* Whether the data is bigger than the cache. This last one kicks in when building one page requires reading more data from disk can be cached. At that point, the problem goes from being CPU-bound to being I/O-bound. This is likely to suddenly slow down the loading of a pages by a factor of 10.
What is Lost
------------
* Cannot "jump to Page N", for an arbitrary N. Why do you want to do that?
* Walking backward from the end does not know the page numbers.
* The code is more complex.
Postlog
-------
Designed about 2007; posted 2012.
See Also
--------
* [A forum discussion](http://stackoverflow.com/questions/31533414/filtering-large-db-record-grouped-by-a-column)
* [Luke calls it "seek method" or "keyset pagination"](http://use-the-index-luke.com/no-offset)
* [More by Luke](http://use-the-index-luke.com/sql/partial-results/fetch-next-page)
Rick James graciously allowed us to use this article in the Knowledge Base.
[Rick James' site](http://mysql.rjweb.org/) has other useful tips, how-tos, optimizations, and debugging tips.
Original source: <http://mysql.rjweb.org/doc.php/pagination>
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Configuring MariaDB for Optimal Performance Configuring MariaDB for Optimal Performance
===========================================
This article is to help you configure MariaDB for optimal performance.
Note that by default MariaDB is configured to work on a desktop system and should because of this not take a lot of resources. To get things to work for a dedicated server, you have to do a few minutes of work.
For this article we assume that you are going to run MariaDB on a dedicated server.
Feel free to update this article if you have more ideas.
[my.cnf](../configuring-mariadb-with-mycnf/index) Files
--------------------------------------------------------
MariaDB is normally configured by editing the [my.cnf](../mysqld-configuration-files-and-groups/index) file.
The following my.cnf example files were included with MariaDB until [MariaDB 10.3.0](https://mariadb.com/kb/en/mariadb-1030-release-notes/). If present, you can examine them to see more complete examples of some of the many ways to configure MariaDB and use the one that fits you best as a base. Note that these files are now quite outdated, so what was huge a few years ago may no longer be seen as such.
* my-small.cnf
* my-medium.cnf
* my-large.cnf
* my-huge.cnf
[InnoDB](../innodb/index) Storage Engine
-----------------------------------------
InnoDB is normally the default storage engine with MariaDB.
* You should set [innodb\_buffer\_pool\_size](../innodb-system-variables/index#innodb_buffer_pool_size) to about 80% of your memory. The goal is to ensure that 80 % of your working set is in memory.
The other most important InnoDB variables are:
* [innodb\_log\_file\_size](../innodb-system-variables/index#innodb_log_file_size)
* [innodb\_flush\_method](../innodb-system-variables/index#innodb_flush_method)
* [innodb\_thread\_sleep\_delay](../innodb-system-variables/index#innodb_thread_sleep_delay)
Some other important InnoDB variables:
* [innodb\_adaptive\_max\_sleep\_delay](../innodb-system-variables/index#innodb_adaptive_max_sleep_delay)
* [innodb\_buffer\_pool\_instances](../innodb-system-variables/index#innodb_buffer_pool_instances)
* [innodb\_max\_dirty\_pages\_pct\_lwm](../innodb-system-variables/index#innodb_max_dirty_pages_pct_lwm)
* [innodb\_read\_ahead\_threshold](../innodb-system-variables/index#innodb_read_ahead_threshold)
* [innodb\_thread\_concurrency](../innodb-system-variables/index#innodb_thread_concurrency)
[Aria](../aria-storage-engine/index) Storage Engine
----------------------------------------------------
* MariaDB uses by default the Aria storage engine for internal temporary files. If you have many temporary files, you should set [aria\_pagecache\_buffer\_size](../aria-server-system-variables/index#aria_pagecache_buffer_size) to a reasonably large value so that temporary overflow data is not flushed to disk. The default is 128M.
[MyISAM](../myisam/index)
-------------------------
* If you don't use MyISAM tables explicitly (true for most [MariaDB 10.4](../what-is-mariadb-104/index)+ users), you can set [key\_buffer\_size](../myisam-system-variables/index#key_buffer_size) to a very low value, like 64K.
Lots of Connections
-------------------
### A Lot of Fast Connections + Small Set of Queries + Disconnects
* If you are doing a lot of fast connections / disconnects, you should increase [back\_log](../server-system-variables/index#back_log) and if you are running [MariaDB 10.1](../what-is-mariadb-101/index) or below [thread\_cache\_size](../server-system-variables/index#thread_cache_size).
* If you have a lot (> 128) of simultaneous running fast queries, you should consider setting [thread\_handling](../thread-pool-system-and-status-variables/index#thread_handling) to `pool_of_threads`.
### Connecting From a Lot of Different Machines
* If you are connecting from a lot of different machines you should increase [host\_cache\_size](../server-system-variables/index#host_cache_size) to the max number of machines (default 128) to cache the resolving of hostnames. If you don't connect from a lot of machines, you can set this to a very low value!
See Also
--------
* [MariaDB Memory Allocation](../mariadb-memory-allocation/index)
* [Full List of MariaDB Options, System and Status Variables](../full-list-of-mariadb-options-system-and-status-variables/index)
* [Server system variables](../server-system-variables/index)
* [mysqld options](../mysqld-options-full-list/index)
* [Performance schema](../performance-schema/index) helps you understand what is taking time and resources.
* [Slow query log](../slow-query-log/index) is used to find queries that are running slow.
* [OPTIMIZE TABLE](../optimize-table/index) helps you defragment tables.
External Links
--------------
* <http://www.tocker.ca/2013/09/17/what-to-tune-in-mysql-56-after-installation.html>
* <http://www.percona.com/resources/technical-presentations/optimizing-mysql-configuration-percona-mysql-university-montevideo>
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB Binary Packages MariaDB Binary Packages
========================
This section contains information on and installation instructions for [MariaDB binaries and packages](https://downloads.mariadb.org/mariadb/).
| Title | Description |
| --- | --- |
| [Installing MariaDB RPM Files](../rpm/index) | Information and instructions on using the RPM packages and the related repositories. |
| [Installing MariaDB .deb Files](../installing-mariadb-deb-files/index) | Installing MariaDB .deb Files. |
| [Installing MariaDB MSI Packages on Windows](../installing-mariadb-msi-packages-on-windows/index) | MSI packages are available for both x86 (32 bit) and x64 (64 bit) processor architectures |
| [Installing MariaDB Server PKG packages on macOS](../installing-mariadb-server-pkg-packages-on-macos/index) | MariaDB Server does not currently provide a .pkg installer for macOS |
| [Installing MariaDB Binary Tarballs](../installing-mariadb-binary-tarballs/index) | Installing MariaDB binary tarballs, systemd, and glibc-2.14. |
| [Installing MariaDB Server on macOS Using Homebrew](../installing-mariadb-on-macos-using-homebrew/index) | Installing MariaDB on macOS via the Homebrew package manager, the "missing ... |
| [Installing MariaDB Windows ZIP Packages](../installing-mariadb-windows-zip-packages/index) | Getting started with ZIP packages on Windows. |
| [Compiling MariaDB From Source](../compiling-mariadb-from-source/index) | Articles on compiling MariaDB from source |
| [Distributions Which Include MariaDB](../distributions-which-include-mariadb/index) | Distributions including MariaDB. |
| [Running Multiple MariaDB Server Processes](../running-multiple-mariadb-server-processes/index) | Running multiple MariaDB Server processes on the same server. |
| [Installing MariaDB Alongside MySQL](../installing-mariadb-alongside-mysql/index) | MariaDB was designed as a drop in place replacement for MySQL, but you can ... |
| [GPG](../gpg/index) | The MariaDB project signs their MariaDB packages for Debian, Ubuntu, Fedora, CentOS, and Red Hat |
| [MariaDB Deprecation Policy](../deprecation-policy/index) | Information on MariaDB's Software Deprecation Policy and Schedule. |
| [Automated MariaDB Deployment and Administration](../automated-mariadb-deployment-and-administration/index) | Tools for automating deployment and management of MariaDB servers. |
| [MariaDB Package Repository Setup and Usage](../mariadb-package-repository-setup-and-usage/index) | Executing and using a convenient shell script to set up the MariaDB Package Repository. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Replication Threads Replication Threads
===================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
MariaDB's [replication](../high-availability-performance-tuning-mariadb-replication/index) implementation requires several types of threads.
Threads on the Master
---------------------
The master usually only has one type of replication-related thread: the binary log dump thread.
If [semisynchronous replication](../semisynchronous-replication/index) is enabled, then the master also has an ACK receiver thread.
### Binary Log Dump Thread
The binary log dump thread runs on the master and dumps the [binary log](../binary-log/index) to the slave. This thread can be identified by running the `[SHOW PROCESSLIST](../show-processlist/index)` statement and finding the thread where the [thread command](../thread-command-values/index) is `"Binlog Dump"`.
The master creates a separate binary log dump thread for each slave connected to the master. You can identify which slaves are connected to the master by executing the `[SHOW SLAVE HOSTS](../show-slave-hosts/index)` statement.
#### Binary Log Dump Threads and the Shutdown Process
When a master server is shutdown and it goes through the normal shutdown process, the master kills client threads in random order. By default, the master also considers its binary log dump threads to be regular client threads. As a consequence, the binary log dump threads can be killed while client threads still exist, and this means that data can be written on the master during a normal shutdown that won't be replicated. This is true even if [semi-synchronous replication](../semisynchronous-replication/index) is being used.
In [MariaDB 10.4](../what-is-mariadb-104/index) and later, this problem can be solved by shutting down the server using either the `[mysqladmin](../mysqladmin/index)` utility or the `[SHUTDOWN](../shutdown/index)` command, and providing a special option.
For example, this problem can be solved by shutting down the server with the `[mysqladmin](../mysqladmin/index)` utility and by providing the `--wait-for-all-slaves` option to the utility and by executing the `shutdown` command with the utility:
```
mysqladmin --wait-for-all-slaves shutdown
```
Or this problem can be solved by shutting down the server with the `[SHUTDOWN](../shutdown/index)` command and by providing the `WAIT FOR ALL SLAVES` option to the command:
```
SHUTDOWN WAIT FOR ALL SLAVES;
```
When one of these special options is provided, the server only kills its binary log dump threads after all client threads have been killed, and it only completes the shutdown after the last [binary log](../binary-log/index) has been sent to all connected slaves.
In [MariaDB 10.4](../what-is-mariadb-104/index) and later, it is still not possible to enable this behavior by default. This means that this behavior is currently inaccessible when shutting down the server using tools like `[systemd](../systemd/index)` or `[sysVinit](../sysvinit/index)`.
In [MariaDB 10.3](../what-is-mariadb-103/index) and before, it is recommended to manually switchover slaves to a new master before shutting down the old master.
### ACK Receiver Thread
When [semisynchronous replication](../semisynchronous-replication/index) is enabled, semisynchronous slaves send acknowledgements (ACKs) to their master confirm that they have received some transaction. The master creates an ACK receiver thread to receive these ACKs.
Threads on the Slave
--------------------
The slave has three types of replication-related threads: the slave I/O thread, the slave SQL thread, and worker threads, which are only applicable when [parallel replication](../parallel-replication/index) is in use.
When [multi-source replication](../multi-source-replication/index) is in use, each independent replication connection has its own slave threads of each type.
### Slave I/O Thread
The slave's I/O thread receives the [binary log](../binary-log/index) events from the master and writes them to its [relay log](../relay-log/index).
#### Binary Log Position
The [binary log](../binary-log/index) position of the slave's I/O thread can be checked by executing the `[SHOW SLAVE STATUS](../show-slave-status/index)` statement. It will be shown as the `Master_Log_File` and `Read_Master_Log_Pos` columns.
The [binary log](../binary-log/index) position of the slave's I/O thread can be set by setting the `[MASTER\_LOG\_FILE](../change-master-to/index#master_log_file)` and `[MASTER\_LOG\_POS](../change-master-to/index#master_log_pos)` options with the `[CHANGE MASTER](../change-master-to/index)` statement.
The [binary log](../binary-log/index) position of the slave's I/O thread and the values of most other `[CHANGE MASTER](../change-master-to/index)` options are written to either the default `master.info` file or the file that is configured by the `[master\_info\_file](../mysqld-options/index#-master-info-file)` option. The slave's I/O thread keeps this [binary log](../binary-log/index) position updated as it downloads events. See [CHANGE MASTER TO: Option Persistence](../change-master-to/index#option-persistence) for more information
### Slave SQL Thread
The slave's SQL thread reads events from the [relay log](../relay-log/index). What it does with them depends on whether [parallel replication](../parallel-replication/index) is in use. If [parallel replication](../parallel-replication/index) is not in use, then the SQL thread applies the events to its local copy of the data. If [parallel replication](../parallel-replication/index) is in use, then the SQL thread hands off the events to its worker threads to apply in parallel.
#### Relay Log Position
The [relay log](../relay-log/index) position of the slave's SQL thread can be checked by executing the `[SHOW SLAVE STATUS](../show-slave-status/index)` statement. It will be shown as the `Relay_Log_File` and `Relay_Log_Pos` columns.
The [relay log](../relay-log/index) position of the slave's SQL thread can be set by setting the `[RELAY\_LOG\_FILE](../change-master-to/index#relay_log_file)` and `[RELAY\_LOG\_POS](../change-master-to/index#relay_log_pos)` options with the `[CHANGE MASTER](../change-master-to/index)` statement.
The [relay log](../relay-log/index) position of the slave's SQL thread is written to either the default `relay-log.info` file or the file that is configured by the `[relay\_log\_info\_file](../replication-and-binary-log-system-variables/index#relay_log_info_file)` system variable. The slave's SQL thread keeps this [relay log](../relay-log/index) position updated as it applies events. See [CHANGE MASTER TO: Option Persistence](../change-master-to/index#option-persistence) for more information.
#### Binary Log Position
The corresponding [binary log](../binary-log/index) position of the current [relay log](../relay-log/index) position of the slave's SQL thread can be checked by executing the `[SHOW SLAVE STATUS](../show-slave-status/index)` statement. It will be shown as the `Relay_Master_Log_File` and `Exec_Master_Log_Pos` columns.
#### GTID Position
If the slave is replicating [binary log](../binary-log/index) events that contain [GTIDs](../gtid/index), then the [slave's SQL thread](index#slave-sql-thread) will write every GTID that it applies to the `[mysql.gtid\_slave\_pos](../mysqlgtid_slave_pos-table/index)` table. This GTID can be inspected and modified through the `[gtid\_slave\_pos](../gtid/index#gtid_slave_pos)` system variable.
If the slave has the `[log\_slave\_updates](../replication-and-binary-log-system-variables/index#log_slave_updates)` system variable enabled and if the slave has the [binary log](../binary-log/index) enabled, then every write by the [slave's SQL thread](index#slave-sql-thread) will also go into the slave's [binary log](../binary-log/index). This means that [GTIDs](../gtid/index) of replicated transactions would be reflected in the value of the `[gtid\_binlog\_pos](../gtid/index#gtid_binlog_pos)` system variable.
See [CHANGE MASTER TO: GTID Persistence](../change-master-to/index#gtid-persistence) for more information.
### Worker Threads
When [parallel replication](../parallel-replication/index) is in use, then the SQL thread hands off the events to its worker threads to apply in parallel.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Annotate_rows_log_event Annotate\_rows\_log\_event
==========================
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
`Annotate_rows` events accompany `row` events and describe the query which caused the row event.
Until [MariaDB 10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/), the binlog event type `Annotate_rows_log_event` was off by default (so as not to change the binary log format and to allow one to replicate [MariaDB 5.3](../what-is-mariadb-53/index) to MySQL/[MariaDB 5.1](../what-is-mariadb-51/index)). You can enable this with `[--binlog-annotate-row-events](#master-option-binlog-annotate-row-events)`.
In the [binary log](../mysqlbinlog/index), each `Annotate_rows` event precedes the corresponding Table map event or the first of the Table map events, if there are more than one (e.g. in a case of multi-delete or insert delayed).
`Annotate_rows` Example
------------------------
```
master> DROP DATABASE IF EXISTS test;
master> CREATE DATABASE test;
master> USE test;
master> CREATE TABLE t1(a int);
master> INSERT INTO t1 VALUES (1), (2), (3);
master> CREATE TABLE t2(a int);
master> INSERT INTO t2 VALUES (1), (2), (3);
master> CREATE TABLE t3(a int);
master> INSERT DELAYED INTO t3 VALUES (1), (2), (3);
master> DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3
-> WHERE t1.a=t2.a AND t2.a=t3.a;
master> SHOW BINLOG EVENTS IN 'master-bin.000001';
+-------------------+------+---------------+-----------+-------------+---------------------------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+-------------------+------+---------------+-----------+-------------+---------------------------------------------------------------------------------+
| master-bin.000001 | 4 | Format_desc | 100 | 240 | Server ver: 5.5.20-MariaDB-mariadb1~oneiric-log, Binlog ver: 4 |
| master-bin.000001 | 240 | Query | 100 | 331 | DROP DATABASE IF EXISTS test |
| master-bin.000001 | 331 | Query | 100 | 414 | CREATE DATABASE test |
| master-bin.000001 | 414 | Query | 100 | 499 | use `test`; CREATE TABLE t1(a int) |
| master-bin.000001 | 499 | Query | 100 | 567 | BEGIN |
| master-bin.000001 | 567 | Annotate_rows | 100 | 621 | INSERT INTO t1 VALUES (1), (2), (3) |
| master-bin.000001 | 621 | Table_map | 100 | 662 | table_id: 16 (test.t1) |
| master-bin.000001 | 662 | Write_rows | 100 | 706 | table_id: 16 flags: STMT_END_F |
| master-bin.000001 | 706 | Query | 100 | 775 | COMMIT |
| master-bin.000001 | 775 | Query | 100 | 860 | use `test`; CREATE TABLE t2(a int) |
| master-bin.000001 | 860 | Query | 100 | 928 | BEGIN |
| master-bin.000001 | 928 | Annotate_rows | 100 | 982 | INSERT INTO t2 VALUES (1), (2), (3) |
| master-bin.000001 | 982 | Table_map | 100 | 1023 | table_id: 17 (test.t2) |
| master-bin.000001 | 1023 | Write_rows | 100 | 1067 | table_id: 17 flags: STMT_END_F |
| master-bin.000001 | 1067 | Query | 100 | 1136 | COMMIT |
| master-bin.000001 | 1136 | Query | 100 | 1221 | use `test`; CREATE TABLE t3(a int) |
| master-bin.000001 | 1221 | Query | 100 | 1289 | BEGIN |
| master-bin.000001 | 1289 | Annotate_rows | 100 | 1351 | INSERT DELAYED INTO t3 VALUES (1), (2), (3) |
| master-bin.000001 | 1351 | Table_map | 100 | 1392 | table_id: 18 (test.t3) |
| master-bin.000001 | 1392 | Write_rows | 100 | 1426 | table_id: 18 flags: STMT_END_F |
| master-bin.000001 | 1426 | Table_map | 100 | 1467 | table_id: 18 (test.t3) |
| master-bin.000001 | 1467 | Write_rows | 100 | 1506 | table_id: 18 flags: STMT_END_F |
| master-bin.000001 | 1506 | Query | 100 | 1575 | COMMIT |
| master-bin.000001 | 1575 | Query | 100 | 1643 | BEGIN |
| master-bin.000001 | 1643 | Annotate_rows | 100 | 1748 | DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a |
| master-bin.000001 | 1748 | Table_map | 100 | 1789 | table_id: 16 (test.t1) |
| master-bin.000001 | 1789 | Table_map | 100 | 1830 | table_id: 17 (test.t2) |
| master-bin.000001 | 1830 | Delete_rows | 100 | 1874 | table_id: 16 |
| master-bin.000001 | 1874 | Delete_rows | 100 | 1918 | table_id: 17 flags: STMT_END_F |
| master-bin.000001 | 1918 | Query | 100 | 1987 | COMMIT |
+-------------------+------+---------------+-----------+-------------+---------------------------------------------------------------------------------+
```
Options Related to Annotate\_rows\_log\_event
---------------------------------------------
The following options have been added to control the behavior of `Annotate_rows_log_event`:
### Master Option: ``--`binlog-annotate-row-events`
This option tells the master to write `Annotate_rows` events to the binary log. See [binlog\_annotate\_row\_events](../replication-and-binary-log-server-system-variables/index#binlog_annotate_row_events) for a detailed description of the variable.
Session values allow you to annotate only some selected statements:
```
...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ...
```
### Slave Option: ``--`replicate-annotate-row-events`
This option tells the slave to reproduce `Annotate_row` events received from the master in its own binary log (sensible only when used in tandem with the `log-slave-updates` option).
See [replicate\_annotate\_row\_events](../replication-and-binary-log-server-system-variables/index#replicate_annotate_row_events) for a detailed description of the variable.
### mysqlbinlog Option: ``--`skip-annotate-row-events`
This option tells [mysqlbinlog](../about-mysqlbinlog/index) to skip all `Annotate_row` events in its output (by default, mysqlbinlog prints `Annotate_row` events, if the binary log contains them).
Example of mysqlbinlog Output
-----------------------------
```
...> mysqlbinlog.exe -vv -R --user=root --port=3306 --host=localhost master-bin.000001
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#100516 15:36:00 server id 100 end_log_pos 240 Start: binlog v 4, server v 5.1.44-debug-log created 100516
15:36:00 at startup
ROLLBACK/*!*/;
BINLOG '
oNjvSw9kAAAA7AAAAPAAAAAAAAQANS4xLjQ0LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACg2O9LEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA=
'/*!*/;
# at 240
#100516 15:36:18 server id 100 end_log_pos 331 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
SET @@session.pseudo_thread_id=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1
/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test
/*!*/;
# at 331
#100516 15:36:18 server id 100 end_log_pos 414 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
CREATE DATABASE test
/*!*/;
# at 414
#100516 15:36:18 server id 100 end_log_pos 499 Query thread_id=1 exec_time=0 error_code=0
use test/*!*/;
SET TIMESTAMP=1274009778/*!*/;
CREATE TABLE t1(a int)
/*!*/;
# at 499
#100516 15:36:18 server id 100 end_log_pos 567 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 567
# at 621
# at 662
#100516 15:36:18 server id 100 end_log_pos 621 Annotate_rows:
#Q> INSERT INTO t1 VALUES (1), (2), (3)
#100516 15:36:18 server id 100 end_log_pos 662 Table_map: `test`.`t1` mapped to number 16
#100516 15:36:18 server id 100 end_log_pos 706 Write_rows: table id 16 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAJYCAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
stjvSxdkAAAALAAAAMICAAAQABAAAAAAAAEAAf/+AQAAAP4CAAAA/gMAAAA=
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 706
#100516 15:36:18 server id 100 end_log_pos 775 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
# at 775
#100516 15:36:18 server id 100 end_log_pos 860 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
CREATE TABLE t2(a int)
/*!*/;
# at 860
#100516 15:36:18 server id 100 end_log_pos 928 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 928
# at 982
# at 1023
#100516 15:36:18 server id 100 end_log_pos 982 Annotate_rows:
#Q> INSERT INTO t2 VALUES (1), (2), (3)
#100516 15:36:18 server id 100 end_log_pos 1023 Table_map: `test`.`t2` mapped to number 17
#100516 15:36:18 server id 100 end_log_pos 1067 Write_rows: table id 17 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAP8DAAAAABEAAAAAAAAABHRlc3QAAnQyAAEDAAE=
stjvSxdkAAAALAAAACsEAAAQABEAAAAAAAEAAf/+AQAAAP4CAAAA/gMAAAA=
'/*!*/;
### INSERT INTO test.t2
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 1067
#100516 15:36:18 server id 100 end_log_pos 1136 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
# at 1136
#100516 15:36:18 server id 100 end_log_pos 1221 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
CREATE TABLE t3(a int)
/*!*/;
# at 1221
#100516 15:36:18 server id 100 end_log_pos 1289 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 1289
# at 1351
# at 1392
#100516 15:36:18 server id 100 end_log_pos 1351 Annotate_rows:
#Q> INSERT DELAYED INTO t3 VALUES (1), (2), (3)
#100516 15:36:18 server id 100 end_log_pos 1392 Table_map: `test`.`t3` mapped to number 18
#100516 15:36:18 server id 100 end_log_pos 1426 Write_rows: table id 18 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAHAFAAAAABIAAAAAAAAABHRlc3QAAnQzAAEDAAE=
stjvSxdkAAAAIgAAAJIFAAAQABIAAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t3
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at 1426
# at 1467
#100516 15:36:18 server id 100 end_log_pos 1467 Table_map: `test`.`t3` mapped to number 18
#100516 15:36:18 server id 100 end_log_pos 1506 Write_rows: table id 18 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAALsFAAAAABIAAAAAAAAABHRlc3QAAnQzAAEDAAE=
stjvSxdkAAAAJwAAAOIFAAAQABIAAAAAAAEAAf/+AgAAAP4DAAAA
'/*!*/;
### INSERT INTO test.t3
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t3
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 1506
#100516 15:36:18 server id 100 end_log_pos 1575 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
# at 1575
#100516 15:36:18 server id 100 end_log_pos 1643 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 1643
# at 1748
# at 1789
# at 1830
# at 1874
#100516 15:36:18 server id 100 end_log_pos 1748 Annotate_rows:
#Q> DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3
#Q> WHERE t1.a=t2.a AND t2.a=t3.
#100516 15:36:18 server id 100 end_log_pos 1789 Table_map: `test`.`t1` mapped to number 16
#100516 15:36:18 server id 100 end_log_pos 1830 Table_map: `test`.`t2` mapped to number 17
#100516 15:36:18 server id 100 end_log_pos 1874 Delete_rows: table id 16
#100516 15:36:18 server id 100 end_log_pos 1918 Delete_rows: table id 17 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAP0GAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
stjvSxNkAAAAKQAAACYHAAAAABEAAAAAAAAABHRlc3QAAnQyAAEDAAE=
stjvSxlkAAAALAAAAFIHAAAAABAAAAAAAAAAAf/+AQAAAP4CAAAA/gMAAAA=
### DELETE FROM test.t1
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t1
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t1
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
stjvSxlkAAAALAAAAH4HAAAQABEAAAAAAAEAAf/+AQAAAP4CAAAA/gMAAAA=
'/*!*/;
### DELETE FROM test.t2
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t2
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t2
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 1918
#100516 15:36:18 server id 100 end_log_pos 1987 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
```
See Also
--------
* [mysqlbinlog Options](../mysqlbinlog-options/index)
* [Replication and Binary Log Server System Variables](../replication-and-binary-log-server-system-variables/index)
* [Full List of MariaDB Options, System and Status Variables](../full-list-of-mariadb-options-system-and-status-variables/index)
* [mysqld Options](../mysqld-options/index)
* [What is MariaDB 5.3](../what-is-mariadb-53/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb SPIDER_COPY_TABLES SPIDER\_COPY\_TABLES
====================
Syntax
------
```
SPIDER_COPY_TABLES(spider_table_name,
source_link_id, destination_link_id_list [,parameters])
```
Description
-----------
A [UDF](../user-defined-functions/index) installed with the [Spider Storage Engine](../spider/index), this function copies table data from `source_link_id` to `destination_link_id_list`. The service does not need to be stopped in order to copy.
If the Spider table is partitioned, the name must be of the format `table_name#P#partition_name`. The partition name can be viewed in the `mysql.spider_tables` table, for example:
```
SELECT table_name FROM mysql.spider_tables;
+-------------+
| table_name |
+-------------+
| spt_a#P#pt1 |
| spt_a#P#pt2 |
| spt_a#P#pt3 |
+-------------+
```
Returns `1` if the data was copied successfully, or `0` if copying the data failed.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb POW POW
===
Syntax
------
```
POW(X,Y)
```
Description
-----------
Returns the value of X raised to the power of Y.
POWER() is a synonym.
Examples
--------
```
SELECT POW(2,3);
+----------+
| POW(2,3) |
+----------+
| 8 |
+----------+
SELECT POW(2,-2);
+-----------+
| POW(2,-2) |
+-----------+
| 0.25 |
+-----------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_CROSSES ST\_CROSSES
===========
Syntax
------
```
ST_CROSSES(g1,g2)
```
Description
-----------
Returns `1` if geometry *`g1`* spatially crosses geometry *`g2`*. Returns `NULL` if `g1` is a [Polygon](../polygon/index) or a [MultiPolygon](../multipolygon/index), or if `g2` is a [Point](../point/index) or a [MultiPoint](../multipoint/index). Otherwise, returns `0`.
The term spatially crosses denotes a spatial relation between two given geometries that has the following properties:
* The two geometries intersect
* Their intersection results in a geometry that has a dimension that is one less than the maximum dimension of the two given geometries
* Their intersection is not equal to either of the two given geometries
ST\_CROSSES() uses object shapes, while [CROSSES()](../crosses/index), based on the original MySQL implementation, uses object bounding rectangles.
Examples
--------
```
SET @g1 = ST_GEOMFROMTEXT('LINESTRING(174 149, 176 151)');
SET @g2 = ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))');
SELECT ST_CROSSES(@g1,@g2);
+---------------------+
| ST_CROSSES(@g1,@g2) |
+---------------------+
| 1 |
+---------------------+
SET @g1 = ST_GEOMFROMTEXT('LINESTRING(176 149, 176 151)');
SELECT ST_CROSSES(@g1,@g2);
+---------------------+
| ST_CROSSES(@g1,@g2) |
+---------------------+
| 0 |
+---------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB Development Tools MariaDB Development Tools
==========================
Tools for developing MariaDB.
| Title | Description |
| --- | --- |
| [Using Git with MariaDB](../using-git-with-mariadb/index) | How to use git to troubleshoot the source code or contribute code to MariaDB. |
| [Compiling MariaDB From Source](../compiling-mariadb-from-source/index) | Articles on compiling MariaDB from source |
| [Buildbot](../buildbot/index) | Pages about buildbot |
| [MariaDB FTP Server](../mariadb-ftp-server/index) | Information on connecting to MariaDB's FTP server. |
| [IRC Chat Servers and Zulip Instance](../irc-chat-servers-and-zulip-instance/index) | Chat servers for discussing MariaDB software. |
| [Worklog](../worklog/index) | Worklog has been replaced by JIRA. |
| [JIRA - Project Planning and Tracking](../jira/index) | JIRA is used for project planning and tracking in MariaDB development. |
| [Tools Available for Developing on the MariaDB Code](../tools-available-for-developing-on-the-mariadb-code/index) | What Tools are Available for Developing the MariaDB Code. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb myisamchk Table Information myisamchk Table Information
===========================
[myisamchk](../myisamchk/index) can be used to obtain information about MyISAM tables, particularly with the *-d*, *-e*, *-i* and *-v* options.
Common options for gathering information include:
* myisamchk -d
* myisamchk -dv
* myisamchk -dvv
* myisamchk -ei
* myisamchk -eiv
The *-d* option returns a short description of the table and its keys. Running the option while the table is being updated, and with external locking disabled, may result in an error, but no damage will be done to the table. Each extra *v* adds more output. *-e* checks the table thoroughly (but slowly), and the *-i* options adds statistical information,
-dvv output
-----------
The following table describes the output from the running myisamchk with the *-dvv* option:
| Heading | Description |
| --- | --- |
| MyISAM file | Name and path of the MyISAM index file (without the extension) |
| Record format | [Storage format](../myisam-storage-formats/index). One of *packed* (dynamic), *fixed* or *compressed*. |
| Chararacter set | Default [character set](../data-types-character-sets-and-collations/index) for the table. |
| File-version | Always 1. |
| Creation time | Time the data file was created |
| Recover time | Most recent time the file was reconstructed. |
| Status | Table status. One or more of *analyzed*, *changed*, *crashed*, *open*, *optimized keys* and *sorted index pages*. |
| Auto increment key | Index number of the table's <auto-increment> column. Not shown if no auto-increment column exists. |
| Last value | Most recently generated auto-increment value. Not shown if no auto-increment column exists. |
| Data records | Number of records in the table. |
| Deleted blocks | Number of deleted blocks that are still reserving space. Use [OPTIMIZE TABLE](../optimize-table/index) to defragment. |
| Datafile parts | For [dynamic tables](../myisam-storage-formats/index), the number of data blocks. If the table is optimized, this will match the number of data records. |
| Deleted data | Number of bytes of unreclaimed deleted data, Use [OPTIMIZE TABLE](../optimize-table/index) to reclaim the space. |
| Datafile pointer | Size in bytes of the data file pointer. The size of the data file pointer, in bytes. |
| Keyfile pointer | Size in bytes of the index file pointer. |
| Max datafile length | Maximum length, in bytes, that the data file could become. |
| Max keyfile length | Maximum length, in bytes, that the index file could become. |
| Recordlength | Space, in bytes, that each row takes. |
| table description | Description of all indexes in the table, followed by all columns |
| Key | Index number, starting with one. If not shown, the index is part of a multiple-column index. |
| Start | Where the index part starts in the row. |
| Len | Length of the index or index part. The length of a multiple-column index is the sum of the component lengths. Indexes of string columns will be shorter than the full column length if only a string prefix is indexed. |
| Index | Whether an index value is unique or not. Either *multip.* or *unique*. |
| Type | Data type of the index of index part. |
| Rec/key | Record of the number of rows per value for the index or index part. Used by the optimizer to calculate query plans. Can be updated with [myisamchk-a](../myisamchk/index). If not present, defaults to *30*. |
| Root | Root index block address. |
| Blocksize | Index block size, in bytes. |
| Field | Column number, starting with one. The first line will contain the position and number of bytes used to store NULL flags, if any (see *Nullpos* and *Nullbit*, below). |
| Start | Column's byte position within the table row. |
| Length | Column length, in bytes. |
| Nullpos | Byte containing the flag for NULL values. Empty if column cannot be NULL. |
| Nullbit | Bit containing the flag for NULL values. Empty if column cannot be NULL. |
| Type | Data type - see the table below for a list of possible values. |
| Huff tree | Only present for packed tables, contains the Huffman tree number associated with the column. |
| Bits | Only present for packed tables, contains the number of bits used in the Huffman tree. |
| Data type | Description |
| --- | --- |
| constant | All rows contain the same value. |
| no endspace | No endspace is stored. |
| no endspace, not\_always | No endspace is stored, and endspace compression is not always performed for all values. |
| no endspace, no empty | No endspace is stored, no empty values are stored. |
| table-lookup | Column was converted to an [ENUM](../enum/index). |
| zerofill(N) | Most significant *N* bytes of the value are not stored, as they are always zero. |
| no zeros | Zeros are not stored. |
| always zero | Zero values are stored with one bit. |
-eiv output
-----------
The following table describes the output from the running myisamchk with the *-eiv* option:
| Heading | Description |
| --- | --- |
| Data records | Number of records in the table. |
| Deleted blocks | Number of deleted blocks that are still reserving space. Use [OPTIMIZE TABLE](../optimize-table/index) to defragment. |
| Key | Index number, starting with one. |
| Keyblocks used | Percentage of the keyblocks that are used. Percentages will be higher for optimized tables. |
| Packed | Percentage space saved from packing key values with a common suffix. |
| Max levels | Depth of the [b-tree index](../storage-engine-index-types/index#b-tree-indexes) for the key. Larger tables and longer key values result in higher values. |
| Records | Number of records in the table. |
| M.recordlength | Average row length. For fixed rows, will be the actual length of each row. |
| Packed | Percentage saving from stripping spaces from the end of strings. |
| Recordspace used | Percentage of the data file used. |
| Empty space | Percentage of the data file unused. |
| Blocks/Record | Average number of blocks per record. Values higher than one indicate fragmentation. Use [OPTIMIZE TABLE](../optimize-table/index) to defragment. |
| Recordblocks | Number of used blocks. Will match the number of rows for fixed or optimized tables. |
| Deleteblocks | Number of deleted blocks |
| Recorddata | Used bytes in the data file. |
| Deleted data | Unused bytes in the data file. |
| Lost space | Total bytes lost, such as when a row is updated to a shorter length. |
| Linkdata | Sum of the bytes used for pointers linking disconnected blocks. Each is four to seven bytes in size. |
Examples
--------
```
myisamchk -d /var/lib/mysql/test/posts
MyISAM file: /var/lib/mysql/test/posts
Record format: Compressed
Character set: utf8mb4_unicode_ci (224)
Data records: 1680 Deleted blocks: 0
Recordlength: 2758
Using only keys '0' of 5 possibly keys
table description:
Key Start Len Index Type
1 1 8 unique ulonglong
2 2265 80 multip. varchar prefix
63 80 varchar
17 5 binary
1 8 ulonglong
3 1231 8 multip. ulonglong
4 9 8 multip. ulonglong
5 387 764 multip. ? prefix
```
```
myisamchk -dvv /var/lib/mysql/test/posts
MyISAM file: /var/lib/mysql/test/posts
Record format: Compressed
Character set: utf8mb4_unicode_ci (224)
File-version: 1
Creation time: 2015-08-10 16:26:54
Recover time: 2015-08-10 16:26:54
Status: checked,analyzed,optimized keys
Auto increment key: 1 Last value: 1811
Checksum: 2299272165
Data records: 1680 Deleted blocks: 0
Datafile parts: 1680 Deleted data: 0
Datafile pointer (bytes): 6 Keyfile pointer (bytes): 6
Datafile length: 4298092 Keyfile length: 156672
Max datafile length: 281474976710654 Max keyfile length: 288230376151710719
Recordlength: 2758
Using only keys '0' of 5 possibly keys
table description:
Key Start Len Index Type Rec/key Root Blocksize
1 1 8 unique ulonglong 1 1024
2 2265 80 multip. varchar prefix 336 1024
63 80 varchar 187
17 5 binary 1
1 8 ulonglong 1
3 1231 8 multip. ulonglong 10 1024
4 9 8 multip. ulonglong 840 1024
5 387 764 multip. ? prefix 1 4096
Field Start Length Nullpos Nullbit Type Huff tree Bits
1 1 8 zerofill(6) 1 9
2 9 8 zerofill(7) 1 9
3 17 5 1 9
4 22 5 1 9
5 27 12 blob 2 9
6 39 10 blob 3 9
7 49 4 always zero 1 9
8 53 10 blob 1 9
9 63 81 varchar 4 9
10 144 81 varchar 5 5
11 225 81 varchar 5 5
12 306 81 varchar 1 9
13 387 802 varchar 6 9
14 1189 10 blob 1 9
15 1199 10 blob 7 9
16 1209 5 1 9
17 1214 5 1 9
18 1219 12 blob 1 9
19 1231 8 no zeros, zerofill(6) 1 9
20 1239 1022 varchar 7 9
21 2261 4 always zero 1 9
22 2265 81 varchar 8 8
23 2346 402 varchar 2 9
24 2748 8 no zeros, zerofill(7) 1 9
```
```
myisamchk -eiv /var/lib/mysql/test/posts
Checking MyISAM file: /var/lib/mysql/test/posts
Data records: 1680 Deleted blocks: 0
- check file-size
- check record delete-chain
No recordlinks
- check key delete-chain
block_size 1024:
block_size 2048:
block_size 3072:
block_size 4096:
- check index reference
- check data record references index: 1
Key: 1: Keyblocks used: 92% Packed: 0% Max levels: 2
- check data record references index: 2
Key: 2: Keyblocks used: 93% Packed: 90% Max levels: 2
- check data record references index: 3
Key: 3: Keyblocks used: 92% Packed: 0% Max levels: 2
- check data record references index: 4
Key: 4: Keyblocks used: 92% Packed: 0% Max levels: 2
- check data record references index: 5
Key: 5: Keyblocks used: 88% Packed: 97% Max levels: 2
Total: Keyblocks used: 91% Packed: 91%
- check records and index references
Records: 1680 M.recordlength: 4102 Packed: 0%
Recordspace used: 100% Empty space: 0% Blocks/Record: 1.00
Record blocks: 1680 Delete blocks: 0
Record data: 6892064 Deleted data: 0
Lost space: 1284 Linkdata: 6264
User time 0.11, System time 0.00
Maximum resident set size 3036, Integral resident set size 0
Non-physical pagefaults 925, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 0, Involuntary context switches 74
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SYSDATE SYSDATE
=======
Syntax
------
```
SYSDATE([precision])
```
Description
-----------
Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context.
The optional *precision* determines the microsecond precision. See [Microseconds in MariaDB](../microseconds-in-mariadb/index).
SYSDATE() returns the time at which it executes. This differs from the behavior for [NOW()](../now/index), which returns a constant time that indicates the time at which the statement began to execute. (Within a stored routine or trigger, NOW() returns the time at which the routine or triggering statement began to execute.)
In addition, changing the [timestamp system variable](../server-system-variables/index#timestamp) with a [SET](../set/index) `timestamp` statement affects the value returned by NOW() but not by SYSDATE(). This means that timestamp settings in the [binary log](../binary-log/index) have no effect on invocations of SYSDATE().
Because SYSDATE() can return different values even within the same statement, and is not affected by SET TIMESTAMP, it is non-deterministic and therefore unsafe for replication if statement-based binary logging is used. If that is a problem, you can use row-based logging, or start the server with the mysqld option [--sysdate-is-now](../mysqld-options/index#-sysdate-is-now) to cause SYSDATE() to be an alias for NOW(). The non-deterministic nature of SYSDATE() also means that indexes cannot be used for evaluating expressions that refer to it, and that statements using the SYSDATE() function are [unsafe for statement-based replication](../unsafe-statements-for-replication/index).
Examples
--------
Difference between NOW() and SYSDATE():
```
SELECT NOW(), SLEEP(2), NOW();
+---------------------+----------+---------------------+
| NOW() | SLEEP(2) | NOW() |
+---------------------+----------+---------------------+
| 2010-03-27 13:23:40 | 0 | 2010-03-27 13:23:40 |
+---------------------+----------+---------------------+
SELECT SYSDATE(), SLEEP(2), SYSDATE();
+---------------------+----------+---------------------+
| SYSDATE() | SLEEP(2) | SYSDATE() |
+---------------------+----------+---------------------+
| 2010-03-27 13:23:52 | 0 | 2010-03-27 13:23:54 |
+---------------------+----------+---------------------+
```
With precision:
```
SELECT SYSDATE(4);
+--------------------------+
| SYSDATE(4) |
+--------------------------+
| 2018-07-10 10:17:13.1689 |
+--------------------------+
```
See Also
--------
* [Microseconds in MariaDB](../microseconds-in-mariadb/index)
* [timestamp server system variable](../server-system-variables/index#timestamp)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb WEEK WEEK
====
Syntax
------
```
WEEK(date[,mode])
```
Description
-----------
This function returns the week number for `date`. The two-argument form of `WEEK()` allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range from 0 to 53 or from 1 to 53. If the `mode` argument is omitted, the value of the [default\_week\_format](../server-system-variables/index#default_week_format) system variable is used.
### Modes
| Mode | 1st day of week | Range | Week 1 is the 1st week with |
| --- | --- | --- | --- |
| 0 | Sunday | 0-53 | a Sunday in this year |
| 1 | Monday | 0-53 | more than 3 days this year |
| 2 | Sunday | 1-53 | a Sunday in this year |
| 3 | Monday | 1-53 | more than 3 days this year |
| 4 | Sunday | 0-53 | more than 3 days this year |
| 5 | Monday | 0-53 | a Monday in this year |
| 6 | Sunday | 1-53 | more than 3 days this year |
| 7 | Monday | 1-53 | a Monday in this year |
With the mode value of 3, which means “more than 3 days this year”, weeks are numbered according to ISO 8601:1988.
Examples
--------
```
SELECT WEEK('2008-02-20');
+--------------------+
| WEEK('2008-02-20') |
+--------------------+
| 7 |
+--------------------+
SELECT WEEK('2008-02-20',0);
+----------------------+
| WEEK('2008-02-20',0) |
+----------------------+
| 7 |
+----------------------+
SELECT WEEK('2008-02-20',1);
+----------------------+
| WEEK('2008-02-20',1) |
+----------------------+
| 8 |
+----------------------+
SELECT WEEK('2008-12-31',0);
+----------------------+
| WEEK('2008-12-31',0) |
+----------------------+
| 52 |
+----------------------+
SELECT WEEK('2008-12-31',1);
+----------------------+
| WEEK('2008-12-31',1) |
+----------------------+
| 53 |
+----------------------+
SELECT WEEK('2019-12-30',3);
+----------------------+
| WEEK('2019-12-30',3) |
+----------------------+
| 1 |
+----------------------+
```
```
CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES
("2007-01-30 21:31:07"),
("1983-10-15 06:42:51"),
("2011-04-21 12:34:56"),
("2011-10-30 06:31:41"),
("2011-01-30 14:03:25"),
("2004-10-07 11:19:34");
```
```
SELECT d, WEEK(d,0), WEEK(d,1) from t1;
+---------------------+-----------+-----------+
| d | WEEK(d,0) | WEEK(d,1) |
+---------------------+-----------+-----------+
| 2007-01-30 21:31:07 | 4 | 5 |
| 1983-10-15 06:42:51 | 41 | 41 |
| 2011-04-21 12:34:56 | 16 | 16 |
| 2011-10-30 06:31:41 | 44 | 43 |
| 2011-01-30 14:03:25 | 5 | 4 |
| 2004-10-07 11:19:34 | 40 | 41 |
+---------------------+-----------+-----------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb AWS Key Management Encryption Plugin AWS Key Management Encryption Plugin
====================================
MariaDB's [data-at-rest encryption](../data-at-rest-encryption/index) requires the use of a [key management and encryption plugin](../encryption-key-management/index). These plugins are responsible both for the management of encryption keys and for the actual encryption and decryption of data.
MariaDB supports the use of [multiple encryption keys](../encryption-key-management/index#using-multiple-encryption-keys). Each encryption key uses a 32-bit integer as a key identifier. If the specific plugin supports [key rotation](../encryption-key-management/index#key-rotation), then encryption keys can also be rotated, which creates a new version of the encryption key.
The AWS Key Management plugin is a [key management and encryption plugin](../encryption-key-management/index) that uses the [Amazon Web Services (AWS) Key Management Service (KMS)](https://aws.amazon.com/kms/).
Overview
--------
The AWS Key Management plugin uses the [Amazon Web Services (AWS) Key Management Service (KMS)](https://aws.amazon.com/kms/) to generate and store AES keys on disk, in encrypted form, using the Customer Master Key (CMK) kept in AWS KMS. When MariaDB Server starts, the plugin will decrypt the encrypted keys, using the AWS KMS "Decrypt" API function. MariaDB data will then be encrypted and decrypted using the AES key. It supports multiple encryption keys. It supports key rotation.
Tutorials
---------
Tutorials related to the AWS Key Management plugin can be found at the following pages:
* [Amazon Web Services (AWS) Key Management Service (KMS) Encryption Plugin Setup Guide](../aws-key-management-encryption-plugin-setup-guide/index)
* [Amazon Web Services (AWS) Key Management Service (KMS) Encryption Plugin Advanced Usage](../aws-key-management-encryption-plugin-advanced-usage/index)
Preparation
-----------
* Before you use the plugin, you need to create a Customer Master Key (CMK). Create a key using the AWS Console as described in the [AMS KMS developer guide](http://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html).
* The easiest way to give the AWS key management plugin access to the key is to create an IAM Role with access to the key, and to apply that IAM Role to an EC2 instance where MariaDB Server runs.
* Make sure that MariaDB Server runs under the correct AWS identity that has access to the above key. For example, you can store the AWS credentials in a AWS credentials file for the user who runs `mysqld`. More information about the credentials file can be found in [the AWS CLI Getting Started Guide](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-file).
Installing the Plugin's Package
-------------------------------
The AWS Key Management plugin depends on the [AWS SDK for C++](https://github.com/aws/aws-sdk-cpp), which uses the [Apache License, Version 2.0](https://github.com/aws/aws-sdk-cpp/blob/master/LICENSE). This license is not compatible with MariaDB Server's [GPL 2.0 license](../mariadb-license/index), so we are not able to distribute packages that contain the AWS Key Management plugin. Therefore, the only way to currently obtain the plugin is to install it from source.
### Installing from Source
When [compiling MariaDB from source](../compiling-mariadb-from-source/index), the AWS Key Management plugin is not built by default in [MariaDB 10.1](../what-is-mariadb-101/index), but it is built by default in [MariaDB 10.2](../what-is-mariadb-102/index) and later, on systems that support it.
Compilation is controlled by the `-DPLUGIN_AWS_KEY_MANAGEMENT=DYNAMIC -DAWS_SDK_EXTERNAL_PROJECT=1` `[cmake](../generic-build-instructions/index#using-cmake)` arguments.
The plugin uses [AWS C++ SDK](https://github.com/awslabs/aws-sdk-cpp), which introduces the following restrictions:
* The plugin can only be built on Windows, Linux and macOS.
* The plugin requires that one of the following compilers is used: `gcc` 4.8 or later, `clang` 3.3 or later, Visual Studio 2013 or later.
* On Unix, the `libcurl` development package (e.g. `libcurl3-dev` on Debian Jessie), `uuid` development package and `openssl` need to be installed.
* You may need to use a newer version of `[cmake](../generic-build-instructions/index#using-cmake)` than is provided by default in your OS.
Installing the Plugin
---------------------
Even after the package that contains the plugin's shared library is installed on the operating system, the plugin is not actually installed by MariaDB by default. There are two methods that can be used to install the plugin with MariaDB.
The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing `[INSTALL SONAME](../install-soname/index)` or `[INSTALL PLUGIN](../install-plugin/index)`. For example:
```
INSTALL SONAME 'aws_key_management';
```
The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options. This can be specified as a command-line argument to `[mysqld](../mysqld-options/index)` or it can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
plugin_load_add = aws_key_management
```
Uninstalling the Plugin
-----------------------
Before you uninstall the plugin, you should ensure that [data-at-rest encryption](../data-at-rest-encryption/index) is completely disabled, and that MariaDB no longer needs the plugin to decrypt tables or other files.
You can uninstall the plugin dynamically by executing `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)`. For example:
```
UNINSTALL SONAME 'aws_key_management';
```
If you installed the plugin by providing the `[--plugin-load](../mysqld-options/index#-plugin-load)` or the `[--plugin-load-add](../mysqld-options/index#-plugin-load-add)` options in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index), then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
Configuring the AWS Key Management Plugin
-----------------------------------------
To enable the AWS Key Management plugin, you also need to set the plugin's system variables. The `[aws\_key\_management\_master\_key\_id](#aws_key_management_master_key_id)` system variable is the primary one to set. These system variables can be specified as command-line arguments to `[mysqld](../mysqld-options/index)` or they can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
aws_key_management_master_key_id=alias/<your key's alias>
```
Once you've updated the configuration file, [restart](../starting-and-stopping-mariadb-starting-and-stopping-mariadb/index) the MariaDB server to apply the changes and make the key management and encryption plugin available for use.
Using the AWS Key Management Plugin
-----------------------------------
Once the AWS Key Management Plugin is enabled, you can use it by creating an encrypted table:
```
CREATE TABLE t (i int) ENGINE=InnoDB ENCRYPTED=YES
```
Now, table `t` will be encrypted using the encryption key generated by AWS.
For more information on how to use encryption, see [Data at Rest Encryption](../data-at-rest-encryption/index).
Using Multiple Encryption Keys
------------------------------
The AWS Key Management Plugin supports [using multiple encryption keys](../encryption-key-management/index#using-multiple-encryption-keys). Each encryption key can be defined with a different 32-bit integer as a key identifier. If a previously unused identifier is used, then the plugin will automatically generate a new key.
When [encrypting InnoDB tables](../innodb-encryption/index), the key that is used to encrypt tables [can be changed](../innodb-xtradb-encryption-keys/index).
When [encrypting Aria tables](../aria-encryption/index), the key that is used to encrypt tables [cannot currently be changed](../aria-encryption-keys/index).
Key Rotation
------------
The AWS Key Management plugin does support [key rotation](../encryption-key-management/index#key-rotation). To rotate a key, set the `[aws\_key\_management\_rotate\_key](#aws_key_management_rotate_key)` system variable. For example, to rotate key with ID 2:
```
SET GLOBAL aws_key_management_rotate_key=2;
```
Or to rotate all keys, set the value to -1:
```
SET GLOBAL aws_key_management_rotate_key=-1;
```
Versions
--------
| Version | Status | Introduced |
| --- | --- | --- |
| 1.0 | Stable | [MariaDB 10.2.6](https://mariadb.com/kb/en/mariadb-1026-release-notes/), [MariaDB 10.1.24](https://mariadb.com/kb/en/mariadb-10124-release-notes/) |
| 1.0 | Beta | [MariaDB 10.1.18](https://mariadb.com/kb/en/mariadb-10118-release-notes/) |
| 1.0 | Experimental | [MariaDB 10.1.13](https://mariadb.com/kb/en/mariadb-10113-release-notes/) |
System Variables
----------------
### `aws_key_management_key_spec`
* **Description:** Encryption algorithm used to create new keys
* **Commandline:** `--aws-key-management-key-spec=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `enumerated`
* **Default Value:** `AES_128`
* **Valid Values:** `AES_128`, `AES_256`
---
### `aws_key_management_log_level`
* **Description:** Dump log of the AWS SDK to MariaDB error log. Permitted values, in increasing verbosity, are **Off** (default), **Fatal**, **Error**, **Warn**, **Info**, **Debug**, and **Trace**.
* **Commandline:** `--aws-key-management-log-level=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `enumerated`
* **Default Value:** `Off`
* **Valid Values:** `Off`, `Fatal`, `Warn`, `Info`, `Debug` and `Trace`
---
### `aws_key_management_master_key_id`
* **Description:** AWS KMS Customer Master Key ID (ARN or alias prefixed by alias/) for the master encryption key. Used to create new data keys. If not set, no new data keys will be created.
* **Commandline:** `--aws-key-management-master-key-id=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:**
---
### `aws_key_management_mock`
* **Description:** Mock AWS KMS calls (for testing). Must be enabled at compile-time.
* **Commandline:** `--aws-key-management-mock`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `boolean`
* **Default Value:** `OFF`
* **Valid Values:** `OFF`, `ON`
---
### `aws_key_management_region`
* **Description:** AWS region name, e.g us-east-1 . Default is SDK default, which is us-east-1.
* **Commandline:** `--aws-key-management-region=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `string`
* **Default Value:** `'us-east-1'`
---
### `aws_key_management_request_timeout`
* **Description:** Timeout in milliseconds for create HTTPS connection or execute AWS request. Specify 0 to use SDK default.
* **Commandline:** `--aws-key-management-request-timeout=value`
* **Scope:** Global
* **Dynamic:** No
* **Data Type:** `integer`
* **Default Value:** 0
---
### `aws_key_management_rotate_key`
* **Description:** Set this variable to a data key ID to perform rotation of the key to the master key given in `aws_key_management_master_key_id`. Specify -1 to rotate all keys.
* **Commandline:** `--aws-key-management-rotate-key=value`
* **Scope:** Global
* **Dynamic:** Yes
* **Data Type:** `integer`
* **Default Value:**
---
Options
-------
### `aws_key_management`
* **Description:** Controls how the server should treat the plugin when the server starts up.
+ Valid values are:
- `OFF` - Disables the plugin without removing it from the `[mysql.plugins](../mysqlplugin-table/index)` table.
- `ON` - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.
- `FORCE` - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.
- `FORCE_PLUS_PERMANENT` - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with `[UNINSTALL SONAME](../uninstall-soname/index)` or `[UNINSTALL PLUGIN](../uninstall-plugin/index)` while the server is running.
+ See [Plugin Overview: Configuring Plugin Activation at Server Startup](../plugin-overview/index#configuring-plugin-activation-at-server-startup) for more information.
* **Commandline:** `--aws-key-management=value`
* **Data Type:** `enumerated`
* **Default Value:** `ON`
* **Valid Values:** `OFF`, `ON`, `FORCE`, `FORCE_PLUS_PERMANENT`
---
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Backing Up and Restoring Databases Backing Up and Restoring Databases
===================================
There are a number of ways to backup a MariaDB server.
| Title | Description |
| --- | --- |
| [Backup and Restore Overview](../backup-and-restore-overview/index) | Backing up and restoring MariaDB. |
| [Backup and Restore via dbForge Studio](../backup-and-restore-via-dbforge-studio/index) | The fastest and easiest way to perform these operations with MariaDB databases. |
| [Replication as a Backup Solution](../replication-as-a-backup-solution/index) | Replication can be used to support the backup strategy. |
| [mariadb-dump/mysqldump](../mariadb-dumpmysqldump/index) | Dump a database or a collection of databases in a portable format. |
| [Mariabackup](../mariabackup/index) | Physical backups, supports Data-at-Rest and InnoDB compression. |
| [mysqlhotcopy](../mysqlhotcopy/index) | Fast backup program on local machine. Deprecated. |
| [Percona XtraBackup](../backing-up-and-restoring-databases-percona-xtrabackup/index) | Open source tool for performing hot backups of MariaDB, MySQL and Percona Server databases. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb GROUP_CONCAT GROUP\_CONCAT
=============
Syntax
------
```
GROUP_CONCAT(expr)
```
Description
-----------
This function returns a string result with the concatenated non-NULL values from a group. It returns NULL if there are no non-NULL values.
The maximum returned length in bytes is determined by the [group\_concat\_max\_len](../server-system-variables/index#group_concat_max_len) server system variable, which defaults to 1M (>= [MariaDB 10.2.4](https://mariadb.com/kb/en/mariadb-1024-release-notes/)) or 1K (<= [MariaDB 10.2.3](https://mariadb.com/kb/en/mariadb-1023-release-notes/)).
If group\_concat\_max\_len <= 512, the return type is [VARBINARY](../varbinary/index) or [VARCHAR](../varchar/index); otherwise, the return type is [BLOB](../blob/index) or [TEXT](../text/index). The choice between binary or non-binary types depends from the input.
The full syntax is as follows:
```
GROUP_CONCAT([DISTINCT] expr [,expr ...]
[ORDER BY {unsigned_integer | col_name | expr}
[ASC | DESC] [,col_name ...]]
[SEPARATOR str_val]
[LIMIT {[offset,] row_count | row_count OFFSET offset}])
```
`DISTINCT` eliminates duplicate values from the output string.
[ORDER BY](../order-by/index) determines the order of returned values.
`SEPARATOR` specifies a separator between the values. The default separator is a comma (`,`). It is possible to avoid using a separator by specifying an empty string.
### LIMIT
**MariaDB starting with [10.3.3](https://mariadb.com/kb/en/mariadb-1033-release-notes/)**Until [MariaDB 10.3.2](https://mariadb.com/kb/en/mariadb-1032-release-notes/), it was not possible to use the [LIMIT](../limit/index) clause with `GROUP_CONCAT`. This restriction was lifted in [MariaDB 10.3.3](https://mariadb.com/kb/en/mariadb-1033-release-notes/).
Examples
--------
```
SELECT student_name,
GROUP_CONCAT(test_score)
FROM student
GROUP BY student_name;
```
Get a readable list of MariaDB users from the [mysql.user](../mysqluser-table/index) table:
```
SELECT GROUP_CONCAT(DISTINCT User ORDER BY User SEPARATOR '\n')
FROM mysql.user;
```
In the former example, `DISTINCT` is used because the same user may occur more than once. The new line (`\n`) used as a `SEPARATOR` makes the results easier to read.
Get a readable list of hosts from which each user can connect:
```
SELECT User, GROUP_CONCAT(Host ORDER BY Host SEPARATOR ', ')
FROM mysql.user GROUP BY User ORDER BY User;
```
The former example shows the difference between the `GROUP_CONCAT`'s [ORDER BY](../order-by/index) (which sorts the concatenated hosts), and the `SELECT`'s [ORDER BY](../order-by/index) (which sorts the rows).
From [MariaDB 10.3.3](https://mariadb.com/kb/en/mariadb-1033-release-notes/), [LIMIT](../limit/index) can be used with `GROUP_CONCAT`, so, for example, given the following table:
```
CREATE TABLE d (dd DATE, cc INT);
INSERT INTO d VALUES ('2017-01-01',1);
INSERT INTO d VALUES ('2017-01-02',2);
INSERT INTO d VALUES ('2017-01-04',3);
```
the following query:
```
SELECT SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(":",dd,cc) ORDER BY cc DESC),",",1) FROM d;
+----------------------------------------------------------------------------+
| SUBSTRING_INDEX(GROUP_CONCAT(CONCAT_WS(":",dd,cc) ORDER BY cc DESC),",",1) |
+----------------------------------------------------------------------------+
| 2017-01-04:3 |
+----------------------------------------------------------------------------+
```
can be more simply rewritten as:
```
SELECT GROUP_CONCAT(CONCAT_WS(":",dd,cc) ORDER BY cc DESC LIMIT 1) FROM d;
+-------------------------------------------------------------+
| GROUP_CONCAT(CONCAT_WS(":",dd,cc) ORDER BY cc DESC LIMIT 1) |
+-------------------------------------------------------------+
| 2017-01-04:3 |
+-------------------------------------------------------------+
```
See Also
--------
* [CONCAT()](../concat/index)
* [CONCAT\_WS()](../concat_ws/index)
* [SELECT](../select/index)
* [ORDER BY](../order-by/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb ColumnStore Bulk Write SDK ColumnStore Bulk Write SDK
==========================
Introduction
============
Starting with MariaDB ColumnStore 1.1 a C++ SDK is available which supports bulk write into ColumnStore. Conceptually this is an API version of cpimport. The SDK is intended to be integrated by custom code and adapters to enable easier publishing of data into ColumnStore.
The API is licensed under LGPLv3.
Getting Started
===============
Prebuilt binary packages may be downloaded [here](https://mariadb.com/downloads/mariadb-ax/data-adapters) or you can build from scratch from [here](https://github.com/mariadb-corporation/mariadb-columnstore-api). To build from scratch please follow the instructions in GitHub's Readme.md.
Installation
------------
### From our repositories
For the installation from our RPM and deb repositories please have a look at this documents:
**Bulk Write SDK 1.1.X**
[https://mariadb.com/kb/en/library/installing-mariadb-ax-mariadb-columnstore-from-the-package-repositories/](../library/installing-mariadb-ax-mariadb-columnstore-from-the-package-repositories/index)
**Bulk Write SDK 1.2.X**
[https://mariadb.com/kb/en/library/installing-mariadb-ax-mariadb-columnstore-from-the-package-repositories-122/](../library/installing-mariadb-ax-mariadb-columnstore-from-the-package-repositories-122/index)
### RHEL / CentOS 7 Package
The following libraries need to be installed on the system for the package install:
```
yum install epel-release
yum install libuv libxml2 snappy python36
```
The API rpm can be installed via:
```
rpm -ivh mariadb-columnstore-api*.rpm
```
#### Bulk Write SDK 1.2.2
Starting with version 1.2.2 the bulk write SDK is split up into its components which be installed separately. Packages are:
| package name | description |
| --- | --- |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-cpp.rpm | The base C++ part needed to execute programs |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-cpp-devel.rpm | The C++ development part needed to build programs |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-java.rpm | The Java part needed to use the API in Java |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-python.rpm | The Python part needed to use the API in Python 2 |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-python3.rpm | The Python part needed to use the API in Python 3 |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-spark.rpm | The Scala/Spark part including ColumnStoreExporter |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-pyspark.rpm | The Python 2/Spark part including ColumnStoreExporter |
| mariadb-columnstore-api-1.2.\*-x86\_64-centos7-pyspark3.rpm | The Python 3/Spark part including ColumnStoreExporter |
### Ubuntu 16 / Debian 9 Package
The following libraries need to be installed on the system for the package install:
```
apt-get install libuv1 libxml2 libsnappy1v5
```
The API deb package can be installed via:
```
dpkg -i mariadb-columnstore-api*.deb
```
#### Bulk Write SDK 1.2.2
Starting with version 1.2.2 the bulk write SDK is split up into its components which can be installed separately. Packages are:
| package name | description |
| --- | --- |
| maraidb-columnstore-api-cpp\_1.2.\*\_amd64.deb | The base C++ part needed to execute programs |
| mariadb-columnstore-api-cpp-devel\_1.2.\*\_amd64.deb | The C++ development part needed to build programs |
| mariadb-columnstore-api-java\_1.2.\*\_amd64.deb | The Java part needed to use the API in Java |
| mariadb-columnstore-api-python\_1.2.\*\_amd64.deb | The Python part needed to use the API in Python 2 |
| mariadb-columnstore-api-python3\_1.2.\*\_amd64.deb | The Python part needed to use the API in Python 3 |
| mariadb-columnstore-api-spark\_1.2.\*\_amd64.deb | The Scala/Spark part including ColumnStoreExporter |
| mariadb-columnstore-api-pyspark\_1.2.\*\_amd64.deb | The Python 2/Spark part including ColumnStoreExporter |
| mariadb-columnstore-api-pyspark3\_1.2.\*\_amd64.deb | The Python 3/Spark part including ColumnStoreExporter |
### Debian 8 Package
The following libraries need to be installed on the system for the package install (jessie-backports is needed to install libuv1):
```
echo "deb http://httpredir.debian.org/debian jessie-backports main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install libuv1 libxml2 libsnappy1
```
The API deb package can be installed:
```
dpkg -i mariadb-columnstore-api*.deb
```
In addition installing OpenJDK8 for java support requires the backports repo and the following command:
```
apt-get install -t jessie-backports openjdk-8-jdk
```
#### Bulk Write SDK 1.2.2
Starting with version 1.2.2 the bulk write SDK is split up into its components which can be installed separately. Packages are:
| package name | description |
| --- | --- |
| maraidb-columnstore-api-cpp\_1.2.\*\_amd64.deb | The base C++ part needed to execute programs |
| mariadb-columnstore-api-cpp-devel\_1.2.\*\_amd64.deb | The C++ development part needed to build programs |
| mariadb-columnstore-api-java\_1.2.\*\_amd64.deb | The Java part needed to use the API in Java |
| mariadb-columnstore-api-python\_1.2.\*\_amd64.deb | The Python part needed to use the API in Python 2 |
| mariadb-columnstore-api-python3\_1.2.\*\_amd64.deb | The Python part needed to use the API in Python 3 |
| mariadb-columnstore-api-spark\_1.2.\*\_amd64.deb | The Scala/Spark part including ColumnStoreExporter |
| mariadb-columnstore-api-pyspark\_1.2.\*\_amd64.deb | The Python 2/Spark part including ColumnStoreExporter |
| mariadb-columnstore-api-pyspark3\_1.2.\*\_amd64.deb | The Python 3/Spark part including ColumnStoreExporter |
### Windows 10 Package
To install the SDK on Windows you simply have to follow the installation wizard of the installer. On Windows, the SDK requires the [Visual Studio 2015/2017 C++ Redistributable (x64)](https://www.microsoft.com/en-us/download/details.aspx?id=48145) to operate. It will be installed automatically if not detected. If Python 2.7 or Python 3.7 is detected during the installation of the SDK, pymcsapi will be installed directly into the regarding Python installation.
Environment Configuration
-------------------------
If the SDK is being installed to a server that is not part of a MariaDB ColumnStore server then it requires a local copy of the ColumnStore.xml file in order to determine how to connect to ColumnStore. The simplest approach is to copy this file from one of the ColumnStore servers to one of the following 2 locations on the SDK server ensuring read privileges for the OS user being used:
* /usr/local/mariadb/columnstore/etc/Columnstore.xml
* $COLUMNSTORE\_INSTALL\_DIR/etc/Columnstore.xml
Alternatively, a custom file location may be passed as an argument to the ColumnStoreDriver constructor. This is also necessary if you plan to write to multiple ColumnStore servers from the same host. The SDK server must be able to communicate to the ColumnStore PM servers over the standard ColumnStore TCP ports 8616, 8630, and 8800.
If the ColumnStore server was configured as a single server deployment, then the Columnstore.xml file will need the IP addresses updated from 127.0.0.1 to the actual ip / hostname of the ColumnStore server in order to be used on a remote SDK server. A simple sed statement should suffice for updating:
```
sed "s/127.0.0.1/172.21.21.8/g" Columnstore.xml > Columnstore_new.xml
```
Getting Started with C++
------------------------
The documentation below is the best place to get started with building and developing against the C++ SDK. Some sample programs are installed to /usr/share/doc/mcsapi/ for review.
Getting Started with Java
-------------------------
The Java version of the SDK provides a very similar API to the C++ one so the pdf documentation can generally be transposed 1 for 1 to understand the API calls. A dedicated Java usage documentation was added with version 1.1.6.
Since the Java version is a wrapper on top of the C++ API the underlying library must be loaded using a static initializer once in your program.
Starting with version 1.1.3 the library is loaded whilst importing the ColumnStoreDriver through:
```
import com.mariadb.columnstore.api.ColumnStoreDriver;
```
Versions prior to 1.1.3 need to manually load the system library:
```
static {
System.loadLibrary("javamcsapi"); // use _javamcsapi for centos7
}
```
The corresponding java jar must be also be included in the java classpath. The packaged install is built and tested with OpenJDK 8.
First a simple table is created with the mcsmysql client:
```
MariaDB [test]> create table t1(i int, c char(3)) engine=columnstore;
```
Next create a file MCSAPITest.java with the following contents:
```
import com.mariadb.columnstore.api.*;
public class MCSAPITest {
public static void main(String[] args) {
ColumnStoreDriver d = new ColumnStoreDriver();
ColumnStoreBulkInsert b = d.createBulkInsert("test", "t1", (short)0, 0);
try {
b.setColumn(0, 2);
b.setColumn(1, "XYZ");
b.writeRow();
b.commit();
}
catch (ColumnStoreException e) {
b.rollback();
e.printStackTrace();
}
}
}
```
Now compile and run the program. For RHEL / CentOS 7 (library installed in /usr/lib64):
```
javac -classpath ".:/usr/lib64/javamcsapi.jar" MCSAPITest.java
java -classpath ".:/usr/lib64/javamcsapi.jar" MCSAPITest
```
For Ubuntu / Debian:
```
javac -classpath ".:/usr/lib/javamcsapi.jar" MCSAPITest.java
java -classpath ".:/usr/lib/javamcsapi.jar" MCSAPITest
```
Now back in mcsmysql verify the data is written:
```
MariaDB [test]> select * from t1;
+------+------+
| i | c |
+------+------+
| 2 | XYZ |
+------+------+
```
Getting Started with Python
---------------------------
The current package install supports Python 2.7 and Python 3. Once installed the library is available for immediate use on the system. A dedicated Python usage documentation was added with version 1.1.6.
First a simple table is created with the mcsmysql client:
```
MariaDB [test]> create table t1(i int, c char(3)) engine=columnstore;
```
For this simple test the python CLI will be used by simply running the python program with no arguments and entering the following:
```
import pymcsapi
driver = pymcsapi.ColumnStoreDriver()
bulk = driver.createBulkInsert('test', 't1', 0, 0)
bulk.setColumn(0,1)
bulk.setColumn(1, 'ABC')
bulk.writeRow()
bulk.commit()
```
In interactive command line mode, the bulk.setColumn and bulk.writeRow methods return the bulk object to allow for more concise chained invocation. You may see something like the following as a result which is normal:
```
>>> bulk.setColumn(0,1)
<pymcsapi.ColumnStoreBulkInsert; proxy of <Swig Object of type 'mcsapi::ColumnStoreBulkInsert *' at 0x7f0d5295bcc0> >
```
Now back in mcsmysql verify the data is written:
```
MariaDB [test]> select * from t1;
+------+------+
| i | c |
+------+------+
| 1 | ABC |
+------+------+
```
Documentation
=============
The following documents provide SDK documentation:
* Usage documentation for C++ ([PDF](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_2_3 "PDF"), [HTML](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_html_1_2_3 "HTML")), Python ([PDF](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_1_2_3 "PDF"), [HTML](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_html_1_2_3 "HTML")), and Java ([PDF](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_1_2_3 "PDF"), [HTML](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_html_1_2_3 "HTML")) for 1.2.3 GA
* Usage documentation for C++ ([PDF](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_2_2 "PDF"), [HTML](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_html_1_2_2 "HTML")), Python ([PDF](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_1_2_2 "PDF"), [HTML](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_html_1_2_2 "HTML")), and Java ([PDF](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_1_2_2 "PDF"), [HTML](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_html_1_2_2 "HTML")) for 1.2.2 GA
* Usage documentation for [C++](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_2_1 "C++"), [Python](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_1_2_1 "Python") and [Java](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_1_2_1 "Java") for 1.2.1 Beta
* Usage documentation for [C++](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_2_0 "C++"), [Python](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_1_2_0 "Python") and [Java](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_1_2_0 "Java") for 1.2.0 Alpha
* Usage documentation for [C++](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_1_6 "C++"), [Python](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/pymcsapi_usage_1_1_6 "Python") and [Java](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/javamcsapi_usage_1_1_6 "Java") for 1.1.6 GA
* [Building](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_building_1_1_4 "Building"), [Usage](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_1_4 "Usage") for 1.1.4 GA
* [Building](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_building_1_1_3 "Building"), [Usage](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_1_3 "Usage") for 1.1.3 GA
* [Building](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_building_1_1_2 "Building"), [Usage](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_1_2 "Usage") for 1.1.2 GA
* [Building](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_building_1_1_1 "Building"), [Usage](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1_1_1 "Usage") for 1.1.1 RC
* [Building](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_building_1 "Building"), [Usage](https://mariadb.com/kb/en/columnstore-bulk-write-sdk/+attachment/libmcsapi_usage_1 "Usage") for 1.1.0 Beta
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb CREATE INDEX CREATE INDEX
============
Syntax
------
```
CREATE [OR REPLACE] [UNIQUE|FULLTEXT|SPATIAL] INDEX
[IF NOT EXISTS] index_name
[index_type]
ON tbl_name (index_col_name,...)
[WAIT n | NOWAIT]
[index_option]
[algorithm_option | lock_option] ...
index_col_name:
col_name [(length)] [ASC | DESC]
index_type:
USING {BTREE | HASH | RTREE}
index_option:
[ KEY_BLOCK_SIZE [=] value
| index_type
| WITH PARSER parser_name
| COMMENT 'string'
| CLUSTERING={YES| NO} ]
[ IGNORED | NOT IGNORED ]
algorithm_option:
ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}
lock_option:
LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}
```
Description
-----------
CREATE INDEX is mapped to an ALTER TABLE statement to create [indexes](../optimization-and-indexes/index). See [ALTER TABLE](../alter-table/index). CREATE INDEX cannot be used to create a PRIMARY KEY; use ALTER TABLE instead.
If another connection is using the table, a [metadata lock](../metadata-locking/index) is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.
Another shortcut, [DROP INDEX](../drop-index/index), allows the removal of an index.
For valid identifiers to use as index names, see [Identifier Names](../identifier-names/index).
Note that KEY\_BLOCK\_SIZE is currently ignored in CREATE INDEX, although it is included in the output of [SHOW CREATE TABLE](../show-create-table/index).
Privileges
----------
Executing the `CREATE INDEX` statement requires the `[INDEX](../grant/index#table-privileges)` privilege for the table or the database.
Online DDL
----------
Online DDL is supported with the [ALGORITHM](#algorithm) and [LOCK](#lock) clauses.
See [InnoDB Online DDL Overview](../innodb-online-ddl-overview/index) for more information on online DDL with [InnoDB](../innodb/index).
CREATE OR REPLACE INDEX
-----------------------
**MariaDB starting with [10.1.4](https://mariadb.com/kb/en/mariadb-1014-release-notes/)**The `OR REPLACE` clause was added in [MariaDB 10.1.4](https://mariadb.com/kb/en/mariadb-1014-release-notes/).
If the `OR REPLACE` clause is used and if the index already exists, then instead of returning an error, the server will drop the existing index and replace it with the newly defined index.
CREATE INDEX IF NOT EXISTS
--------------------------
If the `IF NOT EXISTS` clause is used, then the index will only be created if an index with the same name does not already exist. If the index already exists, then a warning will be triggered by default.
Index Definitions
-----------------
See [CREATE TABLE: Index Definitions](../create-table/index#index-definitions) for information about index definitions.
WAIT/NOWAIT
-----------
**MariaDB starting with [10.3.0](https://mariadb.com/kb/en/mariadb-1030-release-notes/)**Set the lock wait timeout. See [WAIT and NOWAIT](../wait-and-nowait/index).
ALGORITHM
---------
See [ALTER TABLE: ALGORITHM](../alter-table/index#algorithm) for more information.
LOCK
----
See [ALTER TABLE: LOCK](../alter-table/index#lock) for more information.
Progress Reporting
------------------
MariaDB provides progress reporting for `CREATE INDEX` statement for clients that support the new progress reporting protocol. For example, if you were using the `[mysql](../mysql-command-line-client/index)` client, then the progress report might look like this::
```
CREATE INDEX ON tab (num);;
Stage: 1 of 2 'copy to tmp table' 46% of stage
```
The progress report is also shown in the output of the `[SHOW PROCESSLIST](../show-processlist/index)` statement and in the contents of the `[information\_schema.PROCESSLIST](../information-schema-processlist-table/index)` table.
See [Progress Reporting](../progress-reporting/index) for more information.
WITHOUT OVERLAPS
----------------
**MariaDB starting with [10.5.3](https://mariadb.com/kb/en/mariadb-1053-release-notes/)**The [WITHOUT OVERLAPS](../application-time-periods/index#without-overlaps) clause allows one to constrain a primary or unique index such that [application-time periods](../application-time-periods/index) cannot overlap.
Examples
--------
Creating a unique index:
```
CREATE UNIQUE INDEX HomePhone ON Employees(Home_Phone);
```
OR REPLACE and IF NOT EXISTS:
```
CREATE INDEX xi ON xx5 (x);
Query OK, 0 rows affected (0.03 sec)
CREATE INDEX xi ON xx5 (x);
ERROR 1061 (42000): Duplicate key name 'xi'
CREATE OR REPLACE INDEX xi ON xx5 (x);
Query OK, 0 rows affected (0.03 sec)
CREATE INDEX IF NOT EXISTS xi ON xx5 (x);
Query OK, 0 rows affected, 1 warning (0.00 sec)
SHOW WARNINGS;
+-------+------+-------------------------+
| Level | Code | Message |
+-------+------+-------------------------+
| Note | 1061 | Duplicate key name 'xi' |
+-------+------+-------------------------+
```
From [MariaDB 10.5.3](https://mariadb.com/kb/en/mariadb-1053-release-notes/), creating a unique index for an [application-time period table](../application-time-periods/index) with a [WITHOUT OVERLAPS](../application-time-periods/index#without-overlaps) constraint:
```
CREATE UNIQUE INDEX u ON rooms (room_number, p WITHOUT OVERLAPS);
```
See Also
--------
* [Identifier Names](../identifier-names/index)
* [Getting Started with Indexes](../getting-started-with-indexes/index)
* [What is an Index?](../what-is-an-index/index)
* [ALTER TABLE](../alter-table/index)
* [DROP INDEX](../drop-index/index)
* [SHOW INDEX](../show-index/index)
* [SPATIAL INDEX](../spatial-index/index)
* [Full-text Indexes](../full-text-indexes/index)
* [WITHOUT OVERLAPS](../application-time-periods/index#without-overlaps)
* [Ignored Indexes](../ignored-indexes/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Specifying Which Plugins to Build Specifying Which Plugins to Build
=================================
By default all plugins are enabled and built as dynamic `.so` (or `.dll`) modules. If a plugin does not support dynamic builds, it is not built at all.
Use `PLUGIN_xxx` cmake variables. They can be set on the command line with `-DPLUGIN_xxx=*value*` or in the cmake gui. Supported values are
| Value | Effect |
| --- | --- |
| **NO** | the plugin will be not compiled at all |
| **STATIC** | the plugin will be compiled statically, if supported. Otherwise it will be not compiled. |
| **DYNAMIC** | the plugin will be compiled dynamically, if supported. Otherwise it will be not compiled. This is the default behavior. |
| **AUTO** | the plugin will be compiled statically, if supported. Otherwise it will be compiled dynamically. |
| **YES** | same as **AUTO**, but if plugin prerequisites (for example, specific libraries) are missing, it will not be skipped, it will abort cmake with an error. |
Note that unlike autotools, cmake tries to configure and build incrementally. You can modify one configuration option and cmake will only rebuild the part of the tree affected by it. For example, when you do `cmake -DWITH_EMBEDDED_SERVER=1` in the already-built tree, it will make libmysqld to be built, but no other configuration options will be changed or reset to their default values.
In particular this means that if you have run, for example `cmake -DPLUGIN_OQGRAPH=NO` and later you want to restore the default behavior (with OQGraph being built) in the same build tree, you would need to run `cmake -DPLUGIN_OQGRAPH=DYNAMIC`
Alternatively, you might simply delete the `CMakeCache.txt` file — this is the file where cmake stores current build configuration — and rebuild everything from scratch.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Condition Pushdown into Derived Table Optimization Condition Pushdown into Derived Table Optimization
==================================================
If a query uses a derived table (or a view), the first action that the query optimizer will attempt is to apply the [derived-table-merge-optimization](../derived-table-merge-optimization/index) and merge the derived table into its parent select. However, that optimization is only applicable when the select inside the derived table has a join as the top-level operation. If it has a [GROUP-BY](../group-by/index), [DISTINCT](../select/index#distinct), or uses [window functions](../window-functions/index), then [derived-table-merge-optimization](../derived-table-merge-optimization/index) is not applicable.
In that case, the Condition Pushdown optimization is applicable.
Introduction to Condition Pushdown
----------------------------------
Consider an example
```
create view OCT_TOTALS as
select
customer_id,
SUM(amount) as TOTAL_AMT
from orders
where order_date BETWEEN '2017-10-01' and '2017-10-31'
group by customer_id;
select * from OCT_TOTALS where customer_id=1
```
The naive way to execute the above is to
1. Compute the OCT\_TOTALS contents (for all customers).
2. The, select the line with customer\_id=1
This is obviously inefficient, if there are 1000 customers, then one will be doing up to 1000 times more work than necessary.
However, the optimizer can take the condition `customer_id=1` and push it down into the OCT\_TOTALS view.
(TODO: elaborate here)
Condition Pushdown Properties
-----------------------------
* Condition Pushdown has been available since [MariaDB 10.2](../what-is-mariadb-102/index).
* The Jira task for it was [MDEV-9197](https://jira.mariadb.org/browse/MDEV-9197).
* The optimization is enabled by default. One can disable it by setting `@@optimizer_switch` flag `condition_pushdown_for_derived` to OFF.
See Also
--------
* Condition Pushdown through Window Functions (since [MariaDB 10.3](../what-is-mariadb-103/index))
* [Condition Pushdown into IN Subqueries](../condition-pushdown-into-in-subqueries/index) (since [MariaDB 10.4](../what-is-mariadb-104/index))
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb INT3 INT3
====
`INT3` is a synonym for [MEDIUMINT](../mediumint/index).
```
CREATE TABLE t1 (x INT3);
DESC t1;
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| x | mediumint(9) | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema INNODB_FT_DEFAULT_STOPWORD Table Information Schema INNODB\_FT\_DEFAULT\_STOPWORD Table
======================================================
The [Information Schema](../information_schema/index) `INNODB_FT_DEFAULT_STOPWORD` table contains a list of default [stopwords](../stopwords/index) used when creating an InnoDB [fulltext index](../full-text-indexes/index).
The `PROCESS` [privilege](../grant/index) is required to view the table.
It has the following column:
| Column | Description |
| --- | --- |
| `VALUE` | Default `[stopword](../stopwords/index)` for an InnoDB [fulltext index](../full-text-indexes/index). Setting either the [innodb\_ft\_server\_stopword\_table](../xtradbinnodb-server-system-variables/index#innodb_ft_server_stopword_table) or the [innodb\_ft\_user\_stopword\_table](../xtradbinnodb-server-system-variables/index#innodb_ft_user_stopword_table) system variable will override this. |
Example
-------
```
SELECT * FROM information_schema.INNODB_FT_DEFAULT_STOPWORD\G
*************************** 1. row ***************************
value: a
*************************** 2. row ***************************
value: about
*************************** 3. row ***************************
value: an
*************************** 4. row ***************************
value: are
...
*************************** 36. row ***************************
value: www
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Regular Expressions Overview Regular Expressions Overview
============================
Regular Expressions allow MariaDB to perform complex pattern matching on a string. In many cases, the simple pattern matching provided by [LIKE](../like/index) is sufficient. `LIKE` performs two kinds of matches:
* `_` - the underscore, matching a single character
* `%` - the percentage sign, matching any number of characters.
In other cases you may need more control over the returned matches, and will need to use regular expressions.
**MariaDB starting with [10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/)**Until [MariaDB 10.0.5](https://mariadb.com/kb/en/mariadb-1005-release-notes/), MariaDB used the POSIX 1003.2 compliant regular expression library. The new PCRE library is mostly backwards compatible with what is described below - see the [PCRE Regular Expressions](../pcre-regular-expressions/index) article for the enhancements made in 10.0.5.
Regular expression matches are performed with the [REGEXP](../regexp/index) function. `RLIKE` is a synonym for `REGEXP`.
Comparisons are performed on the byte value, so characters that are treated as equivalent by a collation, but do not have the same byte-value, such as accented characters, could evaluate as unequal.
Without any special characters, a regular expression match is true if the characters match. The match is case-insensitive, except in the case of BINARY strings.
```
SELECT 'Maria' REGEXP 'Maria';
+------------------------+
| 'Maria' REGEXP 'Maria' |
+------------------------+
| 1 |
+------------------------+
SELECT 'Maria' REGEXP 'maria';
+------------------------+
| 'Maria' REGEXP 'maria' |
+------------------------+
| 1 |
+------------------------+
SELECT BINARY 'Maria' REGEXP 'maria';
+-------------------------------+
| BINARY 'Maria' REGEXP 'maria' |
+-------------------------------+
| 0 |
+-------------------------------+
```
Note that the word being matched must match the whole pattern:
```
SELECT 'Maria' REGEXP 'Mari';
+-----------------------+
| 'Maria' REGEXP 'Mari' |
+-----------------------+
| 1 |
+-----------------------+
SELECT 'Mari' REGEXP 'Maria';
+-----------------------+
| 'Mari' REGEXP 'Maria' |
+-----------------------+
| 0 |
+-----------------------+
```
The first returns true because the pattern "Mari" exists in the expression "Maria". When the order is reversed, the result is false, as the pattern "Maria" does not exist in the expression "Mari"
A match can be performed against more than one word with the `|` character. For example:
```
SELECT 'Maria' REGEXP 'Monty|Maria';
+------------------------------+
| 'Maria' REGEXP 'Monty|Maria' |
+------------------------------+
| 1 |
+------------------------------+
```
Special Characters
------------------
The above examples introduce the syntax, but are not very useful on their own. It's the special characters that give regular expressions their power.
#### ^
`^` matches the beginning of a string (inside square brackets it can also mean NOT - see below):
```
SELECT 'Maria' REGEXP '^Ma';
+----------------------+
| 'Maria' REGEXP '^Ma' |
+----------------------+
| 1 |
+----------------------+
```
#### $
`$` matches the end of a string:
```
SELECT 'Maria' REGEXP 'ia$';
+----------------------+
| 'Maria' REGEXP 'ia$' |
+----------------------+
| 1 |
+----------------------+
```
#### .
`.` matches any single character:
```
SELECT 'Maria' REGEXP 'Ma.ia';
+------------------------+
| 'Maria' REGEXP 'Ma.ia' |
+------------------------+
| 1 |
+------------------------+
SELECT 'Maria' REGEXP 'Ma..ia';
+-------------------------+
| 'Maria' REGEXP 'Ma..ia' |
+-------------------------+
| 0 |
+-------------------------+
```
#### \*
`x*` matches zero or more of a character `x`. In the examples below, it's the `r` character.
```
SELECT 'Maria' REGEXP 'Mar*ia';
+-------------------------+
| 'Maria' REGEXP 'Mar*ia' |
+-------------------------+
| 1 |
+-------------------------+
SELECT 'Maia' REGEXP 'Mar*ia';
+------------------------+
| 'Maia' REGEXP 'Mar*ia' |
+------------------------+
| 1 |
+------------------------+
SELECT 'Marrria' REGEXP 'Mar*ia';
+---------------------------+
| 'Marrria' REGEXP 'Mar*ia' |
+---------------------------+
| 1 |
+---------------------------+
```
#### +
`x+` matches one or more of a character `x`. In the examples below, it's the `r` character.
```
SELECT 'Maria' REGEXP 'Mar+ia';
+-------------------------+
| 'Maria' REGEXP 'Mar+ia' |
+-------------------------+
| 1 |
+-------------------------+
SELECT 'Maia' REGEXP 'Mar+ia';
+------------------------+
| 'Maia' REGEXP 'Mar+ia' |
+------------------------+
| 0 |
+------------------------+
SELECT 'Marrria' REGEXP 'Mar+ia';
+---------------------------+
| 'Marrria' REGEXP 'Mar+ia' |
+---------------------------+
| 1 |
+---------------------------+
```
#### ?
`x?` matches zero or one of a character `x`. In the examples below, it's the `r` character.
```
SELECT 'Maria' REGEXP 'Mar?ia';
+-------------------------+
| 'Maria' REGEXP 'Mar?ia' |
+-------------------------+
| 1 |
+-------------------------+
SELECT 'Maia' REGEXP 'Mar?ia';
+------------------------+
| 'Maia' REGEXP 'Mar?ia' |
+------------------------+
| 1 |
+------------------------+
SELECT 'Marrria' REGEXP 'Mar?ia';
+---------------------------+
| 'Marrria' REGEXP 'Mar?ia' |
+---------------------------+
| 0 |
+---------------------------+
```
#### ()
`(xyz)` - combine a sequence, for example `(xyz)+` or `(xyz)*`
```
SELECT 'Maria' REGEXP '(ari)+';
+-------------------------+
| 'Maria' REGEXP '(ari)+' |
+-------------------------+
| 1 |
+-------------------------+
```
#### {}
`x{n}` and `x{m,n}` This notation is used to match many instances of the `x`. In the case of `x{n}` the match must be exactly that many times. In the case of `x{m,n}`, the match can occur from `m` to `n` times. For example, to match zero or one instance of the string `ari` (which is identical to `(ari)?`), the following can be used:
```
SELECT 'Maria' REGEXP '(ari){0,1}';
+-----------------------------+
| 'Maria' REGEXP '(ari){0,1}' |
+-----------------------------+
| 1 |
+-----------------------------+
```
#### []
`[xy]` groups characters for matching purposes. For example, to match either the `p` or the `r` character:
```
SELECT 'Maria' REGEXP 'Ma[pr]ia';
+---------------------------+
| 'Maria' REGEXP 'Ma[pr]ia' |
+---------------------------+
| 1 |
+---------------------------+
```
The square brackets also permit a range match, for example, to match any character from a-z, `[a-z]` is used. Numeric ranges are also permitted.
```
SELECT 'Maria' REGEXP 'Ma[a-z]ia';
+----------------------------+
| 'Maria' REGEXP 'Ma[a-z]ia' |
+----------------------------+
| 1 |
+----------------------------+
```
The following does not match, as `r` falls outside of the range `a-p`.
```
SELECT 'Maria' REGEXP 'Ma[a-p]ia';
+----------------------------+
| 'Maria' REGEXP 'Ma[a-p]ia' |
+----------------------------+
| 0 |
+----------------------------+
```
##### ^
The `^` character means does `NOT` match, for example:
```
SELECT 'Maria' REGEXP 'Ma[^p]ia';
+---------------------------+
| 'Maria' REGEXP 'Ma[^p]ia' |
+---------------------------+
| 1 |
+---------------------------+
SELECT 'Maria' REGEXP 'Ma[^r]ia';
+---------------------------+
| 'Maria' REGEXP 'Ma[^r]ia' |
+---------------------------+
| 0 |
+---------------------------+
```
The `[` and `]` characters on their own can be literally matched inside a `[]` block, without escaping, as long as they immediately match the opening bracket:
```
SELECT '[Maria' REGEXP '[[]';
+-----------------------+
| '[Maria' REGEXP '[[]' |
+-----------------------+
| 1 |
+-----------------------+
SELECT '[Maria' REGEXP '[]]';
+-----------------------+
| '[Maria' REGEXP '[]]' |
+-----------------------+
| 0 |
+-----------------------+
SELECT ']Maria' REGEXP '[]]';
+-----------------------+
| ']Maria' REGEXP '[]]' |
+-----------------------+
| 1 |
+-----------------------+
SELECT ']Maria' REGEXP '[]a]';
+------------------------+
| ']Maria' REGEXP '[]a]' |
+------------------------+
| 1 |
+------------------------+
```
Incorrect order, so no match:
```
SELECT ']Maria' REGEXP '[a]]';
+------------------------+
| ']Maria' REGEXP '[a]]' |
+------------------------+
| 0 |
+------------------------+
```
The `-` character can also be matched in the same way:
```
SELECT '-Maria' REGEXP '[1-10]';
+--------------------------+
| '-Maria' REGEXP '[1-10]' |
+--------------------------+
| 0 |
+--------------------------+
SELECT '-Maria' REGEXP '[-1-10]';
+---------------------------+
| '-Maria' REGEXP '[-1-10]' |
+---------------------------+
| 1 |
+---------------------------+
```
#### Word boundaries
The `[:<:](%3c%3a)` and `[:>:](%3e%3a)` patterns match the beginning and the end of a word respectively. For example:
```
SELECT 'How do I upgrade MariaDB?' REGEXP '[[:<:]]MariaDB[[:>:]]';
+------------------------------------------------------------+
| 'How do I upgrade MariaDB?' REGEXP '[[:<:]]MariaDB[[:>:]]' |
+------------------------------------------------------------+
| 1 |
+------------------------------------------------------------+
SELECT 'How do I upgrade MariaDB?' REGEXP '[[:<:]]Maria[[:>:]]';
+----------------------------------------------------------+
| 'How do I upgrade MariaDB?' REGEXP '[[:<:]]Maria[[:>:]]' |
+----------------------------------------------------------+
| 0 |
+----------------------------------------------------------+
```
#### Character Classes
There are a number of shortcuts to match particular preset character classes. These are matched with the `[:character_class:]` pattern (inside a `[]` set). The following character classes exist:
| Character Class | Description |
| --- | --- |
| alnum | Alphanumeric |
| alpha | Alphabetic |
| blank | Whitespace |
| cntrl | Control characters |
| digit | Digits |
| graph | Graphic characters |
| lower | Lowercase alphabetic |
| print | Graphic or space characters |
| punct | Punctuation |
| space | Space, tab, newline, and carriage return |
| upper | Uppercase alphabetic |
| xdigit | Hexadecimal digit |
For example:
```
SELECT 'Maria' REGEXP 'Mar[[:alnum:]]*';
+--------------------------------+
| 'Maria' REGEXP 'Mar[:alnum:]*' |
+--------------------------------+
| 1 |
+--------------------------------+
```
Remember that matches are by default case-insensitive, unless a binary string is used, so the following example, specifically looking for an uppercase, counter-intuitively matches a lowercase character:
```
SELECT 'Mari' REGEXP 'Mar[[:upper:]]+';
+---------------------------------+
| 'Mari' REGEXP 'Mar[[:upper:]]+' |
+---------------------------------+
| 1 |
+---------------------------------+
SELECT BINARY 'Mari' REGEXP 'Mar[[:upper:]]+';
+----------------------------------------+
| BINARY 'Mari' REGEXP 'Mar[[:upper:]]+' |
+----------------------------------------+
| 0 |
+----------------------------------------+
```
#### Character Names
There are also number of shortcuts to match particular preset character names. These are matched with the `[.character.]` pattern (inside a `[]` set). The following character classes exist:
| Name | Character |
| --- | --- |
| NUL | 0 |
| SOH | 001 |
| STX | 002 |
| ETX | 003 |
| EOT | 004 |
| ENQ | 005 |
| ACK | 006 |
| BEL | 007 |
| alert | 007 |
| BS | 010 |
| backspace | '\b' |
| HT | 011 |
| tab | '\t' |
| LF | 012 |
| newline | '\n' |
| VT | 013 |
| vertical-tab | '\v' |
| FF | 014 |
| form-feed | '\f' |
| CR | 015 |
| carriage-return | '\r' |
| SO | 016 |
| SI | 017 |
| DLE | 020 |
| DC1 | 021 |
| DC2 | 022 |
| DC3 | 023 |
| DC4 | 024 |
| NAK | 025 |
| SYN | 026 |
| ETB | 027 |
| CAN | 030 |
| EM | 031 |
| SUB | 032 |
| ESC | 033 |
| IS4 | 034 |
| FS | 034 |
| IS3 | 035 |
| GS | 035 |
| IS2 | 036 |
| RS | 036 |
| IS1 | 037 |
| US | 037 |
| space | ' ' |
| exclamation-mark | '!' |
| quotation-mark | '"' |
| number-sign | '#' |
| dollar-sign | '$' |
| percent-sign | '%' |
| ampersand | '&' |
| apostrophe | '\'' |
| left-parenthesis | '(' |
| right-parenthesis | ')' |
| asterisk | '\*' |
| plus-sign | '+' |
| comma | ',' |
| hyphen | '-' |
| hyphen-minus | '-' |
| period | '.' |
| full-stop | '.' |
| slash | '/' |
| solidus | '/' |
| zero | '0' |
| one | '1' |
| two | '2' |
| three | '3' |
| four | '4' |
| five | '5' |
| six | '6' |
| seven | '7' |
| eight | '8' |
| nine | '9' |
| colon | ':' |
| semicolon | ';' |
| less-than-sign | '<' |
| equals-sign | '=' |
| greater-than-sign | '>' |
| question-mark | '?' |
| commercial-at | '@' |
| left-square-bracket | '[' |
| backslash | '' |
| reverse-solidus | '' |
| right-square-bracket | ']' |
| circumflex | '^' |
| circumflex-accent | '^' |
| underscore | '\_' |
| low-line | '\_' |
| grave-accent | '`' |
| left-brace | '{' |
| left-curly-bracket | '{' |
| vertical-line | '|' |
| right-brace | '}' |
| right-curly-bracket | '}' |
| tilde | '' |
| DEL | 177 |
For example:
```
SELECT '|' REGEXP '[[.vertical-line.]]';
+----------------------------------+
| '|' REGEXP '[[.vertical-line.]]' |
+----------------------------------+
| 1 |
+----------------------------------+
```
### Combining
The true power of regular expressions is unleashed when the above is combined, to form more complex examples. Regular expression's reputation for complexity stems from the seeming complexity of multiple combined regular expressions, when in reality, it's simply a matter of understanding the characters and how they apply:
The first example fails to match, as while the `Ma` matches, either `i` or `r` only matches once before the `ia` characters at the end.
```
SELECT 'Maria' REGEXP 'Ma[ir]{2}ia';
+------------------------------+
| 'Maria' REGEXP 'Ma[ir]{2}ia' |
+------------------------------+
| 0 |
+------------------------------+
```
This example matches, as either `i` or `r` match exactly twice after the `Ma`, in this case one `r` and one `i`.
```
SELECT 'Maria' REGEXP 'Ma[ir]{2}';
+----------------------------+
| 'Maria' REGEXP 'Ma[ir]{2}' |
+----------------------------+
| 1 |
+----------------------------+
```
### Escaping
With the large number of special characters, care needs to be taken to properly escape characters. Two backslash characters, (one for the MariaDB parser, one for the regex library), are required to properly escape a character. For example:
To match the literal `(Ma`:
```
SELECT '(Maria)' REGEXP '(Ma';
ERROR 1139 (42000): Got error 'parentheses not balanced' from regexp
SELECT '(Maria)' REGEXP '\(Ma';
ERROR 1139 (42000): Got error 'parentheses not balanced' from regexp
SELECT '(Maria)' REGEXP '\\(Ma';
+--------------------------+
| '(Maria)' REGEXP '\\(Ma' |
+--------------------------+
| 1 |
+--------------------------+
```
To match `r+`: The first two examples are incorrect, as they match `r` one or more times, not `r+`:
```
SELECT 'Mar+ia' REGEXP 'r+';
+----------------------+
| 'Mar+ia' REGEXP 'r+' |
+----------------------+
| 1 |
+----------------------+
SELECT 'Maria' REGEXP 'r+';
+---------------------+
| 'Maria' REGEXP 'r+' |
+---------------------+
| 1 |
+---------------------+
SELECT 'Maria' REGEXP 'r\\+';
+-----------------------+
| 'Maria' REGEXP 'r\\+' |
+-----------------------+
| 0 |
+-----------------------+
SELECT 'Maria' REGEXP 'r+';
+---------------------+
| 'Maria' REGEXP 'r+' |
+---------------------+
| 1 |
+---------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb mariadb-waitpid mariadb-waitpid
===============
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-waitpid` is a symlink to `mysql_waitpid`, the utility for terminating processes.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysql_waitpid` is the symlink, and `mariadb-waitpid` the binary name.From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysql_waitpid` is the symlink, and `mariadb-waitpid` the binary name.
See [mysql\_waitpid](../mysql_waitpid/index) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ALTER LOGFILE GROUP ALTER LOGFILE GROUP
===================
Syntax
------
```
ALTER LOGFILE GROUP logfile_group
ADD UNDOFILE 'file_name'
[INITIAL_SIZE [=] size]
[WAIT]
ENGINE [=] engine_name
```
The `ALTER LOGFILE GROUP` statement is not supported by MariaDB. It was originally inherited from MySQL NDB Cluster. See [MDEV-19295](https://jira.mariadb.org/browse/MDEV-19295) for more information.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing MariaDB MSI Packages on Windows Installing MariaDB MSI Packages on Windows
==========================================
MSI packages are available for both x86 (32 bit) and x64 (64 bit) processor architectures. We'll use screenshots from an x64 installation below (the 32 bit installer is very similar).
Installation UI
---------------
This is the typical mode of installation. To start the installer, just click on the mariadb-<major>.<minor>.<patch>.msi
### Welcome
### License Agreement
Click on "I accept the terms"
### Custom Setup
Here, you can choose what features to install. By default, all features are installed with the exception of the debug symbols. If the "Database instance" feature is selected, the installer will create a database instance, by default running as a service. In this case the installer will present additional dialogs to control various database properties. Note that you do not necessarily have to create an instance at this stage. For example, if you already have MySQL or MariaDB databases running as services, you can just upgrade them during the installation. Also, you can create additional database instances after the installation, with the `[mysql\_install\_db.exe](../mysql_install_dbexe/index)` utility.
**NOTE**: By default, if you install a database instance, the data directory will be in the "data" folder under the installation root. To change the data directory location, select "Database instance" in the feature tree, and use the "Browse" button to point to another place.
### Database Authentication/Security Related Properties
This dialog is shown if you selected the "Database instance" feature. Here, you can set the password for the "root" database user and specify whether root can access database from remote machines. The "Create anonymous account" setting allows for anonymous (non-authenticated) users. It is off by default and it is not recommended to change this setting.
### Other Database Properties
* Install as service
* Defines whether the database should be run as a service. If it should be run as a service, then it also defines the service name. It is recommended to run your database instance as a service as it greatly simplifies database management. In [MariaDB 10.4](../what-is-mariadb-104/index) and later, the default service name used by the MSI installer is "MariaDB". In 10.3 and before, the default service name used by the MSI installer is "MySQL". Note that the default service name for the `[--install](../mysqld-options/index#-install)` and `[--install-manual](../mysqld-options/index#-install-manual)` options for `mysqld.exe` is "MySQL" in all versions of MariaDB.
* Enable Networking
* Whether to enable TCP/IP (recommended) and which port MariaDB should listen to. If security is a concern, you can change the [bind-address](../server-system-variables/index#bind_address) parameter post-installation to bind to only local addresses. If the "Enable networking" checkbox is deselected, the database will use named pipes for communication.
* Optimize for Transactions
* If this checkbox is selected, the default storage engine is set to Innodb (or XtraDB) and the `sql_mode` parameter is set to "`NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES`". You can also define the Innodb/Xtradb buffer pool size. The default buffer pool size is 12.5% of RAM and depending on your requirements you can give innodb more (up to 70-80% RAM). 32 bit versions of MariaDB have restrictions on maximum buffer pool size, which is approximately 1GB, due to virtual address space limitations for 32bit processes.
### Ready to Install
At this point, all installation settings are collected. Click on the "Install" button.
### End
Installation is finished now. If you have upgradable instances of MariaDB/MySQL, running as services, this dialog will present a "Do you want to upgrade existing instances" checkbox (if selected, it launches the Upgrade Wizard post-installation).
If you installed a database instance as service, the service will be running already.
New Entries in Start Menu
-------------------------
Installation will add some entries in the Start Menu:

* MariaDB Client - Starts command line client mysql.exe
* Command Prompt - Starts a command prompt. Environment is set such that "bin" directory of the installation is included into PATH environment variable, i.e you can use this command prompt to issue MariaDB commands (mysqldadmin, mysql etc...)
* Database directory - Opens the data directory in Explorer.
* Error log - Opens the database error log in Notepad.
* my.ini - Opens the database configuration file my.ini in Notepad.
* Upgrade Wizard - Starts the Wizard to upgrade an existing MariaDB/MySQL database instance to this MariaDB version.
Uninstall UI
------------
In the Explorer applet "Programs and Features" (or "Add/Remove programs" on older Windows), find the entry for MariaDB, choose Uninstall/Change and click on the "Remove" button in the dialog below.
If you installed a database instance, you will need to decide if you want to remove or keep the data in the database directory.
Silent Installation
-------------------
The MSI installer supports silent installations as well. In its simplest form silent installation with all defaults can be performed from an elevated command prompt like this:
```
msiexec /i path-to-package.msi /qn
```
**Note:** the installation is silent due to msiexe.exe's /qn switch (no user interface), if you omit the switch, the installation will have the full UI.
### Properties
Silent installations also support installation properties (a property would correspond for example to checked/unchecked state of a checkbox in the UI, user password, etc). With properties the command line to install the MSI package would look like this:
```
msiexec /i path-to-package.msi [PROPERTY_1=VALUE_1 ... PROPERTY_N=VALUE_N] /qn
```
The MSI installer package requires property names to be all capitals and contain only English letters. By convention, for a boolean property, an empty value means "false" and a non-empty is "true".
MariaDB installation supports the following properties:
| Property name | Default value | Description |
| --- | --- | --- |
| INSTALLDIR | %ProgramFiles%\MariaDB <version>\ | Installation root |
| PORT | 3306 | --port parameter for the server |
| ALLOWREMOTEROOTACCESS | | Allow remote access for root user |
| BUFFERPOOLSIZE | RAM/8 | Bufferpoolsize for innodb |
| CLEANUPDATA | 1 | Remove the data directory (uninstall only) |
| DATADIR | INSTALLDIR\data | Location of the data directory |
| DEFAULTUSER | | Allow anonymous users |
| PASSWORD | | Password of the root user |
| SERVICENAME | | Name of the Windows service. A service is not created if this value is empty. |
| SKIPNETWORKING | | Skip networking |
| STDCONFIG | 1 | Corresponds to "optimize for transactions" in the GUI, default engine innodb, strict sql mode |
| UTF8 | | if set, adds character-set-server=utf8 to my.ini file |
| PAGESIZE | 16K | page size for innodb |
### Features
*Feature* is a Windows installer term for a unit of installation. Features can be selected and deselected in the UI in the feature tree in the "Custom Setup" dialog.
Silent installation supports adding features with the special property `ADDLOCAL=Feature_1,..,Feature_N` and removing features with `REMOVE=Feature_1,..., Feature_N`
Features in the MariaDB installer:
| Feature id | Installed by default? | Description |
| --- | --- | --- |
| DBInstance | yes | Install database instance |
| Client | yes | Command line client programs |
| MYSQLSERVER | yes | Install server |
| SharedLibraries | yes | Install client shared library |
| DEVEL | yes | install C/C++ header files and client libraries |
| HeidiSQL | yes | Installs HeidiSQL |
### Silent Installation Examples
All examples here require running as administrator (and elevated command line in Vista and later)
* Install default features, database instance as service, non-default datadir and port
```
msiexec /i path-to-package.msi SERVICENAME=MySQL DATADIR=C:\mariadb5.2\data PORT=3307 /qn
```
* Install service, add debug symbols, do not add development components (client libraries and headers)
```
msiexec /i path-to-package.msi SERVICENAME=MySQL ADDLOCAL=DEBUGSYMBOLS REMOVE=DEVEL /qn
```
### Silent Uninstall
To uninstall silently, use the `REMOVE=ALL` property with msiexec:
```
msiexec /i path-to-package.msi REMOVE=ALL /qn
```
To keep the data directory during an uninstall, you will need to pass an additional parameter:
```
msiexec /i path-to-package.msi REMOVE=ALL CLEANUPDATA="" /qn
```
Installation Logs
-----------------
If you encounter a bug in the installer, the installer logs should be used for diagnosis. Please attach verbose logs to the bug reports you create. To create a verbose installer log, start the installer from the command line with the `/l*v` switch, like so:
```
msiexec.exe /i path-to-package.msi /l*v path-to-logfile.txt
```
Running 32 and 64 Bit Distributions on the Same Machine
-------------------------------------------------------
It is possible to install 32 and 64 bit packages on the same Windows x64.
Apart from testing, an example where this feature can be useful is a development scenario, where users want to run a 64 bit server and develop both 32 and 64 bit client components. In this case the full 64 bit package can be installed, including a database instance plus development-related features (headers and libraries) from the 32 bit package.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb AsBinary AsBinary
========
A synonym for [ST\_AsBinary()](../st_asbinary/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Columns, Storage Engines, and Plugins Columns, Storage Engines, and Plugins
======================================
MariaDB allows for a variety of column data types, characters and collations.
| Title | Description |
| --- | --- |
| [Data Types](../data-types/index) | Data types for columns in MariaDB tables. |
| [Character Sets and Collations](../character-sets/index) | Setting character set and collation for a language. |
| [Storage Engines](../storage-engines/index) | Various storage engines available for MariaDB. |
| [Plugins](../plugins/index) | Documentation on MariaDB Server plugins. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Full-Text Indexes Full-Text Indexes
==================
MariaDB has support for full-text indexing and searching.
| Title | Description |
| --- | --- |
| [Full-Text Index Overview](../full-text-index-overview/index) | Full-text indexing and searching overview. |
| [Full-Text Index Stopwords](../full-text-index-stopwords/index) | Default list of full-text stopwords used by MATCH...AGAINST. |
| [MATCH AGAINST](../match-against/index) | Perform a fulltext search on a fulltext index. |
| [myisam\_ftdump](../myisam_ftdump/index) | A tool for displaying information on MyISAM FULLTEXT indexes. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Groupwise Max in MariaDB Groupwise Max in MariaDB
========================
The problem
-----------
You want to find the largest row in each group of rows. An example is looking for the largest city in each state. While it is easy to find the MAX(population) ... GROUP BY state, it is hard to find the name of the `city` associated with that `population`. Alas, MySQL and MariaDB do not have any syntax to provide the solution directly.
This article is under construction, mostly for cleanup. The content is reasonably accurate during construction.
The article presents two "good" solutions. They differ in ways that make neither of them 'perfect'; you should try both and weigh the pros and cons.
Also, a few "bad" solutions will be presented, together with why they were rejected.
MySQL manual gives 3 solutions; only the "Uncorrelated" one is "good", the other two are "bad".
Sample data
-----------
To show how the various coding attempts work, I have devised this simple task: Find the largest city in each Canadian province. Here's a sample of the source data (5493 rows):
```
+------------------+----------------+------------+
| province | city | population |
+------------------+----------------+------------+
| Saskatchewan | Rosetown | 2309 |
| British Columbia | Chilliwack | 51942 |
| Nova Scotia | Yarmouth | 7500 |
| Alberta | Grande Prairie | 41463 |
| Quebec | Sorel | 33591 |
| Ontario | Moose Factory | 2060 |
| Ontario | Bracebridge | 8238 |
| British Columbia | Nanaimo | 84906 |
| Manitoba | Neepawa | 3151 |
| Alberta | Grimshaw | 2560 |
| Saskatchewan | Carnduff | 950 |
...
```
Here's the desired output (13 rows):
```
+---------------------------+---------------+------------+
| province | city | population |
+---------------------------+---------------+------------+
| Alberta | Calgary | 968475 |
| British Columbia | Vancouver | 1837970 |
| Manitoba | Winnipeg | 632069 |
| New Brunswick | Saint John | 87857 |
| Newfoundland and Labrador | Corner Brook | 18693 |
| Northwest Territories | Yellowknife | 15866 |
| Nova Scotia | Halifax | 266012 |
| Nunavut | Iqaluit | 6124 |
| Ontario | Toronto | 4612187 |
| Prince Edward Island | Charlottetown | 42403 |
| Quebec | Montreal | 3268513 |
| Saskatchewan | Saskatoon | 198957 |
| Yukon | Whitehorse | 19616 |
+---------------------------+---------------+------------+
```
Duplicate max
-------------
One thing to consider is whether you want -- or do not want -- to see multiple rows for tied winners. For the dataset being used here, that would imply that the two largest cities in a province had identical populations. For this case, a duplicate would be unlikely. But there are many groupwise-max use cases where duplictes are likely.
The two best algorithms differ in whether they show duplicates.
Using an uncorrelated subquery
------------------------------
Characteristics:
* Superior performance or medium performance
* It will show duplicates
* Needs an extra index
* Probably requires 5.6
* If all goes well, it will run in O(M) where M is the number of output rows.
An 'uncorrelated subquery':
```
SELECT c1.province, c1.city, c1.population
FROM Canada AS c1
JOIN
( SELECT province, MAX(population) AS population
FROM Canada
GROUP BY province
) AS c2 USING (province, population)
ORDER BY c1.province;
```
But this also 'requires' an extra index: INDEX(province, population). In addition, MySQL has not always been able to use that index effectively, hence the "requires 5.6". (I am not sure of the actual version.)
Without that extra index, you would need 5.6, which has the ability to create indexes for subqueries. This is indicated by <auto\_key0> in the EXPLAIN. Even so, the performance is worse with the auto-generated index than with the manually generated one.
With neither the extra index, nor 5.6, this 'solution' would belong in 'The Duds' because it would run in O(N\*N) time.
Using @variables
----------------
Characteristics:
* Good performance
* Does not show duplicates (picks one to show)
* Consistent O(N) run time (N = number of input rows)
* Only one scan of the data
```
SELECT
province, city, population -- The desired columns
FROM
( SELECT @prev := '' ) init
JOIN
( SELECT province != @prev AS first, -- `province` is the 'GROUP BY'
@prev := province, -- The 'GROUP BY'
province, city, population -- Also the desired columns
FROM Canada -- The table
ORDER BY
province, -- The 'GROUP BY'
population DESC -- ASC for MIN(population), DESC for MAX
) x
WHERE first
ORDER BY province; -- Whatever you like
```
For your application, change the lines with comments.
The duds
--------
**\* 'correlated subquery' (from MySQL doc):**
```
SELECT province, city, population
FROM Canada AS c1
WHERE population =
( SELECT MAX(c2.population)
FROM Canada AS c2
WHERE c2.province= c1.province
)
ORDER BY province;
```
O(N\*N) (that is, terrible) performance
**\* LEFT JOIN (from MySQL doc):**
```
SELECT c1.province, c1.city, c1.population
FROM Canada AS c1
LEFT JOIN Canada AS c2 ON c2.province = c1.province
AND c2.population > c1.population
WHERE c2.province IS NULL
ORDER BY province;
```
Medium performance (2N-3N, depending on join\_buffer\_size).
For O(N\*N) time,... It will take one second to do a groupwise-max on a few thousand rows; a million rows could take hours.
Top-N in each group
-------------------
This is a variant on "groupwise-max" wherein you desire the largest (or smallest) N items in each group. Do these substitutions for your use case:
* province --> your 'GROUP BY'
* Canada --> your table
* 3 --> how many of each group to show
* population --> your numeric field for determining "Top-N"
* city --> more field(s) you want to show
* Change the SELECT and ORDER BY if you desire
* DESC to get the 'largest'; ASC for the 'smallest'
```
SELECT
province, n, city, population
FROM
( SELECT @prev := '', @n := 0 ) init
JOIN
( SELECT @n := if(province != @prev, 1, @n + 1) AS n,
@prev := province,
province, city, population
FROM Canada
ORDER BY
province ASC,
population DESC
) x
WHERE n <= 3
ORDER BY province, n;
```
Output:
```
+---------------------------+------+------------------+------------+
| province | n | city | population |
+---------------------------+------+------------------+------------+
| Alberta | 1 | Calgary | 968475 |
| Alberta | 2 | Edmonton | 822319 |
| Alberta | 3 | Red Deer | 73595 |
| British Columbia | 1 | Vancouver | 1837970 |
| British Columbia | 2 | Victoria | 289625 |
| British Columbia | 3 | Abbotsford | 151685 |
| Manitoba | 1 | ...
```
The performance of this is O(N), actually about 3N, where N is the number of source rows.
EXPLAIN EXTENDED gives
```
+----+-------------+------------+--------+---------------+------+---------+------+------+----------+----------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+--------+---------------+------+---------+------+------+----------+----------------+
| 1 | PRIMARY | <derived2> | system | NULL | NULL | NULL | NULL | 1 | 100.00 | Using filesort |
| 1 | PRIMARY | <derived3> | ALL | NULL | NULL | NULL | NULL | 5484 | 100.00 | Using where |
| 3 | DERIVED | Canada | ALL | NULL | NULL | NULL | NULL | 5484 | 100.00 | Using filesort |
| 2 | DERIVED | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | No tables used |
+----+-------------+------------+--------+---------------+------+---------+------+------+----------+----------------+
```
Explanation, shown in the same order as the EXPLAIN, but numbered chronologically: 3. Get the subquery id=2 (init) 4. Scan the the output from subquery id=3 (x) 2. Subquery id=3 -- the table scan of Canada 1. Subquery id=2 -- `init` for simply initializing the two @variables Yes, it took two sorts, though probably in RAM.
Main Handler values:
```
| Handler_read_rnd | 39 |
| Handler_read_rnd_next | 10971 |
| Handler_write | 5485 | -- #rows in Canada (+1)
```
Top-n in each group, take II
----------------------------
This variant is faster than the previous, but depends on `city` being unique across the dataset. (from openark.org)
```
SELECT province, city, population
FROM Canada
JOIN
( SELECT GROUP_CONCAT(top_in_province) AS top_cities
FROM
( SELECT SUBSTRING_INDEX(
GROUP_CONCAT(city ORDER BY population DESC),
',', 3) AS top_in_province
FROM Canada
GROUP BY province
) AS x
) AS y
WHERE FIND_IN_SET(city, top_cities)
ORDER BY province, population DESC;
```
Output. Note how there can be more than 3 cities per province:
```
| Alberta | Calgary | 968475 |
| Alberta | Edmonton | 822319 |
| Alberta | Red Deer | 73595 |
| British Columbia | Vancouver | 1837970 |
| British Columbia | Victoria | 289625 |
| British Columbia | Abbotsford | 151685 |
| British Columbia | Sydney | 0 | -- Nova Scotia's second largest is Sydney
| Manitoba | Winnipeg | 632069 |
```
Main Handler values:
```
| Handler_read_next | 5484 | -- table size
| Handler_read_rnd_next | 5500 | -- table size + number of provinces
| Handler_write | 14 | -- number of provinces (+1)
```
Top-n using MyISAM
------------------
(This does not need your table to be MyISAM, but it does need MyISAM tmp table for its 2-column PRIMARY KEY feature.) See previous section for what changes to make for your use case.
```
-- build tmp table to get numbering
-- (Assumes auto_increment_increment = 1)
CREATE TEMPORARY TABLE t (
nth MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY(province, nth)
) ENGINE=MyISAM
SELECT province, NULL AS nth, city, population
FROM Canada
ORDER BY population DESC;
-- Output the biggest 3 cities in each province:
SELECT province, nth, city, population
FROM t
WHERE nth <= 3
ORDER BY province, nth;
+---------------------------+-----+------------------+------------+
| province | nth | city | population |
+---------------------------+-----+------------------+------------+
| Alberta | 1 | Calgary | 968475 |
| Alberta | 2 | Edmonton | 822319 |
| Alberta | 3 | Red Deer | 73595 |
| British Columbia | 1 | Vancouver | 1837970 |
| British Columbia | 2 | Victoria | 289625 |
| British Columbia | 3 | Abbotsford | 151685 |
| Manitoba | ...
SELECT for CREATE:
+----+-------------+--------+------+---------------+------+---------+------+------+----------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+------+---------------+------+---------+------+------+----------------+
| 1 | SIMPLE | Canada | ALL | NULL | NULL | NULL | NULL | 5484 | Using filesort |
+----+-------------+--------+------+---------------+------+---------+------+------+----------------+
Other SELECT:
+----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
| 1 | SIMPLE | t | index | NULL | PRIMARY | 104 | NULL | 22 | Using where |
+----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
```
The main handler values (total of all operations):
```
| Handler_read_rnd_next | 10970 |
| Handler_write | 5484 | -- number of rows in Canada (write tmp table)
```
Both "Top-n" formulations probably take about the same amount of time.
Windowing functions
-------------------
Hot off the press from Percona Live... [MariaDB 10.2](../what-is-mariadb-102/index) has "windowing functions", which make "groupwise max" much more straightforward.
The code:
TBD
Postlog
-------
Developed an first posted, Feb, 2015; Add MyISAM approach: July, 2015; Openark's method added: Apr, 2016; Windowing: Apr 2016
I did not include the technique(s) using GROUP\_CONCAT. They are useful in some situations with small datasets. They can be found in the references below.
See also
--------
* This has some of these algorithms, plus some others: [Peter Brawley's blog](http://www.artfulsoftware.com/infotree/queries.php?&bw=1179#101)
* [Jan Kneschke's blog from 2007](http://jan.kneschke.de/projects/mysql/groupwise-max)
* [StackOverflow discussion of 'Uncorrelated'](http://stackoverflow.com/questions/14770671/mysql-order-by-before-group-by)
* Other references: [Inner ORDER BY thrown away](../mariadb/group-by-trick-has-been-optimized-away/index)
* Adding a large LIMIT to a subquery may make things work. [Why ORDER BY in subquery is ignored](../mariadb/why-is-order-by-in-a-from-subquery-ignored/index)
* [StackOverflow thread](http://stackoverflow.com/questions/36485072/select-with-order-and-group-by-in-maria-dbmysql)
* [row\_number(), rank(), dense\_rank()](http://kennethxu.blogspot.com/2016/04/analytical-function-in-mysql-rownumber.html)
* [http://rpbouman.blogspot.de/2008/07/calculating-nth-percentile-in-mysql.html][Perentile blog](#)
Rick James graciously allowed us to use this article in the Knowledge Base.
[Rick James' site](http://mysql.rjweb.org/) has other useful tips, how-tos, optimizations, and debugging tips.
Original source: <http://mysql.rjweb.org/doc.php/groupwise_max>
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Pluggable Authentication Overview Pluggable Authentication Overview
=================================
When a user attempts to log in, the authentication plugin controls how MariaDB Server determines whether the connection is from a legitimate user.
When creating or altering a user account with the [GRANT](../grant/index), [CREATE USER](../create-user/index) or [ALTER USER](../alter-user/index) statements, you can specify the authentication plugin you want the user account to use by providing the `IDENTIFIED VIA` clause. By default, when you create a user account without specifying an authentication plugin, MariaDB uses the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) plugin.
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, there are some notable changes, such as:
* You can specify multiple authentication plugins for each user account.
* The `root@localhost` user created by [mysql\_install\_db](../mysql_install_db/index) is created with the ability to use two authentication plugins. First, it is configured to try to use the [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin. This allows the the `root@localhost` user to login without a password via the local Unix socket file defined by the [socket](../server-system-variables/index#socket) system variable, as long as the login is attempted from a process owned by the operating system `root` user account. Second, if authentication fails with the [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin, then it is configured to try to use the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin. However, an invalid password is initially set, so in order to authenticate this way, a password must be set with [SET PASSWORD](../set-password/index).
Supported Authentication Plugins
--------------------------------
The authentication process is a conversation between the server and a client. MariaDB implements both server-side and client-side authentication plugins.
### Supported Server Authentication Plugins
MariaDB provides seven server-side authentication plugins:
* [mysql\_native\_password](../authentication-plugin-mysql_native_password/index)
* [mysql\_old\_password](../authentication-plugin-mysql_old_password/index)
* [ed25519](../authentication-plugin-ed25519/index)
* [gssapi](../authentication-plugin-gssapi/index)
* [pam](../authentication-plugin-pam/index) (Unix only)
* [unix\_socket](../authentication-plugin-unix-socket/index) (Unix only)
* [named\_pipe](../authentication-plugin-named-pipe/index) (Windows only)
### Supported Client Authentication Plugins
MariaDB provides eight client-side authentication plugins:
* [mysql\_native\_password](../authentication-plugin-mysql_native_password/index#client-authentication-plugins)
* [mysql\_old\_password](../authentication-plugin-mysql_old_password/index#client-authentication-plugins)
* [client\_ed25519](../authentication-plugin-ed25519/index#client-authentication-plugins)
* [auth\_gssapi\_client](../authentication-plugin-gssapi/index#client-authentication-plugins)
* [dialog](../authentication-plugin-pam/index#client-authentication-plugins)
* [mysql\_clear\_password](../authentication-plugin-pam/index#client-authentication-plugins)
* [sha256\_password](../authentication-plugin-sha-256/index#client-authentication-plugins)
* [caching\_sha256\_password](../authentication-plugin-sha-256/index#client-authentication-plugins)
Options Related to Authentication Plugins
-----------------------------------------
### Server Options Related to Authentication Plugins
MariaDB supports the following server options related to authentication plugins:
| Server Option | Description |
| --- | --- |
| `[old\_passwords={1 | 0}](../server-system-variables/index#old_passwords)` | If set to `1` (`0` is default), MariaDB reverts to using the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin by default for newly created users and passwords, instead of the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin. |
| `[plugin\_dir=path](../server-system-variables/index#plugin_dir)` | Path to the [plugin](../mariadb-plugins/index) directory. For security reasons, either make sure this directory can only be read by the server, or set [secure\_file\_priv](#secure_file_priv). |
| `[plugin\_maturity=level](../server-system-variables/index#plugin_maturity)` | The lowest acceptable [plugin](../mariadb-plugins/index) maturity. MariaDB will not load plugins less mature than the specified level. |
| `[secure\_auth](../server-system-variables/index#secure_auth)` | Connections will be blocked if they use the the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin. The server will also fail to start if the privilege tables are in the old, pre-MySQL 4.1 format. |
### Client Options Related to Authentication Plugins
Most [clients and utilities](../clients-utilities/index) support some command line arguments related to client authentication plugins:
| Client Option | Description |
| --- | --- |
| `--connect-expired-password` | Notify the server that this client is prepared to handle [expired password sandbox mode](../user-password-expiry/index) even if `--batch` was specified. From [MariaDB 10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/). |
| `--default-auth=name` | Default authentication client-side plugin to use. |
| `--plugin-dir=path` | Directory for client-side plugins. |
| `--secure-auth` | Refuse to connect to the server if the server uses the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin. This mode is off by default, which is a difference in behavior compared to MySQL 5.6 and later, where it is on by default. |
Developers who are using [MariaDB Connector/C](../mariadb-connector-c/index) can implement similar functionality in their application by setting the following options with the [mysql\_optionsv](../mysql_optionsv/index) function:
* `MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS`
* `MYSQL_PLUGIN_DIR`
* `MYSQL_DEFAULT_AUTH`
* `MYSQL_SECURE_AUTH`
For example:
```
mysql_optionsv(mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
mysql_optionsv(mysql, MYSQL_DEFAULT_AUTH, "name");
mysql_optionsv(mysql, MYSQL_PLUGIN_DIR, "path");
mysql_optionsv(mysql, MYSQL_SECURE_AUTH, 1);
```
### Installation Options Related to Authentication Plugins
[mysql\_install\_db](../mysql_install_db/index) supports the following installation options related to authentication plugins:
| Installation Option | Description |
| --- | --- |
| `--auth-root-authentication-method={normal `|` socket}` | If set to `normal`, it creates a `root@localhost` account that authenticates with the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin and that has no initial password set, which can be insecure. If set to `socket`, it creates a `root@localhost` account that authenticates with the [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin. Set to `normal` by default. Available since [MariaDB 10.1](../what-is-mariadb-101/index). |
| `--auth-root-socket-user=USER` | Used with `--auth-root-authentication-method=socket`. It specifies the name of the second account to create with [SUPER](../grant/index#global-privileges) privileges in addition to `root`, as well as of the system account allowed to access it. Defaults to the value of `--user`. |
Extended SQL Syntax
-------------------
MariaDB has extended the SQL standard [GRANT](../grant/index), [CREATE USER](../create-user/index), and [ALTER USER](../alter-user/index) statements, so that they support specifying different authentication plugins for specific users. An authentication plugin can be specified with these statements by providing the `IDENTIFIED VIA` clause.
For example, the [GRANT](../grant/index) syntax is:
```
GRANT <privileges> ON <level> TO <user>
IDENTIFIED VIA <plugin> [ USING <string> ]
```
And the [CREATE USER](../create-user/index) syntax is:
```
CREATE USER <user>
IDENTIFIED VIA <plugin> [ USING <string> ]
```
And the [ALTER USER](../alter-user/index) syntax is:
```
ALTER USER <user>
IDENTIFIED VIA <plugin> [ USING <string> ]
```
The optional `USING` clause allows users to provide an authentication string to a plugin. The authentication string's format and meaning is completely defined by the plugin.
For example, for the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin, the authentication string should be a password hash:
```
CREATE USER mysqltest_up1
IDENTIFIED VIA mysql_native_password USING '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
```
Since [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) is the default authentication plugin, the above is just another way of saying the following:
```
CREATE USER mysqltest_up1
IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
```
In contrast, for the [pam](../authentication-plugin-pam/index) authentication plugin, the authentication string should refer to a [PAM service name](../authentication-plugin-pam/index#configuring-the-pam-service):
```
CREATE USER mysqltest_up1
IDENTIFIED VIA pam USING 'mariadb';
```
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, a user account can be associated with multiple authentication plugins.
For example, to configure the `root@localhost` user account to try the [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin, followed by the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin as a backup, you could execute the following:
```
CREATE USER root@localhost
IDENTIFIED VIA unix_socket
OR mysql_native_password USING PASSWORD("verysecret");
```
See [Authentication from MariaDB 10.4](../authentication-from-mariadb-104/index) for more information.
Authentication Plugins Installed by Default
-------------------------------------------
### Server Authentication Plugins Installed by Default
Not all server-side authentication plugins are installed by default. If a specific server-side authentication plugin is not installed by default, then you can find the installation procedure on the documentation page for the specific authentication plugin.
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**In [MariaDB 10.4](../what-is-mariadb-104/index) and later, the following server-side authentication plugins are installed by default:
* The [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) and [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugins authentication plugins are installed by default in all builds.
* The [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin is installed by default in all builds on Unix and Linux.
* The [named\_pipe](../authentication-plugin-named-pipe/index) authentication plugin is installed by default in all builds on Windows.
**MariaDB until [10.3](../what-is-mariadb-103/index)**In [MariaDB 10.3](../what-is-mariadb-103/index) and below, the following server-side authentication plugins are installed by default:
* The [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) and [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugins are installed by default in all builds.
* The [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin is installed by default in **new installations** that use the [.deb](../installing-mariadb-deb-files/index) packages provided by Debian's default repositories in Debian 9 and later and Ubuntu's default repositories in Ubuntu 15.10 and later. See [Differences in MariaDB in Debian (and Ubuntu)](../differences-in-mariadb-in-debian-and-ubuntu/index) for more information.
* The [named\_pipe](../authentication-plugin-named-pipe/index) authentication plugin is installed by default in all builds on Windows.
### Client Authentication Plugins Installed by Default
Client-side authentication plugins do not need to be *installed* in the same way that server-side authentication plugins do. If the client uses either the `libmysqlclient` or [MariaDB Connector/C](../mariadb-connector-c/index) library, then the library automatically loads client-side authentication plugins from the library's plugin directory whenever they are needed.
Most [clients and utilities](../clients-utilities/index) support the `--plugin-dir` command line argument that can be used to set the path to the library's plugin directory:
| Client Option | Description |
| --- | --- |
| `--plugin-dir=path` | Directory for client-side plugins. |
Developers who are using [MariaDB Connector/C](../mariadb-connector-c/index) can implement similar functionality in their application by setting the `MYSQL_PLUGIN_DIR` option with the [mysql\_optionsv](../mysql_optionsv/index) function.
For example:
```
mysql_optionsv(mysql, MYSQL_PLUGIN_DIR, "path");
```
If your client encounters errors similar to the following, then you may need to set the path to the library's plugin directory:
```
ERROR 2059 (HY000): Authentication plugin 'dialog' cannot be loaded: /usr/lib/mysql/plugin/dialog.so: cannot open shared object file: No such file or directory
```
If the client does **not** use either the `libmysqlclient` or [MariaDB Connector/C](../mariadb-connector-c/index) library, then you will have to determine which authentication plugins are supported by the specific client library used by the client.
If the client uses either the `libmysqlclient` or [MariaDB Connector/C](../mariadb-connector-c/index) library, but the client is not bundled with either library's *optional* client authentication plugins, then you can only use the conventional authentication plugins (like [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) and [mysql\_old\_password](../authentication-plugin-mysql_old_password/index)) and the non-conventional authentication plugins that don't require special client-side authentication plugins (like [unix\_socket](../authentication-plugin-unix-socket/index) and [named\_pipe](../authentication-plugin-named-pipe/index)).
Default Authentication Plugin
-----------------------------
### Default Server Authentication Plugin
The [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin is currently the default authentication plugin in all versions of MariaDB if the [old\_passwords](../server-system-variables/index#old_passwords) system variable is set to `0`, which is the default.
On a system with the [old\_passwords](../server-system-variables/index#old_passwords) system variable set to `0`, this means that if you create a user account with either the [GRANT](../grant/index) or [CREATE USER](../create-user/index) `statements, and if you do not specify an authentication plugin with the` IDENTIFIED VIA `clause, then MariaDB will use the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin for the user account.`
For example, this user account will use the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin:
```
CREATE USER username@hostname;
```
And so will this user account:
```
CREATE USER username@hostname IDENTIFIED BY 'notagoodpassword';
```
The [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin becomes the default authentication plugin in all versions of MariaDB if the [old\_passwords](../server-system-variables/index#old_passwords) system variable is explicitly set to `1`.
However, the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin is not considered secure, so it is recommended to avoid using this authentication plugin. To help prevent undesired use of the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin, the server supports the [secure\_auth](../server-system-variables/index#secure_auth) system variable that can be used to configured the server to refuse connections that try to use the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin:
| Server Option | Description |
| --- | --- |
| `[old\_passwords={1 | 0}](../server-system-variables/index#old_passwords)` | If set to `1` (`0` is default), MariaDB reverts to using the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin by default for newly created users and passwords, instead of the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin. |
| `[secure\_auth](../server-system-variables/index#secure_auth)` | Connections will be blocked if they use the the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin. The server will also fail to start if the privilege tables are in the old, pre-MySQL 4.1 format. |
Most [clients and utilities](../clients-utilities/index) also support the `--secure-auth` command line argument that can also be used to configure the client to refuse to connect to servers that use the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin:
| Client Option | Description |
| --- | --- |
| `--secure-auth` | Refuse to connect to the server if the server uses the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin. This mode is off by default, which is a difference in behavior compared to MySQL 5.6 and later, where it is on by default. |
Developers who are using [MariaDB Connector/C](../mariadb-connector-c/index) can implement similar functionality in their application by setting the `MYSQL_SECURE_AUTH` option with the [mysql\_optionsv](../mysql_optionsv/index) function.
For example:
```
mysql_optionsv(mysql, MYSQL_SECURE_AUTH, 1);
```
### Default Client Authentication Plugin
The default client-side authentication plugin depends on a few factors.
If a client doesn't explicitly set the default client-side authentication plugin, then the client will determine which authentication plugin to use by checking the length of the scramble in the server's handshake packet.
If the server's handshake packet contains a 9-byte scramble, then the client will default to the [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin.
If the server's handshake packet contains a 20-byte scramble, then the client will default to the [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin.
#### Setting the Default Client Authentication Plugin
Most [clients and utilities](../clients-utilities/index) support the `--default-auth` command line argument that can be used to set the default client-side authentication plugin:
| Client Option | Description |
| --- | --- |
| `--default-auth=name` | Default authentication client-side plugin to use. |
Developers who are using [MariaDB Connector/C](../mariadb-connector-c/index) can implement similar functionality in their application by setting the `MYSQL_DEFAULT_AUTH` option with the [mysql\_optionsv](../mysql_optionsv/index) function.
For example:
```
mysql_optionsv(mysql, MYSQL_DEFAULT_AUTH, "name");
```
If you know that your user account is configured to require a client-side authentication plugin that isn't [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) or [mysql\_native\_password](../authentication-plugin-mysql_native_password/index), then it can help speed up your connection process to explicitly set the default client-side authentication plugin.
According to the [client-server protocol](../clientserver-protocol/index), the server first sends the handshake packet to the client, then the client replies with a packet containing the user name of the user account that is requesting access. The server handshake packet initially tells the client to use the default server authentication plugin, and the client reply initially tells the server that it will use the default client authentication plugin.
However, the server-side and client-side authentication plugins mentioned in these initial packets may not be the correct ones for this specific user account. The server only knows what authentication plugin to use for this specific user account after reading the user name from the client reply packet and finding the appropriate row for the user account in either the [mysql.user](../mysqluser-table/index) table or the [mysql.global\_priv](../mysqlglobal_priv-table/index) table, depending on the MariaDB version.
If the server finds that either the server-side or client-side default authentication plugin does not match the actual authentication plugin that should be used for the given user account, then the server restarts the authentication on either the server side or the client side.
This means that, if you know what client authentication plugin your user account requires, then you can avoid an unnecessary authentication restart and you can save two packets and two round-trips.between the client and server by configuring your client to use the correct authentication plugin by default.
Authentication Plugins
----------------------
### Server Authentication Plugins
#### `mysql_native_password`
The [mysql\_native\_password](../authentication-plugin-mysql_native_password/index) authentication plugin uses the password hashing algorithm introduced in MySQL 4.1, which is also used by the [PASSWORD()](../password/index) `function when [old\_passwords=0](../server-system-variables/index#old_passwords) is set. This hashing algorithm is based on [SHA-1](https://en.wikipedia.org/wiki/SHA-1).`
#### `mysql_old_password`
The [mysql\_old\_password](../authentication-plugin-mysql_old_password/index) authentication plugin uses the pre-MySQL 4.1 password hashing algorithm, which is also used by the [OLD\_PASSWORD()](../old_password/index) function and by the [PASSWORD()](../password/index) function when [old\_passwords=1](../server-system-variables/index#old_passwords) is set.
#### `ed25519`
The [ed25519](../authentication-plugin-ed25519/index) authentication plugin uses [Elliptic Curve Digital Signature Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) to securely store users' passwords and to authenticate users. The [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) algorithm is the same one that is [used by OpenSSH](https://www.openssh.com/txt/release-6.5). It is based on the elliptic curve and code created by [Daniel J. Bernstein](https://en.wikipedia.org/wiki/Daniel_J._Bernstein).
From a user's perspective, the [ed25519](../authentication-plugin-ed25519/index) authentication plugin still provides conventional password-based authentication.
#### `gssapi`
The [gssapi](../authentication-plugin-gssapi/index) authentication plugin allows the user to authenticate with services that use the [Generic Security Services Application Program Interface (GSSAPI)](https://en.wikipedia.org/wiki/Generic_Security_Services_Application_Program_Interface). Windows has a slightly different but very similar API called [Security Support Provider Interface (SSPI)](https://docs.microsoft.com/en-us/windows/desktop/secauthn/sspi).
On Windows, this authentication plugin supports [Kerberos](https://docs.microsoft.com/en-us/windows/desktop/secauthn/microsoft-kerberos) and [NTLM](https://docs.microsoft.com/en-us/windows/desktop/secauthn/microsoft-ntlm) authentication. Windows authentication is supported regardless of whether a [domain](https://en.wikipedia.org/wiki/Windows_domain) is used in the environment.
On Unix systems, the most dominant GSSAPI service is [Kerberos](https://en.wikipedia.org/wiki/Kerberos_(protocol)). However, it is less commonly used on Unix systems than it is on Windows. Regardless, this authentication plugin also supports Kerberos authentication on Unix.
The [gssapi](../authentication-plugin-gssapi/index) authentication plugin is most often used for authenticating with [Microsoft Active Directory](https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/virtual-dc/active-directory-domain-services-overview).
#### `pam`
The [pam](../authentication-plugin-pam/index) authentication plugin allows MariaDB to offload user authentication to the system's [Pluggable Authentication Module (PAM)](http://en.wikipedia.org/wiki/Pluggable_authentication_module) framework. PAM is an authentication framework used by Linux, FreeBSD, Solaris, and other Unix-like operating systems.
#### `unix_socket`
The [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin allows the user to use operating system credentials when connecting to MariaDB via the local Unix socket file. This Unix socket file is defined by the [socket](../server-system-variables/index#socket) system variable.
The [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin works by calling the [getsockopt](http://man7.org/linux/man-pages/man7/socket.7.html) system call with the `SO_PEERCRED` socket option, which allows it to retrieve the `uid` of the process that is connected to the socket. It is then able to get the user name associated with that `uid`. Once it has the user name, it will authenticate the connecting user as the MariaDB account that has the same user name.
For example:
```
$ mysql -uroot
MariaDB []> CREATE USER serg IDENTIFIED VIA unix_socket;
MariaDB []> CREATE USER monty IDENTIFIED VIA unix_socket;
MariaDB []> quit
Bye
$ whoami
serg
$ mysql --user=serg
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.2.0-MariaDB-alpha-debug Source distribution
MariaDB []> quit
Bye
$ mysql --user=monty
ERROR 1045 (28000): Access denied for user 'monty'@'localhost' (using password: NO)
```
In this example, a user `serg` is already logged into the operating system and has full shell access. He has already authenticated with the operating system and his MariaDB account is configured to use the [unix\_socket](../authentication-plugin-unix-socket/index) authentication plugin, so he does not need to authenticate again for the database. MariaDB accepts his operating system credentials and allows him to connect. However, any attempt to connect to the database as another operating system user will be denied.
#### `named_pipe`
The [named\_pipe](../authentication-plugin-named-pipe/index) authentication plugin allows the user to use operating system credentials when connecting to MariaDB via named pipe on Windows. Named pipe connections are enabled by the [named\_pipe](../server-system-variables/index#named_pipe) system variable.
The [named\_pipe](../authentication-plugin-named-pipe/index) authentication plugin works by using [named pipe impersonation](https://msdn.microsoft.com/en-us/library/windows/desktop/aa378618%28v=vs.85%29.aspx) and calling `GetUserName()` to retrieve the user name of the process that is connected to the named pipe. Once it has the user name, it authenticates the connecting user as the MariaDB account that has the same user name.
For example:
```
CREATE USER wlad IDENTIFIED VIA named_pipe;
CREATE USER monty IDENTIFIED VIA named_pipe;
quit
C:\>echo %USERNAME%
wlad
C:\> mysql --user=wlad --protocol=PIPE
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.12-MariaDB-debug Source distribution
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> quit
Bye
C:\> mysql --user=monty --protocol=PIPE
ERROR 1698 (28000): Access denied for user 'monty'@'localhost'
```
Authentication Plugin API
-------------------------
The authentication plugin API is extensively documented in the [source code](../getting-the-mariadb-source-code/index) in the following files:
* `mysql/plugin_auth.h` (server part)
* `mysql/client_plugin.h` (client part)
* `mysql/plugin_auth_common.h` (common parts)
The MariaDB [source code](../getting-the-mariadb-source-code/index) also contains some authentication plugins that are intended explicitly to be examples for developers. They are located in `plugin/auth_examples`.
The definitions of two example authentication plugins called `two_questions` and `three_attempts` can be seen in `plugin/auth_examples/dialog_examples.c`. These authentication plugins demonstrate how to communicate with the user using the [dialog](../authentication-plugin-pam/index#dialog) client authentication plugin.
The `two_questions` authentication plugin asks the user for a password and a confirmation ("Are you sure?").
The `three_attempts` authentication plugin gives the user three attempts to enter a correct password.
The password for both of these plugins should be specified in the plain text in the `USING` clause:
```
CREATE USER insecure IDENTIFIED VIA two_questions USING 'notverysecret';
```
### Dialog Client Authentication Plugin - Client Library Extension
The [dialog](../authentication-plugin-pam/index#dialog) client authentication plugin, strictly speaking, is not part of the client-server or authentication plugin API. But it can be loaded into any client application that uses the `libmysqlclient` or [MariaDB Connector/C](../mariadb-connector-c/index) libraries. This authentication plugin provides a way for the application to customize the UI of the dialog function.
In order to use the [dialog](../authentication-plugin-pam/index#dialog) client authentication plugin to communicate with the user in a customized way, the application will need to implement a function with the following signature:
```
extern "C" char *mysql_authentication_dialog_ask(
MYSQL *mysql, int type, const char *prompt, char *buf, int buf_len)
```
The function takes the following arguments:
* The connection handle.
* A question "type", which has one of the following values:
+ `1` - Normal question
+ `2` - Password (no echo)
* A prompt.
* A buffer.
* The length of the buffer.
The function returns a pointer to a string of characters, as entered by the user. It may be stored in `buf` or allocated with `malloc()`.
Using this function a GUI application can pop up a dialog window, a network application can send the question over the network, as required. If no `mysql_authentication_dialog_ask` function is provided by the application, the [dialog](../authentication-plugin-pam/index#dialog) client authentication plugin falls back to [fputs()](https://linux.die.net/man/3/fputs) and [fgets()](https://linux.die.net/man/3/fgets).
Providing this callback is particularly important on Windows, because Windows GUI applications have no associated console and the default dialog function will not be able to reach the user. An example of Windows GUI client that does it correctly is [HeidiSQL](../heidisql/index).
See Also
--------
* [GRANT](../grant/index)
* [CREATE USER](../create-user/index)
* [ALTER USER](../alter-user/index)
* [Authentication from MariaDB 10.4](../authentication-from-mariadb-104/index)
* [Who are you? The history of MySQL and MariaDB authentication protocols from 1997 to 2017](https://mariadb.org/history-of-mysql-mariadb-authentication-protocols/)
* [MySQL 5.6 Reference Manual: Pluggable Authentication](https://dev.mysql.com/doc/refman/5.6/en/pluggable-authentication.html)
* [MySQL 5.6 Reference Manual: Writing Authentication Plugins](http://dev.mysql.com/doc/refman/5.6/en/writing-authentication-plugins.html)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Plans for MariaDB 10.4 Plans for MariaDB 10.4
======================
"[What is MariaDB 10.4](../what-is-mariadb-104/index)" shows all features already implemented for 10.4.
[MariaDB 10.4](../what-is-mariadb-104/index) is stable, so no new features will be added to 10.4. See [Plans for MariaDB 10.5](../plans-for-mariadb-105/index) instead.
Planning for 10.4 began at the 2017 MariaDB Developer's Unconference in Shenzhen, and further discussions were held at the 2018 Developers Unconference in New York. The features below were considered for inclusion in [MariaDB 10.4](../what-is-mariadb-104/index).
Very Likely
-----------
### Better Security
* Automatic DOS attacks detection - MariaDB Corporation
* Automatic password crack detection - MariaDB Corporation
* Encryption on client side - MariaDB Corporation
* Password expiration - MariaDB Foundation
* Multiple authentication plugins per user - MariaDB Foundation
* Socket authentication by default ([MDEV-12484](https://jira.mariadb.org/browse/MDEV-12484)) - MariaDB Foundation
* Encryption plugin (Tencent Cloud)
* Column encryption (Tencent Cloud)
### Compatibility
* Oracle stage 2 ([MDEV-10872](https://jira.mariadb.org/browse/MDEV-10872))
* CONNECT BY - Alibaba Cloud, MariaDB Corporation & MariaDB Foundation
* MSSQL (?)
### Spider
* Spider (10.4 patches) - Kentoku & MariaDB Corporation
* Tencent Spider patches (10 patches)
* Vertical partitioning - Kentoku
### Distributed Storage Engine (stage 1 of 4)
* Write scaling
* Planning to be done in November-December
### InnoDB
* Instant drop column etc. ([MDEV-15562](https://jira.mariadb.org/browse/MDEV-15562)) - MariaDB Corporation
* Better redo log ([MDEV-14425](https://jira.mariadb.org/browse/MDEV-14425)) - MariaDB Corporation & Tencent Cloud
### Performance
* Micro optimization ([MDEV-7941](https://jira.mariadb.org/browse/MDEV-7941)) - MariaDB Foundation (Svoj)
* Scalability issues - MariaDB Foundation (Svoj) & IBM
* Moving blocks without using any L? cache (Svoj and Monty)
* [MDEV-7487](https://jira.mariadb.org/browse/MDEV-7487) - semi-join optimisations - (MariaDB Corporation)
* Aggregation on the server (Tencent Cloud)
* GROUP INSERT (Alibaba Cloud)
### Re-Entrant Items
* Building block for parallel query and be able to share stored procedures between threads (Stored procedure cache)
* Reading and updating my.cnf from server - MariaDB Corporation
### Other
* Galera 4 - Codership
* MySQL syntax for multi source (CHANNEL) - Alibaba Cloud
* Updates to MyRocks - MariaDB Corporation & Facebook
* Reverse privileges - MariaDB Foundation
* BLOB & optimized VARCHAR for memory tables - MariaDB Corporation (Greatly reduces memory for internal temporary tables)
Rolling Features
----------------
### Backup
* Backup from the server through storage engine API, patch for mariabackup (MariaDB Corporation and Alibaba)
### Columnstore
* Columnstore integration (MariaDB Corporation)
### Replication
* GTID in OK Packet ([MDEV-11956](https://jira.mariadb.org/browse/MDEV-11956)) - MariaDB Corporation
### Optimizer
* Better ORDER BY LIMIT Optimization ([MDEV-8306](https://jira.mariadb.org/browse/MDEV-8306)) - MariaDB Corporation
* Optimizer trace ([MDEV-6111](https://jira.mariadb.org/browse/MDEV-6111)) - MariaDB Corporation
* Better histograms ([MDEV-12313](https://jira.mariadb.org/browse/MDEV-12313)) - [Google Summer of Code project](../google-summer-of-code-2018/index)
* Prefiltering - MariaDB Corporation (Igor)
* Better telemetry ???
* Improve single-thread CPU performance ???
### Other
* Virtual host in protocol - Microsoft(?)
* Index on expression - MariaDB Corporation
* Pattern matching for keys
* Downscaling memory on demand/request - MariaDB Corporation (?)
+ Closing not used connections
+ Reducing buffer-pool and key caches
+ Flush all internal caches
* Parallel replication of one table - Tencent Cloud
+ Depending on benchmark results
* TIMESTAMP with timezone support ([MDEV-7928](https://jira.mariadb.org/browse/MDEV-7928)) - Seth(?)
* Implement all window function features - [MDEV-12987](https://jira.mariadb.org/browse/MDEV-12987), [MDEV-6115](https://jira.mariadb.org/browse/MDEV-6115)
* Remove the need to use comments for configuration (MariaDB Corporation)
* Remotely provision slaves (?)
Other Activities Overlapping with 10.4 Release
----------------------------------------------
* Allow community builds - MariaDB Foundation (Vicentiu)
* Docker - MariaDB Foundation (Vicentiu)
* Staging trees - MariaDB Foundation (Vicentiu)
* Python Connector - MariaDB Foundation (Vicentiu)
* Query characteristics being returned to Connector (MariaDB Corporation)
* Reduce the number of open MDEVs (?)
JIRA
----
We manage our development plans in JIRA, so the definitive list will be there. [This search](https://jira.mariadb.org/issues/?jql=project+%3D+MDEV+AND+issuetype+%3D+Task+AND+fixVersion+in+%2810.4%29+ORDER+BY+priority+DESC) shows what we **currently** plan for 10.4. It shows all tasks with the **Fix-Version** being 10.4. Not all these tasks will really end up in 10.4, but tasks with the "red" priorities have a much higher chance of being done in time for 10.4. Practically, you can think of these tasks as "features that **will** be in 10.4". Tasks with the "green" priorities probably won't be in 10.4. Think of them as "bonus features that would be **nice to have** in 10.4".
See Also
--------
* [Current tasks for 10.4](https://jira.mariadb.org/issues/?jql=project%20%3D%20MDEV%20AND%20issuetype%20%3D%20Task%20AND%20fixVersion%20in%20(10.4)%20ORDER%20BY%20priority%20DESC)
* [10.4 Features/fixes by vote](https://jira.mariadb.org/issues/?jql=project%20%3D%20MDEV%20AND%20issuetype%20%3D%20Task%20AND%20fixVersion%20in%20(10.4)%20ORDER%20BY%20votes%20DESC%2C%20priority%20DESC)
* [What is MariaDB 10.4?](../what-is-mariadb-104/index)
* [What is MariaDB 10.3?](../what-is-mariadb-103/index)
* [What is MariaDB 10.2?](../what-is-mariadb-102/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Debugging MariaDB Debugging MariaDB
==================
This section is for articles on debugging MariaDB.
| Title | Description |
| --- | --- |
| [Compiling MariaDB for Debugging](../compiling-mariadb-for-debugging/index) | Passing -DCMAKE\_BUILD\_TYPE=Debug to cmake to compile with debug information. |
| [Compile and Using MariaDB with Sanitizers (ASAN, UBSAN, TSAN, MSAN)](../compile-and-using-mariadb-with-sanitizers-asan-ubsan-tsan-msan/index) | How to compile and use MariaDB with AddressSanitizer (ASAN). |
| [Limitations/Differences with a MariaDB Server Compiled for Debugging](../limitationsdifferences-with-a-mariadb-server-compiled-for-debugging/index) | Differences in servers using the --with-debug=full option |
| [Debugging MariaDB With a Debugger](../debugging-mariadb-with-a-debugger/index) | If MariaDB is compiled for debugging, you can both use it in a debugger, an... |
| [Debugging a Running Server (on Linux)](../debugging-a-running-server-on-linux/index) | Debugging a production server on Linux. |
| [Creating a Trace File](../creating-a-trace-file/index) | Creating a trace file is a good way to find mysqld crashing issues. |
| [How to Produce a Full Stack Trace for mysqld](../how-to-produce-a-full-stack-trace-for-mysqld/index) | Producing a full stack trace and core file for mysqld on Unix. |
| [How to Use procmon to Trace mysqld.exe Filesystem Access](../how-to-use-procmon-to-trace-mysqldexe-filesystem-access/index) | Walkthrough on using the Process Monitor on Windows |
| [MariaDB Community Bug Reporting](../mariadb-community-bug-reporting/index) | Guidelines for reporting bugs in MariaDB software. |
| [MariaDB Security Bug Fixing Policy](../mariadb-security-bug-fixing-policy/index) | Bug fixing policy and how security issues are handled. |
| [Enabling Core Dumps](../enabling-core-dumps/index) | Steps to enable core dumps. |
| [Debugging Memory Usage](../debugging-memory-usage/index) | How to debug MariaDB's memory usage. |
| [Optimizer Debugging With GDB](../optimizer-debugging-with-gdb/index) | Useful things for debugging optimizer code with gdb. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb COLUMN_LIST COLUMN\_LIST
============
Syntax
------
```
COLUMN_LIST(dyncol_blob);
```
Description
-----------
Returns a comma-separated list of column names. The names are quoted with backticks.
See [dynamic columns](../dynamic-columns/index) for more information.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mycli mycli
=====
**mycli** is a command line interface for MariaDB, MySQL, and Percona with auto-completion and syntax highlighting.
It is written in Python, and runs on Linux, Mac and Windows.
Read more at <http://mycli.net>.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SPIDER_BG_DIRECT_SQL SPIDER\_BG\_DIRECT\_SQL
=======================
Syntax
------
```
SPIDER_BG_DIRECT_SQL('sql', 'tmp_table_list', 'parameters')
```
Description
-----------
Executes the given SQL statement in the background on the remote server, as defined in the parameters listing. If the query returns a result-set, it sttores the results in the given temporary table. When the given SQL statement executes successfully, this function returns the number of called UDF's. It returns `0` when the given SQL statement fails.
This function is a [UDF](../user-defined-functions/index) installed with the [Spider](../spider/index) storage engine.
Examples
--------
```
SELECT SPIDER_BG_DIRECT_SQL('SELECT * FROM example_table', '',
'srv "node1", port "8607"') AS "Direct Query";
+--------------+
| Direct Query |
+--------------+
| 1 |
+--------------+
```
Parameters
----------
#### `error_rw_mode`
* **Description:** Returns empty results on network error.
+ `0` : Return error on getting network error.
+ `1`: Return 0 records on getting network error.
* **Default Table Value:** `0`
* **DSN Parameter Name:** `erwm`
See also
--------
* [SPIDER\_DIRECT\_SQL](../spider_direct_sql/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Enabling InnoDB Encryption Enabling InnoDB Encryption
==========================
In order to enable data-at-rest encryption for tables using the InnoDB storage engines, you first need to configure the Server to use an [Encryption Key Management](../encryption-key-management/index) plugin. Once this is done, you can enable encryption by setting the [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) system variable to encrypt the InnoDB [system](../innodb-system-tablespaces/index) and [file](../innodb-file-per-table-tablespaces/index) tablespaces and setting the [innodb\_encrypt\_log](../innodb-system-variables/index#innodb_encrypt_log) system variable to encrypt the InnoDB [Redo Log](../innodb-redo-log/index).
Setting these system variables enables the encryption feature for InnoDB tables on your server. To use the feature, you need to use the [ENCRYPTION\_KEY\_ID](../create-table/index#encryption_key_id) table option to set what encryption key you want to use and set the [ENCRYPTED](../create-table/index#encrypted) table option to enable encryption.
When encrypting any InnoDB tables, the best practice is also enable encryption for the Redo Log. If you have encrypted InnoDB tables and have not encrypted the Redo Log, data written to an encrypted table may be found unencrypted in the Redo Log.
### Enabling Encryption for Automatically Encrypted Tablespaces
The [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) system variable controls the configuration of automatic encryption of InnoDB tables. It has the following possible values:
| Option | Description |
| --- | --- |
| `OFF` | Disables table encryption. |
| `ON` | Enables table encryption, but allows unencrypted tables to be created. |
| `FORCE` | Enables table encryption, and doesn't allow unencrypted tables to be created. Added in [MariaDB 10.1.4](https://mariadb.com/kb/en/mariadb-1014-release-notes/). |
When [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) is set to `ON`, InnoDB tables are automatically encrypted by default. For example, the following statements create an encrypted table and confirm that it is encrypted:
```
SET GLOBAL innodb_encryption_threads=4;
SET GLOBAL innodb_encrypt_tables=ON;
SET SESSION innodb_default_encryption_key_id=100;
CREATE TABLE tab1 (
id int PRIMARY KEY,
str varchar(50)
);
SELECT NAME, ENCRYPTION_SCHEME, CURRENT_KEY_ID
FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME='db1/tab1';
+----------+-------------------+----------------+
| NAME | ENCRYPTION_SCHEME | CURRENT_KEY_ID |
+----------+-------------------+----------------+
| db1/tab1 | 1 | 100 |
+----------+-------------------+----------------+
```
When [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) is set to `ON`, an unencrypted InnoDB table can be created by setting the [ENCRYPTED](../create-table/index#encrypted) table option to `NO` for the table. For example, the following statements create an unencrypted table and confirm that it is not encrypted:
```
SET GLOBAL innodb_encryption_threads=4;
SET GLOBAL innodb_encrypt_tables=ON;
SET SESSION innodb_default_encryption_key_id=100;
CREATE TABLE tab1 (
id int PRIMARY KEY,
str varchar(50)
) ENCRYPTED=NO;
SELECT NAME, ENCRYPTION_SCHEME, CURRENT_KEY_ID
FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME='db1/tab1';
+----------+-------------------+----------------+
| NAME | ENCRYPTION_SCHEME | CURRENT_KEY_ID |
+----------+-------------------+----------------+
| db1/tab1 | 0 | 100 |
+----------+-------------------+----------------+
```
When [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) is set to `FORCE`, InnoDB tables are automatically encrypted by default, and unencrypted InnoDB tables can **not** be created. In this scenario, if you set the [ENCRYPTED](../create-table/index#encrypted) table option to `NO` for a table, then you will encounter an error. For example:
```
SET GLOBAL innodb_encryption_threads=4;
SET GLOBAL innodb_encrypt_tables='FORCE';
SET SESSION innodb_default_encryption_key_id=100;
CREATE TABLE tab1 (
id int PRIMARY KEY,
str varchar(50)
) ENCRYPTED=NO;
ERROR 1005 (HY000): Can't create table `db1`.`tab1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+----------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------------------+
| Warning | 140 | InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 |
| Warning | 140 | InnoDB: ENCRYPTED=NO cannot be used with innodb_encrypt_tables=FORCE |
| Error | 1005 | Can't create table `db1`.`tab1` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+----------------------------------------------------------------------+
4 rows in set (0.00 sec)
```
When [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) is set to `ON` or `FORCE`, then you must ensure that [innodb\_encryption\_threads](../innodb-system-variables/index#innodb_encryption_threads) is set to a non-zero value, so that InnoDB can perform any necessary encryption operations in the background. See [background operations](../innodb-background-encryption-threads/index#background-operations) for more information about that. [innodb\_encryption\_rotate\_key\_age](../innodb-system-variables/index#innodb_encryption_rotate_key_age) must also be set to a non-zero value for the initial encryption operations to happen in the background. See [disabling key rotations](../innodb-background-encryption-threads/index#disabling-background-key-rotation-operations) for more information about that.
### Enabling Encryption for Manually Encrypted Tablespaces
If you do not want to automatically encrypt every InnoDB table, then it is possible to manually enable encryption for just the subset of InnoDB tables that you would like to encrypt. MariaDB provides the [ENCRYPTED](../create-table/index#encrypted) and [ENCRYPTION\_KEY\_ID](../create-table/index#encryption_key_id) table options that can be used to manually enable encryption for specific InnoDB tables. These table options can be used with [CREATE TABLE](../create-table/index) and [ALTER TABLE](../alter-table/index) statements. These table options can only be used with InnoDB tables that have their own [InnoDB's file-per-table tablespaces](../innodb-file-per-table-tablespaces/index), meaning that tables that were created with [innodb\_file\_per\_table=ON](../innodb-system-variables/index#innodb_file_per_table) set.
| Table Option | Value | Description |
| --- | --- | --- |
| `ENCRYPTED` | Boolean | Defines whether to encrypt the table |
| `ENCRYPTION_KEY_ID` | 32-bit integer | Defines the identifier for the encryption key to use |
You can manually enable or disable encryption for a table by using the [ENCRYPTED](../create-table/index#encrypted) table option. If you only need to protect a subset of InnoDB tables with encryption, then it can be a good idea to manually encrypt each table that needs the extra protection, rather than encrypting all InnoDB tables globally with [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables). This allows you to balance security with speed, as it means the encryption and decryption performance overhead only applies to those tables that require the additional security.
If a manually encrypted InnoDB table contains a [FULLTEXT INDEX](../full-text-indexes/index), then the internal table for the full-text index will not also be manually encrypted. To encrypt internal tables for InnoDB full-text indexes, you must [enable automatic InnoDB encryption](#enabling-encryption-for-automatically-encrypted-tablespaces) by setting [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) to `ON` or `FORCE`.
You can also manually specify a [encryption key](../encrypting-data-for-innodb-xtradb/index#encryption-keys) for a table by using the [ENCRYPTION\_KEY\_ID](../create-table/index#encryption_key_id) table option. This allows you to use different encryption keys for different tables. For example, you might create a table using a statement like this:
```
CREATE TABLE tab1 (
id int PRIMARY KEY,
str varchar(50)
) ENCRYPTED=YES ENCRYPTION_KEY_ID=100;
SELECT NAME, ENCRYPTION_SCHEME, CURRENT_KEY_ID
FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME='db1/tab1';
+----------+-------------------+----------------+
| NAME | ENCRYPTION_SCHEME | CURRENT_KEY_ID |
+----------+-------------------+----------------+
| db1/tab1 | 1 | 100 |
+----------+-------------------+----------------+
```
If the [ENCRYPTION\_KEY\_ID](../create-table/index#encryption_key_id) table option is not specified, then the table will be encrypted with the key identified by the [innodb\_default\_encryption\_key\_id](../innodb-system-variables/index#innodb_default_encryption_key_id) system variable. For example, you might create a table using a statement like this:
```
SET SESSION innodb_default_encryption_key_id=100;
CREATE TABLE tab1 (
id int PRIMARY KEY,
str varchar(50)
) ENCRYPTED=YES;
SELECT NAME, ENCRYPTION_SCHEME, CURRENT_KEY_ID
FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME='db1/tab1';
+----------+-------------------+----------------+
| NAME | ENCRYPTION_SCHEME | CURRENT_KEY_ID |
+----------+-------------------+----------------+
| db1/tab1 | 1 | 100 |
+----------+-------------------+----------------+
```
In the event that you have an existing table and you want to manually enable encryption for that table, then you can do the same with an [ALTER TABLE](../alter-table/index) statement. For example:
```
CREATE TABLE tab1 (
id int PRIMARY KEY,
str varchar(50)
) ENCRYPTED=NO;
SELECT NAME, ENCRYPTION_SCHEME, CURRENT_KEY_ID
FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME='db1/tab1';
+----------+-------------------+----------------+
| NAME | ENCRYPTION_SCHEME | CURRENT_KEY_ID |
+----------+-------------------+----------------+
| db1/tab1 | 0 | 100 |
+----------+-------------------+----------------+
ALTER TABLE tab1
ENCRYPTED=YES ENCRYPTION_KEY_ID=100;
SELECT NAME, ENCRYPTION_SCHEME, CURRENT_KEY_ID
FROM information_schema.INNODB_TABLESPACES_ENCRYPTION
WHERE NAME='db1/tab1';
+----------+-------------------+----------------+
| NAME | ENCRYPTION_SCHEME | CURRENT_KEY_ID |
+----------+-------------------+----------------+
| db1/tab1 | 1 | 100 |
+----------+-------------------+----------------+
```
InnoDB does not permit manual encryption changes to tables in the [system](../innodb-system-tablespaces/index) tablespace using [ALTER TABLE](../alter-table/index). Encryption of the [system](../innodb-system-tablespaces/index) tablespace can only be configured by setting the value of the [innodb\_encrypt\_tables](../innodb-system-variables/index#innodb_encrypt_tables) system variable. This means that when you want to encrypt or decrypt the [system](../innodb-system-tablespaces/index) tablespace, you must also set a non-zero value for the [innodb\_encryption\_threads](../innodb-system-variables/index#innodb_encryption_threads) system variable, and you must also set the [innodb\_system\_rotate\_key\_age](../innodb-system-variables/index#innodb_encryption_rotate_key_age) system variable to `1` to ensure that the system tablespace is properly encrypted or decrypted by the background threads. See [MDEV-14398](https://jira.mariadb.org/browse/MDEV-14398) for more information.
### Enabling Encryption for Temporary Tablespaces
The [innodb\_encrypt\_temporary\_tables](../innodb-system-variables/index#innodb_encrypt_temporary_tables) system variable controls the configuration of encryption for the [temporary tablespace](../innodb-temporary-tablespaces/index). It has the following possible values:
| Option | Description |
| --- | --- |
| `OFF` | Disables temporary table encryption. |
| `ON` | Enables temporary table encryption. |
This system variable can be specified as a command-line argument to [mysqld](../mysqld-options/index) or it can be specified in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
innodb_encrypt_temporary_tables=ON
```
### Enabling Encryption for the Redo Log
InnoDB uses the [Redo Log](../innodb-redo-log/index) in crash recovery. By default, these events are written to file in an unencrypted state. In configuring MariaDB for data-at-rest encryption, ensure that you also enable encryption for the Redo Log.
To encrypt the Redo Log, first [stop](../starting-and-stopping-mariadb-automatically/index) the server process. Then, set the [innodb\_encrypt\_log](../innodb-system-variables/index#innodb_encrypt_log) to `ON` in a relevant server [option group](../configuring-mariadb-with-option-files/index#option-groups) in an [option file](../configuring-mariadb-with-option-files/index). For example:
```
[mariadb]
...
innodb_encrypt_log = ON
```
Then, start MariaDB. When the server starts back up, it checks to recover InnoDB in the event of a crash. Once it is back online, it begins writing encrypted data to the Redo Log.
In [MariaDB 10.3](../what-is-mariadb-103/index) and before, InnoDB does not support key rotation for the Redo Log. Key rotation for the Redo Log is supported in [MariaDB 10.4](../what-is-mariadb-104/index) and later. See [InnoDB Encryption Keys: Key Rotation](../innodb-xtradb-encryption-keys/index#key-rotation) for more information.
### See Also
* [Disabling InnoDB encryption](../disabling-innodb-encryption/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Buildbot Setup Buildbot Setup
===============
| Title | Description |
| --- | --- |
| [Buildbot Setup Notes](../buildbot-setup-buildbot-setup-notes/index) | Setting up Buildbot |
| [How do I setup a Buildbot build slave?](../how-do-i-setup-a-buildbot-build-slave/index) | These build instructions should in general be platform agnostic. It is base... |
| [Buildbot Setup for VM host](../buildbot-setup-for-vm-host/index) | This page documents the general setup process for a server that is acting a... |
| [Buildbot Setup for Virtual Machines](../buildbot-setup-for-virtual-machines/index) | This section documents the exact steps used to set up each virtual machine ... |
| [Buildbot Setup for MacOSX](../buildbot-setup-buildbot-setup-for-macosx/index) | Setting up a Buildbot slave on Mac OS X |
| [Buildbot Setup for Solaris Sparc](../buildbot-setup-for-solaris-sparc/index) | Setting up a BuildBot slave on Solaris NOTE #1: It would probably make se... |
| [Buildbot Setup for Solaris x86](../buildbot-setup-for-solaris-x86/index) | The following steps were used to create a Solaris 10 x86 BuildSlave. I star... |
| [Buildbot Setup for Ubuntu-Debian](../buildbot-setup-for-ubuntu-debian/index) | Instructions for setting up a buildbot slave on Ubuntu and Debian |
| [Buildbot Setup for Windows](../buildbot-setup-buildbot-setup-for-windows/index) | Recipe for setting up a MariaDB Buildbot slave on Windows |
| [Buildbot Setup for BSD](../buildbot-setup-for-bsd/index) | Here are the steps I did when installing and configuring a buildbot slave o... |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Operating System Error Codes Operating System Error Codes
============================
Below is a partial list of more common Linux and Windows operating system error codes.
Linux Error Codes
-----------------
The [perror](../perror/index) tool can be used to find the error message which is associated with a given error code.
| Number | Error Code | Description |
| --- | --- | --- |
| 1 | EPERM | Operation not permitted |
| 2 | ENOENT | No such file or directory |
| 3 | ESRCH | No such process |
| 4 | EINTR | Interrupted system call |
| 5 | EIO | I/O error |
| 6 | ENXIO | No such device or address |
| 7 | E2BIG | Argument list too long |
| 8 | ENOEXEC | Exec format error |
| 9 | EBADF | Bad file number |
| 10 | ECHILD | No child processes |
| 11 | EAGAIN | Try again |
| 12 | ENOMEM | Out of memory |
| 13 | EACCES | Permission denied |
| 14 | EFAULT | Bad address |
| 15 | ENOTBLK | Block device required |
| 16 | EBUSY | Device or resource busy |
| 17 | EEXIST | File exists |
| 18 | EXDEV | Cross-device link |
| 19 | ENODEV | No such device |
| 20 | ENOTDIR | Not a directory |
| 21 | EISDIR | Is a directory |
| 22 | EINVAL | Invalid argument |
| 23 | ENFILE | File table overflow |
| 24 | EMFILE | Too many open files |
| 25 | ENOTTY | Not a typewriter |
| 26 | ETXTBSY | Text file busy |
| 27 | EFBIG | File too large |
| 28 | ENOSPC | No space left on device |
| 29 | ESPIPE | Illegal seek |
| 30 | EROFS | Read-only file system |
| 31 | EMLINK | Too many links |
| 32 | EPIPE | Broken pipe |
| 33 | EDOM | Math argument out of domain of func |
| 34 | ERANGE | Math result not representable |
| 35 | EDEADLK | Resource deadlock would occur |
| 36 | ENAMETOOLONG | File name too long |
| 37 | ENOLCK | No record locks available |
| 38 | ENOSYS | Function not implemented |
| 39 | ENOTEMPTY | Directory not empty |
| 40 | ELOOP | Too many symbolic links encountered |
| 42 | ENOMSG | No message of desired type |
| 43 | EIDRM | Identifier removed |
| 44 | ECHRNG | Channel number out of range |
| 45 | EL2NSYNC | Level 2 not synchronized |
| 46 | EL3HLT | Level 3 halted |
| 47 | EL3RST | Level 3 reset |
| 48 | ELNRNG | Link number out of range |
| 49 | EUNATCH | Protocol driver not attached |
| 50 | ENOCSI | No CSI structure available |
| 51 | EL2HLT | Level 2 halted |
| 52 | EBADE | Invalid exchange |
| 53 | EBADR | Invalid request descriptor |
| 54 | EXFULL | Exchange full |
| 55 | ENOANO | No anode |
| 56 | EBADRQC | Invalid request code |
| 57 | EBADSLT | Invalid slot |
| 59 | EBFONT | Bad font file format |
| 60 | ENOSTR | Device not a stream |
| 61 | ENODATA | No data available |
| 62 | ETIME | Timer expired |
| 63 | ENOSR | Out of streams resources |
| 64 | ENONET | Machine is not on the network |
| 65 | ENOPKG | Package not installed |
| 66 | EREMOTE | Object is remote |
| 67 | ENOLINK | Link has been severed |
| 68 | EADV | Advertise error |
| 69 | ESRMNT | Srmount error |
| 70 | ECOMM | Communication error on send |
| 71 | EPROTO | Protocol error |
| 72 | EMULTIHOP | Multihop attempted |
| 73 | EDOTDOT | RFS specific error |
| 74 | EBADMSG | Not a data message |
| 75 | EOVERFLOW | Value too large for defined data type |
| 76 | ENOTUNIQ | Name not unique on network |
| 77 | EBADFD | File descriptor in bad state |
| 78 | EREMCHG | Remote address changed |
| 79 | ELIBACC | Can not access a needed shared library |
| 80 | ELIBBAD | Accessing a corrupted shared library |
| 81 | ELIBSCN | .lib section in a.out corrupted |
| 82 | ELIBMAX | Attempting to link in too many shared libraries |
| 83 | ELIBEXEC | Cannot exec a shared library directly |
| 84 | EILSEQ | Illegal byte sequence |
| 85 | ERESTART | Interrupted system call should be restarted |
| 86 | ESTRPIPE | Streams pipe error |
| 87 | EUSERS | Too many users |
| 88 | ENOTSOCK | Socket operation on non-socket |
| 89 | EDESTADDRREQ | Destination address required |
| 90 | EMSGSIZE | Message too long |
| 91 | EPROTOTYPE | Protocol wrong type for socket |
| 92 | ENOPROTOOPT | Protocol not available |
| 93 | EPROTONOSUPPORT | Protocol not supported |
| 94 | ESOCKTNOSUPPORT | Socket type not supported |
| 95 | EOPNOTSUPP | Operation not supported on transport endpoint |
| 96 | EPFNOSUPPORT | Protocol family not supported |
| 97 | EAFNOSUPPORT | Address family not supported by protocol |
| 98 | EADDRINUSE | Address already in use |
| 99 | EADDRNOTAVAIL | Cannot assign requested address |
| 100 | ENETDOWN | Network is down |
| 101 | ENETUNREACH | Network is unreachable |
| 102 | ENETRESET | Network dropped connection because of reset |
| 103 | ECONNABORTED | Software caused connection abort |
| 104 | ECONNRESET | Connection reset by peer |
| 105 | ENOBUFS | No buffer space available |
| 106 | EISCONN | Transport endpoint is already connected |
| 107 | ENOTCONN | Transport endpoint is not connected |
| 108 | ESHUTDOWN | Cannot send after transport endpoint shutdown |
| 109 | ETOOMANYREFS | Too many references: cannot splice |
| 110 | ETIMEDOUT | Connection timed out |
| 111 | ECONNREFUSED | Connection refused |
| 112 | EHOSTDOWN | Host is down |
| 113 | EHOSTUNREACH | No route to host |
| 114 | EALREADY | Operation already in progress |
| 115 | EINPROGRESS | Operation now in progress |
| 116 | ESTALE | Stale NFS file handle |
| 117 | EUCLEAN | Structure needs cleaning |
| 118 | ENOTNAM | Not a XENIX named type file |
| 119 | ENAVAIL | No XENIX semaphores available |
| 120 | EISNAM | Is a named type file |
| 121 | EREMOTEIO | Remote I/O error |
| 122 | EDQUOT | Quota exceeded |
| 123 | ENOMEDIUM | No medium found |
| 124 | EMEDIUMTYPE | Wrong medium type |
| 125 | ECANCELED | Operation Canceled |
| 126 | ENOKEY | Required key not available |
| 127 | EKEYEXPIRED | Key has expired |
| 128 | EKEYREVOKED | Key has been revoked |
| 129 | EKEYREJECTED | Key was rejected by service |
| 130 | EOWNERDEAD | Owner died |
| 131 | ENOTRECOVERABLE | State not recoverable |
Windows Error Codes
-------------------
For a complete list, see <https://msdn.microsoft.com/en-us/library/ms681381.aspx>
| Number | Error Code | Description |
| --- | --- | --- |
| 1 | ERROR\_INVALID\_FUNCTION | Incorrect function. |
| 2 | ERROR\_FILE\_NOT\_FOUND | The system cannot find the file specified. |
| 3 | ERROR\_PATH\_NOT\_FOUND | The system cannot find the path specified. |
| 4 | ERROR\_TOO\_MANY\_OPEN\_FILES | The system cannot open the file. |
| 5 | ERROR\_ACCESS\_DENIED | Access is denied. |
| 6 | ERROR\_INVALID\_HANDLE | The handle is invalid. |
| 7 | ERROR\_ARENA\_TRASHED | The storage control blocks were destroyed. |
| 8 | ERROR\_NOT\_ENOUGH\_MEMORY | Not enough storage is available to process this command. |
| 9 | ERROR\_INVALID\_BLOCK | The storage control block address is invalid. |
| 10 | ERROR\_BAD\_ENVIRONMENT | The environment is incorrect. |
| 11 | ERROR\_BAD\_FORMAT | An attempt was made to load a program with an incorrect format. |
| 12 | ERROR\_INVALID\_ACCESS | The access code is invalid. |
| 13 | ERROR\_INVALID\_DATA | The data is invalid. |
| 14 | ERROR\_OUTOFMEMORY | Not enough storage is available to complete this operation. |
| 15 | ERROR\_INVALID\_DRIVE | The system cannot find the drive specified. |
| 16 | ERROR\_CURRENT\_DIRECTORY | The directory cannot be removed. |
| 17 | ERROR\_NOT\_SAME\_DEVICE | The system cannot move the file to a different disk drive. |
| 18 | ERROR\_NO\_MORE\_FILES | There are no more files. |
| 19 | ERROR\_WRITE\_PROTECT | The media is write protected. |
| 20 | ERROR\_BAD\_UNIT | The system cannot find the device specified. |
| 21 | ERROR\_NOT\_READY | The device is not ready. |
| 22 | ERROR\_BAD\_COMMAND | The device does not recognize the command. |
| 23 | ERROR\_CRC | Data error (cyclic redundancy check). |
| 24 | ERROR\_BAD\_LENGTH | The program issued a command but the command length is incorrect. |
| 25 | ERROR\_SEEK | The drive cannot locate a specific area or track on the disk. |
| 26 | ERROR\_NOT\_DOS\_DISK | The specified disk or diskette cannot be accessed. |
| 27 | ERROR\_SECTOR\_NOT\_FOUND | The drive cannot find the sector requested. |
| 28 | ERROR\_OUT\_OF\_PAPER | The printer is out of paper. |
| 29 | ERROR\_WRITE\_FAULT | The system cannot write to the specified device. |
| 30 | ERROR\_READ\_FAULT | The system cannot read from the specified device. |
| 31 | ERROR\_GEN\_FAILURE | A device attached to the system is not functioning. |
| 32 | ERROR\_SHARING\_VIOLATION | The process cannot access the file because it is being used by another process. |
| 33 | ERROR\_LOCK\_VIOLATION | The process cannot access the file because another process has locked a portion of the file. |
| 34 | ERROR\_WRONG\_DISK | The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1. |
| 36 | ERROR\_SHARING\_BUFFER\_EXCEEDED | Too many files opened for sharing. |
| 38 | ERROR\_HANDLE\_EOF | Reached the end of the file. |
| 39 | ERROR\_HANDLE\_DISK\_FULL | The disk is full. |
| 87 | ERROR\_INVALID\_PARAMETER | The parameter is incorrect. |
| 112 | ERROR\_DISK\_FULL | The disk is full. |
| 123 | ERROR\_INVALID\_NAME | The file name, directory name, or volume label syntax is incorrect. |
| 1450 | ERROR\_NO\_SYSTEM\_RESOURCES | Insufficient system resources exist to complete the requested service. |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Information Schema ROCKSDB_DDL Table Information Schema ROCKSDB\_DDL Table
=====================================
The [Information Schema](../information_schema/index) `ROCKSDB_DDL` table is included as part of the [MyRocks](../myrocks/index) storage engine.
The `PROCESS` [privilege](../grant/index) is required to view the table.
It contains the following columns:
| Column | Description |
| --- | --- |
| `TABLE_SCHEMA` | |
| `TABLE_NAME` | |
| `PARTITION_NAME` | |
| `INDEX_NAME` | |
| `COLUMN_FAMILY` | |
| `INDEX_NUMBER` | |
| `INDEX_TYPE` | |
| `KV_FORMAT_VERSION` | |
| `TTL_DURATION` | |
| `INDEX_FLAGS` | |
| `CF` | |
| `AUTO_INCREMENT` | |
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Troubleshooting MariaDB Installs on Red Hat/CentOS Troubleshooting MariaDB Installs on Red Hat/CentOS
==================================================
The following article is about different issues people have encountered when installing MariaDB on Red Hat / CentOS.
It is highly recommended to [install with yum](../yum/index) where possible.
In Red Hat / CentOS it is also possible to install a [RPM](http://downloads.askmonty.org/mariadb/) or a [tar ball](../installing-mariadb-binary-tarballs/index). The RPM is the preferred version, except if you want to install many versions of MariaDB or install MariaDB in a non standard location.
### Replacing MySQL
If you removed an MySQL RPM to install MariaDB, note that the MySQL RPM on uninstall renames /etc/my.cnf to /etc/my.cnf.rpmsave.
After installing MariaDB you should do the following to restore your configuration options:
```
mv /etc/my.cnf.rpmsave /etc/my.cnf
```
### Unsupported configuration options
If you are using any of the following options in your /etc/my.cnf or other my.cnf file you should remove them. This is also true for MySQL 5.1 or newer:
```
skip-bdb
```
See also
--------
* [Installing with yum (recommended)](../yum/index)
* [Installing MariaDB RPM Files](../installing-mariadb-rpm-files/index)
* [Checking MariaDB RPM Package Signatures](../checking-mariadb-rpm-package-signatures/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB Authorization and Permissions for SQL Server Users MariaDB Authorization and Permissions for SQL Server Users
==========================================================
Understanding Accounts and Users
--------------------------------
MariaDB authorizes access and check permissions on accounts, rather than users. Even if MariaDB supports standard SQL commands like [CREATE USER](../create-user/index) and [DROP USER](../drop-user/index), it is important to remember that it actually works with accounts.
An account is specified in the format `'user'@'host'`. The quotes are optional and allow one to include special characters, like dots. The host part can actually be a pattern, which follows the same syntax used in `LIKE` comparisons. Patterns are often convenient because they can match several hostnames.
Here are some examples.
Omitting the host part indicates an account that can access from any host. So the following statements are equivalent:
```
CREATE USER viviana;
CREATE USER viviana@'%';
```
However, such accounts may be unable to connect from localhost if an anonymous user `''@'%'` is present. See [localhost and %](../troubleshooting-connection-issues/index#localhost-and) for the details.
Accounts are not bound to a specific database. They are global. Once an account is created, it is possible to assign it permissions on any existing or non existing database.
The [sql\_mode](../sql-mode/index) system variable has a [NO\_AUTO\_CREATE\_USER](../sql-mode/index#no_auto_create_user) flag. In recent MariaDB versions it is enabled by default. If it is not enabled, a [GRANT](../grant/index) statement specifying privileges for a non-existent account will automatically create that account.
For more information: [Account Management SQL Commands](../account-management-sql-commands/index).
### Setting or Changing Passwords
Accounts with the same username can have different passwords.
By default, an account has no password. A password can be set, or changed, in the following way:
* By specifying it in [CREATE USER](../create-user/index).
* By the user, with [SET PASSWORD](../set-password/index).
* By root, with `SET PASSWORD` or [ALTER USER](../alter-user/index).
With all these statements (`CREATE USER`, `ALTER USER`, `SET PASSWORD`) it is possible to specify the password in plain or as a hash:
```
-- specifying plain passwords:
CREATE USER tom@'%.example.com' IDENTIFIED BY 'plain secret';
ALTER USER tom@'%.example.com' IDENTIFIED BY 'plain secret';
SET PASSWORD = 'plain secret';
-- specifying hashes:
CREATE USER tom@'%.example.com' IDENTIFIED BY PASSWORD 'secret hash';
ALTER USER tom@'%.example.com' IDENTIFIED BY PASSWORD 'secret hash';
SET PASSWORD = PASSWORD('secret hash');
```
The [PASSWORD()](../password/index) function uses the same algorithm used internally by MariaDB to generate hashes. Therefore it can be used to get a hash from a plain password. Note that this function should not be used by applications, as its output may depend on MariaDB version and configuration.
`SET PASSWORD` applies to the current account, by default. Superusers can change other accounts passwords in this way:
```
SET PASSWORD FOR tom@'%.example.com' = PASSWORD 'secret hash';
```
**MariaDB starting with [10.4.3](https://mariadb.com/kb/en/mariadb-1043-release-notes/)**Passwords can have an expiry date, set by [default\_password\_lifetime](../server-system-variables/index#default_password_lifetime). To set a different date for a particular user:
```
CREATE USER 'tom'@'%.example.com' PASSWORD EXPIRE INTERVAL 365 DAY;
```
To set no expiry date for a particular user:
```
CREATE USER 'tom'@'%.example.com' PASSWORD EXPIRE NEVER;
```
For more details, see [User Password Expiry](../user-password-expiry/index).
**MariaDB starting with [10.4.2](https://mariadb.com/kb/en/mariadb-1042-release-notes/)**It is also possible to lock an account with immediate effect:
```
CREATE USER 'tom'@'%.example.com' ACCOUNT LOCK;
```
See [Account Locking](../account-locking/index) for more details.
Authentication Plugins
----------------------
MariaDB supports [authentication plugins](../authentication-plugins/index). These plugins implement user's login and authorization before they can use MariaDB.
Each user has one or more authentication plugins assigned. The default one is [mysql\_native\_password](../authentication-plugin-mysql_native_password/index). It is the traditional login using the username and password set in MariaDB, as described above.
**MariaDB starting with [10.4](../what-is-mariadb-104/index)**On UNIX systems, root is also assigned the [unix\_socket](../authentication-plugin-unix-socket/index) plugin, which allows a user logged in the operating system to be recognized by MariaDB.
Windows users may be interested in the [named pipe](../authentication-plugin-named-pipe/index) and [GSSAPI](../authentication-plugin-gssapi/index) plugins. GSSAPI also requires the use of a plugin on the [client side](../authentication-plugin-gssapi/index#support-in-client-libraries).
A plugin can be assigned to a user with `CREATE USER`, `ALTER USER` or `GRANT`, using the `IDENTIFIED VIA` syntax. For example:
```
CREATE USER username@hostname IDENTIFIED VIA gssapi;
GRANT SELECT ON db.* TO username@hostname IDENTIFIED VIA named_pipe;
```
TLS connections
---------------
A particular user can be required to use TLS connections. Additional requirements can be set:
* Having a valid X509 certificate.
* The certificate may be required to be issued by a particular authority.
* A particular certificate subject can be required.
* A particular certificate cipher suite can be required.
These requirements can be set with `CREATE USER`, `ALTER USER` or `GRANT`. For the syntax, see [CREATE USER](../create-user/index#tls-options).
MariaDB can be bundled with several cryptography libraries, depending on its version. For more information about the libraries, see [TLS and Cryptography Libraries Used by MariaDB](../tls-and-cryptography-libraries-used-by-mariadb/index).
For more information about secure connections, see [Secure Connections Overview](../secure-connections-overview/index).
Permissions
-----------
Permissions can be granted to accounts. As mentioned before, the specified accounts can actually be patterns, and multiple accounts may match a pattern. For example, in this example we are creating three accounts, and we are assigning permissions to all of them:
```
CREATE USER 'tom'@'example.com';
CREATE USER 'tom'@'123.123.123.123;
CREATE USER 'tom'@'tomlaptop';
GRANT USAGE ON *.* TO tom@'%';
```
The following permission levels exist in MariaDB:
* [Global privileges](../grant/index#global-privileges);
* [Database privileges](../grant/index#database-privileges);
* [Table privileges](../grant/index#table-privileges);
* [Column privileges](../grant/index#column-privileges);
* [Function](../grant/index#function-privileges) and [procedure privileges](../grant/index#procedure-privileges).
Note that database and schema are synonymous in MariaDB.
Permissions can be granted for non-existent objects that could exist in the future.
The list of supported privileges can be found in the [GRANT](../grant/index) page. Some highlights can be useful for SQL Server users:
* `USAGE` privilege has no effect. The `GRANT` command fails if we don't grant at least one privilege; but sometimes we want to run it for other purposes, for example to require a user to use TLS connections. In such cases, it is useful to grant `USAGE`.
* Normally we can obtain a list of all databases for which we have at least one permission. The `SHOW DATABASES` permission allows getting a list of all databases.
* There is no `SHOWPLAN` privilege in MariaDB. Instead, [EXPLAIN](../explain/index) requires the `SELECT` privilege for each accessed table and the `SHOW VIEW` privilege for each accessed view.
* The same permissions are needed to see a table structure (`SELECT`) or a view definition (`SHOW VIEW`).
* `REFERENCES` has no effect.
MariaDB does not support negative permissions (the `DENY` command).
Some differences concerning the SQL commands:
* In MariaDB `GRANT` and `REVOKE` statements can only assign/revoke permissions to one user at a time.
* While we can assign/revoke privileges at column level, we have to run a `GRANT` or `REVOKE` statement for each column. The `table (column_list)` syntax is not recognized by MariaDB.
* In MariaDB it is not needed (or possible) to specify a class type.
Roles
-----
MariaDB supports [roles](../roles/index). Permissions can be assigned to roles, and roles can be assigned to accounts.
An account may have zero or one default roles. A default role is a role that is automatically active for a user when they connect. To assign an account or remove a default role, these SQL statements can be used:
```
SET DEFAULT ROLE some_role FOR username@hostname;
SET DEFAULT ROLE NONE FOR username@hostname;
```
Normally a role is not a default role. If we assign a role in this way:
```
GRANT some_role TO username@hostname;
```
...the user will not have that role automatically enabled. They will have to enable it explicitly:
```
SET ROLE some_role;
```
MariaDB does not have predefined roles, like public.
For an introduction to roles, see [Roles Overview](../roles_overview/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb Installing Galera from Source Installing Galera from Source
=============================
There are binary installation packages available for RPM and Debian-based distributions, which will pull in all required Galera dependencies.
If these are not available, you will need to build Galera from source.
**MariaDB starting with [10.1](../what-is-mariadb-101/index)**Starting from [MariaDB 10.1](../what-is-mariadb-101/index), the wsrep API for Galera Cluster is included by default. Follow the usual [compiling-mariadb-from-source](../compiling-mariadb-from-source/index) instructions
**MariaDB until [10.0](../what-is-mariadb-100/index)**[MariaDB 10.0](../what-is-mariadb-100/index) and below are no longer supported. The instructions below have only historical significance.
Preparation
-----------
*make* cannot manage dependencies for the build process, so the following packages need to be installed first:
RPM-based:
```
yum-builddep MariaDB-server
```
Debian-based:
```
apt-get build-dep mariadb-server
```
If running on an alternative system, or the commands are available, the following packages are required. You will need to check the repositories for the correct package names on your distribution - these may differ between distributions, or require additional packages:
#### MariaDB Database Server with wsrep API
* Git, CMake (on Fedora, both cmake and cmake-fedora are required), GCC and GCC-C++, Automake, Autoconf, and Bison, as well as development releases of libaio and ncurses.
Building
--------
You can use Git to download the source code, as MariaDB source code is available through GitHub. Clone the repository:
```
git clone https://github.com/mariadb/server mariadb
```
1. Checkout the branch (e.g. 10.0-galera or 5.5-galera), for example:
```
cd mariadb
git checkout 10.0-galera
```
### Building the Database Server
The standard and Galera cluster database servers are the same, except that for Galera Cluster, the wsrep API patch is included. Enable the patch with the CMake configuration options `WITH_WSREP` and `WITH_INNODB_DISALLOW_WRITES`. To build the database server, run the following commands:
```
cmake -DWITH_WSREP=ON -DWITH_INNODB_DISALLOW_WRITES=ON .
make
make install
```
There are also some build scripts in the *BUILD/* directory which may be more convenient to use. For example, the following pre-configures the build options discussed above:
```
./BUILD/compile-pentium64-wsrep
```
There are several others as well, so you can select the most convenient.
Besides the server with the Galera support, you will also need a galera provider.
Preparation
-----------
*make* cannot manage dependencies itself, so the following packages need to be installed first:
```
apt-get install -y scons check
```
If running on an alternative system, or the commands are available, the following packages are required. You will need to check the repositories for the correct package names on your distribution - these may differ between distributions, or require additional packages:
#### Galera Replication Plugin
* SCons, as well as development releases of Boost (libboost\_program\_options, libboost\_headers1), Check and OpenSSL.
Building
--------
Run:
```
git clone -b mariadb-4.x https://github.com/MariaDB/galera.git
```
If you are using [MariaDB 10.3](../what-is-mariadb-103/index) or earlier, you should checkout `mariadb-3.x` instead.
After this, the source files for the Galera provider will be in the `galera` directory.
### Building the Galera Provider
The Galera Replication Plugin both implements the wsrep API and operates as the database server's wsrep Provider. To build, cd into the *galera/* directory and do:
```
git submodule init
git submodule update
./scripts/build.sh
mkdir /usr/lib64/galera
cp libgalera_smm.so /usr/lib64/galera
```
The path to `libgalera_smm.so` needs to be defined in the *my.cnf* configuration file.
Building Galera Replication Plugin from source on FreeBSD runs into issues due to Linux dependencies. To overcome these, either install the binary package: `pkg install galera`, or use the ports build available at `/usr/ports/databases/galera`.
Configuration
-------------
After building, a number of other steps are necessary:
* Create the database server user and group:
```
groupadd mysql
useradd -g mysql mysql
```
* Install the database (the path may be different if you specified CMAKE\_INSTALL\_PREFIX):
```
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql
```
* If you want to install the database in a location other than */usr/local/mysql/data* , use the *--basedir* or *--datadir* options.
* Change the user and group permissions for the base directory.
```
chown -R mysql /usr/local/mysql
chgrp -R mysql /usr/local/mysql
```
* Create a system unit for the database server.
```
cp /usr/local/mysql/supported-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
```
* Galera Cluster can now be started using the service command, and is set to start at boot.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_DISJOINT ST\_DISJOINT
============
Syntax
------
```
ST_DISJOINT(g1,g2)
```
Description
-----------
Returns `1` or `0` to indicate whether geometry *`g1`* is spatially disjoint from (does not intersect with) geometry *`g2`*.
ST\_DISJOINT() uses object shapes, while [DISJOINT()](../disjoint/index), based on the original MySQL implementation, uses object bounding rectangles.
ST\_DISJOINT() tests the opposite relationship to [ST\_INTERSECTS()](../st_intersects/index).
Examples
--------
```
SET @g1 = ST_GEOMFROMTEXT('POINT(0 0)');
SET @g2 = ST_GEOMFROMTEXT('LINESTRING(2 0, 0 2)');
SELECT ST_DISJOINT(@g1,@g2);
+----------------------+
| ST_DISJOINT(@g1,@g2) |
+----------------------+
| 1 |
+----------------------+
SET @g2 = ST_GEOMFROMTEXT('LINESTRING(0 0, 0 2)');
SELECT ST_DISJOINT(@g1,@g2);
+----------------------+
| ST_DISJOINT(@g1,@g2) |
+----------------------+
| 0 |
+----------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Equality propagation optimization Equality propagation optimization
=================================
Basic idea
----------
Consider a query with a WHERE clause:
```
WHERE col1=col2 AND ...
```
the WHERE clause will compute to true only if `col1=col2`. This means that in the rest of the WHERE clause occurrences of `col1` can be substituted with `col2` (with some limitations which are discussed in the next section). This allows the optimizer to infer additional restrictions.
For example:
```
WHERE col1=col2 AND col1=123
```
allows to infer a new equality: `col2=123`
```
WHERE col1=col2 AND col1 < 10
```
allows to infer that `col2<10`.
Identity and comparison substitution
------------------------------------
There are some limitations to where one can do the substitution, though.
The first and obvious example is the string datatype and collations. Most commonly-used collations in SQL are "case-insensitive", that is `'A'='a'`. Also, most collations have a "PAD SPACE" attribute, which means that comparison ignores the spaces at the end of the value, `'a'='a '`.
Now, consider a query:
```
INSERT INTO t1 (col1, col2) VALUES ('ab', 'ab ');
SELECT * FROM t1 WHERE col1=col2 AND LENGTH(col1)=2
```
Here, `col1=col2`, the values are "equal". At the same time `LENGTH(col1)=2`, while `LENGTH(col2)=4`, which means one can't perform the substiution for the argument of LENGTH(...).
It's not only collations. There are similar phenomena when equality compares columns of different datatypes. The exact criteria of when thy happen are rather convoluted.
The take-away is: **sometimes, X=Y does not mean that one can replace any reference to X with Y**. What one CAN do is still replace the occurrence in the comparisons `<`, `>`, `>=`, `<=`, etc.
This is how we get two kinds of substitution:
* **Identity substitution**: X=Y, and any occurrence of X can be replaced with Y.
* **Comparison substitution**: X=Y, and an occurrence of X in a comparison (X<Z) can be replaced with Y (Y<Z).
Place in query optimization
---------------------------
(A draft description): Let's look at how Equality Propagation is integrated with the rest of the query optimization process.
* First, multiple-equalities are built (TODO example from optimizer trace)
+ If multiple-equality includes a constant, fields are substituted with a constant if possible.
* From this point, all optimizations like range optimization, ref access, etc make use of multiple equalities: when they see a reference to `tableX.columnY` somewhere, they also look at all the columns that tableX.columnY is equal to.
* After the join order is picked, the optimizer walks through the WHERE clause and substitutes each field reference with the "best" one - the one that can be checked as soon as possible.
+ Then, the parts of the WHERE condition are attached to the tables where they can be checked.
### Interplay with ORDER BY optimization
Consider a query:
```
SELECT ... FROM ... WHERE col1=col2 ORDER BY col2
```
Suppose, there is an `INDEX(col1)`. MariaDB optimizer is able to figure out that it can use an index on `col1` (or sort by the value of `col1`) in order to resolve `ORDER BY col2`.
Optimizer trace
---------------
Look at these elements:
* `condition_processing`
* `attaching_conditions_to_tables`
More details
------------
Equality propagation doesn't just happen at the top of the WHERE clause. It is done "at all levels" where a level is:
* A top level of the WHERE clause.
* If the WHERE clause has an OR clause, each branch of the OR clause.
* The top level of any ON expression
* (the same as above about OR-levels)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb GOTO GOTO
====
**MariaDB starting with [10.3](../what-is-mariadb-103/index)**The GOTO statement was introduced in [MariaDB 10.3](../what-is-mariadb-103/index) for Oracle compatibility.
Syntax
------
```
GOTO label
```
Description
-----------
The `GOTO` statement causes the code to jump to the specified label, and continue operating from there. It is only accepted when in [Oracle mode](../sql_modeoracle-from-mariadb-103/index).
Example
-------
```
SET sql_mode=ORACLE;
DELIMITER //
CREATE OR REPLACE PROCEDURE p1 AS
BEGIN
SELECT 1;
GOTO label;
SELECT 2;
<<label>>
SELECT 3;
END;
//
DELIMITER
call p1();
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.000 sec)
+---+
| 3 |
+---+
| 3 |
+---+
1 row in set (0.000 sec)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mariadb-install-db mariadb-install-db
==================
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-install-db` is a symlink to `mysql_install_db`. the tool for initializing the MariaDB data directory and creating the [system tables](../system-tables/index)
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysql_install_db` is the symlink, and `mariadb-install-db` the binary name.
See [mysql\_install\_db](../mysql_install_db/index) for details.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb MariaDB ColumnStore software upgrade 1.0.13 to 1.0.14 MariaDB ColumnStore software upgrade 1.0.13 to 1.0.14
=====================================================
MariaDB ColumnStore software upgrade 1.0.13 to 1.0.14
-----------------------------------------------------
Note: Columnstore.xml modifications you manually made are not automatically carried forward on an upgrade. These modifications will need to be incorporated back into .XML once the upgrade has occurred.
The previous configuration file will be saved as /usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave.
If you have specified a root database password (which is good practice), then you must configure a .my.cnf file with user credentials for the upgrade process to use. Create a .my.cnf file in the user home directory with 600 file permissions with the following content (updating PASSWORD as appropriate):
```
[mysqladmin]
user = root
password = PASSWORD
```
### Choosing the type of upgrade
As noted on the Preparing guide, you can installing MariaDB ColumnStore with the use of soft-links. If you have the softlinks be setup at the Data Directory Levels, like mariadb/columnstore/data and mariadb/columnstore/dataX, then your upgrade will happen without any issues. In the case where you have a softlink at the top directory, like /usr/local/mariadb, you will need to upgrade using the binary package. If you updating using the rpm package and tool, this softlink will be deleted when you perform the upgrade process and the upgrade will fail.
#### Root User Installs
#### Upgrading MariaDB ColumnStore using RPMs
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
**Download the package mariadb-columnstore-1.0.14-1-centos#.x86\_64.rpm.tar.gz to the PM1 server where you are installing MariaDB ColumnStore.** Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate a set of RPMs that will reside in the /root/ directory.
```
# tar -zxf mariadb-columnstore-1.0.14-1-centos#.x86_64.rpm.tar.gz
```
* Upgrade the RPMs. The MariaDB ColumnStore software will be installed in /usr/local/.
```
# rpm -e --nodeps $(rpm -qa | grep '^mariadb-columnstore')
# rpm -ivh mariadb-columnstore-*1.0.14*rpm
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml.rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
For RPM Upgrade, the previous configuration file will be saved as:
/usr/local/mariadb/columnstore/etc/Columnstore.xml.rpmsave
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /usr/local directory -mariadb-columnstore-1.0.14-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# /usr/local/mariadb/columnstore/bin/pre-uninstall
```
* Unpack the tarball, in the /usr/local/ directory.
```
# tar -zxvf -mariadb-columnstore-1.0.14-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# /usr/local/mariadb/columnstore/bin/post-install
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
### Upgrading MariaDB ColumnStore using the DEB package
A DEB upgrade would be done on a system that supports DEBs like Debian or Ubuntu systems.
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /root directory
mariadb-columnstore-1.0.14-1.amd64.deb.tar.gz
(DEB 64-BIT) to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Unpack the tarball, which will generate DEBs.
```
# tar -zxf mariadb-columnstore-1.0.14-1.amd64.deb.tar.gz
```
* Remove, purge and install all MariaDB ColumnStore debs
```
# cd /root/
# dpkg -r $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg -P $(dpkg --list | grep 'mariadb-columnstore' | awk '{print $2}')
# dpkg --install mariadb-columnstore-*1.0.14-1*deb
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# /usr/local/mariadb/columnstore/bin/postConfigure -u
```
#### Non-Root User Installs
### Initial download/install of MariaDB ColumnStore binary package
Upgrade MariaDB ColumnStore as user root on the server designated as PM1:
* Download the package into the /home/'non-root-user" directory
mariadb-columnstore-1.0.14-1.x86\_64.bin.tar.gz (Binary 64-BIT)to the server where you are installing MariaDB ColumnStore.
* Shutdown the MariaDB ColumnStore system:
```
# mcsadmin shutdownsystem y
```
* Run pre-uninstall script
```
# $HOME/mariadb/columnstore/bin/pre-uninstall
--installdir= /home/guest/mariadb/columnstore
```
* Unpack the tarball, which will generate the $HOME/ directory.
```
# tar -zxvf -mariadb-columnstore-1.0.14-1.x86_64.bin.tar.gz
```
* Run post-install scripts
```
# $HOME/mariadb/columnstore/bin/post-install
--installdir=/home/guest/mariadb/columnstore
```
* Run postConfigure using the upgrade option, which will utilize the configuration from the Columnstore.xml,rpmsave
```
# $HOME/mariadb/columnstore/bin/postConfigure -u -i /home/guest/mariadb/columnstore
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysql_plugin mysql\_plugin
=============
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-plugin` is a symlink to `mysql_plugin`.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysql_plugin` is the symlink, and `mariadb-plugin` the binary name.
`mysql_plugin` is a tool for enabling or disabling [plugins](../mariadb-plugins/index).
It is a commandline alternative to the [INSTALL PLUGIN](../install-plugin/index) and [UNINSTALL PLUGIN](../uninstall-plugin/index) statements, and the `--plugin-load option` to [mysqld](../mysqld-options-full-list/index).
`mysql_plugin` must be run while the server is offline, and works by adding or removing rows from the [mysql.plugin](../mysqlplugin-table/index) table.
`mysql_plugin` basically has two use cases:
* adding a plugin even before the first real server startup
* removing a plugin that crashes the server on startup
For the install use case, adding a [plugin-load-add](../plugin-overview/index#installing-a-plugin-with-plugin-load-add) entry to `my.cnf` or in a separate include option file, is probably a better alternative. In case of a plugin loaded via a `mysql.plugin` crashing the server, uninstalling the plugin with the help of `mysql_plugin` can be the only viable action though.
Usage
-----
```
mysql_plugin [options] <plugin> ENABLE|DISABLE
```
`mysql_plugin` expects to find a configuration file that indicates how to configure the plugins. The configuration file is by default the same name as the plugin, with a `.ini` extension. For example:
```
mysql_plugin crazyplugins ENABLE
```
Here, `mysql_plugin` will look for a file called `crazyplugins.ini`
```
crazyplugins
crazyplugin1
crazyplugin2
crazyplugin3
```
The first line should contain the name of the library object file, with no extension. The other lines list the names of the components. Each value should be on a separate line, and the `#` character at the start of the line indicates a comment.
Options
-------
The following options can be specified on the command line, while some can be specified in the `[mysqld]` group of any option file. For options specified in a `[mysqld]` group, only the `--basedir`, `--datadir`, and `--plugin-dir` options can be used - the rest are ignored.
| Option | Description |
| --- | --- |
| `-b`, `--basedir=name` | The base directory for the server. |
| `-d`, `--datadir=name` | The data directory for the server. |
| `-?`, `--help` | Display help and exit. |
| `-f`, `--my-print-defaults=name` | Path to `my_print_defaults` executable. Example: `/source/temp11/extra` |
| `-m`, `--mysqld=name` | Path to `mysqld` executable. Example: `/sbin/temp1/mysql/bin` |
| `-n`, `--no-defaults` | Do not read values from configuration file. |
| `-p`, `--plugin-dir=name` | The plugin directory for the server. |
| `-i`, `--plugin-ini=name` | Read plugin information from configuration file specified instead of from `<plugin-dir>/<plugin_name>.ini`. |
| `-P`, `--print-defaults` | Show default values from configuration file. |
| `-v`, `--verbose` | More verbose output; you can use this multiple times to get even more verbose output. |
| `-V`, `--version` | Output version information and exit. |
See Also
--------
* [List of Plugins](../list-of-plugins/index)
* [Plugin Overview](../plugin-overview/index)
* [INFORMATION\_SCHEMA.PLUGINS Table](../plugins-table-information-schema/index)
* [INSTALL PLUGIN](../install-plugin/index)
* [INSTALL SONAME](../install-soname/index)
* [UNINSTALL PLUGIN](../uninstall-plugin/index)
* [UNINSTALL SONAME](../uninstall-soname/index)
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
mariadb START SLAVE START SLAVE
===========
The terms *master* and *slave* have historically been used in replication, but the terms terms *primary* and *replica* are now preferred. The old terms are used still used in parts of the documentation, and in MariaDB commands, although [MariaDB 10.5](../what-is-mariadb-105/index) has begun the process of renaming. The documentation process is ongoing. See [MDEV-18777](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
Syntax
------
```
START SLAVE ["connection_name"] [thread_type [, thread_type] ... ] [FOR CHANNEL "connection_name"]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos [FOR CHANNEL "connection_name"]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos [FOR CHANNEL "connection_name"]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
MASTER_GTID_POS = <GTID position> [FOR CHANNEL "connection_name"]
START ALL SLAVES [thread_type [, thread_type]]
START REPLICA ["connection_name"] [thread_type [, thread_type] ... ] -- from 10.5.1
START REPLICA ["connection_name"] [SQL_THREAD] UNTIL
MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos -- from 10.5.1
START REPLICA ["connection_name"] [SQL_THREAD] UNTIL
RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos -- from 10.5.1
START REPLICA ["connection_name"] [SQL_THREAD] UNTIL
MASTER_GTID_POS = <GTID position> -- from 10.5.1
START ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1
thread_type: IO_THREAD | SQL_THREAD
```
Description
-----------
`START SLAVE` (`START REPLICA` from [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)) with no thread\_type options starts both of the replica threads (see [replication](../replication/index)). The I/O thread reads events from the primary server and stores them in the [relay log](../relay-log/index). The SQL thread reads events from the relay log and executes them. `START SLAVE` requires the [SUPER](../grant/index#super) privilege, or, from [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), the [REPLICATION SLAVE ADMIN](../grant/index#replication-slave-admin) privilege.
If `START SLAVE` succeeds in starting the replica threads, it returns without any error. However, even in that case, it might be that the replica threads start and then later stop (for example, because they do not manage to connect to the primary or read its [binary log](../binary-log/index), or some other problem). `START SLAVE` does not warn you about this. You must check the replica's [error log](../error-log/index) for error messages generated by the replica threads, or check that they are running satisfactorily with [SHOW SLAVE STATUS](../show-replica-status/index) ([SHOW REPLICA STATUS](../show-replica-status/index) from [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)).
#### START SLAVE UNTIL
`START SLAVE UNTIL` refers to the `SQL_THREAD` replica position at which the `SQL_THREAD` replication will halt. If `SQL_THREAD` isn't specified both threads are started.
`START SLAVE UNTIL master_gtid_pos=xxx` is also supported. See [Global Transaction ID/START SLAVE UNTIL master\_gtid\_pos=xxx](../global-transaction-id/index#start-slave-until-master_gtid_posxxx) for more details.
#### connection\_name
If there is only one nameless primary, or the default primary (as specified by the [default\_master\_connection](../replication-and-binary-log-server-system-variables/index#default_master_connection) system variable) is intended, `connection_name` can be omitted. If provided, the `START SLAVE` statement will apply to the specified primary. `connection_name` is case-insensitive.
**MariaDB starting with [10.7.0](https://mariadb.com/kb/en/mariadb-1070-release-notes/)**The `FOR CHANNEL` keyword was added for MySQL compatibility. This is identical as using the channel\_name directly after `START SLAVE`.
#### START ALL SLAVES
`START ALL SLAVES` starts all configured replicas (replicas with master\_host not empty) that were not started before. It will give a `note` for all started connections. You can check the notes with [SHOW WARNINGS](../show-warnings/index).
#### START REPLICA
**MariaDB starting with [10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/)**`START REPLICA` is an alias for `START SLAVE` from [MariaDB 10.5.1](https://mariadb.com/kb/en/mariadb-1051-release-notes/).
See Also
--------
* [Setting up replication](../setting-up-replication/index).
* [CHANGE MASTER TO](../change-master-to/index) is used to create and change connections.
* [STOP SLAVE](../stop-slave/index) is used to stop a running connection.
* [RESET SLAVE](../reset-slave/index) is used to reset parameters for a connection and also to permanently delete a primary connection.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb Installing on an Old Linux Version Installing on an Old Linux Version
==================================
This article lists some typical errors that may happen when you try to use an incompatible MariaDB binary on a linux system:
The following example errors are from trying to install MariaDB built for SuSE 11.x on a SuSE 9.0 server:
```
> scripts/mysql_install_db
./bin/my_print_defaults: /lib/i686/libc.so.6:
version `GLIBC_2.4' not found (required by ./bin/my_print_defaults)
```
and
```
> ./bin/mysqld --skip-grant &
./bin/mysqld: error while loading shared libraries: libwrap.so.0:
cannot open shared object file: No such file or directory
```
If you see either of the above errors, the binary MariaDB package you installed is not compatible with your system.
The options you have are:
* Find another MariaDB package or tar from the [download page](https://downloads.mariadb.org/) that matches your system.
* or
* [Download the source](../source-getting-the-mariadb-source-code/index) and [build it](../generic-build-instructions/index).
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SHOW CREATE USER SHOW CREATE USER
================
**MariaDB starting with [10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/)**`SHOW CREATE USER` was introduced in [MariaDB 10.2.0](https://mariadb.com/kb/en/mariadb-1020-release-notes/)
Syntax
------
```
SHOW CREATE USER user_name
```
Description
-----------
Shows the [CREATE USER](../create-user/index) statement that created the given user. The statement requires the [SELECT](../grant/index#table-privileges) privilege for the [mysql](../the-mysql-database-tables/index) database, except for the current user.
Examples
--------
```
CREATE USER foo4@test require cipher 'text'
issuer 'foo_issuer' subject 'foo_subject';
SHOW CREATE USER foo4@test\G
*************************** 1. row ***************************
CREATE USER 'foo4'@'test'
REQUIRE ISSUER 'foo_issuer'
SUBJECT 'foo_subject'
CIPHER 'text'
```
[User Password Expiry](../user-password-expiry/index):
```
CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY;
SHOW CREATE USER 'monty'@'localhost';
+------------------------------------------------------------------+
| CREATE USER for monty@localhost |
+------------------------------------------------------------------+
| CREATE USER 'monty'@'localhost' PASSWORD EXPIRE INTERVAL 120 DAY |
+------------------------------------------------------------------+
```
See Also
--------
* [CREATE USER](../create-user/index)
* [ALTER USER](../alter-user/index)
* [SHOW GRANTS](../show-grants/index) shows the `GRANTS/PRIVILEGES` for a user.
* [SHOW PRIVILEGES](../show-privileges/index) shows the privileges supported by MariaDB.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb ST_DIMENSION ST\_DIMENSION
=============
Syntax
------
```
ST_Dimension(g)
Dimension(g)
```
Description
-----------
Returns the inherent dimension of the geometry value *`g`*. The result can be
| Dimension | Definition |
| --- | --- |
| `-1` | empty geometry |
| `0` | geometry with no length or area |
| `1` | geometry with no area but nonzero length |
| `2` | geometry with nonzero area |
`ST_Dimension()` and `Dimension()` are synonyms.
Examples
--------
```
SELECT Dimension(GeomFromText('LineString(1 1,2 2)'));
+------------------------------------------------+
| Dimension(GeomFromText('LineString(1 1,2 2)')) |
+------------------------------------------------+
| 1 |
+------------------------------------------------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb INT4 INT4
====
`INT4` is a synonym for [INT](../int/index).
```
CREATE TABLE t1 (x INT4);
DESC t1;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| x | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb mysql_tzinfo_to_sql mysql\_tzinfo\_to\_sql
======================
**MariaDB starting with [10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/)**From [MariaDB 10.4.6](https://mariadb.com/kb/en/mariadb-1046-release-notes/), `mariadb-tzinfo-to-sql` is a symlink to `mysql_tzinfo_to_sql`.
**MariaDB starting with [10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/)**From [MariaDB 10.5.2](https://mariadb.com/kb/en/mariadb-1052-release-notes/), `mysql_tzinfo_to_sql` is the symlink, and `mariadb-tzinfo-to-sql` the binary name.
`mysql_tzinfo_to_sql` is a utility used to load [time zones](../time-zones/index) on systems that have a zoneinfo database to load the time zone tables ([time\_zone](../mysqltime_zone-table/index), [time\_zone\_leap\_second](../mysqltime_zone_leap_second-table/index), [time\_zone\_name](../mysqltime_zone_name-table/index), [time\_zone\_transition](../mysqltime_zone_transition-table/index) and [time\_zone\_transition\_type](../mysqltime_zone_transition_type-table/index)) into the mysql database.
Most Linux, Mac OS X, FreeBSD and Solaris systems will have a zoneinfo database - Windows does not. The database is commonly found in the /usr/share/zoneinfo directory, or, on Solaris, the /usr/share/lib/zoneinfo directory.
Usage
-----
`mysql_tzinfo_to_sql` can be called in several ways. The output is usually passed straight to the [mysql client](../mysql-client/index) for direct loading in the mysql database.
```
shell> mysql_tzinfo_to_sql timezone_dir
shell> mysql_tzinfo_to_sql timezone_file timezone_name
shell> mysql_tzinfo_to_sql --leap timezone_file
```
Examples
--------
Most commonly, the whole directory is passed:
```
shell>mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
```
Load a single time zone file, `timezone_file`, corresponding to the time zone called `timezone_name`.
```
shell> mysql_tzinfo_to_sql timezone_file timezone_name | mysql -u root mysql
```
A separate command for each time zone and time zone file the server needs is required.
To account for leap seconds, use:
```
shell> mysql_tzinfo_to_sql --leap timezone_file | mysql -u root mysql
```
After populating the time zone tables, you should usually restart the server so that the new time zone data is correctly loaded.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
mariadb SHOW STATUS SHOW STATUS
===========
Syntax
------
```
SHOW [GLOBAL | SESSION] STATUS
[LIKE 'pattern' | WHERE expr]
```
Description
-----------
`SHOW STATUS` provides server status information. This information also can be obtained using the `[mysqladmin extended-status](../mysqladmin/index)` command, or by querying the [Information Schema GLOBAL\_STATUS and SESSION\_STATUS](../information-schema-global_status-and-session_status-tables/index) tables. The `LIKE` clause, if present, indicates which variable names to match. The `WHERE` clause can be given to select rows using more general conditions.
With the `GLOBAL` modifier, `SHOW STATUS` displays the status values for all connections to MariaDB. With `SESSION`, it displays the status values for the current connection. If no modifier is present, the default is `SESSION`. `LOCAL` is a synonym for `SESSION`. If you see a lot of 0 values, the reason is probably that you have used `SHOW STATUS` with a new connection instead of `SHOW GLOBAL STATUS`.
Some status variables have only a global value. For these, you get the same value for both `GLOBAL` and `SESSION`.
See [Server Status Variables](../server-status-variables/index) for a full list, scope and description of the variables that can be viewed with `SHOW STATUS`.
The `LIKE` clause, if present on its own, indicates which variable name to match.
The `WHERE` and `LIKE` clauses can be given to select rows using more general conditions, as discussed in [Extended SHOW](../extended-show/index).
Examples
--------
Full output from [MariaDB 10.1.17](https://mariadb.com/kb/en/mariadb-10117-release-notes/):
```
SHOW GLOBAL STATUS;
+--------------------------------------------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------------------------------------------+----------------------------------------+
| Aborted_clients | 0 |
| Aborted_connects | 0 |
| Access_denied_errors | 0 |
| Acl_column_grants | 0 |
| Acl_database_grants | 2 |
| Acl_function_grants | 0 |
| Acl_procedure_grants | 0 |
| Acl_proxy_users | 2 |
| Acl_role_grants | 0 |
| Acl_roles | 0 |
| Acl_table_grants | 0 |
| Acl_users | 6 |
| Aria_pagecache_blocks_not_flushed | 0 |
| Aria_pagecache_blocks_unused | 15706 |
| Aria_pagecache_blocks_used | 0 |
| Aria_pagecache_read_requests | 0 |
| Aria_pagecache_reads | 0 |
| Aria_pagecache_write_requests | 0 |
| Aria_pagecache_writes | 0 |
| Aria_transaction_log_syncs | 0 |
| Binlog_commits | 0 |
| Binlog_group_commits | 0 |
| Binlog_group_commit_trigger_count | 0 |
| Binlog_group_commit_trigger_lock_wait | 0 |
| Binlog_group_commit_trigger_timeout | 0 |
| Binlog_snapshot_file | |
| Binlog_snapshot_position | 0 |
| Binlog_bytes_written | 0 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 0 |
| Busy_time | 0.000000 |
| Bytes_received | 432 |
| Bytes_sent | 15183 |
| Com_admin_commands | 1 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 0 |
| Com_alter_tablespace | 0 |
| Com_analyze | 0 |
| Com_assign_to_keycache | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 0 |
| Com_change_db | 0 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_compound_sql | 0 |
| Com_create_db | 0 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 0 |
| Com_create_procedure | 0 |
| Com_create_role | 0 |
| Com_create_server | 0 |
| Com_create_table | 0 |
| Com_create_temporary_table | 0 |
| Com_create_trigger | 0 |
| Com_create_udf | 0 |
| Com_create_user | 0 |
| Com_create_view | 0 |
| Com_dealloc_sql | 0 |
| Com_delete | 0 |
| Com_delete_multi | 0 |
| Com_do | 0 |
| Com_drop_db | 0 |
| Com_drop_event | 0 |
| Com_drop_function | 0 |
| Com_drop_index | 0 |
| Com_drop_procedure | 0 |
| Com_drop_role | 0 |
| Com_drop_server | 0 |
| Com_drop_table | 0 |
| Com_drop_temporary_table | 0 |
| Com_drop_trigger | 0 |
| Com_drop_user | 0 |
| Com_drop_view | 0 |
| Com_empty_query | 0 |
| Com_execute_sql | 0 |
| Com_flush | 0 |
| Com_get_diagnostics | 0 |
| Com_grant | 0 |
| Com_grant_role | 0 |
| Com_ha_close | 0 |
| Com_ha_open | 0 |
| Com_ha_read | 0 |
| Com_help | 0 |
| Com_insert | 0 |
| Com_insert_select | 0 |
| Com_install_plugin | 0 |
| Com_kill | 0 |
| Com_load | 0 |
| Com_lock_tables | 0 |
| Com_optimize | 0 |
| Com_preload_keys | 0 |
| Com_prepare_sql | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_release_savepoint | 0 |
| Com_rename_table | 0 |
| Com_rename_user | 0 |
| Com_repair | 0 |
| Com_replace | 0 |
| Com_replace_select | 0 |
| Com_reset | 0 |
| Com_resignal | 0 |
| Com_revoke | 0 |
| Com_revoke_all | 0 |
| Com_revoke_role | 0 |
| Com_rollback | 0 |
| Com_rollback_to_savepoint | 0 |
| Com_savepoint | 0 |
| Com_select | 1 |
| Com_set_option | 0 |
| Com_show_authors | 0 |
| Com_show_binlog_events | 0 |
| Com_show_binlogs | 0 |
| Com_show_charsets | 0 |
| Com_show_collations | 0 |
| Com_show_contributors | 0 |
| Com_show_create_db | 0 |
| Com_show_create_event | 0 |
| Com_show_create_func | 0 |
| Com_show_create_proc | 0 |
| Com_show_create_table | 0 |
| Com_show_create_trigger | 0 |
| Com_show_databases | 0 |
| Com_show_engine_logs | 0 |
| Com_show_engine_mutex | 0 |
| Com_show_engine_status | 0 |
| Com_show_errors | 0 |
| Com_show_events | 0 |
| Com_show_explain | 0 |
| Com_show_fields | 0 |
| Com_show_function_status | 0 |
| Com_show_generic | 0 |
| Com_show_grants | 0 |
| Com_show_keys | 0 |
| Com_show_master_status | 0 |
| Com_show_open_tables | 0 |
| Com_show_plugins | 0 |
| Com_show_privileges | 0 |
| Com_show_procedure_status | 0 |
| Com_show_processlist | 0 |
| Com_show_profile | 0 |
| Com_show_profiles | 0 |
| Com_show_relaylog_events | 0 |
| Com_show_slave_hosts | 0 |
| Com_show_slave_status | 0 |
| Com_show_status | 2 |
| Com_show_storage_engines | 0 |
| Com_show_table_status | 0 |
| Com_show_tables | 0 |
| Com_show_triggers | 0 |
| Com_show_variables | 0 |
| Com_show_warnings | 0 |
| Com_shutdown | 0 |
| Com_signal | 0 |
| Com_start_all_slaves | 0 |
| Com_start_slave | 0 |
| Com_stmt_close | 0 |
| Com_stmt_execute | 0 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 0 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 0 |
| Com_stmt_send_long_data | 0 |
| Com_stop_all_slaves | 0 |
| Com_stop_slave | 0 |
| Com_truncate | 0 |
| Com_uninstall_plugin | 0 |
| Com_unlock_tables | 0 |
| Com_update | 0 |
| Com_update_multi | 0 |
| Com_xa_commit | 0 |
| Com_xa_end | 0 |
| Com_xa_prepare | 0 |
| Com_xa_recover | 0 |
| Com_xa_rollback | 0 |
| Com_xa_start | 0 |
| Compression | OFF |
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 4 |
| Cpu_time | 0.000000 |
| Created_tmp_disk_tables | 0 |
| Created_tmp_files | 6 |
| Created_tmp_tables | 2 |
| Delayed_errors | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Delete_scan | 0 |
| Empty_queries | 0 |
| Executed_events | 0 |
| Executed_triggers | 0 |
| Feature_delay_key_write | 0 |
| Feature_dynamic_columns | 0 |
| Feature_fulltext | 0 |
| Feature_gis | 0 |
| Feature_locale | 0 |
| Feature_subquery | 0 |
| Feature_timezone | 0 |
| Feature_trigger | 0 |
| Feature_xml | 0 |
| Flush_commands | 1 |
| Handler_commit | 1 |
| Handler_delete | 0 |
| Handler_discover | 0 |
| Handler_external_lock | 0 |
| Handler_icp_attempts | 0 |
| Handler_icp_match | 0 |
| Handler_mrr_init | 0 |
| Handler_mrr_key_refills | 0 |
| Handler_mrr_rowid_refills | 0 |
| Handler_prepare | 0 |
| Handler_read_first | 3 |
| Handler_read_key | 0 |
| Handler_read_last | 0 |
| Handler_read_next | 0 |
| Handler_read_prev | 0 |
| Handler_read_retry | 0 |
| Handler_read_rnd | 0 |
| Handler_read_rnd_deleted | 0 |
| Handler_read_rnd_next | 537 |
| Handler_rollback | 0 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_tmp_update | 0 |
| Handler_tmp_write | 516 |
| Handler_update | 0 |
| Handler_write | 0 |
| Innodb_available_undo_logs | 128 |
| Innodb_background_log_sync | 222 |
| Innodb_buffer_pool_bytes_data | 2523136 |
| Innodb_buffer_pool_bytes_dirty | 0 |
| Innodb_buffer_pool_dump_status | Dumping buffer pool(s) not yet started |
| Innodb_buffer_pool_load_status | Loading buffer pool(s) not yet started |
| Innodb_buffer_pool_pages_data | 154 |
| Innodb_buffer_pool_pages_dirty | 0 |
| Innodb_buffer_pool_pages_flushed | 1 |
| Innodb_buffer_pool_pages_free | 8037 |
| Innodb_buffer_pool_pages_lru_flushed | 0 |
| Innodb_buffer_pool_pages_made_not_young | 0 |
| Innodb_buffer_pool_pages_made_young | 0 |
| Innodb_buffer_pool_pages_misc | 0 |
| Innodb_buffer_pool_pages_old | 0 |
| Innodb_buffer_pool_pages_total | 8191 |
| Innodb_buffer_pool_read_ahead | 0 |
| Innodb_buffer_pool_read_ahead_evicted | 0 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_requests | 558 |
| Innodb_buffer_pool_reads | 155 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 1 |
| Innodb_checkpoint_age | 0 |
| Innodb_checkpoint_max_age | 80826164 |
| Innodb_data_fsyncs | 5 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 2609664 |
| Innodb_data_reads | 172 |
| Innodb_data_writes | 5 |
| Innodb_data_written | 34304 |
| Innodb_dblwr_pages_written | 1 |
| Innodb_dblwr_writes | 1 |
| Innodb_deadlocks | 0 |
| Innodb_have_atomic_builtins | ON |
| Innodb_history_list_length | 0 |
| Innodb_ibuf_discarded_delete_marks | 0 |
| Innodb_ibuf_discarded_deletes | 0 |
| Innodb_ibuf_discarded_inserts | 0 |
| Innodb_ibuf_free_list | 0 |
| Innodb_ibuf_merged_delete_marks | 0 |
| Innodb_ibuf_merged_deletes | 0 |
| Innodb_ibuf_merged_inserts | 0 |
| Innodb_ibuf_merges | 0 |
| Innodb_ibuf_segment_size | 2 |
| Innodb_ibuf_size | 1 |
| Innodb_log_waits | 0 |
| Innodb_log_write_requests | 0 |
| Innodb_log_writes | 1 |
| Innodb_lsn_current | 1616829 |
| Innodb_lsn_flushed | 1616829 |
| Innodb_lsn_last_checkpoint | 1616829 |
| Innodb_master_thread_active_loops | 0 |
| Innodb_master_thread_idle_loops | 222 |
| Innodb_max_trx_id | 2308 |
| Innodb_mem_adaptive_hash | 2217568 |
| Innodb_mem_dictionary | 630703 |
| Innodb_mem_total | 140771328 |
| Innodb_mutex_os_waits | 1 |
| Innodb_mutex_spin_rounds | 30 |
| Innodb_mutex_spin_waits | 1 |
| Innodb_oldest_view_low_limit_trx_id | 0 |
| Innodb_os_log_fsyncs | 3 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 512 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 0 |
| Innodb_pages_read | 154 |
| Innodb_pages_written | 1 |
| Innodb_purge_trx_id | 0 |
| Innodb_purge_undo_no | 0 |
| Innodb_read_views_memory | 88 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 0 |
| Innodb_row_lock_time_avg | 0 |
| Innodb_row_lock_time_max | 0 |
| Innodb_row_lock_waits | 0 |
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 0 |
| Innodb_rows_read | 0 |
| Innodb_rows_updated | 0 |
| Innodb_system_rows_deleted | 0 |
| Innodb_system_rows_inserted | 0 |
| Innodb_system_rows_read | 0 |
| Innodb_system_rows_updated | 0 |
| Innodb_s_lock_os_waits | 2 |
| Innodb_s_lock_spin_rounds | 60 |
| Innodb_s_lock_spin_waits | 2 |
| Innodb_truncated_status_writes | 0 |
| Innodb_x_lock_os_waits | 0 |
| Innodb_x_lock_spin_rounds | 0 |
| Innodb_x_lock_spin_waits | 0 |
| Innodb_page_compression_saved | 0 |
| Innodb_page_compression_trim_sect512 | 0 |
| Innodb_page_compression_trim_sect1024 | 0 |
| Innodb_page_compression_trim_sect2048 | 0 |
| Innodb_page_compression_trim_sect4096 | 0 |
| Innodb_page_compression_trim_sect8192 | 0 |
| Innodb_page_compression_trim_sect16384 | 0 |
| Innodb_page_compression_trim_sect32768 | 0 |
| Innodb_num_index_pages_written | 0 |
| Innodb_num_non_index_pages_written | 5 |
| Innodb_num_pages_page_compressed | 0 |
| Innodb_num_page_compressed_trim_op | 0 |
| Innodb_num_page_compressed_trim_op_saved | 0 |
| Innodb_num_pages_page_decompressed | 0 |
| Innodb_num_pages_page_compression_error | 0 |
| Innodb_num_pages_encrypted | 0 |
| Innodb_num_pages_decrypted | 0 |
| Innodb_have_lz4 | OFF |
| Innodb_have_lzo | OFF |
| Innodb_have_lzma | OFF |
| Innodb_have_bzip2 | OFF |
| Innodb_have_snappy | OFF |
| Innodb_defragment_compression_failures | 0 |
| Innodb_defragment_failures | 0 |
| Innodb_defragment_count | 0 |
| Innodb_onlineddl_rowlog_rows | 0 |
| Innodb_onlineddl_rowlog_pct_used | 0 |
| Innodb_onlineddl_pct_progress | 0 |
| Innodb_secondary_index_triggered_cluster_reads | 0 |
| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 |
| Innodb_encryption_rotation_pages_read_from_cache | 0 |
| Innodb_encryption_rotation_pages_read_from_disk | 0 |
| Innodb_encryption_rotation_pages_modified | 0 |
| Innodb_encryption_rotation_pages_flushed | 0 |
| Innodb_encryption_rotation_estimated_iops | 0 |
| Innodb_scrub_background_page_reorganizations | 0 |
| Innodb_scrub_background_page_splits | 0 |
| Innodb_scrub_background_page_split_failures_underflow | 0 |
| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 |
| Innodb_scrub_background_page_split_failures_missing_index | 0 |
| Innodb_scrub_background_page_split_failures_unknown | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107163 |
| Key_blocks_used | 0 |
| Key_blocks_warm | 0 |
| Key_read_requests | 0 |
| Key_reads | 0 |
| Key_write_requests | 0 |
| Key_writes | 0 |
| Last_query_cost | 0.000000 |
| Master_gtid_wait_count | 0 |
| Master_gtid_wait_time | 0 |
| Master_gtid_wait_timeouts | 0 |
| Max_statement_time_exceeded | 0 |
| Max_used_connections | 1 |
| Memory_used | 273614696 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 25 |
| Open_streams | 0 |
| Open_table_definitions | 18 |
| Open_tables | 11 |
| Opened_files | 77 |
| Opened_plugin_libraries | 0 |
| Opened_table_definitions | 18 |
| Opened_tables | 18 |
| Opened_views | 0 |
| Performance_schema_accounts_lost | 0 |
| Performance_schema_cond_classes_lost | 0 |
| Performance_schema_cond_instances_lost | 0 |
| Performance_schema_digest_lost | 0 |
| Performance_schema_file_classes_lost | 0 |
| Performance_schema_file_handles_lost | 0 |
| Performance_schema_file_instances_lost | 0 |
| Performance_schema_hosts_lost | 0 |
| Performance_schema_locker_lost | 0 |
| Performance_schema_mutex_classes_lost | 0 |
| Performance_schema_mutex_instances_lost | 0 |
| Performance_schema_rwlock_classes_lost | 0 |
| Performance_schema_rwlock_instances_lost | 0 |
| Performance_schema_session_connect_attrs_lost | 0 |
| Performance_schema_socket_classes_lost | 0 |
| Performance_schema_socket_instances_lost | 0 |
| Performance_schema_stage_classes_lost | 0 |
| Performance_schema_statement_classes_lost | 0 |
| Performance_schema_table_handles_lost | 0 |
| Performance_schema_table_instances_lost | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Performance_schema_users_lost | 0 |
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 1031336 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 1 |
| Queries | 4 |
| Questions | 4 |
| Rows_read | 10 |
| Rows_sent | 517 |
| Rows_tmp_read | 516 |
| Rpl_status | AUTH_MASTER |
| Select_full_join | 0 |
| Select_full_range_join | 0 |
| Select_range | 0 |
| Select_range_check | 0 |
| Select_scan | 2 |
| Slave_connections | 0 |
| Slave_heartbeat_period | 0.000 |
| Slave_open_temp_tables | 0 |
| Slave_received_heartbeats | 0 |
| Slave_retried_transactions | 0 |
| Slave_running | OFF |
| Slave_skipped_errors | 0 |
| Slaves_connected | 0 |
| Slaves_running | 0 |
| Slow_launch_threads | 0 |
| Slow_queries | 0 |
| Sort_merge_passes | 0 |
| Sort_priority_queue_sorts | 0 |
| Sort_range | 0 |
| Sort_rows | 0 |
| Sort_scan | 0 |
| Ssl_accept_renegotiates | 0 |
| Ssl_accepts | 0 |
| Ssl_callback_cache_hits | 0 |
| Ssl_cipher | |
| Ssl_cipher_list | |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_ctx_verify_depth | 0 |
| Ssl_ctx_verify_mode | 0 |
| Ssl_default_timeout | 0 |
| Ssl_finished_accepts | 0 |
| Ssl_finished_connects | 0 |
| Ssl_server_not_after | |
| Ssl_server_not_before | |
| Ssl_session_cache_hits | 0 |
| Ssl_session_cache_misses | 0 |
| Ssl_session_cache_mode | NONE |
| Ssl_session_cache_overflows | 0 |
| Ssl_session_cache_size | 0 |
| Ssl_session_cache_timeouts | 0 |
| Ssl_sessions_reused | 0 |
| Ssl_used_session_cache_entries | 0 |
| Ssl_verify_depth | 0 |
| Ssl_verify_mode | 0 |
| Ssl_version | |
| Subquery_cache_hit | 0 |
| Subquery_cache_miss | 0 |
| Syncs | 2 |
| Table_locks_immediate | 21 |
| Table_locks_waited | 0 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 4096 |
| Tc_log_page_waits | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 0 |
| Threads_connected | 1 |
| Threads_created | 2 |
| Threads_running | 1 |
| Update_scan | 0 |
| Uptime | 223 |
| Uptime_since_flush_status | 223 |
| wsrep_cluster_conf_id | 18446744073709551615 |
| wsrep_cluster_size | 0 |
| wsrep_cluster_state_uuid | |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 18446744073709551615 |
| wsrep_provider_name | |
| wsrep_provider_vendor | |
| wsrep_provider_version | |
| wsrep_ready | OFF |
| wsrep_thread_count | 0 |
+--------------------------------------------------------------+----------------------------------------+
516 rows in set (0.00 sec)
```
Example of filtered output:
```
SHOW STATUS LIKE 'Key%';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 107163 |
| Key_blocks_used | 0 |
| Key_blocks_warm | 0 |
| Key_read_requests | 0 |
| Key_reads | 0 |
| Key_write_requests | 0 |
| Key_writes | 0 |
+------------------------+--------+
8 rows in set (0.00 sec)
```
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
| programming_docs |
Subsets and Splits