Thinking in the study
Sea breeze
Learning computer knowledge often let people into the fear of ignorance, the past to break the sand castle to ask the end of the spirit here to moderation, we grasp the degree of the problem, we should be clear about what they are now the most should know what is it; do not cling to the knowledge that now is not the time to know There is only a question mark in mind to be resolved intentionally or unintentionally. Doubt is the panacea for learning, I often with the spirit of suspicion to think about the book narrative knowledge, and often preconceived to scrutinize the unknown knowledge, but found their own guess has the right place will be complacent, if wrong also for the book in the way of the solution of admiration and excitement.
MS SQL Server tips and guesses:
Database is a profound learning, some knowledge, although not very clear, but we can speculate can think. We know that there are many tables in a database, there are many fields in a table, and there are many rules for defining a field. Let's think about that, a record contains all the fields corresponding to the value, and the number of records is variable, the number of fields is also variable, variable plus variable let us create Maintenance Management database brings convenience, the question is, how to achieve such a function? When we look for data modification data, we can select the specified field to specify the record, we also use very happy, but why is this feasible? Before I read about the database storage structure of books, let me boldly guess: The field is a relatively independent object, he has his own attributes, we use the array list to link the various fields in the table, so that we can dynamically increase or decrease the number of fields, The corresponding values for each record field should have pointers to the previous and next corresponding field values. This form a cross linked list, records can be easily managed, we seem to be free to choose a specific field to show and modify, and because of the help of the hero, the data can be easily released However, there are problems, add or subtract a field as if you want to modify all the records, our SQL language seems to be a set of language, so the structure of the child is feasible, efficient? I don't know, I'm just thinking about it. And what about the relationship between tables and tables in a database, and how to express them in a storage structure? How do defaults and rules bind to fields? Oh, forget it.
Stored procedure: A stored procedure consists of a set of SQL statements, they do a task together, we represent the set of statements with a name (perhaps a string of symbols called parameters), so we can send that name to the server where the database is being accessed remotely, Then the server executes the corresponding SQL statement group and returns the result to the customer, which reduces the sending data effect.
Triggers: Triggers define a set of SQL statements, and when we modify a specified table, SQL Server triggers the corresponding trigger and executes a specific set of SQL statements to ensure the correctness and consistency of the data.
Index: consists of index pages and data pages; An index page consists of one or several data items that are sorted by a keyword, one keyword can correspond to more than one record, and a pointer to a specific record is stored, and the sort of keyword can speed up the search for records, which is the actual page where the data is stored. The function of the fill factor is: Because in the memory and hard disk data exchange, always advance or prioritize the storage location of similar data into memory to reduce page fault, so in each of the index pages to set aside a portion of space, so that the system in the new index information can maintain the continuity of data, thus speeding up the query speed.
Database security: We want to use SQL Server, we need to use a login to connect SQL Servers, the login provides the power to use the server but does not provide the right to use the database in the server; The user account provides the right to use the database. So I need to provide a user account for the login in order to log on to the server at the same time to use the specific database, different user accounts to use the database permissions are different, such as some users can only view the data can not modify, and some users can assign to other users to use the power of the database, So we use roles to classify users who have different permissions, to centralize the user with the same privileges, and we create database users and also specify the roles he plays in the data (using database permissions). The system administrator and the database owner have the highest authority to administer the database. We can also assign database users permissions to tables, views, functions, and stored procedures in the database to manage database security from lower-level data objects.
When we have the right to use the database, how do we use the data in the database in the user application? We can use the SELECT statement to create a temporary table. What the application user can see is limited to this temporary table, which has a pointer to the field data for the base table (in fact, the table that has the stored data), through which we can indirectly modify the data of the record segment in the selected table. A pointer to a temporary table can be based on the data in a particular field in a particular table, with the address of the data with such a small object, so we can join the query to modify the data in several tables. View, which can be understood to replace a single SELECT statement with a string, and only use this string to replace the line at a later time to use a specific select, which eases the burden of writing a SELECT statement and, of course, wastes storage space to store the information of a SELECT statement in a system table. Because the application user is indirectly through the pointer access to data, so when we change the physical storage structure of the database, do not need to modify the user program, just modify the user program in the temporary table data address on the line, and the address is dynamically allocated automatically, so as to ensure the stability of the user program. Perhaps changing the physical storage structure, we only need to recompile the index on the line, the index page contains the address of the data, the temporary table can easily get the address from the index page, the index page is not large, the efficient access to the address.
COM's thinking;
In the C + + language, a class encapsulates the data and the methods (functions) in which the data is manipulated. When we need to manipulate the data in the class, we need to call the method function, to call the function operation data to know the function of the code snippet address, in the same process, the address can be represented: class name. function name. No matter where you are, as long as you have a way to get the address of the function, know the definition of the function name, you can use the function to manipulate the data and get the result returned. So, when we have a way to connect to a remote computer and get a function address in the program code that we can run, we can remotely invoke (transmit data over the network) This function to run it on the computer and transfer the results returned back to the local computer. The tasks we want the computer to accomplish are basically done by calling the function. So, in our program, if we knew the address of other functions that could be compiled independently of the program, we could call him to serve our program. So we can combine each relatively independent process together to accomplish our task. The COM Component Object model is designed to solve this technical problem. In COM, we designed various types of interfaces to provide addresses for function calls, each with its own function, or its own private data. Each interface class has a derived object as a member of a COM class, so we can call (assign the derived object address to the interface) through the interface class to the member function of the derived object in the COM class. Then, COM program compiled independently run, as long as the derived object address can be assigned to the interface, and then we need to use COM features in the program to join the interface, call COM function function can also be achieved. COM realized the real object-oriented technology, he put the implementation details of the function completely hidden, COM components, you can easily add an interface to implement the new program functions, only in the original code plus an interface code on the line, the original interface is still available. The storage structure of COM component classes is stored in binary order, so as long as you know the address of an interface, you can compute the address of COM's other interfaces through address offsets, and you can easily switch between interfaces. In order to make COM available in different languages, we have called the standard interface language IDL as an intermediary to implement the conversion of interfaces with the same functions and parameters written in various languages. When we write COM in a particular language, The interface definition is transformed into the form of IDL interface definition, and then the interface is transformed into an interface recognized by other languages through IDL, which realizes the reusability of COM code and language independence.
The biggest problem we have now is how to create a COM instance and get its address for use by programs, and how to implement COM code that is shared by multiple programs at the same time. It's a headache, and I can't understand it in many places. To achieve COM sharing, we design a base class IUnknown interface for all interfaces, IUnknown interface has a function querinterface to implement interface switching, a pair of functions addref each release to increase and decrease his reference count members M_dwref Whenever the component returns a new interface, the program calls AddRef to make M_dwref plus one, calling release when the end of an interface is used to make M_dwref minus one, and deleting the Component object when the M_dwref changes to 0 o'clock. Because the other interfaces are derived from IUnknown, they inherit the M_dwref member so that the reference count can correctly record the number of users who are using the component, and implement the management of the shared component. In the ATL implementation scenario, the experts designed a smart pointer to encapsulate the ability to do reference counting, which some people call the implementation of the garbage collector. What do we need to do to prepare for the server? We need to register the CLSID, the implementation file name, and so on to the registry for remote activation by the customer. When a customer needs a COM service, the remote computer looks in memory to see if the corresponding component has been activated based on the CLSID sent by the client and, if activated, finds the class object in the component service program, and then invokes the method to create an object. and using QueryInterface to return an interface pointer to the customer, if not activated, you need first in the registry to find the corresponding to the CLSID of the program address, with the help of SCM Loader server program, and then look for class object return interface pointer.
In order to release the model of the relationship between the client and the object's concurrency and reentrant constraints, the concept of the suite is developed by establishing a model of the relationship between the object and the process and the thread. A suite can be shared by multiple objects that share a set of concurrency and reentrant restrictions, the suite is set as an attribute of the object interface; At the same time, a thread must enter a suite in order to use the method in COM, and other processes that do not enter the suite can get the address of the COM method, but are forbidden to invoke it. The suite manages the COM that the client program will use to make it more secure for the client line Cheng to invoke. Alas, in fact, a lot of knowledge I still do not understand, do not want to say more, read a number of books on the description, but it reminds me of some problems. COM is run independently, with some global variables and access to critical resources in some methods, what happens if multiple customers need to use these variables at the same time?
Many times, some of my thoughts and thoughts can only prove that my ignorance and superficial, the practical meaning of the idea is not many, but I have learned that accustomed, others like to laugh let him laugh, anyway, I do not understand those knowledge, indeed very ignorant. Beginner com, a little indigestion, again took me to another confusion, I try to play the intelligence speculation unknown, do find it difficult to find the focus, the results of the launch even oneself also feel ridiculous. Although I do not have a systematic understanding of COM, but still believe that they have the ability to become a COM expert, because, I like computer technology, because I want to depend on him to eat.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service