Thoughts on learning
sea breeze
Learning computer knowledge is often in ignorant fear. In the past, the spirit of breaking Sawei asked in the past, we must control it here, we grasp a problem, to clarify what you should know now; no It is still not the time to know now, but there is a question mark in the heart to solve it. Question is a winner of learning, I often hold the knowledge of the skeptical spirit to think about the knowledge of the book, and often go to the unknown knowledge, but I have found my guess. If I have a self-satisfaction, if I am wrong, I am also in the book. Solution to the sigh and excitement.
MS SQL Server experience and guess:
The database is a deep understanding of the door, although some knowledge is not clear, we can speculate. We know that there are many tables in a database, there are many fields in a table, and there are many rules on a field. That let us think about all the values corresponding to all fields, and the number of records is variable, the number of fields is also variable, which can be variable to make us create maintenance management databases to bring convenience, The problem is how to achieve this function? We look for data to modify data, you can select the record specified by the specified field, we also use it very happy, but why do you feast this? Before you didn't have a database storage structure, let me boldly guess: Field is a relatively independent object, he has its own properties, we use the array chain list to link all fields in the table so that we can increase The number of fragments, the corresponding values of each record field should have a pointer to the next corresponding field value, which forms a cross chain list, and the record can be easily managed, we seem to choose specific The field is displayed and modified, and because of the help of this heroes, the data can be conveniently put; but there is a problem, add or decrease a field seems to modify all records, our SQL language seems to be What is the structure of a collection, is this structure, is it efficient? I don't know, I just think about it. Also, the relationship between the database and the table, how do you expressed in the storage structure? How is the default and rules bind to the field? Oh, forget it, until this, I have time to think.
Store procedure: The stored procedure consists of a set of SQL statements. They complete a task. We use a name (a string symbol that may also be composed of some symbols of the parameters) to represent this group of statements; then, when accessing the database remotely We can send this name to the server where the database is located, then the server performs the corresponding SQL statement group and returns the result to the guest, which reducing the data effect of the transmitted.
Trigger: The trigger defines a set of SQL statements. When we modify the specified table, SQL Server triggers the corresponding trigger, performs a specific SQL statement group to ensure the correctness and consistency of the data.
Index: Compose by the index page and the data page; the index page is sorted by one or several data items, and the same keyword can correspond to more than one record, and store a pointer to a specific record, by keyword Sort can speed up the speed of the record, the data page is the actual storage data page. The action of the fill factor is that because in the data exchange of the memory and the hard disk, the data that is always in advance or prioritize the storage location into memory to reduce the widow interrupt; so a part of the space is preceded in each index page, so that The system can maintain the continuity of the data when the index information is added, thus speeding up the query speed. Database Safety: We want to use SQL Server, you need to use a login name to connect to the SQL server, the login name provides the power of using the server but does not provide the power of the database in the server; the user account provides the power of using the database, so I need to provide a user account for the login name to use a specific database while logging in to the server; the permissions of different user accounts use the database are different. For example, some users can only view the data and cannot be modified. Some users can The power to other users use the database, so we use the role to classify the user who has different permissions, and the user with the same privilege is used to manage, and we also specify his data playing while creating database users. Role (using the permissions of the database). System administrators and database owners have the highest power to manage databases. We can also specify privileges owned by tables, views, functions, and stored procedures in the database to manage database security from lower-level data objects.
How do we use the data in the database when we have permissions that use the database, how do we use the data in the database? We can use the Select statement to create a temporary table, the application user can see is limited to this temporary table, this temporary table has a pointer to the base table (actually stored data) corresponding field data, pass This pointer, we can indirectly modify the data recorded in the selected table. The pointer in the temporary table is directed, which can be an address of the data of such a small object based on the data in a particular field in a particular table, so we can thus the query to modify the data in several tables. The view can be understood as a SELECT statement with a string. When you use a specific SELECT, you only need to use this string to replace it, which alleviates the burden of writing the SELECT statement, of course, also wasting storage space to store (exist Information of the SELECT statement in the system table. Because the application user has access to data by the pointer, when we change the physical storage structure of the database, it is not necessary to modify the user program, simply modify the data address of the temporary table in the user program, and the address is dynamically assigned, This guarantees the stability of the user program. Maybe change the physical storage structure, we only need to recompile the index, the index page stores the address of the data, the address in the temporary table can be easily obtained from the index page, the index page is not large, and the efficiency of the acquisition address is high.
Thinking of COM;
In the C language, the class encapsulates the data and operations of the data (functions), when we need to operate data in the class, we need to call the method function, to call the function operation data, know the address of the code segment of the function In the same process, the address can be said like this. Function name. No matter where you are, as long as you have a way to get the address of the function, you can use the function to manipulate the data and get the result. Thus, when we have a way to connect a remote computer and get a function address in which the program code can be run, we can remotely call (via network transfer data) This function runs in the computer and will receive the result of the return to the local On the computer. We want to complete the task completed by the computer, basically through the call function. So, in our program, if we know that other addresses can be independently compiler, we can call him to serve our program. So we can unite all relatively independent procedures to complete our tasks. The COM component object model is designed to solve this technical problem. In COM, we have designed various types of interfaces to provide addresses for function calls, each interface has its own function, or you can have your own private data. Each interface class has a member of a derived object as a member of the COM class; what we can call (to assign the derivative object address to the interface) The member function of the derived object in the COM class. So, the COM program is run independently, as long as the derived object address is entered to the interface, the function function in calling the COM can be added in the program that we need to use the functionality of the COM. The COM implements the true object-oriented technology. He fully hides the implementation details of the function. In the COM component, you can easily add an interface to implement the new program function, just add an interface code to the original code. The original interface is still available. The storage structure of the COM component class is stored in a binary form. Therefore, as soon as you know the address of an interface, you can calculate the address of the COM Other interfaces through the address offset, and it is convenient to switch between the interfaces. We call the COM through the interface, in order to make COM can be used in different languages, the experts designed standard interface language IDL, with this as an intermediary, implement the same function and parameter of the interface with various languages; When we write COM in a specific language, first convert its interface definition into the form of the IDL interface definition, then convert the interface to the interface that can be identified in other languages by IDL; then realize the reuse and language independence of the COM code .
The biggest problem we encounter now is: How to create a COM instance and get its address for use, how to implement the COM code simultaneously by multiple programs. This is a headache, and I have failed to understand many places. To implement COM sharing, we design a base class IUNKNOWN interface for all interfaces. The iUnknown interface has a function querinterface to implement the interface switch, a pair of functions addRef each Release to increase and reduce his reference count member m_dwref; When a new interface, the program calls AddRef to add a M_DWREF, call Release to minimize the m_dwref when the use of an interface is ended, and the component object is deleted when the m_dwref becomes 0. Because other interfaces are derived from iUnknown, they inherited M_DWREF members so that this reference count can correctly record the number of users who are using components and implement the management of shared components. In the ATL implementation, the experts have designed a smart pointer to encapsulate the function of the reference count, saying that the implementation of this function is a garbage collector. In terms of server, what should we need to do? We need to register CLSID, implement file names, and more to register in the registry for remote activation. When the customer needs a COM service, the remote computer views whether the CLSID sent by the customer is activated in memory, if it is activated, that is, in the component service program to find the class object, then call the method to create one Object, and return a interface pointer to the customer via queryinterface; if it is not activated, you need to find the executor address corresponding to the CLSID in the registry, load the server program with the help of the SCM, and then find class objects Returns the interface pointer. In order to relieve the relationship between the customer and the relationship between the combination and the re-entry restriction, the model of the interrelation between the object and the process and the thread has appeared this concept. A suite can be shared by multiple objects. These objects share a group of concurrency and re-restrictions, and the suite is set to an attribute of the object interface; at the same time, the thread wants to use the method in COM, you must first enter a suit, Other processes that do not enter the socket can also get the address of the COM method, but is disabled. The suite manages the COM you want to use by the customer program for more secure calls. Hey, in fact, a lot of knowledge I still don't quite understand, I don't want to say more, I have seen some books, but I remembered some problems. COM is independently compiled, there are some global variables and access to critical resources in some ways. What happens if multiple customers do?
Many times, some of my ideas and thinking can only prove my ignorance and skin, there is not a lot of ideas, but I have learned, others like to laugh, let him laugh, anyway, I really don't I know those knowledge, I really don't know. I'm a little indigestion, I will bring me to another. I strive to play intelligence to speculate unknown. I have found that it is difficult to find a power. The result of the launch is ridiculous. Although there is no cognition of COM now, but still believe that you have the ability to become a COM expert, because I like computer technology because I have to rely on him.
July 8, 2002