Establish a Data Dictionary

If your SQL looks like this, you need to ask yourself how much code you’d have to inspect and revise if you decided to change a database field or table name, as frequently happens during development:

 SQLString = "SELECT [first name], [last name], " & _	"[line preferences]" & _	" FROM [imaging users] WHERE [user code] = " & _	"'" & Trim(UCase(UserIDText.Text)) & "'"ODBCstatus = SQLExecDirect(ODBChandle1, SQLString, _	Len(SQLString))

What happens if SQL command conventions (field name delimiters) change? Because a compile doesn’t reveal such name misspellings or convention flaws, code in obscure procedures can be in production before defects are detected.

Our group established a table and field dictionary in a module used for a recent large project. This helped us ensure that we correctly pasted table and field names into all SQL commands. It also provided a repository that simplified maintenance.

As database resource names changed or new name-delimiting conventions were required, we revised the dictionary before recompiling. We also used the dictionary to convey descriptive information about tables and fields to developers. Our dictionary looks like this:

 'tables:Public Const tblUsers As String = "[imaging users]"'data fields:Public Const fldFirstName As String = "[first name]"	'16 charactersPublic Const fldLastName As String = "[last name]"	'16 charactersPublic Const fldLinePreferences As String = _	"[line preferences]"	'20 charactersPublic Const fldUserCode As String = "[user code]"	'10 characters

Our SQL looks like this:

 SQLString = "SELECT " & fldFirstName & _	", " & fldLastName & _	", " & fldLinePreferences & _	" FROM " & tblUsers & _	" WHERE " & fldUserCode & " = " & _	"'" & Trim(UCase(UserIDText.Text)) & "'"ODBCstatus = SQLExecDirect(ODBChandle1, SQLString, _	Len(SQLString))

Programmers don’t have to know the actual names of database components. They always use the constants that refer to the database components. A clean compile ensures you’ll use correct names and name-delimiting conventions in your SQL statements.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a