Recently, I encountered a problem where the customer released SQL files to the production database, which is under audit consideration. users who cannot directly use JDBC must use a third-party user name. In this way, developers will be troubled. During each release, the table name must contain the JDBC user name in the production environment.
In order to solve this problem, we have developed an auxiliary software to automatically add the specified table owner to the table name in the SQL file submitted by the developer.
:
There are also two episodes:
1. To replace the table name, you cannot simply replace it. What can be used? Naturally, it is a powerful regular expression. Fortunately, Microsoft has a built-in Regular Expression support library in ATL. However, there is no/B in the Perl style and it cannot match the word separator. The/B in the Regular Expression Library atlrx. h of VC is only equivalent to the/s of Perl and represents a blank character. There is no way, so we have to select a third-party Regular Expression Library. When talking about regular expressions in C ++, the first thing that comes to mind is Greta and boost libraries (refer to my other article: ATL in Visual Studio 2008). Unfortunately, these libraries are huge. Although they are powerful, I don't want to bring a DLL together for release to reduce the volume. Why is it so big? As a result, I searched the internet for a small and powerful Regular Expression Library compatible with the Perl style,Deelx Regular Expression Engine
2, even if the project supports Unicode encoding, use cstdiofile to read the keyword file, if not ASCII encoding, Unicode or UTF-8 format, will become garbled. Therefore, a new class cxstdiofile is derived from cstdiofile to differentiate file Encoding Based on the file header.
Attachment File Header encoding:
Uni16_be: 0xfe, 0xff
Uni16_le: 0xff, 0xfe
Utf8_sign: 0xef, 0xbb, 0xbf // UTF-8 with signature format
Of course, to avoid garbled characters, you must use widechartomultibyte and multibytetowidechar.